Skip to main content
The following features are only available when the channel uses the SeaStart engine. With other engines these callbacks never fire and the functions you call directly (such as rtc_switch_layer) return an error. The engine is determined by the channel configuration sent down by the server, so your code doesn’t need to check it—just make sure it still works without these callbacks. The three features map to three separate strongly typed callbacks, in the same style as track_event / track_sample, so there’s no JSON to parse on the C side.

Layer switching (simulcast)

When the publisher pushes a multi-layer simulcast stream, layer switching on the subscriber side is fully automatic: the SDK registers the available layers as candidates, and the SFU switches between them based on bandwidth estimation (BWE). You don’t need to configure anything; usually you only listen for the switching results.

Layer switched callback

reason values:
Which layer is currently in use? The subscription handle (the track_id in sub_key) stays stable for the whole subscription, but the layer actually in use is switched dynamically. The to_track_id you get from layer_switched is the current layer; if you need it, cache a sub_key → current layer mapping yourself.

rtc_switch_layer

Asks the SFU to switch to a specific layer. Useful for switching between large and small windows, or proactively downgrading when a window goes to the background. Returns: RTC_OK (request sent) / RTC_INVALID_PARAM (invalid handle or a parameter is NULL) / RTC_NOT_CONNECTED (not joined) / RTC_ERROR (rejected by the engine).
A successful return only means the request was sent; the switch to the target layer is complete when the layer_switched callback fires.This SDK only supports multi-layer switching on the subscriber side; it doesn’t support publishing multi-layer simulcast streams.

Network quality

Periodic report callback

The SFU periodically (typically at 1 Hz) reports uplink and downlink quality.
The callback fires for every report, so throttling is up to you. If you write logs or feed monitoring, downsample yourself.

rtc_get_connection_quality

Fetches the most recent quality report on demand. Useful right after joining, to populate the UI / monitoring metrics before the first periodic report arrives. out is provided by the caller; the SDK fills in the fields directly, and nothing needs to be freed. Returns

Active speaker

The SDK merges the SFU’s incremental events into a full snapshot before passing it up, sorted by level in descending order, so you can simply overwrite the whole UI without merging deltas yourself. When no one is speaking, speakers_count = 0 and speakers = NULL.
The speakers array is held by the SDK during the callback and freed as soon as the callback returns. To keep it beyond the callback, you must copy it yourself.