diff --git a/static/audioplayer.js b/static/audioplayer.js index e1193a4..491aefc 100644 --- a/static/audioplayer.js +++ b/static/audioplayer.js @@ -207,7 +207,16 @@ class SimpleAudioPlayer { const requestId = reqId || (crypto.randomUUID ? crypto.randomUUID() : (Date.now().toString(36) + Math.random().toString(36).slice(2))); const urlWithReq = `/media/${relUrl}${relUrl.includes('?') ? '&' : '?'}req=${encodeURIComponent(requestId)}`; + // Reset any residual state from the previous track before we fetch the new one this.audio.pause(); + this.audio.currentTime = 0; + this.timeline.value = 0; + this.timeline.style.backgroundSize = '0% 100%'; + this.timeInfo.textContent = '00:00 / --:--'; + if ('mediaSession' in navigator) { + navigator.mediaSession.playbackState = 'paused'; + } + this.container.style.display = 'block'; this.nowInfo.textContent = 'Loading…';