com.shuyu.gsyvideoplayer.listener.LockClickListener Java Examples

The following examples show how to use com.shuyu.gsyvideoplayer.listener.LockClickListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LQRBiliPlayerOptionBuilder.java    From LQRBiliBlili with MIT License 4 votes vote down vote up
/**
 * 锁屏点击
 */
public LQRBiliPlayerOptionBuilder setLockClickListener(LockClickListener lockClickListener) {
    this.mLockClickListener = lockClickListener;
    return this;
}
 
Example #2
Source File: DetailADPlayer2.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail_ad_player2);

    detailPlayer = (NormalGSYVideoPlayer) findViewById(R.id.detail_player);
    adPlayer = (GSYADVideoPlayer) findViewById(R.id.ad_player);

    //普通模式
    resolveNormalVideoUI();

    initVideoBuilderMode();

    detailPlayer.setLockClickListener(new LockClickListener() {
        @Override
        public void onClick(View view, boolean lock) {
            if (orientationUtils != null) {
                //配合下方的onConfigurationChanged
                orientationUtils.setEnable(!lock);
            }
        }
    });
    detailPlayer.setStartAfterPrepared(false);
    detailPlayer.setReleaseWhenLossAudio(false);

    detailPlayer.setGSYVideoProgressListener(new GSYVideoProgressListener() {
        private int preSecond = 0;
        @Override
        public void onProgress(int progress, int secProgress, int currentPosition, int duration) {
            //在5秒的时候弹出中间广告
            int currentSecond = currentPosition / 1000;
            if (currentSecond == 5 && currentSecond != preSecond) {
                detailPlayer.getCurrentPlayer().onVideoPause();
                getGSYADVideoOptionBuilder().setUrl(urlAd2).build(adPlayer);
                startAdPlay();
            }
            preSecond = currentSecond;
        }
    });

}
 
Example #3
Source File: SmallVideoHelper.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
public LockClickListener getLockClickListener() {
    return mLockClickListener;
}
 
Example #4
Source File: WebDetailActivity.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_web_detail);
    ButterKnife.bind(this);

    backupRendType = GSYVideoType.getRenderType();

    //设置为Surface播放模式,注意此设置是全局的
    GSYVideoType.setRenderType(GSYVideoType.SUFRACE);

    resolveNormalVideoUI();

    initVideoBuilderMode();


    webPlayer.setLockClickListener(new LockClickListener() {
        @Override
        public void onClick(View view, boolean lock) {
            if (orientationUtils != null) {
                //配合下方的onConfigurationChanged
                orientationUtils.setEnable(!lock);
                webPlayer.getCurrentPlayer().setRotateViewAuto(!lock);
            }
        }
    });


    WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    webView.loadUrl("https://www.baidu.com");


    orientationUtils.setRotateWithSystem(false);

    webTopLayout.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
        @Override
        public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
            if (!webPlayer.isIfCurrentIsFullscreen() && scrollY >= 0 && isPlay) {
                if (scrollY > webPlayer.getHeight()) {
                    //如果是小窗口就不需要处理
                    if (!isSmall) {
                        isSmall = true;
                        int size = CommonUtil.dip2px(WebDetailActivity.this, 150);
                        webPlayer.showSmallVideo(new Point(size, size), true, true);
                        orientationUtils.setEnable(false);
                    }
                } else {
                    if (isSmall) {
                        isSmall = false;
                        orientationUtils.setEnable(true);
                        //必须
                        webTopLayoutVideo.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                webPlayer.hideSmallVideo();
                            }
                        }, 50);
                    }
                }
                webTopLayoutVideo.setTranslationY((scrollY <= webTopLayoutVideo.getHeight()) ? -scrollY : -webTopLayoutVideo.getHeight());
            }
        }
    });

}
 
Example #5
Source File: DetailListPlayer.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_deatil_list_player);
    ButterKnife.bind(this);

    //普通模式
    initVideo();

    //String url = "http://baobab.wd jcdn.com/14564977406580.mp4";
    List<GSYVideoModel> urls = new ArrayList<>();
    urls.add(new GSYVideoModel("http://7xjmzj.com1.z0.glb.clouddn.com/20171026175005_JObCxCE2.mp4", "标题1"));
    urls.add(new GSYVideoModel("http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4", "标题2"));
    urls.add(new GSYVideoModel("https://res.exexm.com/cw_145225549855002", "标题3"));
    urls.add(new GSYVideoModel("http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4", "标题4"));
    detailPlayer.setUp(urls, true, 0);

    //增加封面
    ImageView imageView = new ImageView(this);
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setImageResource(R.mipmap.xxx1);
    detailPlayer.setThumbImageView(imageView);

    resolveNormalVideoUI();

    detailPlayer.setIsTouchWiget(true);
    //关闭自动旋转
    detailPlayer.setRotateViewAuto(false);
    detailPlayer.setLockLand(false);
    detailPlayer.setShowFullAnimation(false);
    //detailPlayer.setNeedLockFull(true);
    detailPlayer.setAutoFullWithSize(false);

    detailPlayer.setVideoAllCallBack(this);

    detailPlayer.setLockClickListener(new LockClickListener() {
        @Override
        public void onClick(View view, boolean lock) {
            if (orientationUtils != null) {
                //配合下方的onConfigurationChanged
                orientationUtils.setEnable(!lock);
            }
        }
    });

    next.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((ListGSYVideoPlayer) detailPlayer.getCurrentPlayer()).playNext();
        }
    });

}
 
Example #6
Source File: DetailADPlayer.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail_ad_player);
    ButterKnife.bind(this);

    //普通模式
    initVideo();

    ArrayList<GSYSampleADVideoPlayer.GSYADVideoModel> urls = new ArrayList<>();
    //广告1
    urls.add(new GSYSampleADVideoPlayer.GSYADVideoModel("http://7xjmzj.com1.z0.glb.clouddn.com/20171026175005_JObCxCE2.mp4",
            "", GSYSampleADVideoPlayer.GSYADVideoModel.TYPE_AD));
    //正式内容1
    urls.add(new GSYSampleADVideoPlayer.GSYADVideoModel("http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4",
            "正文1标题", GSYSampleADVideoPlayer.GSYADVideoModel.TYPE_NORMAL));
    //广告2
    urls.add(new GSYSampleADVideoPlayer.GSYADVideoModel("http://7xjmzj.com1.z0.glb.clouddn.com/20171026175005_JObCxCE2.mp4",
            "", GSYSampleADVideoPlayer.GSYADVideoModel.TYPE_AD, true));
    //正式内容2
    urls.add(new GSYSampleADVideoPlayer.GSYADVideoModel("http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f30.mp4",
            "正文2标题", GSYSampleADVideoPlayer.GSYADVideoModel.TYPE_NORMAL));

    detailPlayer.setAdUp(urls, true, 0);

    //增加封面
    ImageView imageView = new ImageView(this);
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setImageResource(R.mipmap.xxx1);
    detailPlayer.setThumbImageView(imageView);

    resolveNormalVideoUI();

    detailPlayer.setIsTouchWiget(true);
    //关闭自动旋转
    detailPlayer.setRotateViewAuto(false);
    detailPlayer.setLockLand(false);
    detailPlayer.setShowFullAnimation(false);
    detailPlayer.setNeedLockFull(true);

    detailPlayer.setVideoAllCallBack(this);

    detailPlayer.setLockClickListener(new LockClickListener() {
        @Override
        public void onClick(View view, boolean lock) {
            if (orientationUtils != null) {
                //配合下方的onConfigurationChanged
                orientationUtils.setEnable(!lock);
            }
        }
    });

}
 
Example #7
Source File: DetailExoListPlayer.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_deatil_exo_list_player);
    ButterKnife.bind(this);

    //GSYBaseActivityDetail 的 普通模式初始化
    initVideo();

    List<GSYVideoModel> urls = new ArrayList<>();

    urls.add(new GSYVideoModel("http://7xjmzj.com1.z0.glb.clouddn.com/20171026175005_JObCxCE2.mp4", "标题1"));
    urls.add(new GSYVideoModel("https://media6.smartstudy.com/ae/07/3997/2/dest.m3u8", "标题3"));
    urls.add(new GSYVideoModel("http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4", "标题2"));
    //detailPlayer.setUp(urls, 1);
    detailPlayer.setUp(urls, 0);

    //使用 exo 的 CacheDataSourceFactory 实现
    detailPlayer.setExoCache(false);
    //detailPlayer.setOverrideExtension("m3u8");

    //增加封面
    ImageView imageView = new ImageView(this);
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setImageResource(R.mipmap.xxx1);
    detailPlayer.setThumbImageView(imageView);

    resolveNormalVideoUI();

    detailPlayer.setIsTouchWiget(true);
    //关闭自动旋转
    detailPlayer.setRotateViewAuto(false);
    detailPlayer.setLockLand(false);
    detailPlayer.setShowFullAnimation(false);
    detailPlayer.setNeedLockFull(true);

    detailPlayer.setVideoAllCallBack(this);

    detailPlayer.setLockClickListener(new LockClickListener() {
        @Override
        public void onClick(View view, boolean lock) {
            if (orientationUtils != null) {
                //配合下方的onConfigurationChanged
                orientationUtils.setEnable(!lock);
            }
        }
    });

    next.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            GSYExoVideoManager.instance().next();
            ((GSYExo2PlayerView)detailPlayer.getCurrentPlayer()).nextUI();
        }
    });

}
 
Example #8
Source File: GSYVideoHelper.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
public LockClickListener getLockClickListener() {
    return mLockClickListener;
}
 
Example #9
Source File: GSYVideoOptionBuilder.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
/**
 * 锁屏点击
 */
public GSYVideoOptionBuilder setLockClickListener(LockClickListener lockClickListener) {
    this.mLockClickListener = lockClickListener;
    return this;
}
 
Example #10
Source File: GSYVideoControlView.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
/**
 * 锁屏点击
 */
public void setLockClickListener(LockClickListener lockClickListener) {
    this.mLockClickListener = lockClickListener;
}