rtcEngine$onAudioRouteChanged method

FutureOr<void> rtcEngine$onAudioRouteChanged(
  1. dynamic engine,
  2. dynamic device
)
override

@hidden(macOS) @detail callback @author dixing @brief RTC notifies the audio route changes via this callback. @param engine ByteRTCEngine object @param device Current audio playback device. Refer to ByteRTCAudioRoute{@link #ByteRTCAudioRoute} for more information. @note Either of the following actions will lead to audio route switching. See Set the Audio Route.

  • Connecting/Disconnecting an audio device
  • Designating the other audio device by calling setAudioRoute:{@link #ByteRTCEngine#setAudioRoute}.

Implementation

FutureOr<void> rtcEngine$onAudioRouteChanged(
    dynamic engine, dynamic device) async {
  if ($instance == null || $instance is! IRTCEngineEventHandler) {
    return;
  }
  return ($instance as IRTCEngineEventHandler).onAudioRouteChanged?.call(
      t_AudioRoute.ios_to_code($p_i.ByteRTCAudioRoute.values
          .firstWhere((t) => t.$value == device || t.name == device)));
}