微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PlatformException(VideoError, Video player has error..)

如何解决PlatformException(VideoError, Video player has error..)

我有这个方法

Future<void> uploadVideo(BuildContext context) async {
  File videoFile = widget.videoFile;
  print("videoFile $videoFile"); //this gives: File: '/data/user/0/com.---/app_Flutter/tutorVideo/1610097782457.mp4'
  setState(() {
    isLoading = true;
  });

  StorageReference fileStorageReference = FirebaseStorage.instance
      .ref()
      .child('tutorDetails')
      .child(AuthModel().currentUser.uid)
      .child('Video')
      .child(basename(videoFile.path));

  print("storage ${fileStorageReference.path}"); //this gives: storage tutorDetails/Kb2BmJnNWnMjxartXoXcmZGRjxg2/Video/1610097782457.mp4

  StorageUploadTask uploadTask = fileStorageReference.putFile(videoFile);

  StorageTaskSnapshot taskSnapshot = await uploadTask.onComplete;

  String downloadUrl = await taskSnapshot.ref.getDownloadURL();

  usermodel().updateProfileFields({
    'videoUrl': downloadUrl,"tutorApplicationVideoFlag": true,});

  setState(() {
    isLoading = false;
  });

  Navigator.popUntil(
      context,ModalRoute.withName(TutorApplicationScreen.path));
}

我正在使用最新版本的 video_player Flutter 插件{我更新了它},但我遇到了这些错误

播放错误

未处理的异常:PlatformException(VideoError,Video player has error com.google.android.exoplayer2.ExoPlaybackException:源错误,空,空)

未处理的异常:'package:firebase_storage/src/storage_reference.dart':断言失败:第 62 行 pos 12:'file.existsSync()':不正确。

注意:它在某些设备上正常工作并且没有任何错误,但在其他设备上没有。有什么想法吗?谢谢

解决方法

通过更新代码、检查文档解决了问题。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。