fix(player): new song no longer seeks to previous song's stop position (#595)

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 <noreply@anthropic.com>
This commit is contained in:
OmikronApex
2026-06-25 10:05:52 +02:00
committed by GitHub
co-authored by Claude Sonnet 4.6
parent 4c3ec2ff66
commit b70fde9b02
+4
View File
@@ -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