原JieCaoVideoPlayer 不知道什么時候改名了,現在叫JiaoZiVideoPlayer.
項目GitHub地址:https://github.com/lipangit/JiaoZiVideoPlayer
JiaoZiVideoPlayer主要功能:
1.視頻全屏播放和浮層小窗播放 2.可以完全自定義UI 3.能在ListView、ViewPager和ListView、ViewPager和Fragment等多重嵌套模式下全屏工作 4.手勢修改進度和音量 5.視頻大小的屏幕適配,寬或長至少有兩個對邊是充滿屏幕的,另外兩個方向居中 6.可以在加載、暫停、播放等各種狀態中正常進入全屏和退出全屏 7.基於exoplayer, 支持hls,rtsp 8.設置http頭信息 9.重力感應自動全屏 10.WebView嵌套本地視頻
基本使用
1.添加依賴
compile 'cn.jzvd:jiaozivideoplayer:6.2.12'
2.xml布局文件
<cn.jzvd.JZVideoPlayerStandard android:id="@+id/videoplayer" android:layout_width="match_parent" android:layout_height="200dp"/>
3.設置視頻url和標題
JZVideoPlayerStandard jzVideoPlayerStandard = (JZVideoPlayerStandard) findViewById(R.id.videoplayer); jzVideoPlayerStandard.setUp("http://jzvd.nathen.cn/c6e3dc12a1154626b3476d9bf3bd7266/6b56c5f0dc31428083757a45764763b0-5287d2089db37e62345123a1be272f8b.mp4", JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "餃子閉眼睛"); jzVideoPlayerStandard.thumbImageView.setImage("http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640");
4.AndroidManifest.xml:
<activity android:name=".MainActivity" android:configChanges="orientation|screenSize|keyboardHidden" android:screenOrientation="portrait" />
當我們橫豎屏切換的時候會直接調用onCreate方法中的onConfigurationChanged方法,而不會重新執行onCreate方法,那當然如果不配置這個屬性的話就會重新調用onCreate方法了。