MDN self-hosted library · e01.org

AudioPlaybackStats: toJSON() method

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const audioCtx = new AudioContext();
const stats = audioCtx.playbackStats;

// ...

const json = stats.toJSON();
console.log(json); // A plain object
console.log(typeof json); // "object"
console.log(json.underrunEvents); // Same value as stats.underrunEvents
js
console.log(JSON.stringify(stats));