Web Audio API
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 you to measure audio delay and glitches.
It is possible to retrieve the immediate playout latency of the context via the AudioContext.outputLatency property; playbackStats, however, provides access to more detailed statistics that update over time, including average, minimum, and maximum latency.
Value
An AudioPlaybackStats object.
Examples
Basic usage
const audioCtx = new AudioContext();
const stats = audioCtx.playbackStats;
// ...
// Log average latency
console.log(stats.averageLatency);
See also the main AudioPlaybackStats reference page for a more in-depth example.
Specifications
Browser compatibility
See also
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
