generateThumbnail method
Generate a thumbnail for a video or image file.
The thumbnail will be stored in the file path specified at target
.
Additionally, a target width and height should be specified.
Currently the thumbnail format is JPG, set to image quality 80.
Errors will be propagated to the consumer of this API and need to be handled in the onError handler of the returned Future.
Implementation
Future<String> generateThumbnail(
/// Absolute source file path, without the file:// scheme prepended.
String path,
/// Absolute target file path, without the file:// scheme prepended.
String target,
/// Target width.
int width,
/// Target height.
/// TODO: Consider to remove the field or specify the fit/crop ratio better.
int height, {
/// Position of the video in milliseconds where to generate the image from
int positionMs = 0,
}) async {
return (await _methodChannel.invokeMethod<String>(
'generateThumbnail',
<String, dynamic>{
'path': path,
'target': target,
'width': width,
'height': height,
'positionMs': positionMs,
},
))!;
}