setAudioRoute method
@hidden(macOS)
@detail api
@author yezijian.me
@brief Set the current audio playback route. The default device is set via setDefaultAudioRoute:{@link #ByteRTCEngine#setDefaultAudioRoute}.
When the audio playback route changes, you will receive rtcEngine:onAudioRouteChanged:{@link #ByteRTCEngineDelegate#rtcEngine:onAudioRouteChanged}.
@param audioRoute Audio route. Refer to ByteRTCAudioRoute{@link #ByteRTCAudioRoute}. You can only use the build-in speaker or the default route.
@return
- 0: Success.
- < 0 : Fail. See ByteRTCReturnStatus{@link #ByteRTCReturnStatus} for more details
@note
- You can implement most scenarios by calling setDefaultAudioRoute:{@link #ByteRTCEngine#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 the ByteRTCAudioScenarioCommunication audio scenario. Call setAudioScenario:{@link #ByteRTCEngine#setAudioScenario} to switch between different audio scenarios.
- For the volume type in different audio scenarios, refer to ByteRTCAudioScenarioType{@link #ByteRTCAudioScenarioType}.
Implementation
FutureOr<int> setAudioRoute(ByteRTCAudioRoute audioRoute) async {
return await nativeCall('setAudioRoute:', [audioRoute.$value]);
}