A React application for viewing CCTV videos with backend API integration.
- Camera selection (1-6)
- Date and time picker for video search
- Video player with controls
- Video grid showing all available videos around the selected time
- Folder D rule implementation for video discovery
- Authentication token management
- Video caching system
- Health check endpoint
- Install dependencies:
npm install- Build the React app:
npm run buildRun both frontend and backend concurrently:
npm run dev- Build the React app:
npm run build- Start the server:
npm run serverThe application will be available at http://localhost:3001
GET /api/health- Health check endpointGET /api/cctv/videos?target={timestamp}&camera={camera_id}- Get videos for specified time and camera
The CCTV server configuration is in server.js:
- Base URL:
http://xxx.xxx.fr:8090 - Login:
CCTV - Password:
xxxxxxxxxxxxxxxxx
- Select a camera (1-6) from the dropdown
- Choose a date and time using the datetime picker
- Click "Search Videos" to find videos around that time
- Use "Test API" to test with a known timestamp (2025-07-15T08:10:00)
- Click on any video in the grid to play it in the main player
The application implements the "Folder D" rule:
- First tries normal folder format:
/YYYY-MM-DD/HH/ - If empty, tries D folder format:
/YYYY-MM-DD/HHD/ - Searches hour-1, hour, and hour+1 for better coverage
- Automatic token management with 50-minute expiry
- Auto-renewal before expiration
- XML response parsing for token extraction
- Videos are cached locally to avoid repeated downloads
- Cache naming:
cam{ID}_{timestamp}_{hash}.mp4 - Cache directory:
/static/cache/videos/
API returns data in the exact format specified in the instructions:
[
{"0": "/path/to/video1.mp4", "1": "/path/to/video2.mp4"},
10,
-60,
1,
{"0": 1752567000, "1": 1752567120}
]/
├── src/
│ ├── components/
│ │ ├── VideoPlayer.tsx
│ │ └── VideoGrid.tsx
│ ├── services/
│ │ └── CCTVService.ts
│ ├── App.tsx
│ ├── App.css
│ └── index.tsx
├── public/
│ └── index.html
├── static/
│ └── cache/
│ └── videos/
├── server.js
├── package.json
└── README.md
- Frontend: React 18, TypeScript, HTML5 video
- Backend: Node.js, Express
- Dependencies: cors, node-fetch, xmldom
- Development: concurrently for running both frontend and backend