995 B
995 B
Python video server (Range streaming + JWT + Mongo)
This is a small standalone server that mirrors the app’s /api/video/:id behavior:
- Looks up
movies._id == :idin MongoDB and reads thevideo_filefield - Streams the file from
VIDEO_FILES_DIRwith HTTP Range support (seeking works) - Auth via the same JWT (
Authorization: Bearer ...), plus avideo_authcookie for<video>
Run
python -m pip install -r python_video_server/requirements.txt
export MONGO_URI="..."
export JWT_SECRET="..."
export VIDEO_FILES_DIR="/absolute/path/to/public/video" # optional (default: ./public/video)
export VIDEO_SESSION_MAX_AGE_SECONDS="28800" # optional (default: 8h)
uvicorn python_video_server.server:app --host 0.0.0.0 --port 8000
Endpoints
-
POST /api/video/session
Setsvideo_authcookie (sendAuthorization: Bearer <token>). -
GET|HEAD /api/video/{movieId}
Streams the movie file (supportsRange: bytes=...). -
GET /healthz