setEnableSpeakerphone method
Enables/Disables the audio playback route to the speakerphone.
This method sets whether the audio is routed to the speakerphone or earpiece. After calling this method, the SDK returns the RtcEngineEventHandler.audioRouteChanged callback to indicate the changes.
Note
- Ensure that you have successfully called the RtcEngine.joinChannel method before calling this method.
- This method is invalid for audience users in the ChannelProfile.LiveBroadcasting profile.
Parameter enabled
Sets whether to route the audio to the speakerphone or earpiece:
true
: Route the audio to the speakerphone.false
: Route the audio to the earpiece. If the headset is plugged in, the audio is routed to the headset.
Implementation
@override
Future<void> setEnableSpeakerphone(bool enabled) {
return _invokeMethod('setEnableSpeakerphone', {'enabled': enabled});
}