Skip to main content
There are two ways to subscribe:
  • Auto-subscribe—call rtc_set_auto_subscribe before joining, and the SDK subscribes to every remote track automatically. Use this for “take everything” scenarios such as recording, audio mixing, and AI integration
  • Manual subscription—pick the tracks you need in the track event callback and subscribe to them one by one
Either way, media data goes through the same rtc_set_track_sample_callback callback.

rtc_subscribe_audio

Subscribes to a specific user’s audio track. Returns

rtc_subscribe_video

Subscribes to a specific user’s video track. Parameters and return values are the same as rtc_subscribe_audio; to subscribe to the video composite stream, pass RTC_MCU_PUBLISHER_UID / RTC_TRACK_MCU_ID.
There’s no separate function for subscribing to the composite stream (program); use the two general functions above with the reserved constants. See Composite stream (program).

rtc_unsubscribe

Unsubscribes. For a composite stream, pass the publisher uid plus the corresponding reserved track_id. Return values are the same as above. After you unsubscribe, the SDK automatically stops collecting data for that track, and the corresponding track_sample callbacks stop.

Manual subscription example


rtc_request_key_frame

Asks a remote video track to send a keyframe immediately (sends RTCP PLI to the publisher). Returns When to call it
  • You just subscribed to a video track and want video to appear as soon as possible
  • The decoder reports errors, or the video is corrupted or gray, and you need to refresh the reference frame
When not to call it
You don’t need to request keyframes for packet loss. Light packet loss is recovered automatically by the SDK’s NACK retransmission and doesn’t corrupt the video. So the SDK doesn’t request keyframes based on packet loss rate, and we don’t recommend that you do—it only triggers unnecessary keyframes, which push up the bitrate and make congestion worse.Only call it when your decoder actually reports an error or the video is already corrupted.The function has built-in rate limiting (at most once per second), so calling it repeatedly on per-frame decode errors won’t flood requests.