首先是github地址
https://github.com/lipangit/JieCaoVideoPlayer/
下面这个是带中文说明的
https://github.com/lipangit/JieCaoVideoPlayer/blob/develop/README-ZH.md
总体说明:
这个播放器本身就具有自动记忆播放进度的功能,全屏状态下具有手势快进和快退的功能,以及左边控制亮度,右边控制音量
点击全屏后视频还是竖屏,需要旋转手机才能变成横屏播放,并且使用移动数据时,会有dialog提示
首先导入库
compile 'fm.jiecao:jiecaovideoplayer:5.5'
布局文件
<fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard
android:id="@+id/jiecao_Player"
android:layout_width="match_parent"
android:layout_height="200dp"></fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard>
主界面代码
package myapp.czw.com.ceshi;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard;
//jiecaovideoplayer视频播放
//这个播放器本身就具有自动记忆播放进度的功能,全屏状态下具有手势快进和快退的功能,以及左边控制亮度,右边控制音量
//点击全屏后视频还是竖屏,需要旋转手机才能变成横屏播放
public class JieCaoVideoActivity extends AppCompatActivity {
private JCVideoPlayerStandard jcVideoPlayerStandard;
String s1="http://2449.vod.myqcloud.com/2449_22ca37a6ea9011e5acaaf51d105342e3.f20.mp4";
String s2="http://player.youku.com/player.php/sid/XMjUyODI2NDc2MA==/v.swf";//不支持swf格式的视频播放
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_jie_cao_video);
getSupportActionBar().setTitle("jiecaovideoplayer的使用");
jcVideoPlayerStandard= (JCVideoPlayerStandard) findViewById(R.id.jiecao_Player);
jcVideoPlayerStandard.setUp(s1,jcVideoPlayerStandard.SCREEN_LAYOUT_NORMAL,"视频标题");
}
@Override
public void onBackPressed() {
if (JCVideoPlayer.backPress()){
return;
}
super.onBackPressed();
}
@Override
protected void onPause() {
super.onPause();
JCVideoPlayer.releaseAllVideos();
}
}
清单文件中也需要加一些东西
<activity android:name=".JieCaoVideoActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait"></activity>
以上步骤就完成了最基本的播放功能.
未完待续-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------