Search in sources :

Example 1 with CollectionHelper

use of com.prpr894.cplayer.utils.CollectionHelper 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();
}
Also used : BDCloudVideoView(com.baidu.cloud.videoplayer.widget.BDCloudVideoView) RelativeLayout(android.widget.RelativeLayout) CollectionHelper(com.prpr894.cplayer.utils.CollectionHelper)

Example 2 with CollectionHelper

use of com.prpr894.cplayer.utils.CollectionHelper in project cuddly-octo-fortnight by prpr894.

the class RoomRecyclerAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    CollectionHelper collectionHelper = new CollectionHelper(holder.mImageViewCollection, mList.get(position));
    collectionHelper.checkState(holder.mImageViewCollection);
    holder.mImageViewCollection.setTag(collectionHelper);
    holder.mTextViewStationName.setText(mList.get(position).getNickname());
    Picasso.with(mContext).load(mList.get(position).getLogourl()).placeholder(R.drawable.ic_img_loading).into(holder.mImageViewIcon);
}
Also used : CollectionHelper(com.prpr894.cplayer.utils.CollectionHelper)

Example 3 with CollectionHelper

use of com.prpr894.cplayer.utils.CollectionHelper in project cuddly-octo-fortnight by prpr894.

the class RoomRecyclerAdapter method checkCollectionState.

public void checkCollectionState() {
    if (mList != null) {
        for (int i = 0; i < mList.size(); i++) {
            View child = mRecyclerView.getChildAt(i);
            if (child != null) {
                ViewHolder childViewHolder = (ViewHolder) mRecyclerView.getChildViewHolder(child);
                CollectionHelper helper = (CollectionHelper) childViewHolder.mImageViewCollection.getTag();
                helper.checkState(childViewHolder.mImageViewCollection);
            }
        }
    }
}
Also used : CollectionHelper(com.prpr894.cplayer.utils.CollectionHelper) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View)

Aggregations

CollectionHelper (com.prpr894.cplayer.utils.CollectionHelper)3 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 RelativeLayout (android.widget.RelativeLayout)1 TextView (android.widget.TextView)1 BDCloudVideoView (com.baidu.cloud.videoplayer.widget.BDCloudVideoView)1