mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 09:12:19 +00:00
Register keyboard events
This commit is contained in:
parent
e74acf04f7
commit
9625cba5e1
@ -78,4 +78,25 @@ export function initViewerPage(stream, viewersCounterRefreshPeriod, posterUrl) {
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user