android 视频播放器 饺子播放器


1.饺子播放器集成

implementation 'cn.jzvd:jiaozivideoplayer:6.2.12'

2.添加xml控件

        <cn.jzvd.JZVideoPlayerStandard
            android:id="@+id/videoPlayer"
            android:scaleType="fitXY"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            >
        </cn.jzvd.JZVideoPlayerStandard>

3.设置全屏 拉伸铺满屏幕 去掉头部阴影 去掉屏幕俩边黑边 监听完成进度 设置默认图 暂停 继续 不要返回键

 jiecao_video = (JZVideoPlayerStandard) findViewById(R.id.videoPlayer);

        jiecao_video.SAVE_PROGRESS = false;
        jiecao_video.TOOL_BAR_EXIST = false;
        jiecao_video.hideSupportActionBar(MainActivity_Video.this);
        jiecao_video.thumbImageView.setScaleType(ImageView.ScaleType.FIT_XY);
        jiecao_video.thumbImageView.setImageResource(R.mipmap.video_thume);
        jiecao_video.setUp(json, JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "");
        JZVideoPlayer.setVideoImageDisplayType(JZVideoPlayer.VIDEO_IMAGE_DISPLAY_TYPE_FILL_PARENT);//
        JZUtils.getAppCompActivity(this).getSupportActionBar();
        jiecao_video.hideSupportActionBar(this);
        jiecao_video.startVideo();
 @Override
    protected void onDestroy() {
        super.onDestroy();
        if (jiecao_video != null) {
            jiecao_video.release();
        }
        JZVideoPlayerStandard.releaseAllVideos();
    }
    private boolean isPlayResume=false;
    @Override
    protected void onPause() {
        super.onPause();
        JZVideoPlayerStandard.goOnPlayOnPause();
        isPlayResume = true;
    }
    @Override
    protected void onResume() {
        super.onResume();
        if (isPlayResume) {
            JZVideoPlayerStandard.goOnPlayOnResume();
            isPlayResume = false;
        }
    }
Handler myHandler = new Handler();
    private Runnable runnableStar = new Runnable() {
        @Override
        public void run() {
            try {
                if (!StringUtils.isEmpty(json) && null != jiecao_video) {
                    LogUtils.e("当前播放状态" + jiecao_video.getCurrentPositionWhenPlaying());
                    if (jiecao_video.currentState == CURRENT_STATE_AUTO_COMPLETE) {
                        test.setVisibility(View.VISIBLE);
                        return;
                    }
                }
            } catch (Exception e) {
            }
            myHandler.postDelayed(this, 1000);
        }
    };

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM