fix(web player + stats modal): no auto-resume after user pause; stable stats modal

Player: opening the PWA no longer auto-plays when the user had paused. Pausing via
the media notification while backgrounded routes through togglePlay, which now sets
S._userPaused; _onForeground only auto-resumes an INVOLUNTARY background stop
(_wasPlayingBeforeHide && !_userPaused). playCurrent clears the flag on a new track.
Involuntary-stop/freeze recovery on foreground is preserved.

Stats modal: no more small→big flash when switching period/tab — the body keeps a
stable min-height and retains its current content until the new data arrives (only
the first open shows 'Lade…'); a per-request token drops out-of-order responses.
SW cache -> ns-v71.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Opus 4.8 committed 2026-08-10 18:06:18 +02:00
1 parent 3129333f9a
commit 1d98b273e7
5 files changed
+21 -9

No files matched your search

+3 -2
View File
@@ -396,6 +396,7 @@ export function playQueue(songs, startIdx, opts = {}) {
export function playCurrent() {
if(S.qIdx < 0 || S.qIdx >= S.queue.length) return;
S._userPaused = false; // starting a track is intent to play — clear any stale pause intent
const s = S.queue[S.qIdx];
if (HAS_BRIDGE) {
@@ -661,8 +662,8 @@ export function cancelMusicAutoplay() { _playGen++; S.audio.pause(); }
export function togglePlay() {
if (HAS_BRIDGE) { _nsBridge('togglePlay'); return; }
if(S.audio.src) {
if (S.audio.paused) { S.audio.play(); }
else { S.audio.pause(); _cancelScrobble(); }
if (S.audio.paused) { S._userPaused = false; S.audio.play(); }
else { S._userPaused = true; S.audio.pause(); _cancelScrobble(); }
}
}