com.shuyu.gsyvideoplayer.GSYVideoManager Java Examples

The following examples show how to use com.shuyu.gsyvideoplayer.GSYVideoManager. 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: AdvancedContentFragment.java    From YcShareElement with Apache License 2.0 6 votes vote down vote up
@Override
public void onPageSelected(int position) {
    if (mPlayingCell != null) {
        try {
            GSYVideoManager.instance().stop();
        } catch (IllegalStateException e) {
            e.printStackTrace();
        }
    }
    if (mAdapter.getItem(position) instanceof VideoContentCell) {
        mPlayingCell = ((VideoContentCell) mAdapter.getItem(position));
        mPlayingCell.startPlay();
    } else {
        mPlayingCell = null;
    }
}
 
Example #2
Source File: PlayPickActivity.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
@Override
public void onBackPressed() {
    //先返回正常状态
    if (orientationUtils.getScreenType() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
        videoPlayer.getFullscreenButton().performClick();
        return;
    }
    //释放所有
    videoPlayer.setVideoAllCallBack(null);
    GSYVideoManager.releaseAllVideos();
    if (isTransition && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        super.onBackPressed();
    } else {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                finish();
                overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out);
            }
        }, 500);
    }
}
 
Example #3
Source File: SmartPickVideo.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
@Override
public void onSeekComplete() {
    if (mTmpManager != null) {
        GSYVideoBaseManager manager = GSYVideoManager.instance();
        GSYVideoManager.changeManager(mTmpManager);
        mTmpManager.setLastListener(manager.lastListener());
        mTmpManager.setListener(manager.listener());

        manager.setDisplay(null);

        Debuger.printfError("**** showDisplay onSeekComplete ***** " + mSurface);
        Debuger.printfError("**** showDisplay onSeekComplete isValid***** " + mSurface.isValid());
        mTmpManager.setDisplay(mSurface);
        changeUiToPlayingClear();
        resolveChangedResult();
        manager.releaseMediaPlayer();
    }
}
 
Example #4
Source File: PlayEmptyControlActivity.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
@Override
public void onBackPressed() {
    //释放所有
    videoPlayer.setVideoAllCallBack(null);
    GSYVideoManager.releaseAllVideos();
    if (isTransition && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        super.onBackPressed();
    } else {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                finish();
                overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out);
            }
        }, 500);
    }
}
 
Example #5
Source File: PlayActivity.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
@Override
public void onBackPressed() {
    //先返回正常状态
    if (orientationUtils.getScreenType() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
        videoPlayer.getFullscreenButton().performClick();
        return;
    }
    //释放所有
    videoPlayer.setVideoAllCallBack(null);
    GSYVideoManager.releaseAllVideos();
    if (isTransition && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        super.onBackPressed();
    } else {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                finish();
                overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out);
            }
        }, 500);
    }
}
 
Example #6
Source File: SwitchDetailActivity.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    super.onDestroy();
    detailPlayer.getGSYVideoManager().setListener(detailPlayer.getGSYVideoManager().lastListener());
    detailPlayer.getGSYVideoManager().setLastListener(null);
    GSYVideoManager.releaseAllVideos();
    if (orientationUtils != null)
        orientationUtils.releaseListener();

    SwitchUtil.release();
}
 
Example #7
Source File: DetailMoreTypeActivity.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {

    if (orientationUtils != null) {
        orientationUtils.backToProtVideo();
    }

    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #8
Source File: ListADVideoActivity2.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    if (GSYVideoADManager.backFromWindowFull(this)) {
        return;
    }
    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #9
Source File: AutoPlayRecyclerViewActivity.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #10
Source File: DanmkuVideoActivity.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {

    if (orientationUtils != null) {
        orientationUtils.backToProtVideo();
    }

    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #11
Source File: RecyclerView3Activity.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    super.onDestroy();

    /// 关闭硬解码
    GSYVideoType.disableMediaCodec();


    smallVideoHelper.releaseVideoPlayer();
    GSYVideoManager.releaseAllVideos();
}
 
Example #12
Source File: ListVideoActivity.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    super.onDestroy();
    GSYVideoManager.releaseAllVideos();
    if (listNormalAdapter != null) {
        listNormalAdapter.onDestroy();
    }
}
 
Example #13
Source File: ScrollingActivity.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {

    if (orientationUtils != null) {
        orientationUtils.backToProtVideo();
    }

    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #14
Source File: TyApplication.java    From tysq-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 初始化视屏播放器
 */
private void initVideo() {
    VideoOptionModel videoOptionModel =
            new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
                    "mediacodec-all-videos",
                    1);
    List<VideoOptionModel> list = new ArrayList<>();
    list.add(videoOptionModel);
    GSYVideoManager.instance().setOptionModelList(list);
}
 
Example #15
Source File: AdvancedContentFragment.java    From YcShareElement with Apache License 2.0 5 votes vote down vote up
@Override
public void onPause() {
    if (mPlayingCell != null) {
        GSYVideoManager.instance().pause();
    }
    super.onPause();
}
 
Example #16
Source File: ListADVideoActivity.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    if (GSYVideoADManager.backFromWindowFull(this)) {
        return;
    }
    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #17
Source File: InputUrlDetailActivity.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {

    if (orientationUtils != null) {
        orientationUtils.backToProtVideo();
    }

    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #18
Source File: DetailPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {

    if (orientationUtils != null) {
        orientationUtils.backToProtVideo();
    }

    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #19
Source File: VideoFragment.java    From tysq-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    GSYVideoManager.releaseAllVideos();
    if (orientationUtils != null)
        orientationUtils.releaseListener();
}
 
Example #20
Source File: RecyclerViewActivity.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #21
Source File: DetailNormalActivityPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {

    if (orientationUtils != null) {
        orientationUtils.backToProtVideo();
    }

    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #22
Source File: SimpleListVideoActivityMode1.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #23
Source File: SimplePlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    super.onDestroy();
    GSYVideoManager.releaseAllVideos();
    if (orientationUtils != null)
        orientationUtils.releaseListener();
}
 
Example #24
Source File: SimpleDetailActivityMode2.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    if (orientationUtils != null) {
        orientationUtils.backToProtVideo();
    }
    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #25
Source File: AudioDetailPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {

    if (orientationUtils != null) {
        orientationUtils.backToProtVideo();
    }

    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #26
Source File: AudioDetailPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
private String getUrl() {

        String url = "android.resource://" + getPackageName() + "/" + R.raw.test3;
        //注意,用ijk模式播放raw视频,这个必须打开
        GSYVideoManager.instance().enableRawPlay(getApplicationContext());

        ///exo raw 支持
        //String url =  RawResourceDataSource.buildRawResourceUri(R.raw.test).toString();

        return url;
    }
 
Example #27
Source File: DetailDownloadPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {

    if (orientationUtils != null) {
        orientationUtils.backToProtVideo();
    }

    if (GSYVideoManager.backFromWindowFull(this)) {
        return;
    }
    super.onBackPressed();
}
 
Example #28
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 #29
Source File: GSYVideoPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/*******************************下面方法为管理器和播放控件交互的方法****************************************/

    @Override
    public GSYVideoViewBridge getGSYVideoManager() {
        GSYVideoManager.instance().initContext(getContext().getApplicationContext());
        return GSYVideoManager.instance();
    }
 
Example #30
Source File: VideoPlayActivity.java    From OpenEyes with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    super.onDestroy();
    GSYVideoManager.releaseAllVideos();
    if (orientationUtils != null) {
        orientationUtils.releaseListener();
    }
}