enumerateDevices method

  1. @override
Future<List<MediaDeviceInfo>> enumerateDevices()
override

Returns a List of MediaDeviceInfo describing the devices.

Implementation

@override
Future<List<MediaDeviceInfo>> enumerateDevices() async {
  final devices = await getSources();

  return devices.map((e) {
    var input = e as html.MediaDeviceInfo;
    return MediaDeviceInfo(
      deviceId:
          input.deviceId ?? 'Generated Device Id :(${devices.indexOf(e)})',
      groupId: input.groupId,
      kind: input.kind,
      label: input.label ?? 'Generated label :(${devices.indexOf(e)})',
    );
  }).toList();
}