mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 16:12:19 +00:00
On click, mute and demute player
This commit is contained in:
parent
ac5fc7a33b
commit
e1a0897cc4
@ -69,11 +69,6 @@ video {
|
||||
}
|
||||
|
||||
/* Hide chat toggler on small screen */
|
||||
.control-chat {
|
||||
display: none;
|
||||
}
|
||||
@media(min-width:1000px){
|
||||
.control-chat {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
|
@ -74,25 +74,32 @@ startPeerConnection = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// Register keyboard interactions
|
||||
window.onkeydown = function (event) {
|
||||
// Register keyboard events
|
||||
let viewer = document.getElementById("viewer")
|
||||
// Toggle fullscreen mode
|
||||
if (event.key === "f") {
|
||||
if (document.fullscreen)
|
||||
document.exitFullscreen().then()
|
||||
else
|
||||
viewer.requestFullscreen().then()
|
||||
window.onkeydown = (event) => {
|
||||
switch (event.key) {
|
||||
case 'f':
|
||||
// F key put player in fullscreen
|
||||
if (document.fullscreenElement !== null) {
|
||||
document.exitFullscreen()
|
||||
} else {
|
||||
viewer.requestFullscreen()
|
||||
}
|
||||
// (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()
|
||||
break
|
||||
case 'm':
|
||||
case ' ':
|
||||
// M and space key mute player
|
||||
viewer.muted = !viewer.muted
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// On click, mute and demute
|
||||
viewer.addEventListener("play", (event) => {
|
||||
event.preventDefault()
|
||||
viewer.muted = !viewer.muted
|
||||
})
|
||||
viewer.addEventListener("pause", (event) => {
|
||||
event.preventDefault()
|
||||
viewer.muted = !viewer.muted
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user