Firebase存储上传已停止在react-native上运行

时间:2016-11-13 13:31:16

标签: firebase react-native firebase-storage react-native-camera react-native-fetch-blob

我正在使用

"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' }

0 个答案:

没有答案