You want to add the following to CameraViewModel.swift:
else if let backDualWideCameraDevice = AVCaptureDevice.default(.builtInDualWideCamera, for .video, position: .back) {
logger.log(">>> Using dual wide back camera!")
defaultVideoDevice = backDualWideCameraDevice
}
just before the builtInWideAngleCamera block.
It's not true to say that "dual camera is not supported on iPad Pro" (or else this wouldn't successfully log the message).
The docs state:
The built-in dual camera supports the following features:
Automatic switching from one camera to another when > zoom factor, light level, and focus position allow.
Generating depth data by measuring the disparities between the images captured by the ultrawide and wide-angle cameras.
Delivery of photos from constituent ultrawide and wide-angle devices through a single photo capture request.
Looking more closely at the error, it's actually the else condition of an if block with 2 conditions, only one of which is colorSpace linearGray being unavailable, the other is simply a failure to capture depthData. If you separate out the 2 conditions and log separate errors, you see that there is no problem with the colorSpace, it's coming from the depthData property.
There are a few things you have to do right to ensure you can access depth data, so I suspect it's absence of one of those... still looking for the answer
Post
Replies
Boosts
Views
Activity
Nice work Mike, duplicate question here FWIW but you came to the same conclusion and printed out the format data
Agree this looks like a bug, and interesting to know the depth sensor resolution is ~1/5 that of the camera sensor.
Reproduced your findings on my iPad Pro 11" (3rd Gen) too, only the TrueDepth camera has anything listed for available depth formats. :-(
Is anyone on the iPadOS 15 Beta able to see if it's enabled there? I'm still on 14.6 here.
I suspected it may be due to not setting up the session properly from reading the docs, but if the available formats aren't even listed then that rules that possibility out I suppose.