Get Video Thumbnail from Uri

前端 未结 7 1228
遇见更好的自我
遇见更好的自我 2020-12-19 07:45

I want to select a video from my Gallery. It\'s working fine. But now I want to display a Bitmap, as a thumbnail.I tired this code it\'s not working, it always says: NullPoi

7条回答
  •  天命终不由人
    2020-12-19 08:28

    This works for me:

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

    Using ThumbnailUtils, you can create thumbnail of two types.

    MediaStore.Images.Thumbnails.MICRO_KIND - type will generate thumbnail of size 96 x 96. MediaStore.Images.Thumbnails.MINI_KIND - type will generate thumbnail of size 512 x 384.

提交回复
热议问题