1.7 KiB
1.7 KiB
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 Reactapi/: backend FastAPI.trae/documents/: tài liệu yêu cầu/kiến trúc
Backend API
GET /api/healthGET /api/configPOST /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/scheduleGET /api/recordings?camera=cam1&date=YYYY-MM-DDGET /videos/<camera>/<file>.fmp4
Chạy dev (máy dev)
1) Chạy backend
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
npm install
npm run dev
Frontend dev server đã được cấu hình proxy /api và /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:9997mediamtx_webrtc_url: ví dụhttp://127.0.0.1:8889recordings_dir: ví dụ/recordingscameras: 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.