From 55245208b45319b2c2fbcd305bc537fef22b8062 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sun, 18 Oct 2020 19:14:49 +0200 Subject: [PATCH] Fix player width --- web/static/css/player.css | 1 + web/static/js/viewer.js | 14 +++----------- 2 files changed, 4 insertions(+), 11 deletions(-) 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 })