From 276f70ab9a51465685197f0b9762cf7d3723a7f2 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Tue, 14 Apr 2026 19:34:56 -0700 Subject: [PATCH] Fix media player collapsing after track ends or during queue transitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stream 'stopped' backend event was calling clearTrack() in both the WebSocket handler (updateStreamStatusFromData) and the polling handler (updateStreamStatus), which added the .idle class and collapsed the player to zero height. This fired whenever audio ended naturally or when transitioning between queue items (playQueueItem calls stopStream() to reset backend state before loading the next track). The explicit stop button (handleStop) already calls clearTrack() directly, so the 'stopped' event handlers don't need to — and shouldn't. --- webui/static/script.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/webui/static/script.js b/webui/static/script.js index e69b4ac9..a68c6fb5 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -3590,11 +3590,13 @@ async function updateStreamStatus() { break; case 'stopped': - // Handle stopped state + // Handle stopped state — do NOT clear track here; explicit stop (handleStop) + // calls clearTrack() directly. Clearing here collapses the player mid-playback + // when the backend transitions to 'stopped' after audio naturally ends or during + // queue track transitions. console.log('🛑 Stream stopped'); stopStreamStatusPolling(); hideLoadingAnimation(); - clearTrack(); break; } @@ -3661,10 +3663,11 @@ function updateStreamStatusFromData(data) { clearTrack(); break; case 'stopped': + // Do NOT clear track here — explicit stop (handleStop) calls clearTrack() directly. + // Clearing here collapses the player after audio naturally ends or during queue transitions. console.log('🛑 Stream stopped'); stopStreamStatusPolling(); hideLoadingAnimation(); - clearTrack(); break; } }