uri : source{require (`${RNFS.DocumentDirectoryPath}/`
let fileName = videoURL.substring(videoURL.lastIndexOf("/") + 1, videoURL.length);
this.getVideoUrl(videoURL, fileName)
.then(res => {
this.setState({ videoUri: res });
})
.catch(url => {
this.setState({ videoUri: url });
});
getVideoUrl = (url, filename) => {
return new Promise((resolve, reject) => {
RNFS.readDir(RNFS.DocumentDirectoryPath)
.then(result => {
result.forEach(element => {
if (element.name == filename.replace(/%20/g, "_")) {
resolve(element.path);
}
});
})
.catch(err => {
reject(url);
});
});
};