use of com.baidu.cloud.videoplayer.widget.BDCloudVideoView in project cuddly-octo-fortnight by prpr894.
the class AdvancedPlayActivity method initUI.
/**
* 初始化界面
*/
private void initUI() {
mViewHolder = findViewById(R.id.view_holder);
mediaController = findViewById(R.id.media_controller_bar);
fullHeaderRl = findViewById(R.id.rl_fullscreen_header);
fullControllerRl = findViewById(R.id.rl_fullscreen_controller);
normalHeaderRl = findViewById(R.id.rl_normalscreen_header);
normalControllerRl = findViewById(R.id.rl_normalscreen_controller);
headerBar = findViewById(R.id.rl_header_bar);
/**
* 设置ak
*/
BDCloudVideoView.setAK(ak);
mVV = new BDCloudVideoView(this);
/**
* 注册listener
*/
mVV.setOnPreparedListener(this);
mVV.setOnCompletionListener(this);
mVV.setOnErrorListener(this);
mVV.setOnInfoListener(this);
mVV.setOnBufferingUpdateListener(this);
mVV.setOnPlayerStateListener(this);
if (SharedPrefsStore.isPlayerFitModeCrapping(getApplicationContext())) {
mVV.setVideoScalingMode(BDCloudVideoView.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
} else {
mVV.setVideoScalingMode(BDCloudVideoView.VIDEO_SCALING_MODE_SCALE_TO_FIT);
}
RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(-1, -1);
rllp.addRule(RelativeLayout.CENTER_IN_PARENT);
mViewHolder.addView(mVV, rllp);
mediaController.setMediaPlayerControl(mVV);
mCollectionHelper = new CollectionHelper(mediaController.getCollectionView(), mLiveRoomItemDataBean);
mVV.setVideoPath(mLiveRoomItemDataBean.getPlay_url());
mVV.setLogEnabled(false);
// mVV.setDecodeMode(BDCloudMediaPlayer.DECODE_SW);
// 设置首次缓冲的最大时长
mVV.setMaxProbeTime(2000);
mVV.setTimeoutInUs(1000000);
// Options for live stream only
// mVV.setMaxProbeSize(1 * 2048);
// mVV.setMaxProbeTime(40); // 设置首次缓冲的最大时长
// mVV.setMaxCacheSizeInBytes(32 * 1024);
// mVV.setBufferTimeInMs(100);
// mVV.toggleFrameChasing(true);
// 初始化好之后立即播放(您也可以在onPrepared回调中调用该方法)
mVV.start();
initOtherUI();
}
Aggregations