Listen for audio events
The Video SDK for Android fires audio-related callbacks through ZoomVideoSDKDelegate. Implement the callbacks you need on your listener and the Video SDK for Android will invoke them on the main thread.
onUserAudioStatusChanged and onUserActiveAudioChanged look similar but fire at different times. Use them together:
onUserAudioStatusChanged: fires when a user's audio state changes, such as when they mute, unmute, connect, or disconnect. Use it to drive your mute icons.onUserActiveAudioChanged: fires when the SDK detects sound (or silence) on a user's microphone. Use it to highlight the active speaker or animate a "talking" indicator.
For example, if a user is unmuted and starts speaking, onUserActiveAudioChanged fires repeatedly while they talk. Their onUserAudioStatusChanged only fires once, when they unmuted.
Get notified when a user's audio status has changed
To react when a user mutes, unmutes, connects, or disconnects, implement onUserAudioStatusChanged and read each user's audioStatus.
override fun onUserAudioStatusChanged(audioHelper: ZoomVideoSDKAudioHelper?, userList: MutableList<ZoomVideoSDKUser>) {
userList.forEach {
// Check the current user to see if they are muted
val audioStatus = it.audioStatus
audioStatus.isMuted
}
}
@Override
public void onUserAudioStatusChanged(ZoomVideoSDKAudioHelper audioHelper, List<ZoomVideoSDKUser> userList) {
for (ZoomVideoSDKUser user : userList) {
// Check the current user to see if they are muted
ZoomVideoSDKAudioStatus audioStatus = user.getAudioStatus();
audioStatus.isMuted();
}
}
Get notified when active audio changes
To drive an active-speaker UI, implement onUserActiveAudioChanged and read audioStatus.isTalking on each user.
override fun onUserActiveAudioChanged(audioHelper: ZoomVideoSDKAudioHelper?, list: MutableList<ZoomVideoSDKUser>) {
list.forEach {
// Check if the current user is talking
val audioStatus = it.audioStatus
audioStatus.isTalking
}
}
@Override
public void onUserActiveAudioChanged(ZoomVideoSDKAudioHelper audioHelper, List<ZoomVideoSDKUser> list) {
for (ZoomVideoSDKUser user : list) {
// Check if the current user is talking
ZoomVideoSDKAudioStatus audioStatus = user.getAudioStatus();
audioStatus.isTalking();
}
}
Get notified when mixed audio raw data is received
To receive the combined PCM stream that mixes audio from every user in the session, implement onMixedAudioRawDataReceived.
override fun onMixedAudioRawDataReceived(rawData: ZoomVideoSDKAudioRawData?) {
// See raw data documentation for more information
}
@Override
public void onMixedAudioRawDataReceived(ZoomVideoSDKAudioRawData zoomVideoSDKAudioRawData) {
// See raw data documentation for more information
}
Get notified when one-way audio raw data is received
To receive per-user PCM audio with the originating user attached, implement onOneWayAudioRawDataReceived.
override fun onOneWayAudioRawDataReceived(rawData: ZoomVideoSDKAudioRawData?, user: ZoomVideoSDKUser?) {
// See raw data documentation for more information
}
@Override
public void onOneWayAudioRawDataReceived(ZoomVideoSDKAudioRawData zoomVideoSDKAudioRawData, ZoomVideoSDKUser zoomVideoSDKUser) {
// See raw data documentation for more information
}
Get notified when shared audio raw data is received
To receive PCM audio captured alongside an active screen share, implement onShareAudioRawDataReceived.
override fun onShareAudioRawDataReceived(rawData: ZoomVideoSDKAudioRawData?) {
// See raw data documentation for more information
}
@Override
public void onShareAudioRawDataReceived(ZoomVideoSDKAudioRawData zoomVideoSDKAudioRawData) {
// See raw data documentation for more information
}