diff --git a/index.html b/index.html index 16d4444..9040e5b 100644 --- a/index.html +++ b/index.html @@ -1180,6 +1180,7 @@ state.audio.addEventListener("ended", () => { // the crackle finishing its loop with a track waiting: hand over right here, synchronously if (state.holding && state.pendingJob) { const job = state.pendingJob; state.pendingJob = null; state.holding = false; + if (state.current !== job) { const go = state.onHoldEnd; state.onHoldEnd = null; if (go) go(); state.playing = false; setPlayIcon(); swapNow(); advance(); return; } try { state.audio.loop = !!state.loop; state.audio.src = job.url || (job.url = URL.createObjectURL(job.blob)); const p = state.audio.play(); if (p && p.catch) p.catch(() => {}); job.preplayed = true; } catch {} const go = state.onHoldEnd; state.onHoldEnd = null; if (go) go(); return;