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
@ -70,10 +70,5 @@ video {
|
|||||||
|
|
||||||
/* Hide chat toggler on small screen */
|
/* Hide chat toggler on small screen */
|
||||||
.control-chat {
|
.control-chat {
|
||||||
display: none;
|
display: inline;
|
||||||
}
|
|
||||||
@media(min-width:1000px){
|
|
||||||
.control-chat {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -74,25 +74,32 @@ startPeerConnection = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register keyboard interactions
|
// Register keyboard events
|
||||||
window.onkeydown = function (event) {
|
let viewer = document.getElementById("viewer")
|
||||||
let viewer = document.getElementById("viewer")
|
window.onkeydown = (event) => {
|
||||||
// Toggle fullscreen mode
|
switch (event.key) {
|
||||||
if (event.key === "f") {
|
case 'f':
|
||||||
if (document.fullscreen)
|
// F key put player in fullscreen
|
||||||
document.exitFullscreen().then()
|
if (document.fullscreenElement !== null) {
|
||||||
else
|
document.exitFullscreen()
|
||||||
viewer.requestFullscreen().then()
|
} else {
|
||||||
}
|
viewer.requestFullscreen()
|
||||||
// (Un)mute the stream
|
}
|
||||||
else if (event.key === "m") {
|
break
|
||||||
viewer.muted = !viewer.muted;
|
case 'm':
|
||||||
}
|
case ' ':
|
||||||
// Pause the stream
|
// M and space key mute player
|
||||||
else if (event.key === " ") {
|
viewer.muted = !viewer.muted
|
||||||
if (viewer.paused)
|
break
|
||||||
viewer.play()
|
|
||||||
else
|
|
||||||
viewer.pause()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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