Closed LucasThompson closed 3 years ago
In Firefox it seems audio starts processing without an explicit user action, which breaks some assumptions elsewhere in the app:
Interesting, I only tested in Firefox Nightly, that blocks auto-play for Web Audio by default, classic Mozilla developer problem :-).
Thanks a lot for the patch!
In Firefox it seems audio starts processing without an explicit user action, which breaks some assumptions elsewhere in the app:
SharedArrayBuffer
s used for the parameter and audio queues are currently passed to theProcessor
asynchronously over the message port, which means it isn't valid on construction. So, there is a race - if audio starts before these messages are received, the ring buffers are not initialised whenprocess
is calledAudioContext
is already running, clicking "Start" doesn't update the text of the button to "Stop"This PR suspends the
AudioContext
immediately after construction, which is all that is really needed to fix this, but also uses theAudioWorkletNodeOptions
to pass theSharedArrayBuffer
s to theProcessor
on construction.