一、
添加类库
compile 'cn.jzvd:jiaozivideoplayer:6.0.0'
二、添加布局
<<span class="pl-ent" style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(34, 134, 58);">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
中
转载自原文链接, 如需删除请联系管理员。
原文链接:节操播放器,转载请注明来源!
相关推荐