Streaming
Authenticated media playback and file downloads via signed tokens.
Get Stream Token
GET /api/v1/stream/token
Returns a signed HMAC token (1-hour TTL) for authenticated media playback.
Response
json
{
"token": "user_id:timestamp:hmac_signature",
"expires_in": 3600
}
Stream File
GET /api/v1/stream/{path}?token=SIGNED_TOKEN
Range-request capable endpoint for audio/video playback. Supports the Range header for seeking within the file. Used by the built-in player for MP3, AAC, OGG, FLAC, WAV, HLS, and DASH playback.
Supported Content Types
| Extension | Content-Type | |
|---|---|---|
| .mp3 | audio/mpeg | |
| .aac | audio/aac | |
| .ogg | audio/ogg | |
| .flac | audio/flac | |
| .wav | audio/wav | |
| .m3u8 | application/x-mpegURL | |
| .mpd | application/dash+xml | |
| .ts | video/MP2T | |
| .m4s | video/iso.segment |
Download File
GET /api/v1/stream/download/{path}?token=SIGNED_TOKEN
Direct file download with proper Content-Disposition header.
For HLS/DASH folders, the endpoint automatically creates and returns a ZIP archive containing the manifest and all associated segments.
Example
bash
# Get a stream token first
TOKEN=$(curl -s -H "Authorization: Bearer YOUR_JWT" \
http://localhost:8000/api/v1/stream/token | jq -r .token)
# Download a file
curl -o output.aac \
"http://localhost:8000/api/v1/stream/download/processed/file.aac?token=$TOKEN"
# Download an HLS bundle (returns .zip)
curl -o bundle.zip \
"http://localhost:8000/api/v1/stream/download/processed/hls_folder?token=$TOKEN"