Skip to content

Instantly share code, notes, and snippets.

@mulieriq
Created August 19, 2020 21:40
Show Gist options
  • Save mulieriq/47488a1052709b3d72dceae06c1eef7f to your computer and use it in GitHub Desktop.
Save mulieriq/47488a1052709b3d72dceae06c1eef7f to your computer and use it in GitHub Desktop.
Future getVideo() async {
setState(() {
video = null;
thumbfilepath = null;
});
setState(() {
messageid = DateTime.now().millisecondsSinceEpoch.toString();
});
var vinput = await ImagePicker.pickVideo(source: ImageSource.gallery);
final uint8list = await VideoThumbnail.thumbnailFile(
video: vinput.path,
imageFormat: ImageFormat.JPEG,
maxWidth:
500, // specify the width of the thumbnail, let the height auto-scaled to keep the source aspect ratio
quality: 25,
);
print(uint8list);
setState(() {
mdeiafilesize = filesize(vinput.lengthSync());
video = vinput;
thumbfilepath = uint8list;
});
uploadVideo();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment