Core features

The Video SDK for iOS lets users speak and hear each other in a session over VoIP using their device's microphone and speaker. Users who can't connect over VoIP can dial in by phone. For more information, see Public Switched Telephone Network (PSTN).

The core controls let you connect to audio, mute and unmute, and disconnect. For host-only controls, see Host audio controls.

Before using audio controls, you must request permission to use the microphone. Add an NSMicrophoneUsageDescription entry to your Info.plist and request permission at runtime. For details, see Requesting authorization to capture and save media.

The ZoomVideoSDKAudioHelper provides the methods used to manage a user's audio. Before changing any audio state, check whether the user is already connected to audio by reading the user's ZoomVideoSDKAudioType.

// Get the user's audioStatus.
if let audioStatus = user.audioStatus() {
    // Get the user's audioType.
    let audioType = audioStatus.audioType
}
// Get the user's audioStatus.
ZoomVideoSDKAudioStatus *audioStatus = [user audioStatus];
// Get the user's audioType.
ZoomVideoSDKAudioType audioType = [audioStatus audioType];

audioType is one of the values defined on ZoomVideoSDKAudioType.

ValueMeaning
ZoomVideoSDKAudioType_NoneThe user is not connected to session audio.
ZoomVideoSDKAudioType_VOIPThe user is connected over VoIP (microphone and speaker).
ZoomVideoSDKAudioType_TelephonyThe user is connected by phone dial-in. See Public Switched Telephone Network (PSTN).

Connect to audio

If the user is not already connected, connect to the audio through the ZoomVideoSDKAudioHelper.

if audioType == .none {
    // User's audio is not connected.
    if let audioHelper = ZoomVideoSDK.shareInstance()?.getAudioHelper() {
        // Connect the user's audio.
        audioHelper.startAudio()
    }
} else {
    // User is already connected to audio.
}
if (audioType == ZoomVideoSDKAudioType_None) {
    // User's audio is not connected.
    ZoomVideoSDKAudioHelper *audioHelper = [[ZoomVideoSDK shareInstance] getAudioHelper];
    if (audioHelper) {
        // Connect the user's audio.
        [audioHelper startAudio];
    }
} else {
    // User is already connected to audio.
}

Mute and unmute a user

Once connected, you can mute a user's audio by calling muteAudio with the associated ZoomVideoSDKUser.

if let audioHelper = ZoomVideoSDK.shareInstance()?.getAudioHelper() {
    audioHelper.muteAudio(user)
}
ZoomVideoSDKAudioHelper *audioHelper = [[ZoomVideoSDK shareInstance] getAudioHelper];
if (audioHelper) {
    [audioHelper muteAudio:user];
}

Unmute a user's audio in the same way using unmuteAudio.

if let audioHelper = ZoomVideoSDK.shareInstance()?.getAudioHelper() {
    audioHelper.unmuteAudio(user)
}
ZoomVideoSDKAudioHelper *audioHelper = [[ZoomVideoSDK shareInstance] getAudioHelper];
if (audioHelper) {
    [audioHelper unmuteAudio:user];
}

When the local user is the session host, muting and unmuting behave differently for remote users. For more information, see Host audio controls.

Disconnect from audio

To disconnect completely from audio, use stopAudio. Use this only when the user explicitly disconnects. To silence the user temporarily, use muteAudio instead.

if let audioHelper = ZoomVideoSDK.shareInstance()?.getAudioHelper() {
    audioHelper.stopAudio()
}
ZoomVideoSDKAudioHelper *audioHelper = [[ZoomVideoSDK shareInstance] getAudioHelper];
if (audioHelper) {
    [audioHelper stopAudio];
}