Open orlys-ag opened 1 year ago
The AVCaptureDeviceTypeBuiltInTripleCamera
is especially useful to let the system automatically manage the camera to help focus on large sensor camera devices, such as iPhone 14 Pro 48MP and newer. Related
There is logical cameras in Android also.
Is there an existing issue for this?
Use case
Problem
The current platform-specific iOS implemention gets "all the available cameras" through:
This is missing logical cameras such as
builtInDualCamera
,builtInDualWideCamera
,builtInTripleCamera
. Currently, switching CameraDescription throughsetDescription
has a noticeable delay.Use case
I need access to the logical cameras (builtInDualCamera, builtInTripleCamera, etc.) so that I can take advantage of the platform's automatic hardware camera switch (i.e. going from ultra wide to wide lens when the zoom reaches 1.0).
DeviceType docs: https://developer.apple.com/documentation/avfoundation/avcapturedevice/devicetype
Solution
Since AVCaptureDevice has the following properties:
isVirtualDevice: "A Boolean value that indicates whether the device consists of two or more physical devices." constituentDevices: "An array of physical devices that make up a virtual device."
On the Flutter side, the CameraDescription should take advantage of those properties so that users of the camera package can select hardware cameras, as well as logical cameras, and be able to pick the necessary one(s).
Proposal
This feature can be implemented as part of the
camera
package and is relatively simple to implement. Set thediscoveryDevices
to include the missing built-in logical cameras:File:
camera_avfoundation/ios/Classes/CameraPlugin.m
Function:handleMethodCallAsync
Output - before:
Output - after:
Result:
The newly returned logical camera properly switches hardware cameras when I zoom in/out as expected.