use of com.example.gsyvideoplayer.model.SwitchVideoModel 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();
}
Aggregations