setAudioRoute method
@detail api
@author dixing
@brief Set the current audio playback route. The default device is set via setDefaultAudioRoute{@link #RTCEngine#setDefaultAudioRoute}.
When the audio playback route changes, you will receive onAudioRouteChanged{@link #IRTCEngineEventHandler#onAudioRouteChanged}.
@param audioRoute Audio route. Refer to AudioRoute{@link #AudioRoute}.
For Android device, the valid audio playback devices may vary due to different audio device connection status. See Set the Audio Route.
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details
@note
- You can implement most scenarios by calling setDefaultAudioRoute{@link #RTCEngine#setDefaultAudioRoute} and the default audio route switching strategy of the RTC SDK. For details about the strategy, see Set the Audio Route. You should use this API in a few exceptional scenarios like manually switching audio route with external audio device connected.
- This interface is only supported in communication mode.
- For the volume type in different audio scenarios, refer to AudioScenarioType{@link #AudioScenarioType}.
Implementation
FutureOr<int> setAudioRoute(AudioRoute audioRoute) async {
return await nativeCall('setAudioRoute', [audioRoute.$value]);
}