discoverySessionWithDeviceTypes static method

Future<CaptureDeviceDiscoverySession> discoverySessionWithDeviceTypes({
  1. required List<String> deviceTypes,
  2. String? mediaType,
  3. required int position,
})

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

deviceTypes: A list of device types to search for, such as CaptureDeviceType.builtInMicrophone and CaptureDeviceType.builtInWideAngleCamera. This list must contain at least one valid CaptureDeviceType value.

mediaType: The media type to capture, such as MediaType.audio. Pass null 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). See CaptureDevicePosition. Pass CaptureDevicePosition.unspecified to search for devices regardless of position.

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

Implementation

static Future<CaptureDeviceDiscoverySession> discoverySessionWithDeviceTypes({
  required List<String> deviceTypes,
  String? mediaType,
  required int position,
}) async {
  assert(deviceTypes.isNotEmpty);
  return await _channel.$discoverySessionWithDeviceTypes(
    deviceTypes,
    mediaType,
    position,
  ) as CaptureDeviceDiscoverySession;
}