💠Is there a way to get the zoom thresholds where a multi-cam device switches between physical devices?
Question
Hi, apologies if this has already been asked, but I couldn't find it when searching or in the docs.
Is there a way to get the zoom levels at which a multi-cam device transitions between the physical cameras? For instance, how can we tell where the transition point from the wide angle to the ultra wide angle camera is?
What I'm looking for I guess would be something like:
const ranges = {
ultraWideAngleRange: [0.5, 2],
wideAngleRange: [2, 8],
telephotoRange: [8, 128]
}
function switchToTelephoto() {
camera.zoom = ranges.telephotoRange[0];
}
For context, we're trying to add some zoom buttons, much like those in the stock iOS camera, e.g. to set the zoom to 0.5x, 1x, 2x, 3x etc. I can't really find a way to do this with the current APIs, we can't find the zoom levels that these buttons should jump you to, and we can't find the real optical zoom level of each physical camera device (e.g. on the iPhone 16, the 3x button reads 5x in the stock UI; and it doesn't seem possible to detect that currently).
What I tried
I tried getting the physical cameras by themselves:
const devices = useCameraDevices();
const physicalDevices = devices.filter(({ isMultiCam }) => !isMultiCam);
console.log(
physicalDevices.map(({ name, minZoom, maxZoom, formats }) => ({
name,
minZoom,
maxZoom,
formats: formats.map(({ maxZoom }) => maxZoom)
}))
);
but, they all have their own zoom ranges, starting from 1 --- this doesn't really get us anything that helps figure out the zoom ranges of a multi-cam composed of these individual devices:
[
{ "name": "Back Camera", "minZoom": 1, "maxZoom": 123.75 },
{ "name": "Front Camera", "minZoom": 1, "maxZoom": 128.875 },
{ "name": "Back Telephoto Camera", "minZoom": 1, "maxZoom": 123.75 },
{ "name": "Back Ultra Wide Camera", "minZoom": 1, "maxZoom": 123.75 }
]
Likewise, there seem to be no properties on the CameraDevice object that return information about the optical characteristics of the device from which we could otherwise try to approximate these numbers, unless I'm missing something.
VisionCamera Version
3.9.0
Additional information
- [X] I am using Expo
- [X] I have read the Troubleshooting Guide
- [X] I agree to follow this project's Code of Conduct
- [X] I searched for similar questions in the issues page as well as in the discussions page and found none.
Excellent question! Wondering the same thing.