com.shuyu.gsyvideoplayer.video.base.GSYVideoPlayer Java Examples

The following examples show how to use com.shuyu.gsyvideoplayer.video.base.GSYVideoPlayer. 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: FlutterVideoDetailActivity.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    GSYVideoPlayer.releaseAllVideos();
    //GSYPreViewManager.instance().releaseMediaPlayer();
    if (orientationUtils != null)
        orientationUtils.releaseListener();
    super.onDestroy();
}
 
Example #2
Source File: ListGSYVideoPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gsyVideoPlayer) {
    if (gsyVideoPlayer != null) {
        ListGSYVideoPlayer listGSYVideoPlayer = (ListGSYVideoPlayer) gsyVideoPlayer;
        GSYVideoModel gsyVideoModel = mUriList.get(mPlayPosition);
        if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) {
            mTitleTextView.setText(gsyVideoModel.getTitle());
        }
    }
    super.resolveNormalVideoShow(oldF, vp, gsyVideoPlayer);
}
 
Example #3
Source File: GSYBaseADActivityDetail.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onEnterFullscreen(String url, Object... objects) {
    super.onEnterFullscreen(url, objects);
    //隐藏调全屏对象的返回按键
    GSYVideoPlayer gsyVideoPlayer = (GSYVideoPlayer) objects[1];
    gsyVideoPlayer.getBackButton().setVisibility(View.GONE);
}
 
Example #4
Source File: ListVideoUtil.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 动画回到正常效果
 */
private void resolveMaterialToNormal(final GSYVideoPlayer gsyVideoPlayer) {
    if (showFullAnimation && fullViewContainer instanceof FrameLayout) {
        int delay = orientationUtils.backToProtVideo();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                TransitionManager.beginDelayedTransition(fullViewContainer);
                FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) gsyVideoPlayer.getLayoutParams();
                lp.setMargins(listItemRect[0], listItemRect[1], 0, 0);
                lp.width = listItemSize[0];
                lp.height = listItemSize[1];
                //注意配置回来,不然动画效果会不对
                lp.gravity = Gravity.NO_GRAVITY;
                gsyVideoPlayer.setLayoutParams(lp);
                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        resolveToNormal();
                    }
                }, 400);
            }
        }, delay);
    } else {
        resolveToNormal();
    }
}
 
Example #5
Source File: GSYVideoHelper.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 动画回到正常效果
 */
private void resolveMaterialToNormal(final GSYVideoPlayer gsyVideoPlayer) {
    if (mVideoOptionBuilder.isShowFullAnimation() && mFullViewContainer instanceof FrameLayout) {
        int delay = mOrientationUtils.backToProtVideo();
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                TransitionManager.beginDelayedTransition(mFullViewContainer);
                FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) gsyVideoPlayer.getLayoutParams();
                lp.setMargins(mNormalItemRect[0], mNormalItemRect[1], 0, 0);
                lp.width = mNormalItemSize[0];
                lp.height = mNormalItemSize[1];
                //注意配置回来,不然动画效果会不对
                lp.gravity = Gravity.NO_GRAVITY;
                gsyVideoPlayer.setLayoutParams(lp);
                mHandler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        resolveToNormal();
                    }
                }, 400);
            }
        }, delay);
    } else {
        resolveToNormal();
    }
}
 
Example #6
Source File: SmartPickVideo.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
private void resolveStartChange(int position) {
    final String name = mUrlList.get(position).getName();
    if (mSourcePosition != position) {
        if ((mCurrentState == GSYVideoPlayer.CURRENT_STATE_PLAYING
                || mCurrentState == GSYVideoPlayer.CURRENT_STATE_PAUSE)) {
            showLoading();
            final String url = mUrlList.get(position).getUrl();
            cancelProgressTimer();
            hideAllWidget();
            if (mTitle != null && mTitleTextView != null) {
                mTitleTextView.setText(mTitle);
            }
            mPreSourcePosition = mSourcePosition;
            isChanging = true;
            mTypeText = name;
            mSwitchSize.setText(name);
            mSourcePosition = position;
            //创建临时管理器执行加载播放
            mTmpManager = GSYVideoManager.tmpInstance(gsyMediaPlayerListener);
            mTmpManager.initContext(getContext().getApplicationContext());
            resolveChangeUrl(mCache, mCachePath, url);
            mTmpManager.prepare(mUrl, mMapHeadData, mLooping, mSpeed, mCache, mCachePath, null);
            changeUiToPlayingBufferingShow();
        }
    } else {
        Toast.makeText(getContext(), "已经是 " + name, Toast.LENGTH_LONG).show();
    }
}
 
Example #7
Source File: SmartPickVideo.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 推出全屏时将对应处理参数逻辑返回给非播放器
 *
 * @param oldF
 * @param vp
 * @param gsyVideoPlayer
 */
@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;
        mSwitchSize.setText(mTypeText);
        setUp(mUrlList, mCache, mCachePath, mTitle);
    }
}
 
Example #8
Source File: SampleControlVideo.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 推出全屏时将对应处理参数逻辑返回给非播放器
 *
 * @param oldF
 * @param vp
 * @param gsyVideoPlayer
 */
@Override
protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gsyVideoPlayer) {
    super.resolveNormalVideoShow(oldF, vp, gsyVideoPlayer);
    if (gsyVideoPlayer != null) {
        SampleControlVideo sampleVideo = (SampleControlVideo) gsyVideoPlayer;
        mSourcePosition = sampleVideo.mSourcePosition;
        mType = sampleVideo.mType;
        mTransformSize = sampleVideo.mTransformSize;
        resolveTypeUI();
    }
}
 
Example #9
Source File: DanmakuVideoPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 处理播放器在退出全屏时,弹幕显示的逻辑
 需要格外注意的是,因为全屏和小屏,是切换了播放器,所以需要同步之间的弹幕状态
 */
@Override
protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gsyVideoPlayer) {
    super.resolveNormalVideoShow(oldF, vp, gsyVideoPlayer);
    if (gsyVideoPlayer != null) {
        DanmakuVideoPlayer gsyDanmaVideoPlayer = (DanmakuVideoPlayer) gsyVideoPlayer;
        setDanmaKuShow(gsyDanmaVideoPlayer.getDanmaKuShow());
        if (gsyDanmaVideoPlayer.getDanmakuView() != null &&
                gsyDanmaVideoPlayer.getDanmakuView().isPrepared()) {
            resolveDanmakuSeek(this, gsyDanmaVideoPlayer.getCurrentPositionWhenPlaying());
            resolveDanmakuShow();
            releaseDanmaku(gsyDanmaVideoPlayer);
        }
    }
}
 
Example #10
Source File: LandLayoutVideo.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gsyVideoPlayer) {
    LandLayoutVideo landLayoutVideo = (LandLayoutVideo)gsyVideoPlayer;
    landLayoutVideo.dismissProgressDialog();
    landLayoutVideo.dismissVolumeDialog();
    landLayoutVideo.dismissBrightnessDialog();
    super.resolveNormalVideoShow(oldF, vp, gsyVideoPlayer);
}
 
Example #11
Source File: SampleVideo.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 弹出切换清晰度
 */
private void showSwitchDialog() {
    if (!mHadPlay) {
        return;
    }
    SwitchVideoTypeDialog switchVideoTypeDialog = new SwitchVideoTypeDialog(getContext());
    switchVideoTypeDialog.initList(mUrlList, new SwitchVideoTypeDialog.OnListItemClickListener() {
        @Override
        public void onItemClick(int position) {
            final String name = mUrlList.get(position).getName();
            if (mSourcePosition != position) {
                if ((mCurrentState == GSYVideoPlayer.CURRENT_STATE_PLAYING
                        || mCurrentState == GSYVideoPlayer.CURRENT_STATE_PAUSE)) {
                    final String url = mUrlList.get(position).getUrl();
                    onVideoPause();
                    final long currentPosition = mCurrentPosition;
                    getGSYVideoManager().releaseMediaPlayer();
                    cancelProgressTimer();
                    hideAllWidget();
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            setUp(url, mCache, mCachePath, mTitle);
                            setSeekOnStart(currentPosition);
                            startPlayLogic();
                            cancelProgressTimer();
                            hideAllWidget();
                        }
                    }, 500);
                    mTypeText = name;
                    mSwitchSize.setText(name);
                    mSourcePosition = position;
                }
            } else {
                Toast.makeText(getContext(), "已经是 " + name, Toast.LENGTH_LONG).show();
            }
        }
    });
    switchVideoTypeDialog.show();
}
 
Example #12
Source File: SampleVideo.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 推出全屏时将对应处理参数逻辑返回给非播放器
 *
 * @param oldF
 * @param vp
 * @param gsyVideoPlayer
 */
@Override
protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gsyVideoPlayer) {
    super.resolveNormalVideoShow(oldF, vp, gsyVideoPlayer);
    if (gsyVideoPlayer != null) {
        SampleVideo sampleVideo = (SampleVideo) gsyVideoPlayer;
        mSourcePosition = sampleVideo.mSourcePosition;
        mType = sampleVideo.mType;
        mTransformSize = sampleVideo.mTransformSize;
        mTypeText = sampleVideo.mTypeText;
        setUp(mUrlList, mCache, mCachePath, mTitle);
        resolveTypeUI();
    }
}
 
Example #13
Source File: GSYExoSubTitleVideoView.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gsyVideoPlayer) {
    super.resolveNormalVideoShow(oldF, vp, gsyVideoPlayer);
    GSYExoSubTitleVideoView gsyExoSubTitleVideoView = (GSYExoSubTitleVideoView) gsyVideoPlayer;
    ((GSYExoSubTitlePlayerManager) GSYExoSubTitleVideoManager.instance().getPlayer())
            .removeTextOutput(gsyExoSubTitleVideoView.mSubtitleView);

}
 
Example #14
Source File: GSYExo2PlayerView.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gsyVideoPlayer) {
    if (gsyVideoPlayer != null) {
        GSYVideoModel gsyVideoModel = mUriList.get(mPlayPosition);
        if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) {
            mTitleTextView.setText(gsyVideoModel.getTitle());
        }
    }
    super.resolveNormalVideoShow(oldF, vp, gsyVideoPlayer);
}
 
Example #15
Source File: DetailExoListPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onEnterFullscreen(String url, Object... objects) {
    super.onEnterFullscreen(url, objects);
    //隐藏调全屏对象的返回按键
    GSYVideoPlayer gsyVideoPlayer = (GSYVideoPlayer)objects[1];
    gsyVideoPlayer.getBackButton().setVisibility(View.GONE);
}
 
Example #16
Source File: DetailADPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onEnterFullscreen(String url, Object... objects) {
    super.onEnterFullscreen(url, objects);
    //隐藏调全屏对象的返回按键
    GSYVideoPlayer gsyVideoPlayer = (GSYVideoPlayer) objects[1];
    gsyVideoPlayer.getBackButton().setVisibility(View.GONE);
}
 
Example #17
Source File: VideoDetailActivity.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    GSYVideoPlayer.releaseAllVideos();
    //GSYPreViewManager.instance().releaseMediaPlayer();
    if (orientationUtils != null)
        orientationUtils.releaseListener();
    super.onDestroy();
}
 
Example #18
Source File: DetailListPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onEnterFullscreen(String url, Object... objects) {
    super.onEnterFullscreen(url, objects);
    //隐藏调全屏对象的返回按键
    GSYVideoPlayer gsyVideoPlayer = (GSYVideoPlayer) objects[1];
    gsyVideoPlayer.getBackButton().setVisibility(View.GONE);
}
 
Example #19
Source File: VideoFullCreenActivity.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    GSYVideoPlayer.releaseAllVideos();
    //GSYPreViewManager.instance().releaseMediaPlayer();
    if (orientationUtils != null)
        orientationUtils.releaseListener();
    super.onDestroy();
}
 
Example #20
Source File: SampleVideo.java    From Aurora with Apache License 2.0 5 votes vote down vote up
/**
 * 推出全屏时将对应处理参数逻辑返回给非播放器
 *
 * @param oldF
 * @param vp
 * @param gsyVideoPlayer
 */
@Override
protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gsyVideoPlayer) {
    super.resolveNormalVideoShow(oldF, vp, gsyVideoPlayer);
    if (gsyVideoPlayer != null) {
        SampleVideo sampleVideo = (SampleVideo) gsyVideoPlayer;
        mSourcePosition = sampleVideo.mSourcePosition;
        mType = sampleVideo.mType;
        mTransformSize = sampleVideo.mTransformSize;
        setUp(mUrlList, mCache, mCachePath, mTitle);
        resolveTypeUI();
    }
}
 
Example #21
Source File: DetailADPlayer2.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onEnterFullscreen(String url, Object... objects) {
    super.onEnterFullscreen(url, objects);
    //隐藏调全屏对象的返回按键
    GSYVideoPlayer gsyVideoPlayer = (GSYVideoPlayer) objects[1];
    gsyVideoPlayer.getBackButton().setVisibility(View.GONE);
}
 
Example #22
Source File: SmallVideoHelper.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 动画回到正常效果
 */
private void resolveMaterialToNormal(final GSYVideoPlayer gsyVideoPlayer) {
    if (gsyVideoOptionBuilder.isShowFullAnimation() && fullViewContainer instanceof FrameLayout) {
        int delay = orientationUtils.backToProtVideo();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                TransitionManager.beginDelayedTransition(fullViewContainer);
                FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) gsyVideoPlayer.getLayoutParams();
                lp.setMargins(listItemRect[0], listItemRect[1], 0, 0);
                lp.width = listItemSize[0];
                lp.height = listItemSize[1];
                //注意配置回来,不然动画效果会不对
                lp.gravity = Gravity.NO_GRAVITY;
                gsyVideoPlayer.setLayoutParams(lp);
                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        resolveToNormal();
                    }
                }, 400);
            }
        }, delay);
    } else {
        resolveToNormal();
    }
}
 
Example #23
Source File: VideoListFragment.java    From DoingDaily with Apache License 2.0 4 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    GSYVideoPlayer.releaseAllVideos();
}
 
Example #24
Source File: AudioDetailPlayer.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
private GSYVideoPlayer getCurPlay() {
    if (detailPlayer.getFullWindowPlayer() != null) {
        return detailPlayer.getFullWindowPlayer();
    }
    return detailPlayer;
}
 
Example #25
Source File: VideoDetailActivity.java    From LQRBiliBlili with MIT License 4 votes vote down vote up
private GSYVideoPlayer getCurPlay() {
    if (mVideoView.getFullWindowPlayer() != null) {
        return mVideoView.getFullWindowPlayer();
    }
    return mVideoView;
}
 
Example #26
Source File: InputUrlDetailActivity.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
private GSYVideoPlayer getCurPlay() {
    if (detailPlayer.getFullWindowPlayer() != null) {
        return  detailPlayer.getFullWindowPlayer();
    }
    return detailPlayer;
}
 
Example #27
Source File: DanmkuVideoActivity.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
private GSYVideoPlayer getCurPlay() {
    if (danmakuVideoPlayer.getFullWindowPlayer() != null) {
        return  danmakuVideoPlayer.getFullWindowPlayer();
    }
    return danmakuVideoPlayer;
}
 
Example #28
Source File: DetailMoreTypeActivity.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
private GSYVideoPlayer getCurPlay() {
    if (detailPlayer.getFullWindowPlayer() != null) {
        return  detailPlayer.getFullWindowPlayer();
    }
    return detailPlayer;
}
 
Example #29
Source File: DetailPlayer.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
private GSYVideoPlayer getCurPlay() {
    if (detailPlayer.getFullWindowPlayer() != null) {
        return detailPlayer.getFullWindowPlayer();
    }
    return detailPlayer;
}
 
Example #30
Source File: ScrollingActivity.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
private GSYVideoPlayer getCurPlay() {
    if (detailPlayer.getFullWindowPlayer() != null) {
        return detailPlayer.getFullWindowPlayer();
    }
    return detailPlayer;
}