没有使用照片库插件获取视频 URI/URl

问题描述 投票:0回答:0

我在下面尝试了什么:

第 1 步: 尝试点击此链接https://ionicframework.com/docs/v5/native/photo-library.

第 2 步: 我已经在下面的命令下安装了这个

$ ionic cordova 插件添加 cordova-plugin-photo-library
$ npm install @awesome-cordova-plugins/photo-library

第三步: 以下代码供参考

   import { PhotoLibrary } from '@awesome-cordova-plugins/photo-library/ngx';

constructor(private photoLibrary: PhotoLibrary) { }

this.photoLibrary.requestAuthorization().then(() => {
this.photoLibrary.getLibrary().subscribe({
 next: library => {
   library.forEach(function(libraryItem) {
     console.log(libraryItem.id);          // ID of the photo
     console.log(libraryItem.photoURL);    // Cross-platform access to photo
     console.log(libraryItem.thumbnailURL);// Cross-platform access to thumbnail
     console.log(libraryItem.fileName);    // array of ids of appropriate AlbumItem, only of includeAlbumsData was used
   });
 },
 error: err => { console.log('could not get photos'); },
 complete: () => { console.log('done getting photos'); }
});
})
.catch(err => console.log('permissions weren\'t granted'));

我面临的问题:

  1. 在 console.log 中我找不到画廊提供的任何视频

基于我的研究的解决方法

  1. 我们需要在
    onst options: GetLibraryOptions = {includeVideos:true};
    方法中提供
    getLibrary()
    作为参数。
  2. 但我无法在 getlibrary 方法中将选项作为参数发送

如何使用此选项打印图库中的视频。

请告诉我如何在不打开图库的情况下从图库中获取所有视频和图像。

javascript angular cordova ionic-framework cordova-plugins
© www.soinside.com 2019 - 2024. All rights reserved.