Class

AVCaptureDevice.DiscoverySession

A query for finding and monitoring available capture devices.

Declaration

class DiscoverySession : NSObject

Overview

Use this class to find all available capture devices matching a specific device type (such as microphone or wide-angle camera), supported media types for capture (such as audio, video, or both), and position (front- or back-facing).

After creating a device discovery session, you can inspect its devices array to choose a device for capture.

Topics

Creating a Session

init(deviceTypes: [AVCaptureDevice.DeviceType], mediaType: AVMediaType?, position: AVCaptureDevice.Position)

Creates a discovery session for finding devices with the specified criteria.

struct AVCaptureDevice.DeviceType

Values identifying the general type of a capture device, used with the default(_:for:position:) method and the AVCaptureDevice.DiscoverySession class.

Discovering Devices

var devices: [AVCaptureDevice]

An array of currently available devices matching the session’s criteria.

Relationships

Inherits From

Conforms To

See Also

Discovering Devices

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

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

class func devices() -> [AVCaptureDevice]

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

init?(uniqueID: String)

Returns the device with a given ID.

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

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

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

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

struct AVCaptureDevice.DeviceType

Values identifying the general type of a capture device, used with the default(_:for:position:) method and the AVCaptureDevice.DiscoverySession class.

enum AVCaptureDevice.Position

Constants to specify the position of a capture device.

static let AVCaptureDeviceWasConnected: NSNotification.Name

Posted when a new device becomes available.

static let AVCaptureDeviceWasDisconnected: NSNotification.Name

Posted when an existing device becomes unavailable.