The app I am working on allows users to create social posts like Facebook with text, images and videos. I am working on PWA part and I came across this issue. For selecting video from storage, I need to create a thumbnail of the video to display in UI.
I was able to pick video as Uint8List
as it is supported in all the platforms but I couldn't get a thumbnail from it. I tried many libraries but all are using File
as an input.
Is there any way I can get this done?
I am using following code to get Uint8List of video File...
Library used: file_picker_cross
final filePicker = FilePickerCross(type: FileTypeCross.video);
await filePicker.pick();
final imageBytes = filePicker.toUint8List();
// TODO: get video thumbnail from [imageBytes]
A Flutter plugin that is able to generate thumbnails for images, pdf and xlsx files. if thumbnail generation is not supported for specific mime type, then a fallback icon from FontAwesome is returned.
U might use video_thumbnail 0.2.5+1 plugin in your flutter project
final uint8list = await VideoThumbnail.thumbnailData(
video: videofile.path,
imageFormat: ImageFormat.JPEG,
maxWidth: 128,
// specify the width of the thumbnail, let the height auto-scaled to keep the source aspect ratio
quality: 25,
);
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With