安卓:是否可以显示视频缩略图? [英] Android: Is it possible to display video thumbnails?

查看:272
本文介绍了安卓:是否可以显示视频缩略图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了库对话框的视频录制应用程序。该库对话框显示录制的视频列表,其中每个项目包括图标,视频标题,标签和位置信息的方式如下:

I created a video recording application with library dialog. The library dialog displays the list of recorded videos where each item consists of icon, video title, tags and location information the following way:

有谁知道是否有可能取代视频缩略图图标(单帧preVIEW)?

Does anyone know whether it is possible to replace icons with video thumbnails (single frame preview)?

谢谢!

推荐答案

如果您使用的是API 2.0或更新版本,这将正常工作。

If you are using API 2.0 or newer this will work.

int id = **"The Video's ID"**
ImageView iv = (ImageView ) convertView.findViewById(R.id.imagePreview);
ContentResolver crThumb = getContentResolver();
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = 1;
Bitmap curThumb = MediaStore.Video.Thumbnails.getThumbnail(crThumb, id, MediaStore.Video.Thumbnails.MICRO_KIND, options);
iv.setImageBitmap(curThumb);

这篇关于安卓:是否可以显示视频缩略图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆