requestToggleAudio()

(userId: string, shouldMute?: boolean)

Requests toggle of a remote user's microphone. The target user's id is provided as a parameter. As an optional second parameter you can specify a concrete wanted state for the remote user's microphone. In case it is not specified, then the microphone will be toggled - if it is enabled, then it will become muted and vice-versa - if muted, then the remote user will be asked to enable it.

You cannot forcefully unmute a remote user, because that can easily become a privacy concern. You can only request a remote user to unmute and then the remote user will accept or deny the request.

//Toggles the state of the remote user microphone - id as param
sambaFrame.requestToggleAudio('9efc7798-a1a4-44bd-9d8d-532fe0feea9d');

//Mutes the remote user's microphone - id as first param, true means mute
sambaFrame.requestToggleAudio('9efc7798-a1a4-44bd-9d8d-532fe0feea9d', true);

//Ask the remote user to unmute microphone - id as first param, false means unmute
sambaFrame.requestToggleAudio('9efc7798-a1a4-44bd-9d8d-532fe0feea9d', false);

Sample use case: Have a custom participants panel in your integration and want moderators to be able to toggle or set the remote user's microphone state.

This method is a combination of requestMute and requestUnmute functionality.

Last updated