AudioContext: playbackStats property
The playbackStats read-only property of the AudioContext interface returns an AudioPlaybackStats object providing access to duration, underrun, and latency statistics for the AudioContext. These statistics allow developers to measure audio delay and glitchiness.
It is possible to retrieve the immediate playout latency of the context via the AudioContext.outputLatency property; playbackStats however provides access to more detailed information that updates over time — including average, minimum, and maximum latency, and other information besides.
Value
An AudioPlaybackStats object.
Examples
>Basic usage
js
const audioCtx = new AudioContext();
const stats = audioCtx.playbackStats;
// ...
// Log current average latency
console.log(stats.averageLatency);
See also the main AudioPlaybackStats reference page for a more in-depth example.
Specifications
| Specification |
|---|
| Web Audio API> # dom-audiocontext-playbackstats> |