setDefaultAudioRoutetoSpeakerphone method

  1. @override
Future<void> setDefaultAudioRoutetoSpeakerphone(
  1. bool defaultToSpeaker
)

Sets the default audio route.

If the default audio route of the SDK (see Set the Audio Route) cannot meet your requirements, you can call this method to switch the default audio route. After successfully switching the audio route, the SDK triggers the audioRouteChanged callback to indicate the changes.

Note

  • Call this method before calling joinChannel. If you need to switch the audio route after joining a channel, call setEnableSpeakerphone.
  • If the user uses an external audio playback device such as a Bluetooth or wired headset, this method does not take effect, and the SDK plays audio through the external device. When the user uses multiple external devices, the SDK plays audio through the last connected device.

Parameter defaultToSpeaker Sets the default audio route as follows:

  • true: Set to the speakerphone.
  • false: Set to the earpiece.

Implementation

@override
Future<void> setDefaultAudioRoutetoSpeakerphone(bool defaultToSpeaker) {
  return _invokeMethod('setDefaultAudioRoutetoSpeakerphone', {
    'defaultToSpeaker': defaultToSpeaker,
  });
}