feat: implement WebCodecs Opus decode for browser listen

- Add broadcastOpusToWeb to PcmBroadcaster interface for raw Opus packets
- Server broadcasts Opus frames with mode byte (1) + user hash + packet data
- Browser detects packet mode: mode=1 for Opus, mode=0 for legacy PCM
- Implement WebCodecs AudioDecoder for Opus decoding in browser
- Keep existing PCM playback as fallback for compatibility
- Show error if WebCodecs unsupported
- Fixes listen feature under Bun where native Opus decode unavailable
This commit is contained in:
MythEclipse
2026-05-13 22:13:03 +07:00
parent 251a176b2b
commit 25dbd8413b
11 changed files with 1308 additions and 958 deletions
+4
View File
@@ -30,6 +30,8 @@
"pino-http": "^11.0.0",
"prism-media": "2.0.0-alpha.0",
"prom-client": "^15.1.3",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"sodium-native": "^4.3.2",
"ws": "^8.20.1",
"zod": "^4.4.3"
@@ -39,6 +41,8 @@
"@types/better-sqlite3": "^7.6.13",
"@types/express": "^5.0.6",
"@types/fluent-ffmpeg": "^2.1.28",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@types/ws": "^8.18.1",
"bun-types": "latest",
"pino-pretty": "^10.3.1",