Skip to content

Fix: Resume restarting instances that weren't paused - #308

Merged
zbdd merged 1 commit into
zbdd/v5-stop-pausedfrom
zbdd/v5-resume-unpaused
Nov 2, 2026
Merged

zbdd merged 1 commit into
zbdd/v5-stop-pausedfrom
zbdd/v5-resume-unpaused

Conversation

@zbdd

@zbdd zbdd commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Backport of #295. resumeAll(), sound.resume() or paused = false on an instance that was never paused played it again, on WebAudio as a second source stop() couldnt reach (#137).

* Fix: Resume restarting instances that weren't paused

- A new instance's really-paused flag started undefined, so resumeAll(), sound.resume() or paused = false on an instance that was never paused played it again. On WebAudio that built a second source over the first that stop() couldn't reach (#137); on HTML it fired resumed/start and turned the loop off
- Flag now starts false on both backends, and the combined paused state is compared as a boolean, since a window focus with no blur before it sets the context's paused to undefined
- play() stops and disconnects the old source and gain before building new ones
- Stopping a source that never started (play() threw before start()) is caught for InvalidStateError, so stop() and destroy() don't throw after it

* Fix: Name the Sound under test in resume test labels

(cherry picked from commit 5ef247b)
@zbdd
zbdd added this pull request to stack #313 November 2, 2026 08:10
@zbdd
zbdd merged commit bbf015c into v5.x Nov 2, 2026
2 checks passed
@zbdd
zbdd deleted the zbdd/v5-resume-unpaused branch November 2, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant