Reputation: 2628
Here I am trying to create thumb from video file. I selected video file from my App XYZVideos/ folder using gallery media selection intent.
Videos are already recorded by me and stored in this folder XYZVideos/.
If I am trying to do same thing by picking videos from other folders like camera it's working fine(i.e. creating thumb successfully).
I am using below code snippet to create thumb from media uri i received from intent:
String filePath = getRealPathFromURI(uri);
ThumbnailUtils.createVideoThumbnail( filePath, Thumbnails.MICRO_KIND);
Is any buddy come across this thing before. Please Help me...
Upvotes: 0
Views: 158
Reputation: 548
Try this code its solve for me:-
public String getPathFromURI(Uri contentUri) {
String[] proj1 = { MediaStore.Images.Media.DATA };
Cursor cursor1 = managedQuery(contentUri, proj1, null, null, null);
int column_index = cursor1.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor1.moveToFirst();
return cursor1.getString(column_index);
}
Upvotes: 2