feat(lotus-audio-inject): one soundboard clip at a time (replace mode)
CI / Build embedded bundle (push) Successful in 35s
CI / Publish to Gitea npm registry (push) Has been skipped

playInjectedClip now stops any in-flight clip (via the existing idempotent
cleanup) before starting a new one, so rapid taps replace rather than
overlap/stack — no track leak. The host also debounces the button.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Lotus CI
2026-07-01 23:21:50 -04:00
co-authored by Claude Fable 5
parent 940d71da92
commit 0aef1c5fe2
+7
View File
@@ -101,6 +101,13 @@ async function playInjectedClip(
return;
}
// Max ONE clip at a time (replace mode): stop any in-flight clip before
// starting a new one, so clips can't overlap or be spammed. Runs
// synchronously before the first await, and each cleanup() is idempotent and
// removes itself from activeClips (so no track leak). The host also debounces
// the button; together they cover the brief fetch window.
for (const abort of [...activeClips]) abort();
const resp = await fetch(url, { credentials: "omit", mode: "cors" });
if (!resp.ok) throw new Error(`fetch ${url} -> ${resp.status}`);
const arrayBuffer = await resp.arrayBuffer();