Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.reactor.inc/llms.txt

Use this file to discover all available pages before exploring further.

What is a track?

A track is a named media stream between your app and the model. Tracks carry video, audio, or any other data the model expects or produces. Every track has a name that both sides use to identify it.

Server-driven track configuration

Track configuration is server-driven. When you connect to a model, the server declares the available tracks in its capabilities. Your app does not need to declare tracks up front. The SDK reads the model’s capabilities and sets up the WebRTC connection accordingly. You can inspect the available tracks after connecting:
reactor.on("capabilitiesReceived", (capabilities) => {
  console.log("Available tracks:", capabilities.tracks);
});
Each track has a name, kind ("video" or "audio"), and direction ("recvonly" or "sendonly"):
  • recvonly tracks are outputs from the model to your app (e.g. generated video).
  • sendonly tracks are inputs from your app to the model (e.g. webcam feed).

Output tracks (model to app)

The SDK receives the model’s output tracks automatically. Read them by name once the track arrives.
reactor.on("trackReceived", (name, track) => {
  if (name === "main_video") {
    const video = document.querySelector("video");
    if (video) video.srcObject = new MediaStream([track]);
  }
});
If the model exposes multiple output tracks (e.g. a depth map or audio), they are all received automatically.

Input tracks (app to model)

Some models accept input tracks (e.g. a webcam feed for video-to-video transformation). Publish a media track to the model once connected. The JavaScript variant captures the webcam with getUserMedia; in React the WebcamStream component captures and publishes for you.
reactor.on("statusChanged", async (status) => {
  if (status === "ready") {
    const stream = await navigator.mediaDevices.getUserMedia({ video: true });
    await reactor.publishTrack("webcam", stream.getVideoTracks()[0]);
  }
});

Naming convention

Here’s how track names map between the model and your app:
Track naming: model track names must match app track names
For output tracks, the SDK handles naming automatically. For input tracks (e.g. webcam), the track name you publish must match the attribute name defined in the model’s Python class.
If a track is not working, check that the track name you are using matches the model’s declared track name. You can inspect available tracks via getCapabilities() / get_capabilities().
Check the Model API Reference to see what tracks a model exposes.