setAudioInputDevice method

Future<void> setAudioInputDevice(
  1. MediaDevice device
)

Set audio input device.

Implementation

Future<void> setAudioInputDevice(MediaDevice device) async {
  if (lkPlatformIs(PlatformType.web) && localParticipant != null) {
    for (var audioTrack in localParticipant!.audioTracks) {
      await audioTrack.track?.setDeviceId(device.deviceId);
    }
    Hardware.instance.selectedAudioInput = device;
  } else {
    await Hardware.instance.selectAudioInput(device);
  }
  engine.roomOptions = engine.roomOptions.copyWith(
    defaultAudioCaptureOptions:
        roomOptions.defaultAudioCaptureOptions.copyWith(
      deviceId: device.deviceId,
    ),
  );
}