diff --git a/stacks/gateway-chat/conf/index.html b/stacks/gateway-chat/conf/index.html index 2a1b032..c29dbd3 100644 --- a/stacks/gateway-chat/conf/index.html +++ b/stacks/gateway-chat/conf/index.html @@ -147,6 +147,12 @@ function showErr(text){ const m = addMsg('error','err'); m.body.className = 'err // --- mOrpheus TTS: streaming-decode auto-voice of quoted text (Web Audio, low TTFA) --- let audioCtx = null; // shared AudioContext let ttsGen = 0; // generation counter — a newer reply's stream supersedes older ones +function primeAudio(){ // browsers suspend the AudioContext until a user gesture; resume on ANY + if (!audioCtx) audioCtx = new (window.AudioContext || window.webkitAudioContext)(); + if (audioCtx.state === 'suspended') audioCtx.resume(); // interaction so async playback isn't silent +} +document.addEventListener('click', primeAudio, true); +document.addEventListener('keydown', primeAudio, true); function extractQuotes(text){ const re = /“([^”]+)”|"([^"]+)"/g; // typographic "…" or straight "…" const out = []; let m; diff --git a/tools/gateway-chat.html b/tools/gateway-chat.html index 2a1b032..c29dbd3 100644 --- a/tools/gateway-chat.html +++ b/tools/gateway-chat.html @@ -147,6 +147,12 @@ function showErr(text){ const m = addMsg('error','err'); m.body.className = 'err // --- mOrpheus TTS: streaming-decode auto-voice of quoted text (Web Audio, low TTFA) --- let audioCtx = null; // shared AudioContext let ttsGen = 0; // generation counter — a newer reply's stream supersedes older ones +function primeAudio(){ // browsers suspend the AudioContext until a user gesture; resume on ANY + if (!audioCtx) audioCtx = new (window.AudioContext || window.webkitAudioContext)(); + if (audioCtx.state === 'suspended') audioCtx.resume(); // interaction so async playback isn't silent +} +document.addEventListener('click', primeAudio, true); +document.addEventListener('keydown', primeAudio, true); function extractQuotes(text){ const re = /“([^”]+)”|"([^"]+)"/g; // typographic "…" or straight "…" const out = []; let m;