Contents

AVCaptureDevice

An object that represents a hardware or virtual capture device like a camera or microphone.

Declaration

class AVCaptureDevice

Mentioned in

Overview

Capture devices provide media data to capture session inputs that you connect to an AVCaptureSession. An individual device can provide one or more streams of media of a particular type.

You don’t create capture device instances directly. Instead, retrieve them using an instance of AVCaptureDevice.DiscoverySession, or by calling the default(_:for:position:) method.

A capture device provides several configuration options. Before attempting to configure device properties, such as its focus mode, exposure mode, and so on, you must first acquire a lock on the device by calling the lockForConfiguration() method. You should also query the device’s capabilities to ensure that the new modes you intend to set are valid for the device. You can then set the properties and release the lock using the unlockForConfiguration() 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 apps sharing the device and isn’t recommended.

Topics

Finding and monitoring devices

Authorizing device access

Identifying a device

Accessing device state

Inspecting device characteristics

Monitoring device rotation

Configuring camera hardware

Configuring Cinematic video

Configuring smart framing

Configuring dynamic aspect ratio

Enabling automatic frame rate

Supporting spatial capture

Supporting Continuity Camera

Supporting system features

Monitoring system pressure

Restricting camera switching

Configuring macOS features

Accessing camera extrinsics

Accessing the focal length

Determining lens stabilization

Configuring lens smudge detection

Synchronizing with external devices

Type Properties

See Also

Capture devices