genericUser
genericUser

Reputation: 7108

Flutter video_thumbnail "Couldn't generate thumbnail" on IOS

I'm using the video_thumbnail: ^0.5.3 flutter package to present the video's first frame.

Here is my code:

Future<Uint8List?> generateThumbnail(String videoUrl) async {
  try {
    final thumbnail = await VideoThumbnail.thumbnailData(video: 'https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_30mb.mp4');
    return thumbnail;
  } catch (e) {
    if (kDebugMode) {
      print('Error generating thumbnail: $e');
    }
    return null;
  }
}

I'm trying to load a list of thumbnails (even from the same URL), but on old IOS devices most of them are not loaded, and I'm getting the above error.

couldn't generate thumbnail, error:Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-12792), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x283be6730 {Error Domain=NSOSStatusErrorDomain Code=-12792 "(null)"}}

Important key points:

  1. This issue occurs only for IOS devices.
  2. It happens on old devices.
  3. The file is not corrupted.
  4. When trying to load multiple thumbnails from the same URL, some are loaded while others getting the error.
  5. I tried to uninstall and rebuild the app again but nothing worked.
  6. There is no problem on Android devices.

Upvotes: 0

Views: 825

Answers (1)

Ziyad
Ziyad

Reputation: 384

Ensure your platform configuration has appropriate permissions to make network requests and download/store images.

Upvotes: 0

Related Questions