Skip to content

bug: cordova plugin camera not showing gallery on iPad capacitor  #3176

@tskravisankar

Description

@tskravisankar

Bug Report

Capacitor Version

![image](https://user-images.githubusercontent.com/26854917/86087259-668a1000-bac1-11ea-8b3c-92b03fb9c95e.png)
![image](https://user-images.githubusercontent.com/26854917/86087285-77d31c80-bac1-11ea-979c-b86d9ff8e3c1.png)

Platform(s)

  • iOS -> iPad alone

Current Behavior

Gallery popover is not visible when upload is clicked on iPad after capacitor migration. It works on iPhone devices.

Expected Behavior

When upload is clicked, gallery popover need to get display on iPad. It works fine on iPhone.

iPad:
When upload is clicked, this.camera.getPicture() gets hit. After that no response. No error log also found. App doesn't got crashed as well.

Note:
When the same process is done on iPhone, it shows gallery options.

Code Reproduction

step 1:
ionic start cameraApp blank --capacitor
cd cameraApp

step2: (https://ionicframework.com/docs/native/camera)
npm install cordova-plugin-camera
npm install @ionic-native/camera
ionic cap sync

step3:
Use this code in home:
import { Camera, CameraOptions } from '@ionic-native/camera/ngx';

constructor(private camera: Camera) { }

...

upload()
{
const options: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.FILE_URI,
sourceType: this.camera.PictureSourceType.SAVEDPHOTOALBUM,
mediaType: this.camera.MediaType.VIDEO
}

this.camera.getPicture(options).then((imageData) => {
alert(imageData);
}, (err) => {
// Handle error
});
}

step 4:
add normal ionic button and call the upload method

step 5:
ionic build
npx cap sync ios
npx cap open ios

step 5:
Run in simulator -> iPhone
Run in simulator -> iPad

In iPhone, gallery popover will get open
In iPad, gallery popover is not opening

Note:
Also tried multiple combinations on cameraoptions. Nothing works on iPad.

Other Technical Details

npm --version output: 6.4.1

node --version output: v10.15.1

pod --version output (iOS issues only): 1.8.4

Version of cordova plugin camera:
cordova-plugin-camera: 4.1.0
@ionic-native/camera: ^5.26.0 (or) 4.7.0 (tried these versions)

Additional Context

We have migrated our ionic application to capacitor. Before migration, cordova plugin camera shows gallery option on both iPhone and iPad. Once it is migrated to capacitor, it shows gallery option only on iPhone. But it is not showing gallery popover on iPad. There is no difference in code level. On both devices, it hits the same method. But on iPad, it doesn't show the gallery popover.

apache/cordova-plugin-camera#614

Actual Requirement:
We need to select video alone from gallery. For that, we have choose this plugin. It works fine on iPhone devices after migration. But not showing gallery popover on iPad devices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions