android get video thumbnail PATH, not Bitmap

前端 未结 2 1213
悲&欢浪女
悲&欢浪女 2021-01-12 08:39

Is it possible to get the video thumbnail PATH, not Bitmap object itself? I\'m aware of method

MediaStore.Images.Thumbnails.queryMiniThumbnail
2条回答
  •  无人共我
    2021-01-12 08:55

    First get the video file URL and then use below query.

    Sample Code:

    private static final String[] VIDEOTHUMBNAIL_TABLE = new String[] {
        Video.Media._ID, // 0
        Video.Media.DATA, // 1 from android.provider.MediaStore.Video
        };
    
    Uri videoUri = MediaStore.Video.Thumbnails.getContentUri("external");
    
    cursor c = cr.query(videoUri, VIDEOTHUMBNAIL_TABLE, where, 
               new String[] {filepath}, null);
    
    if ((c != null) && c.moveToFirst()) {
      VideoThumbnailPath = c.getString(1);
    }
    

    VideoThumbnailPath, should have video thumbnail path. Hope it help's.

提交回复
热议问题