From 7b8152e33a6eea5d5af7e58c64afef5620942e52 Mon Sep 17 00:00:00 2001 From: Jan Svabenik Date: Sun, 22 Mar 2026 15:53:11 +0100 Subject: [PATCH] fix: resume browser audio context for live listen --- web/app.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/app.js b/web/app.js index 76a656a..6e973f1 100644 --- a/web/app.js +++ b/web/app.js @@ -226,6 +226,7 @@ class LiveListenWS { this.audioCtx = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: this.sampleRate }); + this.audioCtx.resume().catch(() => {}); this.nextTime = 0; this.started = false; } @@ -233,6 +234,9 @@ class LiveListenWS { _playChunk(buf) { const ctx = this.audioCtx; if (!ctx) return; + if (ctx.state === 'suspended') { + ctx.resume().catch(() => {}); + } const samples = new Int16Array(buf); const nFrames = Math.floor(samples.length / this.channels);