How to get video thumbnail for starting duration in android?

755 views Asked by At

I want to display video thumbnail from sdcard video i have tried one code for display video thumbnail but it is display thumbnail lastduration i want to display thumbnail when first screen display when video start.

What i have tried check below.

Bitmap bitmap = ThumbnailUtils.createVideoThumbnail("/mnt/sdcard/peakmedia/201411200944130359.mp4",
                                            MediaStore.Video.Thumbnails.MINI_KIND);
1

There are 1 answers

4
Sarthak Mittal On BEST ANSWER

Maybe this code will help you :

MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(String file_path);
Bitmap bmpCover = retriever.getFrameAtTime(0,  MediaMetadataRetriever.OPTION_CLOSEST_SYNC);