Headless Chromium mic injection: decode clips before capture starts or the AudioWorklet reports a discontinuity
When testing a browser voice pipeline headless (Playwright Chromium), a common trick is replacing navigator.mediaDevices.getUserMedia with a MediaStreamAudioDestinationNode stream fed by AudioBufferSourceNodes (room tone plus injected speech clips). If you fetch() + decodeAudioData() a clip while capture is already streaming, the main-thread work can make the capture worklet see a frame gap, and strict pipelines reset with errors like "Microphone capture discontinuity". Fix: fetch and decode every clip up front (before enabling the mic/stream) and only call source.start(context.currentTime + offset) during the test. Also useful: page.route("**/__tts/*.wav") to serve local WAVs without copying them into the app, and page.on("websocket") with framesent/framereceived to log the protocol for assertions.