Repository navigation
Improvements & UI Polish
• Camera Capacity Indicator on Home Screen: The Monitored Cameras section header now shows how many slots you're using out of the 8-camera limit (e.g., MONITORED CAMERAS (2/8)).
• Clearer Requirements in Documentation: Updated all READMEs with system, browser, permission, and network requirements for the Browser-Based Web Viewer.
Connection & Reliability Fixes
• No More Refresh Needed to Reconnect in Web Viewer:
• Fixed a bug where leaving a browser tab open while the phone slept caused every reconnect attempt to fail immediately until you refreshed the page.
• Fixed connection hangs when returning from backgrounded/switched tabs, tapping Back mid-connection, or switching networks.
• Added automatic recovery if video playback is blocked by browser unmuted-autoplay rules or if an ICE connection stalls right after answering.
• More Reliable Camera Wake-Up: When connecting to a sleeping Camera phone, retried connection requests no longer interrupt the first handshake in progress.
──────
For Developers
Centralized Configuration (9b9eaa5)
• Added single source of truth cammonitor.config.json + optional gitignored cammonitor.local.json (recursive object deep-merge; arrays/primitives replace) documented in CONFIG.md and WEB_VIEWER_DEPLOY.md.
• Covers Tier 1 (project GitHub owner/repo & webViewerBaseUrl, signaling brokers/ports/keepalive/topicPrefix, webrtc.iceServers with optional TURN username/credential) and Tier 2 (webrtc.video, limits,
camera standby/OLED/night lux hysteresis/battery thresholds, updates, logging).
• Android codegen: Added GenerateAppConfigTask in app/build.gradle.kts emitting compile-time com.a0soft.gphone.camonitor.config.AppConfig into variant sources, wired across 13 Android classes,
and removed duplicate non-translatable GitHub URLs from all 4 strings.xml files.
• Static Web sync: Added zero-dep scripts/sync-web-config.mjs generating docs/viewer/src/config.js and updating CSP connect-src in docs/viewer/index.html (--check fails on drift).
Android App Changes (cac95cb, 995af6d, 78390be)
• Home Capacity Header (cac95cb): app/src/main/java/com/a0soft/gphone/camonitor/ui/home/HomeScreen.kt now formats home_section_monitored_cameras with SecurityRepository.MAX_PAIRED_CAMERAS (%1$d/%2$d)
across all 4 strings.xml locales.
• PA Offer Deduplication (995af6d): Added OfferDeduplicationTracker in app/src/main/java/com/a0soft/gphone/camonitor/service/CameraMonitorService.kt — ignores duplicate in-flight Offers while Answer #1 is
being built and re-sends cached Answer + local ICE candidates once ready (preventing PC #1 teardown split-brain).
• Stale Observer Guard (995af6d): Added per-peer peerConnectionGenerations in app/src/main/java/com/a0soft/gphone/camonitor/data/webrtc/WebRtcManager.kt so async callbacks from a disposed PeerConnection
cannot overwrite a replacement connection's state or activeViewersCount.
Web Viewer Resilience Fixes (995af6d, 8d759f6)
• MQTT Worker Timer Sleep-Drift Fix (8d759f6): Set timerVariant: "native" in docs/viewer/src/signaling.js to bypass mqtt@5.16.1's bundled worker-timers, whose window.performance.timeOrigin + performance.
now() lags Date.now() after mobile sleep/Doze and triggered immediate false Keepalive timeout disconnects on CONNACK.
• MQTT Promise & Socket Lifecycle (995af6d): Fixed permanent connectPromise deadlock when stopListening() runs mid-connect (cancelPendingConnect + stale-gen finish(false)), added isClientHealthy()
WebSocket readyState checks, added PUBLISH_TIMEOUT_MS (5s) QoS-1 timeout with auto forceReconnect() + one-shot retry, and wired handlePageHidden / handlePageVisible / pageshow (10s hidden threshold) in
docs/viewer/src/signaling.js & docs/viewer/src/app.js.
• WebRTC Watchdog, LNA & Autoplay (995af6d): Armed the 15s countdown before Offer publish, extended Offer retry to 8s on CAMERA_WAKING, handled duplicate/split-brain ANSWERs, added 12s post-ANSWER
ICE_ESTABLISH_WATCHDOG_MS + oniceconnectionstatechange recovery, extended Chrome LNA IP filtering to CGNAT (100.64.0.0/10) and unspecified (0.0.0.0, ::), and added muted autoplay fallback +
viewer_signaling_failed_desc (all 4 locales) in docs/viewer/src/webrtc.js, docs/viewer/src/app.js, and docs/viewer/src/i18n.js.
• Service Worker (sw.js): Switched HTML/CSS/src/*.js to network-first (cache fallback) to avoid HTML/JS skew across deploys, bumped through v4 → v5 → v6 (docs/viewer/sw.js).
Tests & Verification
• Added Tests: app/src/test/java/com/a0soft/gphone/camonitor/config/AppConfigParityTest.kt, app/src/test/java/com/a0soft/gphone/camonitor/service/OfferDeduplicationTest.kt, docs/viewer/test/config.test.js,
plus new cases in docs/viewer/test/signaling.test.js and docs/viewer/test/webrtc.test.js.