代码拉取完成,页面将自动刷新
同步操作将从 杨充/YCVideoPlayer 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
compile 'cn.yc:YCVideoPlayerLib:2.6.4'
<org.yczbj.ycvideoplayerlib.VideoPlayer
android:id="@+id/video_player"
android:layout_width="match_parent"
android:layout_height="240dp"/>
//设置播放类型
// IjkPlayer or MediaPlayer
videoPlayer.setPlayerType(VideoPlayer.TYPE_NATIVE);
//网络视频地址
String videoUrl = DataUtil.getVideoListData().get(0).getVideoUrl();
//设置视频地址和请求头部
videoPlayer.setUp(videoUrl, null);
//创建视频控制器
VideoPlayerController controller = new VideoPlayerController(this);
controller.setTitle("自定义视频播放器可以播放视频拉");
//设置视频控制器
videoPlayer.setController(controller);
@Override
protected void onStop() {
super.onStop();
//从前台切到后台,当视频正在播放或者正在缓冲时,调用该方法暂停视频
VideoPlayerManager.instance().suspendVideoPlayer();
}
@Override
protected void onDestroy() {
super.onDestroy();
//销毁页面,释放,内部的播放器被释放掉,同时如果在全屏、小窗口模式下都会退出
VideoPlayerManager.instance().releaseVideoPlayer();
}
@Override
public void onBackPressed() {
//处理返回键逻辑;如果是全屏,则退出全屏;如果是小窗口,则退出小窗口
if (VideoPlayerManager.instance().onBackPressed()){
return;
}else {
//销毁页面
VideoPlayerManager.instance().releaseVideoPlayer();
}
super.onBackPressed();
}
@Override
protected void onRestart() {
super.onRestart();
//从后台切换到前台,当视频暂停时或者缓冲暂停时,调用该方法重新开启视频播放
VideoPlayerManager.instance().resumeVideoPlayer();
}
//在宿主Activity中设置代码如下
@Override
protected void onStop() {
super.onStop();
VideoPlayerManager.instance().releaseVideoPlayer();
}
@Override
public void onBackPressed() {
if (VideoPlayerManager.instance().onBackPressed()) return;
super.onBackPressed();
}
//--------------------------------------------------
//在此Fragment中设置代码如下
@Override
public void onStop() {
super.onStop();
VideoPlayerManager.instance().releaseVideoPlayer();
}
<activity android:name=".ui.test2.TestMyActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="portrait"/>
if(BuildConfig.DEBUG){
VideoLogUtil.setIsLog(true);
}else {
VideoLogUtil.setIsLog(false);
}
初期最简单功能
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。