demo · v131

WebAudio playback statistics

AudioContext.getOutputTimestamp() always told you the clock. The new AudioContext.renderCapacity / playback stats surface tells you the audio thread's headroom. Press start to play a tone and watch the metrics tick.

currentTime

-
seconds

output position

-
contextTime

performance ts

-
DOMHighResTimeStamp

load (renderCapacity)

-
% audio thread

the api

const ts = ctx.getOutputTimestamp();
console.log(ts.contextTime, ts.performanceTime);

// AudioRenderCapacity (newer surface)
const rc = ctx.renderCapacity;
rc.onupdate = (e) => console.log(e.load, e.peakLoad);
rc.start({ updateInterval: 0.25 });

see also