Skip to content

fix(player): serialize audio worklet output lifecycle operations - #2911

Merged
Danielku15 merged 1 commit into
developfrom
fix/webaudio-start-stop-race
Oct 5, 2026
Merged

Danielku15 merged 1 commit into
developfrom
fix/webaudio-start-stop-race

Conversation

@Danielku15

Copy link
Copy Markdown
Member

Note

AI-authored disclosure (alphatab-ai-authored-v1)

Portions of this content were authored by an AI agent. The agent has read
AGENTS.md and the human submitter accepts responsibility for
compliance with the rules in that document.

Issues

Fixes #2821

Proposed changes

The audio worklet output finishes its audio graph setup asynchronously (worklet module load) while play/pause/destroy are synchronous. Pausing before the setup completed called stop() on a never-started source, and stale setup continuations started the source of a later play, leaving the output stalled.

The audio graph operations of play, pause and destroy are now chained to run in the order of the calls. Each play buffers only the events received until its own worklet is created. Destroy cancels a pending worklet load wait so it is never delayed by a stalled load.

Checklist

  • I consent that this change becomes part of alphaTab under its current or any future open source license
  • This PR is linked to an accepted issue (see above)
  • Changes are implemented
  • New tests were added
  • I have read AGENTS.md if an AI helped draft any part of this PR

AI authorship disclosure

  • No AI agent authored any part of this PR (description, code, tests, or commit messages)
  • An AI agent contributed to this PR. The AI-authored disclosure block
    (alphatab-ai-authored-v1) is present at the top of this body, and I have
    personally reviewed every change and can explain each one

Further details

  • This is a breaking change
  • This change will require update of the documentation/website

The audio worklet output finishes its audio graph setup asynchronously
(worklet module load) while play/pause/destroy are synchronous. Pausing
before the setup completed called stop() on a never-started source, and
stale setup continuations started the source of a later play, leaving
the output stalled.

The audio graph operations of play, pause and destroy are now chained
to run in the order of the calls. Each play buffers only the events
received until its own worklet is created. Destroy cancels a pending
worklet load wait so it is never delayed by a stalled load.

Refs #2821
@Danielku15
Danielku15 merged commit 8c1983c into develop Oct 5, 2026
6 checks passed
@Danielku15
Danielku15 deleted the fix/webaudio-start-stop-race branch October 5, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to execute 'stop' on 'AudioScheduledSourceNode': cannot call stop without calling start first.

1 participant