getFileThumbnail method

Future<File> getFileThumbnail(
  1. String path, {
  2. int quality = 100,
  3. int position = -1,
})

getByteThumbnail written to <video name>.jpg in the cache folder.

Implementation

Future<File> getFileThumbnail(
  String path, {
  int quality = 100,
  int position = -1,
}) async {
  final name = path.split('/').last;
  final dot = name.lastIndexOf('.');
  final base = dot > 0 ? name.substring(0, dot) : name;
  return VideoCompressor.getThumbnailFile(
    path,
    position: position < 0 ? null : Duration(milliseconds: position),
    quality: quality.clamp(1, 100),
    maxSide: _thumbnailMaxSide,
    outputPath: '${await VideoCompressor.cacheDirectory()}/$base.jpg',
  );
}