setDefaultAudioRoute method

Future<int?> setDefaultAudioRoute(
  1. AudioRoute route
)

@detail api @author dixing @brief Set the speaker or earpiece as the default audio playback device. @param route Audio playback device. Refer to AudioRoute{@link #AudioRoute}. You can only use earpiece and speakerphone. @return - 0: Success. - < 0: failure. It fails when the device designated is neither a speaker nor an earpiece. @note For the default audio route switching strategy of the RTC SDK, see Set the Audio Route.

Implementation

Future<int?> setDefaultAudioRoute(AudioRoute route) async {
  $a() => ($instance as $p_a.RTCEngine)
      .setDefaultAudioRoute(t_AudioRoute.code_to_android(route));
  $i() => ($instance as $p_i.ByteRTCEngine)
      .setDefaultAudioRoute(t_AudioRoute.code_to_ios(route));

  if (Platform.isAndroid) {
    return $a();
  } else if (Platform.isIOS) {
    return $i();
  } else {
    throw UnsupportedError(
        'Not Support Platform ${Platform.operatingSystem}');
  }
}