How to retrieve videos from gallery


#1

Hi All,

I am trying to retrieve all videos from the mobile gallery, cordova photo library plugin can read all photo, but there no videos in it.
How can get all videos stored in the phone?

thanks.


#2

any ideas,please thanks.


#3

I got a little progress:

const options: CameraOptions = {
quality: 100,
sourceType : this.camera.PictureSourceType.PHOTOLIBRARY,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.VIDEO
}

    this.camera.getPicture(options).then((imageData) => {
        // imageData is either a base64 encoded string or a file URI
        // If it's base64:
        //let base64Image = 'data:image/jpeg;base64,' + imageData;
        
        console.log('video data is '+imageData);
    }, (err) => {
        // Handle error
    });

I can use above code to choose one video, but it does not allow play it before select it, it is not that good, so I need to implement myself select UI with preview(play).

But how can I return the video list in the device???

any ideas ,thanks.