Skip to content

Commit

Permalink
Implement push-to-talk. Fixes #223
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkaufman committed Feb 13, 2021
1 parent d4d70b6 commit 3887321
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 17 additions & 0 deletions html/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,23 @@ function mic_on_for_music() {
}
}

let pushToTalkEngaged = false;
window.addEventListener("keydown", (e) => {
if (e.key === " " && e.path && e.path[0] == document.body &&
micState == "onForMusic") {
pushToTalkEngaged = true;
mic_on();
}
});
window.addEventListener("keyup", (e) => {
if (e.key === " " && pushToTalkEngaged) {
pushToTalkEngaged = false;
if (micState == "on") {
mic_on_for_music();
}
}
});

function upateMutes() {
updateButtonMutes();
updateTwilioMute();
Expand Down
3 changes: 2 additions & 1 deletion html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,8 @@ <h3>Something else weird is going on</h3>
<div class=buttonGroup>
mic:
<button disabled id=micOffButton>off</button>
<button disabled id=micOnForMusicButton>on for music</button>
<button disabled id=micOnForMusicButton title="Muted in video call, unmuted during songs.
Holding spacebar will unmute until released.">on for music</button>
<button disabled id=micOnButton>on</button>
</div>

Expand Down

0 comments on commit 3887321

Please sign in to comment.