Files
IPCam_OrangePi_Dashboard/README.md
T
2026-04-26 21:27:00 +07:00

61 lines
1.7 KiB
Markdown

# IPCam Orange Pi Dashboard
Dashboard giám sát camera IP gọn nhẹ chạy trên Orange Pi, dựa trên MediaMTX:
- Live View (WebRTC WHEP) dạng grid, auto reconnect, lazy load
- Playback fMP4 theo camera + ngày (file list + HTML5 video)
- Settings: quản lý camera + lịch ghi hình (scheduler ở backend)
## Cấu trúc thư mục
- `src/`: frontend React
- `api/`: backend FastAPI
- `.trae/documents/`: tài liệu yêu cầu/kiến trúc
## Backend API
- `GET /api/health`
- `GET /api/config`
- `POST /api/cameras` / `DELETE /api/cameras/{name}`
- `GET /api/paths` (proxy trạng thái từ MediaMTX)
- `POST /api/recording` (bật/tắt ghi hình ngay)
- `POST /api/scheduler/enabled` / `POST /api/scheduler/schedule`
- `GET /api/recordings?camera=cam1&date=YYYY-MM-DD`
- `GET /videos/<camera>/<file>.fmp4`
## Chạy dev (máy dev)
### 1) Chạy backend
```bash
python3 -m venv api/.venv
source api/.venv/bin/activate
pip install -r api/requirements.txt
uvicorn api.app.main:app --host 0.0.0.0 --port 8000
```
### 2) Chạy frontend
```bash
npm install
npm run dev
```
Frontend dev server đã được cấu hình proxy `/api``/videos` sang `http://localhost:8000`.
## Cấu hình
Backend tự tạo file cấu hình tại `api/data/config.json` khi chạy lần đầu.
- `mediamtx_api_url`: ví dụ `http://127.0.0.1:9997`
- `mediamtx_webrtc_url`: ví dụ `http://127.0.0.1:8889`
- `recordings_dir`: ví dụ `/recordings`
- `cameras`: danh sách camera (name + rtsp_url)
- `schedule`: lịch ghi hình
Có thể override WebRTC base URL ở frontend bằng biến môi trường `VITE_MEDIAMTX_WEBRTC_URL`.
## Triển khai
Xem hướng dẫn chi tiết trong `INSTALL.md`.