Skip to content

Streaming API

Stream media files from your library via HLS.

Try it with a token

Start with the Authentication login flow, then use that bearer token in the requests below.

Start stream

http
GET /api/stream/:fileId
Authorization: Bearer <token>
bash
curl -G -i \
  -H "Authorization: Bearer $OMNILUX_TOKEN" \
  --data-urlencode "quality=1080p" \
  --data-urlencode "audioTrack=1" \
  --data-urlencode "subtitleTrack=2" \
  "http://your-server:4000/api/stream/1"

Query parameters:

ParameterTypeDescription
qualitystringTranscoding quality: original, 1080p, 720p, 480p
audioTracknumberAudio track index
subtitleTracknumberSubtitle track index

Response: Redirects to the HLS manifest URL.

http
HTTP/1.1 302 Found
Location: /api/stream/1/manifest.m3u8?session=stream_01HV6Y7J6P46B8Q4K6XK5J9A6A
Cache-Control: no-store

Error example:

json
{
  "error": "File 1 is not streamable",
  "code": "STREAM_UNSUPPORTED_MEDIA"
}

HLS manifest

http
GET /api/stream/:fileId/manifest.m3u8
Authorization: Bearer <token>

Returns an HLS manifest (M3U8) with segment URLs. The player uses this to stream the file.

bash
curl -sS \
  -H "Authorization: Bearer $OMNILUX_TOKEN" \
  http://your-server:4000/api/stream/1/manifest.m3u8

Response:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:6.000000,
segment-0.ts
#EXTINF:6.000000,
segment-1.ts
...

Report progress

http
POST /api/stream/:fileId/progress
Authorization: Bearer <token>
Content-Type: application/json

{
  "positionSeconds": 1234,
  "durationSeconds": 8880,
  "completed": false
}
bash
curl -sS \
  -X POST \
  -H "Authorization: Bearer $OMNILUX_TOKEN" \
  -H "Content-Type: application/json" \
  --data @- \
  "http://your-server:4000/api/stream/1/progress" <<'EOF'
{
  "positionSeconds": 1234,
  "durationSeconds": 8880,
  "completed": false
}
EOF

Reports the current playback position. Used for "Continue watching" and watch history.

Response:

json
{
  "saved": true
}

Error example:

json
{
  "error": "positionSeconds must be between 0 and durationSeconds",
  "code": "INVALID_PROGRESS_PAYLOAD"
}

Transcoding profiles

When quality is set to anything other than original, OmniLux transcodes on the fly using FFmpeg:

QualityResolutionVideo codecBitrate
originalSourceSourceSource
1080p1920x1080H.264 / NVENC8 Mbps
720p1280x720H.264 / NVENC4 Mbps
480p854x480H.264 / NVENC2 Mbps

NVENC (hardware) is used when available, falling back to libx264 (software).

Subtitle and audio track selection

Use the file detail endpoint to discover available tracks:

http
GET /api/library/files/:id

The response includes tracks with type (video, audio, subtitle), language, and index. Pass the desired audioTrack or subtitleTrack index when starting a stream.

External subtitle files (SRT, ASS, VTT) discovered alongside the media file are also available.

If you are building a player or an integration, start with Library API to discover track indexes and then call the stream endpoint with the selected audioTrack and subtitleTrack.