A device that provides input (such as audio or video) for capture sessions and offers controls for hardware-specific capture features.
- iOS 4.0+
- macOS 10.7+
- UIKit for Mac 13.0+Beta
AVCapture object represents a physical capture device and the properties associated with that device. You use a capture device to configure the properties of the underlying hardware. A capture device also provides input data (such as audio or video) to an
You use the methods of the
AVCapture class to enumerate the available devices, query their capabilities, and be informed about when devices come and go. Before you attempt to set properties of a capture device (its focus mode, exposure mode, and so on), you must first acquire a lock on the device using the
lock method. You should also query the device’s capabilities to ensure that the new modes you intend to set are valid for that device. You can then set the properties and release the lock using the
unlock method. You may hold the lock if you want all settable device properties to remain unchanged. However, holding the device lock unnecessarily may degrade capture quality in other applications sharing the device and is not recommended.
Most common configurations of capture settings are available through the
AVCapture object and its available presets. However, on iOS devices, some specialized options (such as high frame rate) require directly setting a capture format on an
AVCapture instance. The following code example illustrates how to select an iOS device’s highest possible frame rate: