节操视频播放器

一、添加类库

compile 'cn.jzvd:jiaozivideoplayer:6.0.0'
二、添加布局
<cn.jzvd.JZVideoPlayerStandard
  android:id="@+id/videoplayer" 
  android:layout_width="match_parent"
 android:layout_height="200dp"/>
三、适配器中
 
public class RecyAdapter extends BaseQuickAdapter{

public RecyAdapter(int layoutResId, @Nullable List data) {
super(layoutResId, data);
}

@Override
protected void convert(BaseViewHolder helper, Bean._$00850FRBBean item) {
JZVideoPlayerStandard videoplayer = helper.getView(R.id.videoplayer);
//添加图片
 
Glide.with(mContext).load(item.getCover()).into(videoplayer.thumbImageView);
videoplayer.setUp(item.getMp4_url(),JZVideoPlayerStandard.SCREEN_LAYOUT_NORMAL,item.getTitle());
}
}
四、Activity中
 
public class Main2Activity extends BaseeActivity implements LoginContract.View {

private RecyclerView mRecy;
private List list=new ArrayList<>();
private RecyAdapter recyAdapter;

@Override
public void loginSucc(Bean bean) {
list.addAll(bean.get_$00850FRB());
recyAdapter.notifyDataSetChanged();

}

@Override
public void loginFail(String string) {

}

@Override
protected void initView() {
mRecy = findViewById(R.id.mRecy);
mRecy.setLayoutManager(new LinearLayoutManager(this));
mPersenter.loginPre();
recyAdapter = new RecyAdapter(R.layout.recy_item, list);
mRecy.setAdapter(recyAdapter);
}

@Override
protected int getLayoutId() {
return R.layout.activity_main2;
}
@Override
public void onBackPressed() {
if (JZVideoPlayer.backPress()) {
return;
}
super.onBackPressed();
}
@Override
protected void onPause() {
super.onPause();
JZVideoPlayer.releaseAllVideos();
}
}
五、
AndroidManifest.xml中

 

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