Manage in-meeting audio settings

After the SDK is initialized and connected, use setting::GetSettingToolkit()->GetSettingAudioToolkit() for device selection or audio settings, meeting::GetAudioToolkit(...) for in-meeting mute controls, and meeting::GetParticipantsToolkit(...) for participant audio state.

auto* settingAudio = setting::GetSettingToolkit()->GetSettingAudioToolkit();
auto* meetingAudio = meeting::GetAudioToolkit(g_meetingInstance);
auto* participants = meeting::GetParticipantsToolkit(g_meetingInstance);

Get a participant's audio state

Use ZMToolSuiteUser to expose audioType (ZMToolSuiteAudioType_None, ZMToolSuiteAudioType_Voip, ZMToolSuiteAudioType_Telephony) and bAudioMuted.

auto* participants = meeting::GetParticipantsToolkit(g_meetingInstance);
ZMToolSuiteUser me = participants->GetMySelf();
ZMToolSuiteAudioType myAudioType = me.audioType;
bool myMuted = me.bAudioMuted;
ZMToolSuiteUser other = participants->GetUserByUserID(12345);
ZMToolSuiteAudioType otherAudioType = other.audioType;

Manage audio speaker

List devices with GetAudioDeviceList(false). ZMToolSuiteDeviceInfo includes device_id, device_name, and isSelected. Switch with SelectAudioDevice(false, ...).

auto* audioSetting = setting::GetSettingToolkit()->GetSettingAudioToolkit();
IToolSuiteVector<ZMToolSuiteDeviceInfo>* speakers = audioSetting->GetAudioDeviceList(false);
for (int i = 0; speakers && i < speakers->GetCount(); ++i) {
    ZMToolSuiteDeviceInfo d = speakers->GetItem(i);
    if (d.isSelected) {
        // current output device
    }
}
bool submitted = audioSetting->SelectAudioDevice(
    false,                 // speaker
    deviceId,              // const zchar_t*
    deviceName,            // const zchar_t*
    [](const BaseResult& result) {
        // handle result.error_code
    }
);

Manage audio microphone

Managing audio microphone follows a similar pattern as managing the audio speaker. List devices with getAudioDeviceList(true), inspect with ZoomToolSuiteDeviceInfo. Switch with selectAudioDevice(_:deviceId:deviceName:completion:), with the first parameter true for microphone.

auto* audioSetting = setting::GetSettingToolkit()->GetSettingAudioToolkit();
IToolSuiteVector<ZMToolSuiteDeviceInfo>* mics = audioSetting->GetAudioDeviceList(true);
bool submitted = audioSetting->SelectAudioDevice(
    true,                  // microphone
    deviceId,
    deviceName,
    [](const BaseResult& result) {
        // handle result.error_code
    }
);

Mute or unmute your microphone

To mute the current user's microphone, useMuteMyAudio. To unmute on the current user's microphone, use UnmuteMyAudio. To toggle the current user's microphone mute or unmute status, use ToggleMyAudioStatus.

auto* meetingAudio = meeting::GetAudioToolkit(g_meetingInstance);
meetingAudio->MuteMyAudio([](const BaseResult& result) {
    // handle result.error_code
});
meetingAudio->UnMuteMyAudio([](const BaseResult& result) {
    // handle result.error_code
});
meetingAudio->ToggleMyAudioStatus([](const BaseResult& result) {
    // handle result.error_code
});

Control whether participants may unmute themselves

Hosts can control whether participants may unmute themselves. To check if participants can unmute themselves, use IsParticipantsUnmuteSelfAllowed. To let all participants mute or unmute themselves, use AllowParticipantsToUnmuteSelf.

auto* participants = meeting::GetParticipantsToolkit(g_meetingInstance);
participants->IsParticipantsUnmuteSelfAllowed([](const BoolValueResult& result) {
    // result.bValue, result.error_code
});
participants->AllowParticipantsToUnmuteSelf(
    true,
    [](const BaseResult& result) {
        // handle result.error_code
    }
);

Mute or unmute everyone

To mute all current participants, use MuteAllAudio. To unmute all current participants, use UnMuteAllAudio.

NOTE Only hosts or co-hosts can mute or unmute all participants.

auto* meetingAudio = meeting::GetAudioToolkit(g_meetingInstance);
meetingAudio->MuteAllAudio([](const BaseResult& result) {
    // handle result.error_code
});
meetingAudio->UnMuteAllAudio([](const BaseResult& result) {
    // handle result.error_code
});

Mute participants on entry

To mute participants as they enter the meeting, use EnableMuteOnEntryFeature. To see if this feature is currently enabled, use IsMuteOnEntryFeatureOn.

auto* meetingAudio = meeting::GetAudioToolkit(g_meetingInstance);
meetingAudio->EnableMuteOnEntryFeature(
    true,   // muteOnEntry
    true,   // allowUnmuteBySelf
    [](const BaseResult& result) {
        // handle result.error_code
    }
);
meetingAudio->IsMuteOnEntryFeatureOn([](const BoolValueResult& result) {
    // result.bValue, result.error_code
});