Advanced features

Beyond the core audio controls, the Video SDK for iOS offers several advanced audio features.

Monitor mic and speaker volume

The SDK reports the local microphone and speaker volume levels through the onMicSpeakerVolumeChanged callback. Use this to drive a volume meter in your UI or to detect when the mic gain has been pushed unusually low.

func onMicSpeakerVolumeChanged(_ micVolume: UInt32, speakerVolume: UInt32) {
    updateMicMeter(micVolume)
    updateSpeakerMeter(speakerVolume)
}
- (void)onMicSpeakerVolumeChanged:(unsigned int)micVolume speakerVolume:(unsigned int)speakerVolume {
    [self updateMicMeter:micVolume];
    [self updateSpeakerMeter:speakerVolume];
}

Adjust a user's local playback volume

You can control how loud each user sounds on the local device using setUserPlaybackVolume on the ZoomVideoSDKUser object. This only changes what the current user hears. It does not change the volume for any other participant in the session. The volume is a float between 0 and 10; setting it to 0 silences that user on your device only.

The isSharingAudio argument selects whether you are adjusting microphone audio (false) or shared audio (true, used when the user is sharing a screen with audio). Use canSetUserPlaybackVolume to check whether the SDK currently permits a volume change for that audio source. For example, the SDK returns false for a user who is not connected to audio.

// Lower a remote user's microphone audio on this device only.
if remoteUser.canSetUserPlaybackVolume(false) {
    remoteUser.setUserPlaybackVolume(5.0, isSharingAudio: false)
}
// Read the current local playback volume.
var currentVolume: Float = 0
remoteUser.getUserPlaybackVolume(&currentVolume, isSharingAudio: false)
// Lower a remote user's microphone audio on this device only.
if ([remoteUser canSetUserPlaybackVolume:NO]) {
    [remoteUser setUserPlaybackVolume:5.0 isSharingAudio:NO];
}
// Read the current local playback volume.
float currentVolume = 0;
[remoteUser getUserPlaybackVolume:&currentVolume isSharingAudio:NO];

Subscribe to raw audio data

For server-side processing, transcription, or custom audio pipelines, the SDK can deliver raw PCM audio. Call subscribe on the ZoomVideoSDKAudioHelper to begin receiving raw audio, and unSubscribe to stop. The mixed, per-user, and shared raw streams arrive through the onMixedAudioRawDataReceived, onOneWayAudioRawDataReceived, and onSharedAudioRawDataReceived callbacks.

ZoomVideoSDK.shareInstance()?.getAudioHelper()?.subscribe()
[[[ZoomVideoSDK shareInstance] getAudioHelper] subscribe];

For the full raw-data integration pattern (buffer format, sample rate, and processing examples), see Receive raw data.