未处理的异常:MissingPluginException(在频道 video_thumbnail 上找不到方法文件的实现)

时间:2020-12-23 19:26:04

标签: flutter

当我使用 ImagePicker.pickVideo(source: ImageSource.camera) 时它工作得很好,但如果我使用 ImagePicker.pickVideo(source: ImageSource.gallery) 我收到这个错误

Unhandled Exception: MissingPluginException(No implementation found for method file on channel video_thumbnail)
getVideo() async {
    final pickedFile = await ImagePicker.pickVideo(source: ImageSource.gallery);

    if(pickedFile != null){
      videoAddress = pickedFile.path;

      final thumbnailPath = await VideoThumbnail.thumbnailFile(
          video: videoAddress,
          imageFormat: ImageFormat.JPEG,
          quality: 75);

      videoPosterAddress = thumbnailPath;
      setState(() { videoPoster = File(thumbnailPath); });
    }
  }

videoPoster 包含缩略图文件。

0 个答案:

没有答案