在 ionic 的相机预览插件的 stopRecordVideo() 函数返回的文件路径上找不到视频
Cannot find the video on the file path returned by stopRecordVideo() function of camera preview plugin of ionic
当我在 ionic 中调用相机预览插件 stopRecordVideo()
时,我无法在返回的文件路径中找到录制的视频文件。
我使用的函数:
开始录制
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);
}
停止录制
this.cameraPreview.stopRecordVideo().then((filePath) => {
alert(JSON.stringify(filePath));
//filePath = "/data/user/0/com.xyz.abc/cache/fileName.mp4
});
我没有在该位置获取此文件。
我正在使用这个插件:https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview
请帮我获取文件。
我通过以下方法访问了视频文件:
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));
});
当我在 ionic 中调用相机预览插件 stopRecordVideo()
时,我无法在返回的文件路径中找到录制的视频文件。
我使用的函数:
开始录制
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);
}
停止录制
this.cameraPreview.stopRecordVideo().then((filePath) => {
alert(JSON.stringify(filePath));
//filePath = "/data/user/0/com.xyz.abc/cache/fileName.mp4
});
我没有在该位置获取此文件。 我正在使用这个插件:https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview 请帮我获取文件。
我通过以下方法访问了视频文件:
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));
});