diff --git a/index.html b/index.html
index 6a10c87..d41194d 100644
--- a/index.html
+++ b/index.html
@@ -1359,6 +1359,12 @@ function onTimeupdate(e) {
function onEnded(e) {
if (e.target !== audio) return;
if (isCrossfading) return;
+ if (pendingNextIndex >= 0) {
+ const idx = pendingNextIndex;
+ pendingNextIndex = -1;
+ playTrack(idx);
+ return;
+ }
if (repeatMode === 'one') {
playTrack(currentIndex);
} else {