Make muting work

pull/248/head
ElementalAlchemist 3 years ago committed by Mike Lang
parent e6aa395c95
commit 4fb8548aba

@ -80,26 +80,22 @@ async function loadVideoPlayer(playlistURL) {
if (data.fatal) { if (data.fatal) {
switch (data.type) { switch (data.type) {
case Hls.ErrorTypes.NETWORK_ERROR: case Hls.ErrorTypes.NETWORK_ERROR:
console.log("A fatal network error occurred; retrying"); console.log("A fatal network error occurred; retrying", data);
console.log(data);
globalPlayer.startLoad(); globalPlayer.startLoad();
break; break;
case Hls.ErrorTypes.MEDIA_ERROR: case Hls.ErrorTypes.MEDIA_ERROR:
console.log("A fatal media error occurred; retrying"); console.log("A fatal media error occurred; retrying", data);
console.log(data);
globalPlayer.recoverMediaError(); globalPlayer.recoverMediaError();
break; break;
default: default:
console.log("A fatal error occurred; resetting video player"); console.log("A fatal error occurred; resetting video player", data);
console.log(data);
addError( addError(
"Some sort of video player error occurred. Thrimbletrimmer is resetting the video player." "Some sort of video player error occurred. Thrimbletrimmer is resetting the video player."
); );
resetVideoPlayer(); resetVideoPlayer();
} }
} else { } else {
console.log("A non-fatal video player error occurred; HLS.js will retry"); console.log("A non-fatal video player error occurred; HLS.js will retry", data);
console.log(data);
} }
}); });
@ -185,6 +181,10 @@ function setUpVideoControls() {
} }
videoElement.volume = defaultVolume; videoElement.volume = defaultVolume;
volumeLevel.value = videoElement.volume; volumeLevel.value = videoElement.volume;
volumeMuted.addEventListener("click", (_event) => {
videoElement.muted = !videoElement.muted;
});
volumeLevel.addEventListener("click", (event) => { volumeLevel.addEventListener("click", (event) => {
videoElement.volume = event.offsetX / event.target.offsetWidth; videoElement.volume = event.offsetX / event.target.offsetWidth;
videoElement.muted = false; videoElement.muted = false;

Loading…
Cancel
Save