susResBtn.onclick = () => {
if (audioCtx.state === "running") {
audioCtx.suspend().then(() => {
susResBtn.textContent = "Resume context";
});
} else if (audioCtx.state === "suspended") {
audioCtx.resume().then(() => {
susResBtn.textContent = "Suspend context";
});
}
};AudioContext: suspend() method / notebook
AudioContext: suspend() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.