A patch release focused on context lifecycle and playback correctness. Audio-thread events such as onended keep firing however many contexts an app creates, closed contexts are released instead of staying in memory, and Ogg Vorbis files decode as quickly on Android as they did in 0.13.
Fixes
Context lifecycle
- Audio-thread events (
onended,onpositionchangedand the rest) kept working only for the first fourAudioContexts of an app's lifetime and were silently dropped after that. Each context now releases its event queue producer when it closes or is destroyed (#1489) - A closed
AudioContextorOfflineAudioContextreleases itsstatechangelistener once theclosedevent is delivered, so the context, its threads and its buffers can be freed. The event payload is now typed as{ state: ContextState }(#1498) - An
AudioContextwhose construction fails throws a JS error fromnew AudioContext()instead of crashing the app in its destructor (#1510)
Playback
new AudioBufferSourceNode(ctx, { loop: true })loops. The option was stored but never applied, so only theloopsetter worked (#1449)- The
durationargument ofAudioBufferSourceNode.start()is counted in buffer time, as the spec requires, including loop iterations. At aplaybackRateof 2 it used to play twice the requested content (#1444) - Connecting a node to an
AudioParamof a source node, such as an LFO intoOscillatorNode.frequencyfor vibrato, no longer aborts Debug builds on an assertion (#1456)
Android
decodeAudioDatatries the bundled miniaudio decoder before the systemMediaCodecone, which brings Ogg Vorbis decoding back from several seconds to near-instant. The decoders are also compiled with-O3in Debug builds (#1467)- Seeking from the playback notification with skip controls enabled no longer makes the seek thumb jump back to the previous position for a moment (#1508)
Web
BaseAudioContextis a real class on web rather than a type-only interface, soinstanceof BaseAudioContextworks andAudioContextandOfflineAudioContextshare one implementation (#1476)