Search in sources :

Example 1 with GSYVideoModel

use of com.shuyu.gsyvideoplayer.model.GSYVideoModel in project GSYVideoPlayer by CarGuo.

the class ListGSYVideoPlayer method startWindowFullscreen.

@Override
public GSYBaseVideoPlayer startWindowFullscreen(Context context, boolean actionBar, boolean statusBar) {
    GSYBaseVideoPlayer gsyBaseVideoPlayer = super.startWindowFullscreen(context, actionBar, statusBar);
    if (gsyBaseVideoPlayer != null) {
        ListGSYVideoPlayer listGSYVideoPlayer = (ListGSYVideoPlayer) gsyBaseVideoPlayer;
        listGSYVideoPlayer.mPlayPosition = mPlayPosition;
        listGSYVideoPlayer.mUriList = mUriList;
        GSYVideoModel gsyVideoModel = mUriList.get(mPlayPosition);
        if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) {
            listGSYVideoPlayer.mTitleTextView.setText(gsyVideoModel.getTitle());
        }
    }
    return gsyBaseVideoPlayer;
}
Also used : GSYVideoModel(com.shuyu.gsyvideoplayer.model.GSYVideoModel)

Example 2 with GSYVideoModel

use of com.shuyu.gsyvideoplayer.model.GSYVideoModel in project GSYVideoPlayer by CarGuo.

the class DetailListPlayer method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_deatil_list_player);
    ButterKnife.bind(this);
    //String url = "http://baobab.wd jcdn.com/14564977406580.mp4";
    List<GSYVideoModel> urls = new ArrayList<>();
    urls.add(new GSYVideoModel("http://baobab.wdjcdn.com/14564977406580.mp4", "标题1"));
    urls.add(new GSYVideoModel("http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4", "标题2"));
    urls.add(new GSYVideoModel("http://baobab.wdjcdn.com/14564977406580.mp4", "标题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();
    //外部辅助的旋转,帮助全屏
    orientationUtils = new OrientationUtils(this, detailPlayer);
    //初始化不打开外部的旋转
    orientationUtils.setEnable(false);
    detailPlayer.setIsTouchWiget(true);
    //关闭自动旋转
    detailPlayer.setRotateViewAuto(false);
    detailPlayer.setLockLand(false);
    detailPlayer.setShowFullAnimation(false);
    detailPlayer.setNeedLockFull(true);
    detailPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            //直接横屏
            orientationUtils.resolveByClick();
            //第一个true是否需要隐藏actionbar,第二个true是否需要隐藏statusbar
            detailPlayer.startWindowFullscreen(DetailListPlayer.this, true, true);
        }
    });
    detailPlayer.setStandardVideoAllCallBack(new SampleListener() {

        @Override
        public void onPrepared(String url, Object... objects) {
            super.onPrepared(url, objects);
            //开始播放了才能旋转和全屏
            orientationUtils.setEnable(true);
            isPlay = true;
        }

        @Override
        public void onAutoComplete(String url, Object... objects) {
            super.onAutoComplete(url, objects);
        }

        @Override
        public void onClickStartError(String url, Object... objects) {
            super.onClickStartError(url, objects);
        }

        @Override
        public void onQuitFullscreen(String url, Object... objects) {
            super.onQuitFullscreen(url, objects);
            if (orientationUtils != null) {
                orientationUtils.backToProtVideo();
            }
        }
    });
    detailPlayer.setLockClickListener(new LockClickListener() {

        @Override
        public void onClick(View view, boolean lock) {
            if (orientationUtils != null) {
                //配合下方的onConfigurationChanged
                orientationUtils.setEnable(!lock);
            }
        }
    });
}
Also used : ArrayList(java.util.ArrayList) SampleListener(com.example.gsyvideoplayer.listener.SampleListener) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) NestedScrollView(android.support.v4.widget.NestedScrollView) LockClickListener(com.shuyu.gsyvideoplayer.listener.LockClickListener) GSYVideoModel(com.shuyu.gsyvideoplayer.model.GSYVideoModel) OrientationUtils(com.shuyu.gsyvideoplayer.utils.OrientationUtils) ImageView(android.widget.ImageView)

Example 3 with GSYVideoModel

use of com.shuyu.gsyvideoplayer.model.GSYVideoModel in project GSYVideoPlayer by CarGuo.

the class ListGSYVideoPlayer method setUp.

/**
     * 设置播放URL
     *
     * @param url           播放url
     * @param cacheWithPlay 是否边播边缓存
     * @param cachePath     缓存路径,如果是M3U8或者HLS,请设置为false
     * @param objects       object[0]目前为title
     * @return
     */
public boolean setUp(List<GSYVideoModel> url, boolean cacheWithPlay, int position, File cachePath, Object... objects) {
    mUriList = url;
    mPlayPosition = position;
    GSYVideoModel gsyVideoModel = url.get(position);
    boolean set = setUp(gsyVideoModel.getUrl(), cacheWithPlay, cachePath, objects);
    if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) {
        mTitleTextView.setText(gsyVideoModel.getTitle());
    }
    return set;
}
Also used : GSYVideoModel(com.shuyu.gsyvideoplayer.model.GSYVideoModel)

Example 4 with GSYVideoModel

use of com.shuyu.gsyvideoplayer.model.GSYVideoModel in project GSYVideoPlayer by CarGuo.

the class ListGSYVideoPlayer method onAutoCompletion.

@Override
public void onAutoCompletion() {
    if (mPlayPosition < (mUriList.size() - 1)) {
        mPlayPosition++;
        GSYVideoModel gsyVideoModel = mUriList.get(mPlayPosition);
        setUp(gsyVideoModel.getUrl(), mCache, mCachePath, mObjects);
        if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) {
            mTitleTextView.setText(gsyVideoModel.getTitle());
        }
        startPlayLogic();
        return;
    }
    super.onAutoCompletion();
}
Also used : GSYVideoModel(com.shuyu.gsyvideoplayer.model.GSYVideoModel)

Example 5 with GSYVideoModel

use of com.shuyu.gsyvideoplayer.model.GSYVideoModel in project GSYVideoPlayer by CarGuo.

the class ListGSYVideoPlayer method setUp.

/**
     * 设置播放URL
     *
     * @param url           播放url
     * @param cacheWithPlay 是否边播边缓存
     * @param objects       object[0]目前为title
     * @return
     */
public boolean setUp(List<GSYVideoModel> url, boolean cacheWithPlay, int position, Object... objects) {
    mUriList = url;
    mPlayPosition = position;
    GSYVideoModel gsyVideoModel = url.get(position);
    boolean set = setUp(gsyVideoModel.getUrl(), cacheWithPlay, objects);
    if (!TextUtils.isEmpty(gsyVideoModel.getTitle())) {
        mTitleTextView.setText(gsyVideoModel.getTitle());
    }
    return set;
}
Also used : GSYVideoModel(com.shuyu.gsyvideoplayer.model.GSYVideoModel)

Aggregations

GSYVideoModel (com.shuyu.gsyvideoplayer.model.GSYVideoModel)5 NestedScrollView (android.support.v4.widget.NestedScrollView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 BindView (butterknife.BindView)1 SampleListener (com.example.gsyvideoplayer.listener.SampleListener)1 LockClickListener (com.shuyu.gsyvideoplayer.listener.LockClickListener)1 OrientationUtils (com.shuyu.gsyvideoplayer.utils.OrientationUtils)1 ArrayList (java.util.ArrayList)1