Why can I not add a depthData connection to AVCaptureSession?

Asked on 02/26/2025

1 search

To add a depthData connection to an AVCaptureSession, you need to ensure that the device and format you are using support depth data capture. The process involves setting up an AVCaptureDevice and AVCaptureOutput that are compatible with depth data. Here are some general steps you might follow:

  1. Check Device Compatibility: Ensure that the device you are using supports depth data capture. Not all devices or camera configurations support this feature.

  2. Configure the Capture Session: Set up your AVCaptureSession with the appropriate input and output. You need to use an AVCaptureDevice that supports depth data and configure an AVCaptureOutput that can handle it.

  3. Enable Depth Data: Once you have the correct device and format, you can enable depth data capture by configuring the session appropriately.

If you are encountering issues, it might be due to the device or format not supporting depth data, or the session not being configured correctly. You can refer to the Build compelling spatial photo and video experiences session for more details on setting up capture sessions and handling different media types.