Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The averageLatency read-only property of the AudioPlaybackStats interface is a number indicating the average latency since the audio context was initialized or since AudioPlaybackStats.resetLatency() was last called.
A double-precision floating point number indicating the average latency, in seconds.
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.