setAudioOutputDevice method

Future<void> setAudioOutputDevice(
  1. MediaDevice device
)

Set audio output device.

Implementation

Future<void> setAudioOutputDevice(MediaDevice device) async {
  if (lkPlatformIs(PlatformType.web)) {
    participants.forEach((_, participant) {
      for (var audioTrack in participant.audioTracks) {
        audioTrack.track?.setSinkId(device.deviceId);
      }
    });
    Hardware.instance.selectedAudioOutput = device;
  } else {
    await Hardware.instance.selectAudioOutput(device);
  }
  engine.roomOptions = engine.roomOptions.copyWith(
    defaultAudioOutputOptions: roomOptions.defaultAudioOutputOptions.copyWith(
      deviceId: device.deviceId,
    ),
  );
}