ThumbnailUtils.createVideoThumbnail returns NULL when capturing a new video

I am trying to create a thumbnail from a video. I am using the following line:

Bitmap thumb = ThumbnailUtils.createVideoThumbnail(selectedVideoPath, MediaStore.Images.Thumbnails.MICRO_KIND);

It works great when I select an existing video from the gallery, but returns NULL when recording a new video, and then tries to get a thumbnail, although the path is valid (/storage/emulated/0/airImagePicker/1394007123308.3gp).

I am on HTC One Android 4.2.2.

Thank!

+4
source share
1 answer

, , . , , , , ( ). , , , . ( # xamarin android)

try {
                Bitmap bitmap = null;
                for (int time = 0; time < 6000; time += timeInterval) {
                    bitmap = ThumbnailUtils.CreateVideoThumbnail (videoFile.Path, ThumbnailKind.MiniKind);
                    if (bitmap != null)
                        break;
                    await Task.Delay (timeInterval);
                }


          return bitmap;

, .

0

Source: https://habr.com/ru/post/1530190/


All Articles