enablePushToTalk

View as MarkdownOpen in Claude
1enablePushToTalk(): void

Enable push-to-talk: while setPushToTalkActive has been called with false, the microphone gain is forced to 0; calling setPushToTalkActive with true restores the configured gain. Use this instead of mute/unmute for instant talk/silence transitions because it doesn’t rebuild the track.

This method installs the pipeline but does not attach any keyboard listener — consumers bind the key themselves and call setPushToTalkActive on keydown/keyup.

Returns

void

Examples

Bind to the Space key

1call.enablePushToTalk();
2call.setPushToTalkActive(false); // start silent
3
4document.addEventListener('keydown', (e) => {
5 if (e.code === 'Space' && !e.repeat) call.setPushToTalkActive(true);
6});
7document.addEventListener('keyup', (e) => {
8 if (e.code === 'Space') call.setPushToTalkActive(false);
9});

See