diff --git a/html/poketube.ejs b/html/poketube.ejs index 9a7a352f..a143ae59 100644 --- a/html/poketube.ejs +++ b/html/poketube.ejs @@ -2189,15 +2189,21 @@ const drawPause = () => { } const init = () => { - // fixes a issue where firefox/chromium fails to load the ambinet mode and doesnt load it. - please dont remove this line lmao - video.pause();video.play(); + // Fixes an issue where Firefox/Chromium fails to load ambient mode and doesn't load it. + video.pause(); video.play(); + // DO NOT REMOVE + + // Check if ambient mode should load + if (numWorkers < 2 || window.matchMedia("(prefers-reduced-motion: reduce)").matches) { + return; + } - // DO NOT REMOVE AMvideo.addEventListener("play", drawStart, false) AMvideo.addEventListener("pause", drawPause, false) AMvideo.addEventListener("ended", drawPause, false) } + const cleanup = () => { AMvideo.removeEventListener("play", drawStart) AMvideo.removeEventListener("pause", drawPause) @@ -2261,7 +2267,7 @@ window.addEventListener("unload", cleanup) - +