The currently active media data format of the capture device.
- iOS 7.0+
- macOS 10.7+
- Mac Catalyst 13.0+Beta
You use this property to get or set the currently active device format.
In iOS, you should generally set the session preset on an
AVCapture object to configure image or video capture and use the shared
AVAudio object to configure audio capture. When using a session preset, the session automatically controls the capture device’s active format. However, some specialized capture options (such as high frame rate) are not available in session presets. For these options, you can set the capture device’s active format instead. Doing so changes the associated capture session’s preset to
Before changing the value of this property, you must call
lock to acquire exclusive access to the device’s configuration properties. Otherwise, setting the value of this property raises an exception. When you are done configuring the device, call
unlock to release the lock and allow other devices to configure the settings. You must also call
lock before calling the
start, or the session's preset will override the selected active format on the capture device.
You can observe changes to the value of this property using Key-value observing.