loadMediaDevices method

Future<Map<MediaDeviceType, List<MediaDeviceInfo>>> loadMediaDevices()

Get all the devices which are currently available in the system

Implementation

Future<Map<MediaDeviceType, List<MediaDeviceInfo>>> loadMediaDevices() async {
  final List<MediaDeviceInfo> devices =
      await navigator.mediaDevices.enumerateDevices();
  _updateDeviceList(devices);
  navigator.mediaDevices.ondevicechange = (event) => {
        navigator.mediaDevices.enumerateDevices().then((devices) {
          _updateDeviceList(devices);
        }),
      };

  return mediaDevices;
}