Camera app now fails, mentioning audio error

I have a camera app. The camera controller is based on Apple's AVCam sample project, which uses AVFoundation. My first release requested the front AVCaptureDeviceTypeBuiltInWideAngleCamera as the preferred device type. This worked fine.

Now I want to leverage the SemanticSegmentationMatteTypes available with the TrueDepth camera, so I changed the preferred device type to AVCaptureDeviceTypeBuiltInTrueDepthCamera. It finds one of those on my iPad. Early in development it was working fine, delivering the image for the semantic matte for skin, hair, and teeth. I pared this down to only the skin image. It still worked fine.

Then later in the day, using the same iPad as the test device, it started failing with:

Code Block
Capture session runtime error: Error Domain=AVFoundationErrorDomain Code=-11819 "Cannot Complete Action" UserInfo={NSLocalizedDescription=Cannot Complete Action, NSLocalizedRecoverySuggestion=Try again later.}

What's this cryptic error supposed to mean? It prevents the camera from working.

I'm also using JPSVolumeButtonHandler to trigger the camera with the volume buttons. After switching to the TrueDepth camera, I also started getting these errors in the log:

Code Block
[avas] AVAudioSessionUtilities.h:106   AudioSessionGetProperty ('rcid') failed with error: '!ini'

I wondered if somehow AVFoundation thought the TrueDepth camera required audio, and it was fighting with the JPSVolumeButtonHandler, so I commented out the JPSVolumeButtonHandler. The AudioSessionGetProperty error goes away, but the other error remains, it repeats every 5 seconds.

Accepted Reply

Ack. Turns out I need to also turn on portraitEffectsMatteDeliveryEnabled, which is stupid. Strange that it works on my iPhone X but not on my 11" iPad Pro.

I had gone through and turned off things I didn't need, not imagining that turning off the portrait image would cause it to fail with such an unhelpful error.

Replies

Ack. Turns out I need to also turn on portraitEffectsMatteDeliveryEnabled, which is stupid. Strange that it works on my iPhone X but not on my 11" iPad Pro.

I had gone through and turned off things I didn't need, not imagining that turning off the portrait image would cause it to fail with such an unhelpful error.