respect repeat settings when a-b loop reaches point b

This commit is contained in:
Jonathan Sykes
2026-07-04 18:11:21 +08:00
parent 327a67004d
commit b72c079fb4

View File

@@ -1199,8 +1199,20 @@ function updateProgress() {
els.durTime.textContent = fmtTime(dur);
if (dur) els.seek.value = String((cur / dur) * 1000);
updateMiniBar();
// A-B loop: if both points are set and we pass B, jump to A
if (abA !== null && abB !== null && abB > abA && cur >= abB) Player.seek(abA);
// A-B loop: passing B behaves like the track ending. Loop the A-B segment only
// when "loop current" is on; otherwise B is the effective end of the track and
// we advance per the repeat settings (next track, or wrap when "repeat list").
if (abA !== null && abB !== null && abB > abA && cur >= abB) {
if (data.settings.loopOne) {
Player.seek(abA);
} else if (!advanceQueue()) {
// Nothing to advance to (repeat off, last track) — stop at B like a real end.
Player.pause();
Player.seek(abA);
updatePlayBtn();
$('upnext').classList.add('hidden');
}
}
}
// ============================================================================