Live Video Streaming (RTSP)
Relevant source files
The following files were used as context for generating this wiki page:Live video streaming is a core feature of the HomeSecurity project, providing users with the ability to visually monitor their property in real-time. This functionality is delivered through the companion Android mobile application, which integrates with a dedicated IP camera using the Real Time Streaming Protocol (RTSP). The primary purpose of the video stream is to allow users to visually verify alerts triggered by the ESP32 sensor system, offering a crucial layer of confirmation and situational awareness.
The video streaming capability is independent of the ESP32's core sensor processing tasks. The ESP32's role is to detect potential intrusions and send push notifications; the mobile application then provides the interface for the user to access the live video feed from the IP camera.
Sources: HomeSecurity/README.md
System Architecture
In the project's three-tier architecture, the live video streaming components reside entirely within the Client Tier. The ESP32 (Edge Tier) and Firebase (Cloud Tier) are responsible for alert generation and notification delivery, but they do not process or route the video stream itself. The Android application directly communicates with the IP camera over the local network to display the RTSP stream.
This diagram illustrates the position of the IP Camera within the overall system architecture.
Sources: HomeSecurity/README.md
Components and Technology
The implementation of live video streaming relies on specific hardware and software components working together.
Hardware Component
An external IP camera is used to capture and stream video. The project specifies a particular model for this purpose.
| Component | Model | Purpose |
|---|---|---|
| IP Camera | TP-Link Tapo C200 | Live video streaming via RTSP |
Sources: HomeSecurity/README.md
Protocol
The system uses the Real Time Streaming Protocol (RTSP) to manage and transmit the video feed from the camera to the mobile application. RTSP is a standard network control protocol designed for use in entertainment and communications systems to control streaming media servers.
Sources: HomeSecurity/README.md
Mobile Application Integration
The companion Android application is the client that renders the video stream for the user. It uses a specific library to handle the RTSP connection and video decoding.
| Technology | Purpose |
|---|---|
| Kotlin | Primary programming language for the app |
| Jetpack Compose | Declarative UI framework for building the app's interface |
| LibVLC | The core library used for handling the RTSP video stream |
| MVVM Architecture | Architectural pattern for separating UI from business logic |
The live video feed is displayed on the application's Home Screen, providing immediate visual access upon opening the app.
Sources: HomeSecurity/README.md
Operational Flow
The video streaming feature is most effective when used in response to an alert from the sensor system. The flow begins with the ESP32 detecting an event and culminates in the user visually verifying the situation via the live stream.
This sequence diagram shows the end-to-end flow from sensor detection to video verification.
Future Development
The current implementation relies on the mobile app and the IP camera being on the same local network, or requires port forwarding for remote access. A planned enhancement is to improve the security and accessibility of the video stream.
| Feature | Description |
|---|---|
| VPN/WebRTC | Implement a secure video streaming solution that does not require port forwarding, using technologies like VPN or WebRTC. |
Sources: HomeSecurity/README.md
Summary
The RTSP-based live video streaming is a critical user-facing feature of the HomeSecurity system. It acts as the visual verification counterpart to the ESP32's sensor-based alert system. By integrating a TP-Link Tapo C200 camera and leveraging the LibVLC library within a Kotlin-based Android app, the project provides users with a direct and immediate view of their property, significantly enhancing the overall effectiveness and reliability of the security solution.