# Streaming App
## API Documentation
This document provides details on the CRUD endpoints available in the Streaming App.
### Base URL
### Endpoints
#### 1. **Create Overlay**
- **Endpoint**: `/api/overlay`
- **Method**: `POST`
- **Request Body**:
```json
{
"userId": "string",
"position": {
"x": "number",
"y": "number"
},
"size": {
"width": "number",
"height": "number"
},
"content": "string"
}
- Response:
- Status:
201 Created
- Body:
- Status:
{
"message": "Overlay created!"
}
- Endpoint:
/api/overlays
- Method:
POST
- Request Body:
{
"userId": "string"
}
- Response:
- Status:
200 OK
- Body:
- Status:
[
{
"_id": "string",
"userId": "string",
"position": {
"x": "number",
"y": "number"
},
"size": {
"width": "number",
"height": "number"
},
"content": "string"
}
]
- Endpoint:
/api/updateOverlay
- Method:
POST
- Request Body:
{
"_id": "string",
"position": {
"x": "number",
"y": "number"
},
"size": {
"width": "number",
"height": "number"
},
"content": "string"
}
- Response:
- Status:
200 OK
- Body:
- Status:
{
"message": "Overlay updated successfully."
}
- Status:
404 Not Found
- Body:
{
"error": "Overlay not found."
}
- Endpoint:
/api/delete
- Method:
DELETE
- Request Body:
{
"overlayId": "string"
}
- Response:
- Status:
200 OK
- Body:
- Status:
{
"message": "Overlay deleted!"
}
- Status:
404 Not Found
- Body:
{
"message": "Overlay not found!"
}
- Ensure that the MongoDB instance is running before using the API.
- The application uses Flask and requires Python 3.x.
-
Clone the Repository
git clone <repository-url> cd <repository-directory>
-
Install Dependencies
pip install -r requirements.txt
-
Create a
.env
File In the root directory of the project, create a file named.env
and add the following environment variables:MONGO_URI=mongodb://127.0.0.1:27017/streamapp HLS_OUTPUT_DIR=<your-hls-output-directory> RTSP_URL=<your-rtsp-url> FFMPEG_PATH=<path-to-ffmpeg> FRONTEND_URL=http://localhost:3000
- Replace
<your-hls-output-directory>
with the directory where HLS files will be stored. - Replace
<your-rtsp-url>
with the RTSP URL you want to stream. - Replace
<path-to-ffmpeg>
with the path to your FFmpeg executable.
- Replace
-
Run the Application
python app.py
- The RTSP URL is specified in the
.env
file under theRTSP_URL
variable. Modify this value to set the desired RTSP stream.
-
Creating Overlays
- Send a
POST
request to/api/overlay
with the overlay details in the request body.
- Send a
-
Retrieving Overlays
- Send a
POST
request to/api/overlays
with theuserId
in the request body to get all overlays for a specific user.
- Send a
-
Updating Overlays
- Send a
POST
request to/api/updateOverlay
with the overlay ID and the updated details.
- Send a
-
Deleting Overlays
- Send a
DELETE
request to/api/delete
with the overlay ID in the request body to remove an overlay.
- Send a
Installing Client
cd client
npm i
npm start