mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 04:32:19 +00:00
Register keyboard interactions to mute/pause/set fullscreen mode
This commit is contained in:
parent
9fc94cf0de
commit
1a0fcb9c44
@ -73,3 +73,26 @@ startPeerConnection = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Register keyboard interactions
|
||||
window.onkeydown = function (event) {
|
||||
let viewer = document.getElementById("viewer")
|
||||
// Toggle fullscreen mode
|
||||
if (event.key === "f") {
|
||||
if (document.fullscreen)
|
||||
document.exitFullscreen().then()
|
||||
else
|
||||
viewer.requestFullscreen().then()
|
||||
}
|
||||
// (Un)mute the stream
|
||||
else if (event.key === "m") {
|
||||
viewer.muted = !viewer.muted;
|
||||
}
|
||||
// Pause the stream
|
||||
else if (event.key === " ") {
|
||||
if (viewer.paused)
|
||||
viewer.play()
|
||||
else
|
||||
viewer.pause()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user