Android 泽宇节操视频

今天我要介绍的是节操视频,此框架的小编个人感觉还是很好用的,轻轻松松的几行代码就搞定了

1.所用依赖:implementation 'fm.jiecao:jiecaovideoplayer:5.5'

2.在你的布局文件中添加

<fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard
        android:id="@+id/videoplayer"
        android:layout_width="match_parent"
        android:layout_height="270dp" />

3.在你的播放页面Activity中添加(我添加在onCreate()方法当中)

@Override
   protected void onCreate(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", "嫂子辛苦了");
       //直接进入全屏
   }

@Override
   public void onBackPressed() {
       if (JCVideoPlayer.backPress()) {
           return;
       }
       super.onBackPressed();
   }

   @Override
   protected void onPause() {
       super.onPause();
       JCVideoPlayer.releaseAllVideos();
   }


作者:来自唐朝的栗子
链接:https://www.jianshu.com/p/21db979dfb7f
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

猜你喜欢

转载自blog.csdn.net/zeyu_rensheng/article/details/81059612