v158 · web audio · offline rendering

Lifecycle, close(), and the indefinite context

Incremental rendering reshapes the OfflineAudioContext lifecycle: startRendering() becomes repeatable, a finite context closes itself when the last frame is delivered, close() exists to stop an open-ended render, and length can describe a context with no end at all. Every experiment below runs the real call on this build and reports the real result — including the errors.

Chrome targets incremental rendering for Chrome 158 behind the OfflineAudioContextIncrementalRendering runtime flag (--enable-blink-features=OfflineAudioContextIncrementalRendering, or chrome://flags/#enable-experimental-web-platform-features). On a pre-158 build the experiments still run — their outcomes are the old contract, which is exactly what makes the difference visible.

Experiment 1 · Does close() exist, and what does it do?

The explainer's feature-detection advice is to check for close(). This runs typeof OfflineAudioContext.prototype.close, and — where it exists — creates a context, renders one chunk, closes it, and tries to render again.

Not run yet.

Experiment 2 · The second startRendering() call

Pre-158, a second call is always an InvalidStateError — one shot is all you get. With incremental rendering, repeat calls are the whole point until the context closes; after that the same error returns. This renders a tiny context to completion, then calls again.

Observed sequence
callresultcontext state after
Not run yet.

Experiment 3 · Constructing an indefinite-length context

The explainer proposes open-ended rendering; the implementer's sample passes length: null, the explainer text says Infinity. This tries null, Infinity, and omitting length entirely, and reports what each really does on this build — no guessing which spelling shipped.

Constructor outcomes on this build
options.lengthoutcome
Not run yet.

Experiment 4 · What oncomplete and statechange report

Chunked delivery raises the question: does complete still fire, and with what? This renders a small context (chunked where supported) with both listeners attached and logs every event in order.

Event log
t (ms)eventdetail
Not run yet.

see also