setDefaultAudioRoutetoSpeakerphone method
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:
- In the ChannelProfile.Communication profile:
- For a voice call, the default audio route is the earpiece.
- For a video call, the default audio route is the speaker. If the user disables the video using RtcEngine.disableVideo, or RtcEngine.muteLocalVideoStream and RtcEngine.muteAllRemoteVideoStreams, the default audio route automatically switches back to the earpiece.
- In the ChannelProfile.LiveBroadcasting profile: The default audio route is the speaker. See ChannelProfile.LiveBroadcasting
Note
- This method applies to the ChannelProfile.Communication profile only.
- Call this method before the user joins a channel.
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});
}