我在用
"firebase": "^3.6.0",
"react": "15.3.2",
"react-native": "0.37.0",
"react-native-camera": "git+https://github.com/lwansbrough/react-native-camera.git",
"react-native-fetch-blob": "^0.10.0",
"react-native-vector-icons": "^3.0.0",
"react-native-video": "^0.9.0"
我正在尝试将使用 react-native-video 录制的视频上传到 firebase - 这有效,但突然停止工作,现在没有成功。
我正在使用以下代码,其中 this.props.file.path 看起来像这样:
文件:///storage/emulated/0/Pictures/vidid.mp4
accept = () => {
let rnfbURI = RNFetchBlob.wrap(this.props.file.path)
Blob
.build(rnfbURI, { type : 'video/mp4;'})
.then((blob) => {
// upload image using Firebase SDK
firebase.storage()
.ref()
.child('testImageName')
.put(blob, { contentType : 'video/mp4' })
.then((snapshot) => {
console.log(snapshot)
blob.close()
done()
})
})
}
我尝试编写 Firebase 支持,但由于这是一种解决方法,因此对我没有帮助。
我的 blob 对象如下所示:
{ listeners: {},
isRNFetchBlobPolyfill: true,
multipartBoundary: null,
_ref: 'file:///storage/emulated/0/Pictures/VID_20161113_142100.mp4',
_blobCreated: true,
_closed: false,
cacheName: 'blob-559cd5c4-e880-4742-a3fe-dfae7e1a0df0',
type: 'video/mp4;',
size: '3665375' }