节操视频播放器

权限和依赖

//jiecao
implementation 'fm.jiecao:jiecaovideoplayer:5.5'
implementation 'com.github.bumptech.glide:glide:3.7.0'


首先布局

    android:id="@+id/videoplayer"
    android:layout_width="match_parent"
    android:layout_height="270dp" />

具体代码

    //视频
holder.jcVideoPlayerStandard.TOOL_BAR_EXIST = false;
holder.jcVideoPlayerStandard.setUp(db.getVideouri(),
        JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, " ");
Glide.with(context.getApplicationContext()).load( db.getBimageuri() ) .into(   holder.jcVideoPlayerStandard.thumbImageView);
holder.jcVideoPlayerStandard.widthRatio = 4;//播放比例
holder.jcVideoPlayerStandard.heightRatio = 3;

在UI中

@Override
public void onBackPressed() {
    if (JCVideoPlayer.backPress()) {
        return;
    }
    this.onBackPressed();
}
@Override
public void onPause() {
    super.onPause();
    JCVideoPlayer.releaseAllVideos();
}
 

你可能感兴趣的:(节操视频播放器)