AudioContext: playbackStats property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("Web Audio API")}}{{SeeCompatTable}}
The **playbackStats** read-only property of the {{domxref("AudioContext")}} interface returns an {{domxref("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 {{domxref("AudioContext.outputLatency")}} property; playbackStats, however, provides access to more detailed statistics that update over time, including average, minimum, and maximum latency.
Value
An {{domxref("AudioPlaybackStats")}} object.
Examples
Basic usage
const audioCtx = new AudioContext();
const stats = audioCtx.playbackStats;
// ...
// Log average latency
console.log(stats.averageLatency);See also the main {{domxref("AudioPlaybackStats")}} reference page for a more in-depth example.
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- Web Audio API