2
我知道谷歌沒有官方API在API 2.0下獲取視頻縮略圖,但是如何訪問Gallery應用程序中顯示的視頻縮略圖。他們存儲在某個地方?安卓視頻縮略圖
我知道谷歌沒有官方API在API 2.0下獲取視頻縮略圖,但是如何訪問Gallery應用程序中顯示的視頻縮略圖。他們存儲在某個地方?安卓視頻縮略圖
使用視頻的路徑就可以得到縮略圖這樣,
String tmppath = "/sdcard/temp.png";
String[] proj = { MediaStore.Video.Media._ID,
MediaStore.Video.Media.DISPLAY_NAME,
MediaStore.Video.Media.DATA };
Cursor cursor = managedQuery(
MediaStore.Video.Media.EXTERNAL_CONTENT_URI, proj,
MediaStore.Video.Media.DISPLAY_NAME + "=?",
new String[] { tmppath.substring(tmppath.lastIndexOf("/")+1,
tmppath.length()) }, null);
cursor.moveToFirst();
long id1 = cursor.getLong(cursor
.getColumnIndex(MediaStore.Video.Media._ID));
ContentResolver crThumb = getContentResolver();
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = 1;
bitmap = MediaStore.Video.Thumbnails.getThumbnail(crThumb,id1, MediaStore.Video.Thumbnails.MICRO_KIND, options);