IOS WebCamTexture ultra wide missing resolutions

I have an iPhone 16 with an ultra wide back camera. I know that the ultra wide camera can take wide pictures with aspect ratio 4:3 and with a high resolution (4032 x 3024) - I get that resolution when I use the IOS camera app.

However, in my unity app, when I select the ultra wide camera and log the available resolutions WebCamDevice.availableResolutions, the best 4:3 resolution I get is 640x480.

My question is: How do I take a 4:3 picture with a resolution higher than 640x480.

Here is a full log that I used to debug (logging camera info and availableResolutions):

Device 5:
  Name: Back Ultra Wide Camera
  IsFrontFacing: False
  AutoFocusPointSupported: True
  Kind: UltraWideAngle
  AvailableResolutions count: 7
  Depth Camera Name: 
---
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
<StartCamera>d__13:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Device Name:  πŸ“ Back Ultra Wide Camera: 192x144 (aspect: 1.333)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
<StartCamera>d__13:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Device Name:  πŸ“ Back Ultra Wide Camera: 352x288 (aspect: 1.222)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
<StartCamera>d__13:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Device Name:  πŸ“ Back Ultra Wide Camera: 480x360 (aspect: 1.333)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
<StartCamera>d__13:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Device Name:  πŸ“ Back Ultra Wide Camera: 640x480 (aspect: 1.333)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
<StartCamera>d__13:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Device Name:  πŸ“ Back Ultra Wide Camera: 1280x720 (aspect: 1.778)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
<StartCamera>d__13:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Device Name:  πŸ“ Back Ultra Wide Camera: 1920x1080 (aspect: 1.778)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
<StartCamera>d__13:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Device Name:  πŸ“ Back Ultra Wide Camera: 3840x2160 (aspect: 1.778)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
<StartCamera>d__13:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Thank you in advance for any help or hints.

So in the exported xcode project there should be a file Classes/Unity/CameraCapture.mm
Find the method fillCaptureDeviceResolutions (around line 518, depending on version)
Inside it is a presets array containing values from AVCaptureSession.Preset | Apple Developer Documentation

Try adding some values/custom preset you want there
Specifically AVCaptureSessionPresetPhoto, I have a feeling it might be the 4k 4:3 as that is the full sensor usually?,
the last loop will iterate through presets, and if it is available to be set, it will and report it back.

Do report back if that worked for you, and what kind of resolutions you used, we might consider adding them if it makes sense (then you won’t need to manually edit the xcode project).

Thanks for the prompt response and the useful tips @Evaldas_Unity

Yes, that worked for getting a 4:3 resolution higher than 640x480. However, the best resolution I could get is 1920x1080with AVCaptureSessionPresetPhoto. That’s already so much better, but still not able to get the 4K 4:3.

It would be nice to add the granular resolutions within the WebCamDevice, for now we are using a post-build script to automatically edit the Classes/Unity/CameraCapture.mm file.