fluxstream docs

Streaming Engine API

Query, control, and monitor torrent stream downloads programmatically.

Fluxstream exposes a REST API on the background server port, allowing external developers to query active download states and control stream caches.

Beta Disclaimer & Stability Warning

The Streaming Engine API is currently in Beta and highly unstable. It exists primarily as a demonstration of how the player's core streaming capabilities can be managed programmatically.

  • Decoupled Architecture: The engine is designed to be loosely coupled. You are free to build custom provider APIs, or take the streaming engine and client codebases and build on top of them directly.
  • No Protective Measures: As of now, no protective security measures have been implemented (such as requiring users to have an API key or verification token to make requests to provider APIs).
  • Liability: Since provider services must be independently hosted by developers, abuse of external servers is not the responsibility of the Fluxstream core project developers.

Base Endpoint

All requests to the local streaming daemon should target:

http://localhost:3000/api

Videos API (/videos)

1. Register a Torrent

Add a new magnet link to the download manager. The engine immediately begins sequential buffering and metadata resolution.

POST/videos
Request Payload
json
{
  "magnet_link": "magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel"
}
Response (200 OK)
json
{
  "video_id": "uqX92P"
}

2. List Registered Videos

Retrieve metadata for all currently registered torrent downloads and local disk resources.

GET/videos
Response (200 OK)
json
[
  {
    "id": "uqX92P",
    "magnet_link": "magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel",
    "file_path": "/tmp/fluxstream/Sintel.mp4",
    "created_at": 1779956936,
    "deleted": false
  }
]

3. Fetch Video Metadata

Retrieve file properties, sizes, names, and formats of a registered video by its ID.

GET/videos/:videoId/metadata
Response (200 OK)
json
{
  "name": "Sintel.mp4",
  "path": "/tmp/fluxstream/Sintel.mp4",
  "length": 12938102,
  "extension": ".mp4",
  "is_video": true
}

4. Stream Video Contents

Streams the sequential torrent buffer on-the-fly or returns the completed video file on disk. Supports range queries and streaming headers.

GET/videos/:videoId/stream

Response (200 OK / 206 Partial Content): Returns the live video binary stream.

5. Serve Subtitles

Serves extracted subtitle tracks for the streaming media.

GET/videos/:videoId/subs

Response (200 OK): Returns SRT/VTT subtitle assets.


Torrents API (/torrents)

1. Swarm Stats Stream

Connect to a Server-Sent Events (SSE) feed of real-time swarm download metrics (speed, active peers, seeders, buffer chunks).

GET/torrents/:videoId/stats/stream
Response (Server-Sent Events)
text/event-stream
{
  "bytes_completed": 4535808,
  "bytes_missing": 8402294,
  "total_bytes": 12938102,
  "progress": 0.35,
  "active_peers": 12,
  "total_peers": 42,
  "download_speed": 1048576,
  "upload_speed": 512
}

2. Remove Torrent & Cleanup

Stop sequential download streams, clean up memory buffers, and optionally delete on-disk files.

DELETE/torrents/:videoId
Request Payload
json
{
  "delete_resource": true
}

Response (204 No Content): No content returned.

On this page