From 5544379890f3e2a8d72343c0d18de0cfe5564602 Mon Sep 17 00:00:00 2001 From: Agahnim Date: Mon, 23 Mar 2026 13:26:04 +0100 Subject: [PATCH] miniplayer: add pause when going on music page --- static/miniplayer.js | 11 +++++++++++ templates/base.html | 4 ++++ templates/partials/home.html | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/static/miniplayer.js b/static/miniplayer.js index 5240957..43b2a3f 100644 --- a/static/miniplayer.js +++ b/static/miniplayer.js @@ -108,6 +108,17 @@ function initMiniPlayer() { handlePlayPause(); } }); + + + audio.addEventListener("pause", () => { + isPlaying = false; + updatePlayState(); + }); + + audio.addEventListener("play", () => { + isPlaying = true; + updatePlayState(); + }); } initMiniPlayer(); diff --git a/templates/base.html b/templates/base.html index e240bf9..a7159bc 100644 --- a/templates/base.html +++ b/templates/base.html @@ -37,6 +37,10 @@ if (miniplayer) { miniplayer.style.display = isMusicPage ? 'none' : ''; } + if (isMusicPage) { + const audio = document.querySelector('mini-player audio'); + if (audio) audio.pause(); + } } function updateNavState() { diff --git a/templates/partials/home.html b/templates/partials/home.html index 7d2b61c..edc8b2c 100644 --- a/templates/partials/home.html +++ b/templates/partials/home.html @@ -52,7 +52,7 @@ - +