setAudioRoute method

int setAudioRoute(
  1. TXAudioRoute route
)
override

Setting the Audio Route (for Mobile OS)

A mobile phone has two audio playback devices:

  • The receiver at the top
  • The speaker at the bottom

If the audio route is set to the receiver:

  • The volume is relatively low, and audio can be heard only when the phone is put near the ear.
  • This mode has a high level of privacy and is suitable for answering calls.

If the audio route is set to the speaker:

  • The volume is relatively high, and there is no need to put the phone near the ear.

  • This mode enables the "hands-free" feature.

  • Parameters:

Implementation

int setAudioRoute(TXAudioRoute route) {
  if (_only_support_mobile) {
    return _deviceFFIBindings.set_audio_route(_nativePointer, route.value());
  } else {
    debugPrint("device-manager-api not support");
    return -1;
  }
}