From 0d989de8dbf53f5e1e9cb0ebe48e67d050ef45a6 Mon Sep 17 00:00:00 2001 From: Carolina <79524656+carochacs@users.noreply.github.com> Date: Mon, 3 Aug 2026 18:38:07 -0600 Subject: [PATCH 1/5] Fix stems takeover pause state handling Reset and manage `_stemsRerouteInProgress` during song teardown and stems takeover so intentional HTML5-to-stems pauses do not get treated as real playback failures. This also adds debug logging around song readiness, shim availability, decode completion, and transport startup to help diagnose takeover races and issue #39. --- src/main.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index cf8935f..0592ae7 100644 --- a/src/main.js +++ b/src/main.js @@ -209,6 +209,10 @@ import { // ── Teardown ── function teardown() { + // Defensive reset: a new song load starting mid-takeover (or after a + // crash before the flag was cleared) must not leave togglePlay() + // permanently ignoring real pause failures. See #39. + window._stemsRerouteInProgress = false; cleanupPointerHandlers(); if (S.pollHandle !== null) { clearInterval(S.pollHandle); @@ -770,6 +774,7 @@ import { // ── Main entry: called after song_info arrives ── async function onSongReady() { + console.log('[stems debug] onSongReady called, gen was:', S.loadGeneration); teardown(); const info = currentSongInfo(); const stems = (info && info.stems) || []; @@ -794,6 +799,7 @@ import { // refuse the takeover and let core's native