android获取视频缩略图PATH,而不是Bitmap [英] android get video thumbnail PATH, not Bitmap

查看:133
本文介绍了android获取视频缩略图PATH,而不是Bitmap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以获取视频缩略图PATH,而不是Bitmap对象本身?我知道方法

Is it possible to get the video thumbnail PATH, not Bitmap object itself? I'm aware of method

MediaStore.Images.Thumbnails.queryMiniThumbnail

但由于我使用我自己的Bitmap缓存机制,我想要有视频缩略图的路径而不是Bitmap对象本身。此方法返回Bitmap对象,而不是路径。
谢谢

but since I use my own Bitmap caching mechanism I want to have the path to video thumbnail rather than the Bitmap object itself. This method returns Bitmap object, not path. Thanks

推荐答案

首先获取视频文件URL,然后使用下面的查询。

First get the video file URL and then use below query.

示例代码

private static final String[] VIDEOTHUMBNAIL_TABLE = new String[] {
    Video.Media._ID, // 0
    Video.Media.DATA, // 1 from android.provider.MediaStore.Video
    };

Uri videoUri = MediaStore.Video.Thumbnails.getContentUri("external");

cursor c = cr.query(videoUri, VIDEOTHUMBNAIL_TABLE, where, 
           new String[] {filepath}, null);

if ((c != null) && c.moveToFirst()) {
  VideoThumbnailPath = c.getString(1);
}

VideoThumbnailPath应该有视频缩略图路径。希望它有帮助。

VideoThumbnailPath, should have video thumbnail path. Hope it help's.

这篇关于android获取视频缩略图PATH,而不是Bitmap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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