Type Method


Returns the default device used to capture data of a given media type.


class func `default`(for mediaType: AVMediaType) -> AVCaptureDevice?



A media type identifier.

For possible values, see AVFoundation Constants.

Return Value

The default device used to capture data of the type indicated by mediaType.


When you use this method to request a camera (using the video media type), the returned device is always of the builtInWideAngleCamera device type. To request other device types, use the default(_:for:position:) method instead.

See Also

Discovering Devices

init?(uniqueID: String)

Returns the device with a given ID.

class func `default`(AVCaptureDevice.DeviceType, for: AVMediaType?, position: AVCaptureDevice.Position) -> AVCaptureDevice?

Returns the default device for the specified device type, media type, and position.

enum AVCaptureDevice.Position

Constants to specify the position of a capture device.

struct AVCaptureDevice.DeviceType

Values identifying the capture device’s type.

class AVCaptureDevice.DiscoverySession

A query for finding and monitoring available capture devices.

static let AVCaptureDeviceWasConnected: NSNotification.Name

Posted when a new device becomes available.

static let AVCaptureDeviceWasDisconnected: NSNotification.Name

Posted when an existing device becomes unavailable.

class func devices() -> [AVCaptureDevice]

Returns an array of the available capture devices on the system.

class func devices(for: AVMediaType) -> [AVCaptureDevice]

Returns an array of the devices able to capture data of a given media type.