Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

React native video from local file

$
0
0

I am using react-native-video (v 5.0.2) and try to play file from local.

It's working in Android but not working in iOS.

I created the file that I want to play with react-native-fs. This is my code:

Write file:

const localFilePath = `file://${RNFS.DocumentDirectoryPath}/test.mp4`;
RNFS.writeFile(localFilePath, base64.encode(content), 'base64')
.then(success => {
console.log('FILE WRITTEN');
})
.catch(err => {
console.log('File Write Error: ', err.message);
});

Video source:

source={{ uri: this.state.fileUrl }}

I try to change the source with "file://" and without it, with "file:///" and also I tried to use encodeURI.

How can I let it work on iOS?


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>