Reputation: 1034
I need to get video thumbnail from MediaStore and I want to show them in 16:9 format. Actually, with the following code, I can get them in 96x96 size (MICRO_KIND). I would like to have the path for the thumbnail, so I can have the thumbnail in original format and not the fixed size from the library. How to do this ?
my code:
long ids = videocursor.getLong(videocursor.getColumnIndex(MediaStore.Video.Media._ID));
ContentResolver crThumb = getContentResolver();
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 1;
Bitmap curThumb = MediaStore.Video.Thumbnails.getThumbnail(
crThumb, ids, MediaStore.Video.Thumbnails.MICRO_KIND,
options);
Upvotes: 0
Views: 653
Reputation: 1679
There is no MediaStore thumbnail in original aspect ratio, only MINI and MICRO_KIND which you have seen.
What I have done is decode a single frame and then scale it using BitmapFactory.
Decoding can be done with MediaMetadataRetriever#getFrameAtTime or ExoPlayer.
Upvotes: 1