简单的视频播放器显示图片

依赖

//视频播放jiecao依赖
  compile 'fm.jiecao:jiecaovideoplayer:5.5.4'

 


 

 

 

public class Video_Adapter extends RecyclerView.Adapter {
    List list;
    Context context;
    public String url;

    public Video_Adapter(List list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View inflate = View.inflate(context, R.layout.video_item, null);
        ViewHolder viewHolder = new ViewHolder(inflate);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        holder.tv.setText(list.get(position).getText());

//视频播放器
        holder.videocontroller.TOOL_BAR_EXIST = false;
        holder.videocontroller.setUp(list.get(position).getVideouri()
                , JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "");

//        jcVideoPlayerStandard.loop  = true;//是否循环播放

        Glide.with(context).load(list.get(position).getBimageuri())
                .into(holder.videocontroller.thumbImageView);
        holder.videocontroller.widthRatio = 4;//播放比例
        holder.videocontroller.heightRatio = 3;


    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    class ViewHolder extends RecyclerView.ViewHolder {
        private final TextView tv;
        private final JCVideoPlayerStandard videocontroller;
        //private final ImageView thumbImageView;

        public ViewHolder(View itemView) {
            super(itemView);
            tv = itemView.findViewById(R.id.tv);
            videocontroller = itemView.findViewById(R.id.videocontroller);

        }
    }

}

你可能感兴趣的:(简单的视频播放器显示图片)