Ionic - iOS - 将路径存储到照片库

时间:2018-06-06 09:23:21

标签: ios ionic-framework path filesystems

在Ionic app上工作,我正在尝试在iOS照片库中存储和重用视频路径。使用Ionic原生相机插件。但是,每次打开视频时,它都会生成并在 tmp 文件夹中提供带有新uuid的新路径。 Xcode日志示例:

2018-06-06 16:10:11.062523+0800 openGallery >> file:///private/var/mobile/Containers/Data/Application/B3C0CDB7-6B2D-4F32-8C0C-632AE0D8FC79/tmp/BFDDB5BC-7F0B-42E5-B943-E5F9EAF25FB5.MOV
2018-06-06 16:10:11.062655+0800 file:///private/var/mobile/Containers/Data/Application/B3C0CDB7-6B2D-4F32-8C0C-632AE0D8FC79/tmp/BFDDB5BC-7F0B-42E5-B943-E5F9EAF25FB5.MOV

这是我的代码:

  openGallery() {
console.log('open gallery');
let cameraOptions = {
  mediaType: MediaType.ALLMEDIA,
  sourceType: PictureSourceType.PHOTOLIBRARY,
  destinationType: DestinationType.NATIVE_URI,
  quality: 100,
  targetWidth: 600,
  targetHeight: 600,
  encodingType: EncodingType.JPEG,
  correctOrientation: true
}

return new Promise<any>((resolve, reject) => {
  this.camera.getPicture(cameraOptions)
    .then(file_uri => {
      if (this.platform.is('android')) {
        file_uri = "file://" + file_uri;
      }
      console.log("openGallery >> " + file_uri)
      resolve(file_uri);
    }, err => {
      console.log(err)
      reject(err)
    });
})

有没有办法在库中存储现有视频的路径,而无需在app文件夹中制作副本?

0 个答案:

没有答案