From b70fde9b02ef60620f397c8908b74380b3eae820 Mon Sep 17 00:00:00 2001 From: OmikronApex <45161725+OmikronApex@users.noreply.github.com> Date: Thu, 25 Jun 2026 10:05:52 +0200 Subject: [PATCH] fix(player): new song no longer seeks to previous song's stop position (#595) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit audio.currentTime does not reset synchronously when audio.src is cleared — it only resets when audio.load() is called (later, in highway.js). The jump-fix guard (setInterval ~line 8979) held lastAudioTime at the old position and, once the new song started playing from t=0, saw a 30s+ jump and sought the new song to the previous position. If the new song was shorter, song:ended fired immediately, showing the score screen. Reset lastAudioTime = 0 in playSong() so the guard has no stale anchor. Co-authored-by: Claude Sonnet 4.6 --- static/app.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/app.js b/static/app.js index cf64867..8b38566 100644 --- a/static/app.js +++ b/static/app.js @@ -5958,6 +5958,10 @@ async function playSong(filename, arrangement, options) { clearLoop(); _resetSectionPracticeLog(); _hideSectionPracticeBar(); + // Reset so the jump-fix (setInterval, ~line 8979) doesn't mistake the new + // song starting at t=0 for an unexpected seek from the previous song's + // position. audio.currentTime may not reset synchronously when src is cleared. + lastAudioTime = 0; currentFilename = filename; // A fresh load arms autoplay; a pending auto-exit from the previous