When running WebCamDevice.availableResolutions on an iOS device, the back facing camera always returns only 1 resolution.
This resolution has width:0, height: 0 and refreshRate: 0.
In addition, the webcam seems to ignore WebCamTexture.requestedWidth and/or WebCamTexture.requestedHeight properties. It always returns webcam of aspect ratio 4:3. In my case, it always returns a webcam of size width: 1104, height: 828
Please note that:
The front facing camera does work correctly and returns the correct available resolutions.
Using Unity version 2022.3.14f returns the correct available resolutions for both front and back cameras. Updating to Unity 6000.0.26f1 without changing any code results in the issue described above
To reproduce:
Unity Version: 6000.0.26f1
iPhone running iOS 17
Run the following code:
int numCams = WebCamTexture.devices.Length;
Debug.Log("Number of Cameras " + numCams);
for (int i = 0; i < numCams; I++)
{
Resolution[] resolutions = WebCamTexture.devices[i].availableResolutions;
if (resolutions != null)
{
foreach (var res in resolutions)
{
Debug.Log("Resoltions for Camera " + i + $" Width: {res.width}, Height: {res.height}, Refresh Rate: {res.refreshRate}");
}
}
}
I wasn’t able to reproduce your issue on my end, so I’d like to ask some more info to hopefully help me guide in the right direction:
Can you share with me the exact iPhone model you’re using? I’ve tried a few different devices ranging from iOS version 15 to 18 and wasn’t able to reproduce the bug.
Is this the only device that you can reproduce the issue on or does it reproduce on other devices as well? Other iOS versions?
I am using an real device (not a simulator). It is an iPhone XR with iOS 17.4.1. The application is built using Unity Version: 6000.0.26f1
I do not have any other iPhone devices on which to test. However, I did find a thread from another user with a very similar issue. That user was using iOS 18 on iPhone SE 2022 with Unity version 2022.3.50f1. Here is the link to the other thread: WebCamTexture resolution issue on iOS18
Yes, we were finally able to track down a device where we could reproduce the problem.
I’ve created a bugreport and passed it to our dev team to look into, I’ll follow-up when a fix is available.
You should also be able to track the progress with the ticket here (might take a few minutes for the link to start working properly).
Hi again @robertas-unity and thank you so much for your reply!
Glad to hear you were able to reproduce the problem.
I’m quite new to the issue tracker so I wanted to ask, how does the bug tracking work with the votes system? I seem to have a limit of 10 votes. Do they reset someday or are they 10 votes for the lifetime of the account?
Also, do you have an estimated timeframe for when a fix will be available? Does that appear in the bug tracker too?