问题描述
我正在尝试rn-fetch-blob,我想从Firebase下载mp4文件。我的功能在iOS上运行良好,只有在android上才能下载3个视频。只有他只显示1。我认为它正在覆盖路径,但是我不知道如何更改它。有人可以帮我吗?
这是用于下载的mij函数:
downloadVideo(post){
console.log("Video"+post.image);
let fullPost = post;
let dirs =RNFetchBlob.fs.dirs;
RNFetchBlob
.config({
fileCache : false,appendExt: 'mp4',addAndroidDownloads : {
useDownloadManager : true,// <-- this is the only thing required
// Optional,override notification setting (default to true)
notification : true,// Optional,but recommended since android DownloadManager will fail when
// the url does not contains a file extension,by default the mime type will be text/plain
mime : 'mp4',description : 'File downloaded by download manager.',path: RNFetchBlob.fs.dirs.DownloadDir+"/filename.ext"
}
})
.fetch('GET',fullPost.image,{
//some headers ..
})
.then((res) => {
// the temp file path
//console.log('The file saved to ',res.path())
let path =res.path();
console.log("het padje:"+path)
var newelement = {date: fullPost.date,function: fullPost.function,image: path,name: fullPost.name,text: fullPost.text,type:fullPost.type,post: fullPost.post};
this.setState(prevstate => ({
messages: [...prevstate.messages,newelement]
}))
})
}
messages数组是我在视图中映射的het数组。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)