Search in sources :

Example 6 with OrientationUtils

use of com.shuyu.gsyvideoplayer.utils.OrientationUtils in project GSYVideoPlayer by CarGuo.

the class PlayActivity method init.

private void init() {
    String url = "http://baobab.wdjcdn.com/14564977406580.mp4";
    //需要路径的
    //videoPlayer.setUp(url, true, new File(FileUtils.getPath()), "");
    //借用了jjdxm_ijkplayer的URL
    String source1 = "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4";
    String name = "普通";
    SwitchVideoModel switchVideoModel = new SwitchVideoModel(name, source1);
    String source2 = "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f30.mp4";
    String name2 = "清晰";
    SwitchVideoModel switchVideoModel2 = new SwitchVideoModel(name2, source2);
    List<SwitchVideoModel> list = new ArrayList<>();
    list.add(switchVideoModel);
    list.add(switchVideoModel2);
    videoPlayer.setUp(list, true, "");
    //增加封面
    ImageView imageView = new ImageView(this);
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setImageResource(R.mipmap.xxx1);
    videoPlayer.setThumbImageView(imageView);
    //增加title
    videoPlayer.getTitleTextView().setVisibility(View.VISIBLE);
    videoPlayer.getTitleTextView().setText("测试视频");
    //设置返回键
    videoPlayer.getBackButton().setVisibility(View.VISIBLE);
    //设置旋转
    orientationUtils = new OrientationUtils(this, videoPlayer);
    //设置全屏按键功能
    videoPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            orientationUtils.resolveByClick();
        }
    });
    //videoPlayer.setBottomProgressBarDrawable(getResources().getDrawable(R.drawable.video_new_progress));
    //videoPlayer.setDialogVolumeProgressBar(getResources().getDrawable(R.drawable.video_new_volume_progress_bg));
    //videoPlayer.setDialogProgressBar(getResources().getDrawable(R.drawable.video_new_progress));
    //videoPlayer.setBottomShowProgressBarDrawable(getResources().getDrawable(R.drawable.video_new_seekbar_progress),
    //getResources().getDrawable(R.drawable.video_new_seekbar_thumb));
    //videoPlayer.setDialogProgressColor(getResources().getColor(R.color.colorAccent), -11);
    //是否可以滑动调整
    videoPlayer.setIsTouchWiget(true);
    //设置返回按键功能
    videoPlayer.getBackButton().setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    //过渡动画
    initTransition();
}
Also used : OrientationUtils(com.shuyu.gsyvideoplayer.utils.OrientationUtils) ArrayList(java.util.ArrayList) ImageView(android.widget.ImageView) SwitchVideoModel(com.example.gsyvideoplayer.model.SwitchVideoModel) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View)

Aggregations

OrientationUtils (com.shuyu.gsyvideoplayer.utils.OrientationUtils)6 View (android.view.View)5 ImageView (android.widget.ImageView)5 BindView (butterknife.BindView)5 NestedScrollView (android.support.v4.widget.NestedScrollView)4 SampleListener (com.example.gsyvideoplayer.listener.SampleListener)4 LockClickListener (com.shuyu.gsyvideoplayer.listener.LockClickListener)4 ArrayList (java.util.ArrayList)2 Activity (android.app.Activity)1 Point (android.graphics.Point)1 WebSettings (android.webkit.WebSettings)1 FrameLayout (android.widget.FrameLayout)1 SwitchVideoModel (com.example.gsyvideoplayer.model.SwitchVideoModel)1 ScrollWebView (com.example.gsyvideoplayer.view.ScrollWebView)1 GSYVideoModel (com.shuyu.gsyvideoplayer.model.GSYVideoModel)1