The composite stream (program) is a channel-level audio and video stream: a server-side MCU program composites everyone in the channel into a single stream, and every subscriber receives exactly the same video and audio.
Typical uses:
- Viewers who don’t speak subscribe to just one stream, saving bandwidth and decoding overhead
- Server-side recording / re-streaming
Reserved identifiers
The composite stream doesn’t belong to any regular user; it lives under a system identity. The header exposes these three reserved constants:
Publishing (MCU program side)
Publishing the composite stream requires connecting with the MCU identity: the uid in the token issued by the server must be __mcu__; otherwise the publish functions return RTC_ERROR.
rtc_publish_mcu_video_track
Publishes the video composite stream. It differs from rtc_publish_local_track in only two ways: it always uses the reserved trackId internally (you can’t customize it), and it requires the MCU identity. track_handle must be created with a video codec, and options must fill in desc / width / height / fps.
rtc_publish_mcu_audio_track
Publishes the audio composite stream (the mixed audio stream), with the same semantics as above. track_handle must be created with an audio codec, and options must fill in desc / sample_rate / channel_count.
Returns (same for both functions)
Example
Subscribing (viewer side)
The C interface has no RemoteTrack handle, so there’s no separate subscribe function for the composite stream—use the general subscribe functions with the reserved constants:
When not to use the composite stream
If a user in the channel wants to “hear everyone,” don’t subscribe to the audio composite stream. The composite stream includes your own voice, so subscribing to it causes echo.The right approach is rtc_set_auto_subscribe(rtc, 1, 0) to auto-subscribe to everyone’s audio; once each track’s data arrives through the track_sample callback, mix it yourself (excluding your own track when mixing).The composite stream is meant for viewers who don’t speak and for recording / re-streaming.