Files
healthchat-web/apps
hayyaksi 8e6e5424bb Stop one finished sound from cutting off another (#34576)
Every sound played through a BackgroundAudio shares the one audio context,
which is suspended rather than closed when a sound ends so that it can be
reused. The handler suspended it whenever any source finished, so a sound
that started while an earlier one was still going was cut off part way
through. Suspending is not stopping either: the cut-off buffer stayed
where it was and picked up again the next time anything was played, which
is how a notification for one room ends up sounding in another.

The context is now suspended only once nothing this instance started is
still running, and each source is disconnected as it ends. A looping sound
holds the count up until it is stopped, and stopping it ends it, so the
context is still suspended as soon as everything is quiet.

Tests: the context is suspended when a lone sound ends, and left running
while a second sound outlasts the first.
2026-08-12 13:39:38 +00:00
..