Issue
I am facing issue in finding the recorded video file on the file path returned when I called stopRecordVideo()
of camera preview plugin in ionic.
The function I used:
To start recording
startRecording(){
options = {
cameraDirection: this.cameraPreview.CAMERA_DIRECTION.BACK,
width: (window.screen.width / 2),
height: (window.screen.height / 2),
quality: 60,
withFlash: false,
storeToFile: true,
}
this.cameraPreview.startRecordVideo(options);
}
To stop recording
this.cameraPreview.stopRecordVideo().then((filePath) => {
alert(JSON.stringify(filePath));
//filePath = "/data/user/0/com.xyz.abc/cache/fileName.mp4
});
I am not getting this file at the location. I am using this plugin: https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview Please help me to get the file.
Solution
I have accessed the video file by the following method:
import { File,FileEntry } from '@ionic-native/file/ngx';
constructor(
private file: File,
) { }
this.file.resolveLocalFilesystemUrl("file:///data/user/0/com.xyz.abc/cache/fileName.mp4")
.then(entry => {
(<FileEntry>entry).file(file => {
alert(JSON.stringify(file));
}
);
})
.catch(err => {
alert('Error while reading file.' + JSON.stringify(err));
});
Answered By - Pushprajsinh Chudasama
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.