GoogleChromeLabs / GoogleChromeLabs/web-audio-samples
Several AudioWorklet demos have no way to stop playback except reloading the page
- Dominant language
- JavaScript
- Stars
- 753
- Forks
- 207
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
### Description
A number of demos under `src/audio-worklet/` only implement a **START** button. Once clicked, playback begins and the button disables itself there is no Stop control. The only way to stop the audio is to reload the page.
### Affected demos
- `src/audio-worklet/basic/handling-errors/`
- `src/audio-worklet/basic/message-port/`
- `src/audio-worklet/design-pattern/shared-buffer/`
- `src/audio-worklet/design-pattern/wasm-ring-buffer/`
- `src/audio-worklet/design-pattern/wasm/`
### Steps to reproduce
1. Open any of the demos above.
2. Click **START**.
3. Try to stop playback no control is available.
### Expected behavior
A visible **STOP** button should let the user suspend the audio
context and re-enable Start, without reloading the page.
### Proposed fix
Add a `button-stop` element next to `button-start` in each demo's markup, and wire it to `audioContext.suspend()`, re-enabling Start when clicked. Guard worklet-module loading and graph setup with flags so Start doesn't rebuild the audio graph on repeat clicks.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the markup and start-button handlers in the five affected directories under src/audio-worklet/. Run one demo, trace its audioContext and worklet setup, then apply the same stop and repeat-start behavior across the listed demos. Done means each has a visible STOP control that suspends playback, re-enables START, and does not rebuild the graph on repeat clicks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100