enumerateDevices method

Future<List<MediaDevice>> enumerateDevices(
  1. {String? type}
)

Implementation

Future<List<MediaDevice>> enumerateDevices({String? type}) async {
  var infos = await rtc.navigator.mediaDevices.enumerateDevices();
  var devices =
      infos.map((e) => MediaDevice(e.deviceId, e.label, e.kind!)).toList();
  if (type != null && type.isNotEmpty) {
    devices = devices.where((d) => d.kind == type).toList();
  }
  return devices;
}