第三方库之 JZVideo

作者: Kevin_小飞象 | 来源:发表于2021-08-28 16:30 被阅读0次

    高度自定义的安卓视频框架 MediaPlayer exoplayer ijkplayer ffmpeg

    目前最新的版本是 7.7.0。
    GitHub:JZVideo
    中文文档:JZVD文档

    效果图

    01.png

    使用

    1. 添加类库
    implementation 'cn.jzvd:jiaozivideoplayer:7.7.0'
    
    1. 添加布局
        <cn.jzvd.JzvdStd
            android:id="@+id/jz_video"
            android:layout_width="match_parent"
            android:layout_height="200dp"/>
    

    3.设置视频地址、缩略图地址、标题

    public class MainActivity extends BaseActivity {
        private String videoUrl = "https://v-cdn.zjol.com.cn/280443.mp4";
        @Override
        protected int getLayoutId() {
            return R.layout.activity_main;
        }
    
        @Override
        protected void init(Bundle savedInstanceState) {
            initView();
        }
    
        private void initView() {
            JzvdStd videoPlayer = findViewById(R.id.jz_video);
            videoPlayer.setUp(videoUrl,"追龙");
            videoPlayer.posterImageView.setImageResource(R.mipmap.ic_cover);
    //        videoPlayer.startVideo();
        }
    
        @Override
        public void onBackPressed() {
            if (Jzvd.backPress()) {
                return;
            }
            super.onBackPressed();
        }
        @Override
        protected void onPause() {
            super.onPause();
            Jzvd.releaseAllVideos();
        }
    }
    
    1. 在 AndroidManifest.xml 中
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.hk.netdemo">
    
        <!-- 网络 -->
        <uses-permission android:name="android.permission.INTERNET" />
        
        ...
            <activity
                android:configChanges="orientation|screenSize|keyboardHidden"
                android:screenOrientation="portrait"
                android:name=".MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        
        ...
    </manifest>
    

    测试的在线小视频 url 地址:
    新冠肺炎疫情相关视频:武汉加油中国加油

    1. https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218114723HDu3hhxqIT.mp4
    2. https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218093206z8V1JuPlpe.mp4
    3. https://stream7.iqilu.com/10339/article/202002/18/2fca1c77730e54c7b500573c2437003f.mp4
    4. https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218025702PSiVKDB5ap.mp4
    5. https://stream7.iqilu.com/10339/upload_transcode/202002/18/202002181038474liyNnnSzz.mp4
    6. https://stream7.iqilu.com/10339/article/202002/18/02319a81c80afed90d9a2b9dc47f85b9.mp4
    7. http://stream4.iqilu.com/ksd/video/2020/02/17/c5e02420426d58521a8783e754e9f4e6.mp4
    8. http://stream4.iqilu.com/ksd/video/2020/02/17/87d03387a05a0e8aa87370fb4c903133.mp4
    9. https://stream7.iqilu.com/10339/article/202002/17/c292033ef110de9f42d7d539fe0423cf.mp4
    10. http://stream4.iqilu.com/ksd/video/2020/02/17/97e3c56e283a10546f22204963086f65.mp4
    11. https://stream7.iqilu.com/10339/article/202002/17/778c5884fa97f460dac8d90493c451de.mp4
    12. https://stream7.iqilu.com/10339/upload_transcode/202002/17/20200217021133Eggh6zdlAO.mp4
    13. https://stream7.iqilu.com/10339/article/202002/17/4417a27b1a656f4779eaa005ecd1a1a0.mp4
    14. https://stream7.iqilu.com/10339/upload_transcode/202002/17/20200217104524H4D6lmByOe.mp4
    15. https://stream7.iqilu.com/10339/upload_transcode/202002/17/20200217101826WjyFCbUXQ2.mp4
    16. http://stream.iqilu.com/vod_bag_2016//2020/02/16/903BE158056C44fcA9524B118A5BF230/903BE158056C44fcA9524B118A5BF230_H264_mp4_500K.mp4
    17. https://stream7.iqilu.com/10339/upload_transcode/202002/16/20200216050645YIMfjPq5Nw.mp4
    18. https://stream7.iqilu.com/10339/article/202002/16/3be2e4ef4aa21bfe7493064a7415c34d.mp4
    19. https://stream7.iqilu.com/10339/upload_transcode/202002/09/20200209105011F0zPoYzHry.mp4
    20. https://stream7.iqilu.com/10339/upload_transcode/202002/09/20200209104902N3v5Vpxuvb.mp4

    20 条速度比较快的地址:

    1. https://v-cdn.zjol.com.cn/280443.mp4
    2. https://v-cdn.zjol.com.cn/276982.mp4
    3. https://v-cdn.zjol.com.cn/276984.mp4
    4. https://v-cdn.zjol.com.cn/276985.mp4
    5. https://v-cdn.zjol.com.cn/276986.mp4
    6. https://v-cdn.zjol.com.cn/276987.mp4
    7. https://v-cdn.zjol.com.cn/276988.mp4
    8. https://v-cdn.zjol.com.cn/276989.mp4
    9. https://v-cdn.zjol.com.cn/276990.mp4
    10. https://v-cdn.zjol.com.cn/276991.mp4
    11. https://v-cdn.zjol.com.cn/276992.mp4
    12. https://v-cdn.zjol.com.cn/276993.mp4
    13. https://v-cdn.zjol.com.cn/276994.mp4
    14. https://v-cdn.zjol.com.cn/276996.mp4
    15. https://v-cdn.zjol.com.cn/276998.mp4
    16. https://v-cdn.zjol.com.cn/277000.mp4
    17. https://v-cdn.zjol.com.cn/277001.mp4
    18. https://v-cdn.zjol.com.cn/277002.mp4
    19. https://v-cdn.zjol.com.cn/277003.mp4
    20. https://v-cdn.zjol.com.cn/277004.mp4

    相关文章

      网友评论

        本文标题:第三方库之 JZVideo

        本文链接:https://www.haomeiwen.com/subject/urwbiltx.html