iOS cam zoom factors

Viewed 239

I'd like to show zoom factors in my video app in the same way the iOS native app does. Opposed to the options shown in the iOS cam app, a call to AVCaptureDevice.virtualDeviceSwitchOverVideoZoomFactors returns factors starting at 1.0 for "full field of view". It looks like there is a device specific magic factor to map virtualDeviceSwitchOverVideoZoomFactors factors to options in the UI:

device options cam app virtualDeviceSwitchOverVideoZoomFactors magic factor
iPhone X 1, 2 (1), 1.799 1.11
iPhone 11 Pro Max 0.5, 1, 2 (1), 2, 4 0.5
iPhone 12 Pro Max 0.5, 1, 2.5 (1), 2, 5 0.5

Am I doing something wrong or do I need to hard code the magic factor in my app? I'd rather do not... Otherwise I need to run this through a maintenance cycle every time Apple releases some new angle / zoom option.

1 Answers

I had a virtual lab with the AVFoundation team at WWDC yesterday, and besides pointing me to this post, they confirmed that the iPhone X is an outlier. They told me that in all other cases the 0.5 factor is correct.

Related