React-Native无法将视频从本地文件系统放入Amplify存储



考虑到以下内容:

const path = 'file:///data/user/0/com.thing.place/cache/VisionCamera-20220520_1215171796142274516288565.mp4'
const uploadVideo = async () => {
const timestamp = Date.now()
const filename = 'blablablah'
// tried with and without the following:
// const response = await fetch(path)
// console.log(response) // fetch.umd.js:600 Not allowed to load local resource: {path}
// const blob = await response.blob()
//    
// below is never triggered?
const upload = Storage.put(filename, path, {
contentType: 'video/mp4',
resumable: true,
completeCallback: (event) => {
console.log(`Successfully uploaded ${event.key}`)
},
progressCallback: (progress) => {
console.log(`Uploaded: ${progress.loaded}/${progress.total}`)
},
errorCallback: (error) => {
console.error('Unexpected error while uploading', error)
},
})
}

这永远不会出错或失败,它只是永远不会启动。这里缺少什么,或者我们如何从本地文件系统缓存存储上传文件?

  • 权限授予,检查
  • S3策略就位,检查
  • 放大配置,检查
  • 文件可以在中查看react-native-video, check
  • 通过反应-本地视觉相机创建和存储的文件

一如既往的任何和所有的方向都非常感激,所以提前感谢!

问题是,当调试器在应用内菜单中通过debug运行时,fetch调用:

const response = await fetch(path)

…静默失败,代码永远不会开始上传。

相关内容

最新更新