BabeView is a multi-source (N-to-1) monitoring hub built in Flutter at JHH Solutions to solve a real systems challenge: continuous baby monitoring with sub-50 ms LAN latency, bidirectional (Full-Duplex) audio, and unified simultaneous playback across repurposed smartphones (Baby Units) and dedicated IP security cameras (RTSP/ONVIF) on a single Parent Unit — operating 100% LAN-First (Zero-Cloud).
- Public Architecture Showcase (12 ADRs, C4 & 27 Clean Code Slices): github.com/evslopes/babeview-architecture-showcase
Zero-Config Pairing & Live Monitoring Flow
Designed to eliminate manual IP or port configuration: any device on the local Wi-Fi can act as a Baby Unit (transmitter) or Parent Unit (multi-camera receiver), discovering peers automatically via mDNS.
Polymorphic Multi-Source Architecture (IMediaSource)
To prevent presentation widgets from coupling to RTCVideoRenderer (WebRTC) or native C/C++ Player handles (media_kit), BabeView enforces Domain-Driven Design (DDD) with zero external dependencies in domain/, converging all heterogeneous streams behind a single IMediaSource contract:
LAN Discovery
mDNS nsd & IP Scan
Signaling & Handshake
WebRTC / RTSP Auth
Native Engines
flutter_webrtc & media_kit
Domain Contract
IMediaSource & Capabilities
Reactive Orchestration
MediaSourceManager + Riverpod 3
Agnostic Rendering
CameraGridView 2x2 & Carousel
| Concrete Implementation | Protocol / Engine | Supported Capabilities | Real-World Role |
|---|---|---|---|
WebRTCPeerMediaSource | flutter_webrtc (UDP/SRTP P2P) | HD Video, Full-Duplex Audio, ICE Reconnection | Repurposed smartphone or tablet as Baby Unit |
RTSPMediaSource | media_kit (C/C++ H.264/H.265 bindings) | Hardware decoding, RTSP Auth, ONVIF support | Dedicated nursery IP security cameras |
LocalCameraMediaSource | camera (Native hardware I/O) | Zoom control, front/rear lens switching | Local framing preview and hardware diagnostics |
Reliability Engineering, Lifecycle & Memory Safety
Decoding up to 4 simultaneous video streams on mobile hardware demands strict lifecycle discipline to avoid memory leaks and thermal throttling:
- Protocol-Agnostic Presentation:
CameraGridView,CameraCarouselView, andMediaSourceRendererconsume reactive state exposed byMediaSourceManagerunder Riverpod 3, never instantiating raw players directly. - Deterministic Teardown (
dispose()): Switching between carousel and2x2grid views deterministically releases native textures, C/C++ decoders, and orphaned peer connections — backed by69internal engineering docs including camera-switch freeze post-mortems. - Wi-Fi Drop Resilience & Android 14+ (
API 34+) Lifecycle:ConnectionServiceleverages an injectableReconnectionClockwith exponential backoff ([2s, 4s, 8s, 16s]) alongside typed Android 14+ForegroundServicedeclarations (camera|microphonefor Baby Units andmediaPlaybackfor Parent Units). - Binary TCP Framing, Constant-Time PIN & Procedural DSP Audio:
4-Byte Big-Endian Length-PrefixedTCP signaling for>90 KBWebRTC SDP offers, optical QR/PIN pairing hardened with bitwise XORconstantTimePinEquals, and a 100% pure-Dart procedural16-bitPCM WAV synthesizer (Paul Kellet Pink Noise modulated by a 60 BPM breathing LFO, Brown Noise, and a zero-click120 mscrossfaded C-Major pentatonic music box).
Inspect authentic production slices (WebRTC P2P, media_kit RTSP, 4-Byte TCP Framing, ONVIF Multicast, Constant-Time PIN, and Procedural WAV DSP) paired with their automated test suites.