.mov文件以文本形式存储在Firebase中 [英] .mov files getting stored as text in Firebase
问题描述
我正在尝试将.mov文件存储在我的React Native应用程序的Firebase存储中.我将文件转换为Blob,然后将其上传到Firebase.该文件以 video/mov
的类型存储在Firebase中,因此一切看起来都很酷.
I'm trying to store a .mov file in Firebase storage in my React Native app.
I convert the file to a blob and upload it to Firebase. The file is being stored in Firebase with the type of video/mov
so everything seems cool.
但是,当我尝试下载该文件时,它正在以文本文件的形式下载,现在查看时,看起来就像是以文本文件的形式存储.
However, when I try and download the file, it is being downloaded as a text file and now looking at it, it looks like it's being stored as a text file.
对为什么会发生这种情况有任何想法吗?我在手机上录制的视频被保存到带有.mov扩展名btw的磁盘上.
Any thoughts on why this is happening? The video I record on my phone is being saved to the disk w/ the .mov extension btw.
这是相关代码
this.camera.capture({mode: Camera.constants.CaptureMode.video})
.then((data) => {
console.log(data)
const video = data.path;
this.props.dispatch(saveVideoPath(video));
let rnfbURI = RNFetchBlob.wrap(video);
Blob
.build(rnfbURI, { type : 'video/mov'})
.then((blob) => {
console.log(blob);
storageRef.child('video/' + '12345').put(blob, { contentType : 'video/mov' })
.then((snapshot) => {
const downloadURL = snapshot.downloadURL
this.props.dispatch(saveVideoDownloadURL(downloadURL));
console.log('Uploaded a blob or file!');
}).catch(error => console.log(error));
})
})
推荐答案
您的问题是您尝试使用文件查看器
代替视频播放器打开保存的视频文件
,这就是为什么您看到这些符号的原因.要解决此问题,请更改用于打开电影文件的应用程序,然后尝试选择 Quicktime
.正如我在您的屏幕快照中看到的那样,您文件的类型是 video/mov
.因此,这是一个视频文件,而不是文本文件.
Your problem is that you are trying to open the saved video file with a file viewer
in stead of a video player
, that's why you see those symbols. To solve this, change the app with which you are opening the movie files and try to choose Quicktime
. As i see in your screenshot, the type of your file is video/mov
. So it's a video file and not a text file.
希望有帮助.
这篇关于.mov文件以文本形式存储在Firebase中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!