Search code examples
androidfilevideopreview

How to get thumbnail of video file in android


I have a video file in my sdcard. I would like to show a preview of this video in my ImageView . I know that there is a API:

ThumbnailUtils.createVideoThumbnail(videoFile,
        MediaStore.Images.Thumbnails.MINI_KIND)

but it always returns null, is there any alternative?


Solution

  • Its working for me

     Bitmap thumb = ThumbnailUtils.createVideoThumbnail(filePath, MediaStore.Images.Thumbnails.MINI_KIND);
    

    please check once, if you are passing path of video file .