GSYVideoPlayer全屏与非全屏的同步问题

2022-09-29  本文已影响0人  妖精的尾巴_3be1

外部获取当前播放器,推荐使用

 private StandardGSYVideoPlayer getCurPlay() {
        if (detailPlayer.getFullWindowPlayer() != null) {
            return detailPlayer.getFullWindowPlayer();
        }
        return detailPlayer;
    }

继承默认播放器 重新方法

/**
 * 全屏时将对应处理参数逻辑赋给全屏播放器
 *
 */
@Override
public GSYBaseVideoPlayer startWindowFullscreen(Context context, boolean actionBar, boolean statusBar) {
    SmartPickVideo sampleVideo = (SmartPickVideo) super.startWindowFullscreen(context, actionBar, statusBar);
    sampleVideo.mSourcePosition = mSourcePosition;
    sampleVideo.mType = mType;
    sampleVideo.mTypeText = mTypeText;
    return sampleVideo;
}

/**
 * 推出全屏时将对应处理参数逻辑返回给非播放器
 *
 */
@Override
protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gsyVideoPlayer) {
    super.resolveNormalVideoShow(oldF, vp, gsyVideoPlayer);
    if (gsyVideoPlayer != null) {
        SmartPickVideo sampleVideo = (SmartPickVideo) gsyVideoPlayer;
        mSourcePosition = sampleVideo.mSourcePosition;
        mType = sampleVideo.mType;
        mTypeText = sampleVideo.mTypeText;
    }
}
上一篇 下一篇

猜你喜欢

热点阅读