1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-22 15:02:19 +00:00

Register keyboard events

This commit is contained in:
Yohann D'ANELLO 2020-11-09 16:24:39 +01:00
parent e74acf04f7
commit 9625cba5e1

View File

@ -78,4 +78,25 @@ export function initViewerPage(stream, viewersCounterRefreshPeriod, posterUrl) {
console.log(error); console.log(error);
} }
}); });
// Register keyboard events
window.addEventListener("keydown", (event) => {
switch (event.key) {
case "f":
// F key put player in fullscreen
if (document.fullscreenElement !== null) {
document.exitFullscreen();
} else {
player.requestFullscreen();
}
break;
case "m":
case " ":
// M and space key mute player
player.setMute(!player.getMute());
event.preventDefault();
player.play();
break;
}
});
} }