ionic-team / capacitor-plugins

Official plugins for Capacitor ⚡️
529 stars 592 forks source link

Enable options for PWA Camera changes for the rear cameras #1045

Open lazmeister opened 2 years ago

lazmeister commented 2 years ago

Feature Request

Plugin

@camera

Description

Would be great to give options to which rear camera is available. I'm finding on phones with more than 1 camera on the rear, it defaults to the wide angle lens instead of the main portrait lens that native apps use.

Platform(s)

PWA (in mobile browser iOS and Android)

Preferred Solution

Would be nice to have the Camera.getPhoto function direction: CameraDirection.Rear choose the main rear or default camera if more than 1 lenses.

Alternatives

Would be nice to give the option for the user to switch cameras on camera modal (would this be the right place to ask for PWA?)

Or something like this:

export declare enum CameraDirection {
    Default= "DEFAULT", // Default usually picks rear camera that is portrait (non wide)
    Rear = "REAR",
    Front = "FRONT"
}
lazmeister commented 2 years ago

This plugin has camera switches and ability to roll through more than 2 cameras on the device

https://basst314.github.io/ngx-webcam

StefanNedelchev commented 2 years ago

Are you sure that the Web Device Capture API actually provides the ability to select between multiple rear cameras? That's what the PWA Camera here uses under the hood.

lazmeister commented 2 years ago

I believe it would fall under here: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices I haven't delved into ngx-webcam code but I would think its similar approach