thumbnailData static method

Future<Uint8List> thumbnailData({
  1. required String video,
  2. Map<String, String>? headers,
  3. ImageFormat imageFormat = ImageFormat.PNG,
  4. int maxHeight = 0,
  5. int maxWidth = 0,
  6. int timeMs = 0,
  7. int quality = 10,
})

Generates a thumbnail image data in memory as UInt8List, it can be easily used by Image.memory(...). The video can be a local video file, or an URL repreents iOS or Android native supported video format. Specify the maximum height or width for the thumbnail or 0 for same resolution as the original video. The lower quality value creates lower quality of the thumbnail image, but it gets ignored for PNG format.

Implementation

static Future<Uint8List> thumbnailData({
  required String video,
  Map<String, String>? headers,
  ImageFormat imageFormat = ImageFormat.PNG,
  int maxHeight = 0,
  int maxWidth = 0,
  int timeMs = 0,
  int quality = 10,
}) async {
  assert(video.isNotEmpty);

  return VideoThumbnailPlatform.instance.thumbnailData(
    video: video,
    headers: headers,
    imageFormat: imageFormat,
    maxHeight: maxHeight,
    maxWidth: maxWidth,
    timeMs: timeMs,
    quality: quality,
  );
}