Type Method

discoverySessionWithDeviceTypes:mediaType:position:

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

Declaration

+ (instancetype)discoverySessionWithDeviceTypes:(NSArray<AVCaptureDeviceType> *)deviceTypes mediaType:(AVMediaType)mediaType position:(AVCaptureDevicePosition)position;

Parameters

deviceTypes

A list of device types to search for, such as AVCaptureDeviceTypeBuiltInMicrophone and AVCaptureDeviceTypeBuiltInWideAngleCamera.

This array must contain at least one valid AVCaptureDeviceType value.

mediaType

The media type to capture, such as AVMediaTypeAudio (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 AVCaptureDevicePositionUnspecified 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

AVCaptureDeviceType

Values identifying the capture device’s type.