setAudioRouteToSpeaker method

Future<void> setAudioRouteToSpeaker(
  1. bool defaultToSpeaker
)

Whether to use the built-in speaker to play audio.

Available since: 1.1.0 Description: Whether to use the speaker to play audio, when you choose not to use the built-in speaker to play the sound, the SDK will select the audio output device with the highest current priority to play the sound according to the system schedule, and common audio routes are: handsets, headphones, Bluetooth devices, and so on. When to call: After creating the engine createEngine. Restrictions: Only switching between the earpiece and the speaker is supported. If it is a Bluetooth headset or a wired headset, it does not support routing to the speaker through this interface. Related APIs: Get the current audio route getAudioRouteType.

  • defaultToSpeaker Whether to use the built-in speaker to play sound, true: use the built-in speaker to play sound, false: use the highest priority audio output device scheduled by the current system to play sound

Implementation

Future<void> setAudioRouteToSpeaker(bool defaultToSpeaker) async {
  return await ZegoExpressImpl.instance
      .setAudioRouteToSpeaker(defaultToSpeaker);
}