Contents

init(deviceTypes:mediaType:position:)

Creates a discovery session that finds devices that match 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 Builtinwideanglecamera and Builtinmicrophone. The array must contain at least one valid Devicetype Swift.struct value.

  • mediaType:

    The media type to capture, such as Video or Audio. 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 Unspecified to search for devices regardless of position.

Return Value

A new discovery session.

Discussion

After creating a discovery session, query its devices property to examine matching devices and choose one for capture.