-
Notifications
You must be signed in to change notification settings - Fork 204
Add a Mute/Unmute Button? #23
Copy link
Copy link
Open
Description
I added the following code (i found online) to add a mute/unmute button and it doesnt work. Any idea why?
In index.html i added:
<button id="mute_btn" onclick="muteBtnClick()">Mute Mic</button>
In script.js i added at the very bottom:
function muteBtnClick() {
var btn = document.getElementById("mute_btn");
if (isMicMuted()) {
muteMic(false);
btn.innerHTML = "Mute Mic";
} else {
muteMic(true);
btn.innerHTML = "Unmute Mic";
}
}
function isMicMuted() {
return !(localStream.getAudioTracks()[0].enabled); }
function muteMic (mute) {
localStream.getAudioTracks()[0].enabled = !mute;
};
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels