To Do First
Did you try latest release = yes
Did you try master = yes
Platforms -Linux mint
Versions
Android: oreo in emulator pixel 2
iOS: n/a
react: "16.9.0",
react-native: "0.61.5",
react-native-camera: "^3.23.1",
Description/Current Behaviour
i want record video with rn camera with below code
async startRecording() {
await this.camera.recordAsync({
maxDuration: 30,
}).then(data => {
console.log('data of startRecording', data)
this.saveVideo(data)
}).catch(e => {
console.log('catch of startRecording', e)
})
}
it will return 4 things
1 uri
2 deviceOrientation
3 videoOrientation
4 isRecordingInterrupted
After that i want to move recorded video file from below location to download dir location
Path of recorded video which receive from data.uri
file:///data/user/0/com.videoapp/cache/Camera/b5ba0d8f-07ea-4755-8f7f-a88d5cc7a331.mp4"
My Code for moving file
saveVideo = async (data) => {
try {
RNFetchBlob.fs.mv(data.uri, RNFetchBlob.fs.dirs.DownloadDir)
.then((e) => {
console.log('MSG =>in RNFetchBlob ', e)
})
.catch(e => { console.log('MSG =>in RNFetchBlob ', e) })
} catch (e) {
console.log('MSG => Main Catch', e)
}
}
After all this it is throw error => Source file at path does not exist
Help Wanted Here
1 How to save video with react-native-camera at diff file location
I take reference from below link
https://medium.com/@masochist.aman/capturing-images-with-react-native-203e24f93eb9
I also save URI in state
async startRecording() {
this.setState({ recording: true });
await this.camera.recordAsync({
maxDuration: 30,
}).then(data => {
console.log('data of startRecording', data)
this.setState({
videoPath: data.uri
})
}).catch(e => {
console.log('catch of startRecording', e)
})
}
and then =>
<Video
source={{uri:this.state.videoPath}}
style={{height:300,width:300}}
onError={(e)=>{console.log(e)}} <--error say that try to load empty source
/>