diff --git a/web/static/css/player.css b/web/static/css/player.css index e79c05d..1d09cad 100644 --- a/web/static/css/player.css +++ b/web/static/css/player.css @@ -2,6 +2,7 @@ video { display: block; flex-grow: 1; + width: 100%; /* Black borders around video */ background-color: #000; diff --git a/web/static/js/viewer.js b/web/static/js/viewer.js index 18ebbfc..9b8f3ea 100644 --- a/web/static/js/viewer.js +++ b/web/static/js/viewer.js @@ -76,7 +76,7 @@ startPeerConnection = () => { // Register keyboard events let viewer = document.getElementById("viewer") -window.onkeydown = (event) => { +window.addEventListener("keydown", (event) => { switch (event.key) { case 'f': // F key put player in fullscreen @@ -90,16 +90,8 @@ window.onkeydown = (event) => { case ' ': // M and space key mute player viewer.muted = !viewer.muted + event.preventDefault() + viewer.play() 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 })