Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

flutter video thumbnail from url

Use the package video_thumbnail:
		  
   video_thumbnail: ^0.5.0

//And here's the method to extract a file thumbnail image from video url or file path:
  
  Future<File> getVideoThumbnail (String url) async {

    var thumbTempPath = await VideoThumbnail.thumbnailFile(
      video: url,
      thumbnailPath: (await getTemporaryDirectory()).path,
      imageFormat: ImageFormat.WEBP,
      maxHeight: 64, // specify the height of the thumbnail, let the width auto-scaled to keep the source aspect ratio
      quality: 75, // you can change the thumbnail quality here
    );
    return File(thumbTempPath!);
  }
 
PREVIOUS NEXT
Tagged: #flutter #video #thumbnail #url
ADD COMMENT
Topic
Name
2+6 =