toggleAudio()

toggleAudio(newState?: boolean)

Toggles user's microphone state.

If the microphone is currently enabled, then it will be disabled. And vice-versa -> if the microphone is currently disabled, then it will be enabled. There is also an optional param to set a concrete target microphone state, but you may use disableAudio() and enableAudio() to achieve similar functionality.

//This will toggle the microphone state
sambaFrame.toggleAudio();

//This will enable the microphone, equivalent to sambaFrame.enableAudio();
sambaFrame.toggleAudio(true); 

//This will disable the microphone, equivalent to sambaFrame.disableAudio();
sambaFrame.toggleAudio(false);

Sample use case: Have a custom toolbar in your integration and want user to control microphone from it.

Last updated