颤振:';existsSync()和#x27;尝试将视频上载到firebase_存储时,在IOS设备上似乎总是错误的
我正在尝试将视频从用户库上载到firebase_存储。 首先,用户选择视频:颤振:';existsSync()和#x27;尝试将视频上载到firebase_存储时,在IOS设备上似乎总是错误的,firebase,flutter,firebase-storage,Firebase,Flutter,Firebase Storage,我正在尝试将视频从用户库上载到firebase_存储。 首先,用户选择视频: final File file = await ImagePicker.pickVideo( source: ImageSource.gallery, ); // Video compression MediaInfo info; if (Platform.isIOS) { info = await _flutterVide
final File file = await ImagePicker.pickVideo(
source: ImageSource.gallery,
);
// Video compression
MediaInfo info;
if (Platform.isIOS) {
info = await _flutterVideoCompress.getMediaInfo(file.path);
} else {
info = await _flutterVideoCompress.compressVideo(
file.path,
deleteOrigin: true,
quality: VideoQuality.MediumQuality,
includeAudio: true,
);
}
setState(() {
_galleryFile = info.file;
});
选择视频文件后(在android压缩系统上,ios会自动执行),用户可以触发上传:
try {
var timestamp = DateTime.now().millisecondsSinceEpoch.toString();
var type = user.type;
var typeString = type == 0 ? 'player' : type == 1 ? 'trainer' : 'club';
String fileName = '${id}_$timestamp';
StorageReference reference = FirebaseStorage.instance
.ref()
.child(typeString)
.child(
'$typeString-upload-${_fileType == 'video' ? 'video' : 'images'}')
.child(id)
.child(fileName);
setState(() {
isLoadingUpload = true;
});
_uploadTask = reference.putFile(_galleryFile, StorageMetadata(contentType: 'video/mp4'));
.
.
.
catch (e) {
print(e);
}
但是代码在uploadTask=reference.putFile(_galleryFile,StorageMetadata(contentType:'video/mp4'))处已经失败带有“file.existsSync()的代码>不正确”。
在iPhone 7和iPhone XR上测试。
android上的一切都非常完美。
提前感谢。同样的事情也会发生在我身上,但只有从谷歌照片共享视频,如果从iOS gallery共享视频,它才能完美工作。同样的事情也会发生在我身上,但只有从谷歌照片共享视频,如果从iOS gallery共享视频,它才能完美工作。