mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
Research-driven voice/video polish pass based on Discord/TeamSpeak comparison. Refactor: - Split livekitSession.ts (1,509 lines) into 4 modules: audioPipeline.ts, audioElements.ts, deviceManager.ts + facade in livekitSession.ts - Facade pattern preserves all existing exports (zero breaking changes) AudioWorklet VAD: - Migrated VAD from setTimeout polling to AudioWorklet (vad-worklet.js) - Runs on audio thread, works when app is backgrounded - Graceful fallback to setTimeout if AudioWorklet unavailable Bug fixes: - Token TTL extended from 4h to 24h (eliminates fragile long sessions) - Ghost voice state: retry with exponential backoff (3 attempts, 100-400ms) - Client token refresh adjusted to 23h (1h before expiry) UX improvements: - Speaker indicator: pulsing green glow animation (speak-pulse keyframes) - Permission recovery: "Grant Microphone" button in VoiceWidget for listen-only mode with listenOnly state in voiceStore - Device hot-swap: devicechange listener with 500ms debounce, auto-fallback to default device, toast notification - Camera/screenshare stop: toast feedback on disable - Connection quality: auto-expand stats pane on poor/bad quality (3s debounce) - Bandwidth display: human-readable Mbps in stats pane (formatBitrate) Observability: - Voice session metrics: voice_sessions counter on /api/v1/metrics endpoint Tests: - 55 new unit tests for audioPipeline + audioElements modules - 22 new Go tests for HTTPS proxy (WebSocket upgrade, origin validation, path blocking) - 11 new voice E2E tests (lifecycle, widget, speaker indicators) - Pre-refactor snapshot tests for livekitSession public API Docs: - DESIGN.md: full design system documentation (tokens, typography, colors, spacing, motion, voice-specific tokens) - VOICE-COMPARISON-MATRIX.md: 25-behavior comparison across Discord, TeamSpeak, Guilded - voice-video-polish.md: CEO plan with scope decisions