Audio API 1.0.2

v1.​0.​2Patch Release

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, onpositionchanged and the rest) kept working only for the first four AudioContexts 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 AudioContext or OfflineAudioContext releases its statechange listener once the closed event is delivered, so the context, its threads and its buffers can be freed. The event payload is now typed as { state: ContextState } (#1498)
  • An AudioContext whose construction fails throws a JS error from new 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 the loop setter worked (#1449)
  • The duration argument of AudioBufferSourceNode.start() is counted in buffer time, as the spec requires, including loop iterations. At a playbackRate of 2 it used to play twice the requested content (#1444)
  • Connecting a node to an AudioParam of a source node, such as an LFO into OscillatorNode.frequency for vibrato, no longer aborts Debug builds on an assertion (#1456)

Android

  • decodeAudioData tries the bundled miniaudio decoder before the system MediaCodec one, which brings Ogg Vorbis decoding back from several seconds to near-instant. The decoders are also compiled with -O3 in 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

  • BaseAudioContext is a real class on web rather than a type-only interface, so instanceof BaseAudioContext works and AudioContext and OfflineAudioContext share one implementation (#1476)

Full changelog

Release card
Audio API 1.0.2 release card