Listen for audio events
The Video SDK for Windows fires audio-related callbacks through IZoomVideoSDKDelegate. Implement the callbacks below to react to audio state changes in your session.
For details on setting up a delegate, see callback events.
The onUserAudioStatusChanged callback is different from onUserActiveAudioChanged.
- The SDK calls
onUserAudioStatusChangedwhen the user's audio status changes. - The SDK calls
onUserActiveAudioChangedwhen a given user's active audio changes. For example, if the user is unmuted and is using their device's microphone, the SDK triggers this callback whenever their microphone detects a sound.
Get notified when a user's audio status has changed
onUserAudioStatusChanged fires when a user mutes, unmutes, connects, or disconnects their audio.
void CExampleListener::onUserAudioStatusChanged(IZoomVideoSDKAudioHelper* pAudioHelper, IVideoSDKVector<IZoomVideoSDKUser*>* userList)
{
IZoomVideoSDKUser* pUser;
int count = userList->GetCount();
for (int i = 0; i < count; i++)
{
pUser = userList->GetItem(i);
// Use isMuted to check whether the user's audio is muted.
bool isMuted = pUser->getAudioStatus().isMuted;
}
}
Get notified when a user's active audio changes
onUserActiveAudioChanged fires when an unmuted user's microphone detects sound. Use the isTalking field of the user's audio status to drive a talking indicator in your UI.
void CExampleListener::onUserActiveAudioChanged(IZoomVideoSDKAudioHelper* pAudioHelper, IVideoSDKVector<IZoomVideoSDKUser*>* list)
{
IZoomVideoSDKUser* pUser;
int count = list->GetCount();
for (int i = 0; i < count; i++)
{
pUser = list->GetItem(i);
// Use isTalking to see whether the user is currently talking.
if (pUser->getAudioStatus().isTalking)
{
// The user began talking.
}
}
}
Get notified when mixed audio raw data is received
After you subscribe to raw audio, onMixedAudioRawDataReceived delivers the mixed audio of all users.
void CExampleListener::onMixedAudioRawDataReceived(AudioRawData* data_)
{
// data_ contains the mixed PCM audio for all users.
}
Get notified when one-way audio raw data is received
onOneWayAudioRawDataReceived delivers the raw audio of a single user.
void CExampleListener::onOneWayAudioRawDataReceived(AudioRawData* data_, IZoomVideoSDKUser* pUser)
{
// data_ contains the PCM audio for the given user.
}
Get notified when shared audio raw data is received
onSharedAudioRawDataReceived delivers the raw audio shared along with a screen share.
void CExampleListener::onSharedAudioRawDataReceived(AudioRawData* data_)
{
// data_ contains the shared PCM audio.
}