const storeLocation = `${RNFS.DocumentDirectoryPath}`
let pathName = new Date().getTime() + '0714.mp4'
let downloadDest = `${storeLocation}/${pathName}`
const ret = RNFS.downloadFile({
fromUrl: videoUrl,
toFile: downloadDest,
ret.promise.then(res => {
if (res && res.statusCode == 200) {
var promise = CameraRoll.saveToCameraRoll('file://' + downloadDest)
promise
.then(result => {
Toast.showShortCenter('Saved to album')
.catch(error => {
Toast.showShortCenter('Save failed')
console.log(res)
}).catch((error)=>{
console.log(error)
{ [Error: sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection]
framesToPop: 1,
nativeStackAndroid: [],
userInfo: null,
code: 'EUNSPECIFIED',
line: 3059,
column: 26,
sourceURL: 'http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false' }
zaydion, DanilovG103, yan-alex, Ritikaagarg, samp989, hieuplasma, and daniel-keen reacted with thumbs down emoji
gustavopch, OleksandIadvigun, adelTerki31, mimaev-intellective, parsable-jobradovic, and zaydion reacted with eyes emoji
All reactions
As @Drckk said, in my case it was because I was calling RNFS.downloadFile
passing a file://
URI to parameter fromUrl
. That's not possible. It can't download stuff from the file system.
you can on ios