AudioRouterManager, and it behaves the same as in SRTC. In SMeeting you get and release it through MeetingEngine:
AudioRouterManager type itself still comes from the RTC package: cn.seastart.rtc.media.audioRouter.AudioRouterManager.
1. Get AudioRouterManager
In SMeeting, get it through the current MeetingEngine:
Notes
getAudioRouterManager()returns a nullable type; handle null in your app.- In the current
meetingSDKimplementation, this method passes through to the underlying RTC engine. - We recommend holding it in one place on the meeting screen / call screen, rather than getting and initializing it again on every button tap.
2. Recommended initialization order
Based on themeetingSDK demo, we recommend initializing in the following order after entering the meeting screen:
- Get the manager with
meetingEngine.getAudioRouterManager() - Set the callback listener with
setAudioRouterCalllback(...) - Set the audio mode with
setMode(...) - Set the auto-switch policy with
setAutoChangeAudioRouter(...) - Call
init()to start route monitoring
MeetingActivity.kt:
3. Using setMode
Recommended for meeting / call scenarios:
AudioManager, for example:
AudioManager.MODE_NORMALAudioManager.MODE_RINGTONEAudioManager.MODE_IN_CALLAudioManager.MODE_IN_COMMUNICATION
Notes
- The current project’s
minSdk = 24. - In the current integration, we recommend that your app set the mode explicitly rather than rely on the default.
- If your app has different audio scenarios such as meetings, playback, and voice chat, we recommend calling
setMode(...)again when switching scenarios.
4. setAutoChangeAudioRouter auto-switch policy
4.1 Basic usage
4.2 Full usage
isAutoChangetrue: the route is switched automatically internallyfalse: device changes are only monitored; your app switches manually
isPrioritySpeakertrue: the speaker has higher priority than the earpiecefalse: the earpiece has higher priority than the speaker
isPriorityWiredEarphonetrue: a wired headset has higher priority than a Bluetooth headsetfalse: a Bluetooth headset has higher priority than a wired headset
4.3 Policy used in the current demo
MeetingActivity.kt uses:
- Auto-switching is on
- The speaker takes priority over the earpiece
- A Bluetooth headset takes priority over a wired headset
5. Callbacks
5.1 Available output devices changed
- A Bluetooth headset connected / disconnected
- A wired headset was plugged in / unplugged
- The system’s output device capabilities changed
5.2 Active output device changed
5.3 A route change may cause noise
- A headset was unplugged
- A Bluetooth headset disconnected
- The system automatically switched from the headset to the speaker
- Lowering the volume
- Pausing playback
- Notifying the user
6. Get the available devices and the active device
6.1 Get the currently available output devices
6.2 Get the currently active output device
6.3 Correct the Bluetooth name (optional)
To get a more accurate Bluetooth name, handle Bluetooth permissions according to the OS version; on Android 12 and later you usually need to take care of BLUETOOTH_CONNECT.
7. Switch routes manually
Your app can switch actively when the user taps the UI:selectType is an AudioOutputDeviceType, for example:
Special value: UN_KNOW
- Restoring the default recommended route
- Explicitly asking the SDK to choose a route again after a device is plugged in or unplugged
8. Release resources
We recommend calling this when the meeting screen exits / is destroyed:9. Common device enums
UN_KNOW: unknown / triggers automatic re-routingSPEAKER: speakerEARPIECE: earpieceWIRED_EARPHONE: wired headsetBLUETOOTH_HEADSET: Bluetooth headset
10. Recommended practices
- Integrate through the APIs exposed by
MeetingEngine; don’t depend on the underlyingrtcEnginedirectly in your app. - Initialize when entering the meeting screen and release when leaving it, to avoid repeatedly calling
init()/release()from a single button tap. - Set
setMode(...)again every time you switch your app’s audio scenario. - When showing “the device currently in use,” rely on
activeOutputDeviceChange(...). - When showing “the list of currently selectable devices,” rely on
exitOutputDeviceChange(...)orgetExitAudioOutputDevices(). - We recommend fully verifying switching among Bluetooth / wired headset / speaker / earpiece on real devices.
AudioRouterManageris an Engine-level cached object; callers shouldn’t call itsrelease()directly—always usemeetingEngine.releaseAudioRouterManager().