一:依赖、
compile 'fm.jiecao:jiecaovideoplayer:5.5'
二:布局
<fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard
android:id="@+id/videoplayer"
android:layout_width="match_parent"
android:layout_height="270dp" />
三:OnCreate()方法里
@OverrideprotectedvoidonCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); JCVideoPlayerStandard jcVideoPlayerStandard = (JCVideoPlayerStandard) findViewById(R.id.videoplayer); jcVideoPlayerStandard.TOOL_BAR_EXIST =false; jcVideoPlayerStandard.setUp("http://ssb-video.oss-cn-qingdao.aliyuncs.com/Video_1003_20161027140007.mp4", JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL,"播放视频的标题,可以为空");// jcVideoPlayerStandard.loop = true;//是否循环播放Glide.with(getApplicationContext()).load("http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640") .into(jcVideoPlayerStandard.thumbImageView); jcVideoPlayerStandard.widthRatio =4;//播放比例jcVideoPlayerStandard.heightRatio =3;// JCVideoPlayerStandard.startFullscreen(this, JCVideoPlayerStandard.class, "http://2449.vod.myqcloud.com/2449_22ca37a6ea9011e5acaaf51d105342e3.f20.mp4", "嫂子辛苦了");//直接进入全屏}@OverridepublicvoidonBackPressed(){if(JCVideoPlayer.backPress()) {return; }super.onBackPressed(); }@OverrideprotectedvoidonPause(){super.onPause(); JCVideoPlayer.releaseAllVideos(); }
网友评论