Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cordova 在ionic相机预览插件的stopRecordVideo()函数返回的文件路径上找不到视频_Cordova_Ionic Framework_Ionic5 - Fatal编程技术网

Cordova 在ionic相机预览插件的stopRecordVideo()函数返回的文件路径上找不到视频

Cordova 在ionic相机预览插件的stopRecordVideo()函数返回的文件路径上找不到视频,cordova,ionic-framework,ionic5,Cordova,Ionic Framework,Ionic5,当我在ionic中调用camera preview插件的stopRecordVideo()时,在返回的文件路径上查找录制的视频文件时遇到了问题 我使用的函数: 开始录制 startRecording(){ options = { cameraDirection: this.cameraPreview.CAMERA_DIRECTION.BACK, width: (window.screen.width / 2), height: (window.screen.height /

当我在ionic中调用camera preview插件的
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
    });
停止录制

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
    });
我无法在该位置获取此文件。 我正在使用这个插件:
请帮助我获取该文件。

我已通过以下方法访问该视频文件:

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 native/File/ngx'导入{File,FileEntry};
建造师(
私有文件:文件,
) { }
此.file.resolveLocalFilesystemUrl(“file:///data/user/0/com.xyz.abc/cache/fileName.mp4")
。然后(条目=>{
(条目).file(文件=>{
警报(JSON.stringify(文件));
}
);
})
.catch(错误=>{
警报('读取文件时出错。'+JSON.stringify(err));
});