Apparence-io / CamerAwesome

📸 Embedding a camera experience within your own app shouldn't be that hard. A flutter plugin to integrate awesome Android / iOS camera experience.
https://ApparenceKit.dev
MIT License
947 stars 234 forks source link

Wide Angle & Zoom Lens Switching? #195

Open jtkeyva opened 1 year ago

jtkeyva commented 1 year ago

Proposal

Include the option to cycle through all available camera/lenses.

iPhone Pro has 3 different lenses / cameras. I recall using a Flutter app/package that allowed you to cycle through all the lenses which included the wide-angle the regular as well as the zoom lens. It was a while back but I think it was just a matter of allowing 4 cameras in the list rather than 2.

Any plans for this?

Thanks

g-apparence commented 1 year ago

Hello, This has just been made by our awesome @istornz You can test it on master branch directly.

istornz commented 1 year ago

It's done on iOS, missing the Android part.

jamesdixon commented 1 year ago

@istornz amazing work!

Is this possible on Android? I believe I saw another thread that maybe questioned whether it was possible or not.

istornz commented 1 year ago

@jamesdixon Thanks, I think it's possible but complicated, any advise @apalala-dev ?

apalala-dev commented 1 year ago

@jamesdixon It should be possible but for some reason I am only getting 2 camera ids (one for front and one for back camera) whatever I do.

Same goes for CameraX extensions (night mode, HDR...). In theory, the code is ready but my code or CameraX API is broken atm 😅

I am trying with devices from Firebase Test Lab since my own is getting old (Xiaomi Mi 9T), but even a Pixel 7 Pro doesn't return more than 2 cameras and can't use CameraX extensions.

We'll let you know if we figure it out!

apalala-dev commented 1 year ago

On Android, there is a concept of "logical camera" and "physical camera". A logical camera can use multiple physical camera.

Most of the time, it seems that there is only one logical camera for each side of the phone and I didn't find a way to directly use the physical camera with CameraX.

However, it is still possible to switch between several cameras with different capabilities by setting a specific zoom to them. On a Pixel 7 Pro for instance, I was able to get the wide angle camera (x0.6) by setting a zoom value between 0.0 and 0.4 (included). I got back to the normal sensor (x1) starting at 0.5 value and even could be able to achieve a x30 when setting the zoom value to 1.0 (PIxel 7 Pro has a telephoto sensor that allows x30 zoom).

jtkeyva commented 1 year ago

Thanks all!