1.依赖 compile 'fm.jiecao:jiecaovideoplayer:2.0'
compile'fm.jiecao:jiecaovideoplayer:4.8.3' //现在用的都是这个
2.xml文件中:
<fm.jiecao.jcvideoplayer_lib.JCVideoPlayer
android:id="@+id/jc_one"
android:layout_width="match_parent"
android:layout_height="200dp"/>
3.找到id调方法:
1.添加类库
compile'fm.jiecao:jiecaovideoplayer:2.0'
2.添加布局
3.设置视频/MP3地址、缩略图地址、标题
JCVideoPlayerjCVideoPlayer=(JCVideoPlayer) findViewById(R.id.videocontroller);videoController.setUp("视频/MP3地址","视频/MP3标题");videoController.ivThumb.setThumbInCustomProject("视频/MP3缩略图地址");
4.在包含播放器的Fragment或Activity的onPause()方法中调用JCVideoPlayer.releaseAllVideos();
注:全屏导致崩溃的请在清单文件中当前activity中加上:
android:name=".activity.MainActivity"
android:configChanges="orientation"
android:screenOrientation="portrait">
网友评论