thumbnailFile static method

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

Generates a thumbnail file under specified thumbnail folder or given full path and name which matches expected ext. The video can be a local video file, or an URL repreents iOS or Android native supported video format. If the thumbnailPath is ommited or null, a thumbnail image file will be created under the same folder as the video file. 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<String?> thumbnailFile(
    {required String video,
    Map<String, String>? headers,
    String? thumbnailPath,
    ImageFormat imageFormat = ImageFormat.PNG,
    int maxHeight = 0,
    int maxWidth = 0,
    int timeMs = 0,
    int quality = 10}) async {
  assert(video.isNotEmpty);
  if (video.isEmpty) return null;
  final reqMap = <String, dynamic>{
    'video': video,
    'headers': headers,
    'path': thumbnailPath,
    'format': imageFormat.index,
    'maxh': maxHeight,
    'maxw': maxWidth,
    'timeMs': timeMs,
    'quality': quality
  };
  return await _channel.invokeMethod('file', reqMap);
}