Feature: Play remote audio on iPhone via WebAudio + self-hosted Opus WASM

iOS WebKit lacks Media Source Extensions with WebM/Opus, so remote audio
was silent on iPhone Safari/Chrome even though audio frames kept flowing.
Add a Web Audio API fallback path that decodes Opus packets with the
`opus-decoder` WASM library and schedules them onto an AudioContext.

The decoder bundle is now self-hosted — served at /static/opus-decoder.min.js
by both the Go and C++ servers — instead of pulled from a CDN, which was
unreachable from some networks.

Gotcha fixed during bring-up: the unscoped `opus-decoder` build's
`OpusDecoder.decodeFrame` is synchronous and returns {channelData,
samplesDecoded, sampleRate, errors} directly, not a Promise, so it must be
called in try/catch rather than via .then().

Also remove the on-screen diagnostic overlay (audio toast + frame counter)
used while debugging the phone without a console; diagnostics now go to
console.* only.

Co-Authored-By: deepseek-v4-pro
This commit is contained in:
yuanyuanxianganddeepseek-v4-pro committed 2026-10-03 18:23:10 +02:00
1 parent d118558eda
commit f3a05c14b1
10 files changed
+655 -13

No files matched your search

+3
View File
@@ -21,3 +21,6 @@ var xtermCSS []byte
//go:embed assets/static/fit.min.js
var xtermFitJS []byte
//go:embed assets/static/opus-decoder.min.js
var opusDecoderJS []byte