Recipes
Mute button
let muted = false;
muteButton.onclick = async () => {
muted = !muted;
await (muted ? client.muteInputAudio() : client.unmuteInputAudio());
};Show a loading state until the avatar appears
spinner.hidden = false;
client.on("video_play_started", () => { spinner.hidden = true; });
await client.streamToVideoElement("avatar");Tidy up when the call ends, whoever ended it
client.on("session_ended", () => {
startButton.disabled = false;
stopButton.disabled = true;
});Join without a microphone (avatar only, or a user who declined it)
await client.streamToVideoElement("avatar", { microphone: false });