Initializer

init(deviceTypes:mediaType:position:)

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

Declaration

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

Parameters

deviceTypes

A list of device types to search for, such as builtInMicrophone and builtInWideAngleCamera.

This array must contain at least one valid AVCaptureDevice.DeviceType value.

mediaType

The media type to capture, such as audio (see Media Types).

Pass nil to search for devices regardless of supported media types.

position

The position of capture device to search for, relative to system hardware (front- or back-facing).

Pass AVCaptureDevice.Position.unspecified to search for devices regardless of position.

Return Value

A new discovery session.

Discussion

After creating a device discovery session, read its devices array to examine matching devices and choose one for capture.

See Also

Creating a Session

struct AVCaptureDevice.DeviceType

Values identifying the capture device’s type.