Флаттер: получить первый кадр видео - PullRequest
0 голосов
/ 19 января 2019

Как получить первый кадр локального видеофайла в проекте Flutter?Вот мой код:

ImagePicker.pickVideo(source: ImageSource.camera).then((File file) {
  if (file != null && mounted) {
    //I got the video file here, but I want to get the first frame of the video.
  }
 });
},

Ответы [ 2 ]

0 голосов
/ 20 февраля 2019
String thumb = await Thumbnails.getThumbnail(
    thumbnailFolder:'[FOLDER PATH TO STORE THUMBNAILS]', // creates the specified path if it doesnt exist
    videoFile: '[VIDEO PATH HERE]',
    imageType: ThumbFormat.PNG,
    quality: 30);

/*
* thumbnailFolder property can be omitted if you dont wish to keep the generated thumbails past each usage
*/
0 голосов
/ 19 января 2019

Я реализовал это, используя миниатюры паба.

String thumb = await Thumbnails.getThumbnail(
    thumbnailFolder:'[FOLDER PATH TO STORE THUMBNAILS]', // creates the specified path if it doesnt exist
    videoFile: '[VIDEO PATH HERE]',
    imageType: ThumbFormat.PNG,
    quality: 30);

/*
* thumbnailFolder property can be omitted if you dont wish to keep the generated thumbails past each usage
*/
...