I tried to create a video thumbnail as described here. I also read the reference here.
In my app I first let the user choose a video with:
startActivityForResult(new Intent(Intent.ACTION_GET_CONTENT).setType("video/*"), ACTIVITY_PICKVIDEO);
Then I determine the video ID with:
fileID = Integer.parseInt(contentUri.getLastPathSegment());
So, the video content://media/external/video/media/5 would have the ID 5.
Then I try to get the thumbnail bitmap with:
ContentResolver crThumb = getContentResolver();
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 1;
Bitmap curThumb = MediaStore.Video.Thumbnails.getThumbnail(crThumb, fileID, MediaStore.Video.Thumbnails.MICRO_KIND, options);
There's no exception thrown but the bitmap has a width and height of -1. I'm not sure if the ID needed in getThubnail() is actually the ID that I determined above. Does anyone know of a working example how to get the thumbnail bitmap if you have the content Uri?
Interestingly (maybe so) I get null when trying with MediaStore.Video.Thumbnails.MINI_KIND as thumbnail size and an IllegalArgumentException ("Unsupported kind: 2") when I try FULL_SCREEN_KIND.
I'm using a Motorola Milestone with Android 2.1.
/EDIT: I also tried getting the ID with querying for the BaseColumns._ID but it turns out to be the same as in the Uri (in the given example the _ID is 5).