setDefaultAudioRoutetoSpeakerphone method

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

Sets the default audio playback route.

This method sets whether the received audio is routed to the earpiece or speakerphone by default before joining a channel. If a user does not call this method, the audio is routed to the earpiece by default. If you need to change the default audio route after joining a channel, call the RtcEngine.setEnableSpeakerphone method. The default audio route for each scenario:

Note

Parameter defaultToSpeaker Sets the default audio route:

  • true: Route the audio to the speaker. If the playback device connects to the earpiece or Bluetooth, the audio cannot be routed to the earpiece.
  • false: (Default) Route the audio to the earpiece. If a headset is plugged in, the audio is routed to the headset.

Implementation

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