Skip to main content

FileRef

A reference to an uploaded file, returned by upload_file(). Pass into send_command() to attach files to a command.
Definition
See File Uploads for usage examples.

ReactorStatus

Connection state enum. A str subclass, so it compares equal to the plain string too (ReactorStatus.READY == "ready").
Definition

ReactorError

Raised when a native operation fails — connect(), send_command(), upload_file(), request_clip(), and similarly for any other async method backed by the native library — and the payload of the "error" event / on_error. The same class either way: what on_error hands you is not a separate type that happens to agree with the exception, it is the exception. It is also the base class of a small hierarchy: every code in the error codes table below has its own subclass, so you can catch a specific failure by class instead of parsing .code.
Definition
Example
Every class in the error codes table below imports from reactor_sdk directly. except ReactorError still catches every one of them, so existing broad except blocks keep working.
ConflictError and VersionMismatchError are real, current exceptions — don’t confuse them with the identically-named classes from the older aiortc-based py-sdk, which this package is not. Their codes and fields follow the table below, not that earlier library’s shape.
There is no component field. Earlier releases split codes by which tier of the platform failed (api, gpu); that field was removed because it wasn’t something a caller could act on, and it was possible for the same failure to be reported under two different codes depending on which tier noticed it first. Match on code alone.

Error codes

Every code in the table below has a matching exception class — the same code, the same fields, whether you catch it as an exception or receive it through on_error.
Codes are open-ended. A command or a control request the model itself rejects reports the platform’s own code, which this list cannot enumerate — that raises the base ReactorError with code set to whatever arrived. Match on error.code for anything not in the table; never assume an unrecognized code means the error was malformed.

TrackKind / TrackDirection

Enums describing a Track. Both are str subclasses, so they compare equal to the plain string too.
Definition
See Track for the object these describe.

TrackList

The type of reactor.tracks — a list[Track] subclass with filters that chain, for finding the track you mean without hardcoding its name.
Definition
Everything a list does keeps working — iterate, index, len() — and the filters return another TrackList, so they compose in either order:
Example
A track whose kind or direction the session hasn’t declared yet matches neither filter — there is nothing to match it against until the model’s capabilities arrive, shortly after connect(). one() raises ValueError if zero or more than one track matches, naming the candidates so the filter can be narrowed.

Clip

Returned by request_clip() / request_recording().
Definition
playlist_url is an HLS manifest — see Recordings for how to preview or download it.

ConnectionStats

Returned by get_stats().
Definition
An unmeasured field is None, never zero. A missing RTT does not mean a zero-latency link. candidate_type reads "relay" when the media goes through a TURN server, which is the first thing to check when latency is bad. The SDK measures the two bitrates on the candidate pair that carries the media, over the window since the previous call. Both read None on the first call after connecting, again after a reconnect, and until ICE selects a pair. A call made less than 200 ms after the last one also reads None for them. Everything else is on every call. The SDK reads jitter_s, packet_loss_ratio and frames_per_second from the received video stream. With no video stream, the first two fall back to the receive streams there are, and frames_per_second is None. All four types import from reactor_sdk.

InboundStream

One receive stream’s counters, as the WebRTC engine reports them. Read from ConnectionStats.inbound.
Definition

OutboundStream

One send stream’s counters. Read from ConnectionStats.outbound.
Definition
The last four come from the far end’s report about this client, so they stay at 0.0 until it sends one. A zero there means “not measured yet”.

CandidatePair

One ICE candidate pair. Read from ConnectionStats.candidate_pairs.
Definition
A connection gathers many pairs, and exactly one is nominated. Only that pair carries traffic, and the rest report zeros. Read nominated rather than an average across the list.

AuthError

Raised by fetch_jwt() when an API key cannot be exchanged for a token — including automatically, inside connect(), when the Reactor constructor was given api_key rather than jwt.
Definition

fetch_jwt()

Exchanges an API key for a JWT. Used internally by connect() when the constructor was given api_key; call directly only if you need the token itself.
Signature
Returns the token as a str. Raises AuthError if the exchange fails for any reason, including a response with no token.
In most cases you don’t need this directly. Pass api_key to the Reactor constructor and the SDK handles the exchange automatically during connect().

download_clip()

Fetches every segment a Clip’s playlist_url names and concatenates them. Reactor does not host clips, so this — not a URL you can hand to a player directly — is how you get one onto disk or into memory. See Recordings for the full flow.
Signature
Example
Given path, streams each segment straight to the file and returns None — nothing beyond one segment is ever held in memory. This is the one to reach for with request_recording(), which has no upper bound on a session’s length. Without path, assembles and returns the full bytes instead, which does mean holding the whole clip in memory: fine for a short request_clip() result, not the default choice for a long recording.
Built on urllib.request — the fetch itself is synchronous, dispatched to a thread internally (asyncio.to_thread) so the call above is the whole thing, not something you wrap yourself. Raises urllib.error.URLError (a fetch failed) or urllib.error.HTTPError (a non-2xx response — playlist_url and its segments expire) for a failure, and ValueError if the playlist names no segments at all.
Returns interleaved MPEG-TS bytes, not an MP4 — playable as-is by most players (ffplay, VLC, mpv), but remux with ffmpeg -i clip.ts -c copy clip.mp4 first if you specifically need that container.