我在下面的适配器中创建videoview是我的代码
VideoThumbnailView = (VideoView) view.findViewById(R.id.video_thumbnail);
}
public void bind(final int position){
VideoThumbnailView.setVideoURI(Uri.parse(mList.get(position).VODUrl));
VideoThumbnailView.seekTo(100);
代码在android 7上运行但在android 5上无法运行,有没有人有解决方案?
答案 0 :(得分:0)
使用此功能创建视频缩略图并设置为videoview
Bitmap thumb = ThumbnailUtils.createVideoThumbnail(Uri.parse(mList.get(position).VODUrl),
MediaStore.Images.Thumbnails.MINI_KIND);
BitmapDrawable bitmapDrawable = new BitmapDrawable(thumb);
VideoThumbnailView.setBackgroundDrawable(bitmapDrawable);