Skip to main content
This page gets the C SDK working with two minimal runnable examples: first a receiver (join a channel and write remote audio and video to disk), then a publisher (push encoded data up). Prerequisites:
A token is bound to one session. Once the process leaves the channel, that session is no longer valid, and using the same token again returns 1032 该会话不在线 (“session is not online”). Issue a new token every time you start a new process.

Receiver: join a channel and receive remote media

Compile and run:
Auto-subscribe suits “take everything” scenarios such as recording, audio mixing, and AI integration. If you only want specific tracks from specific users, use rtc_set_track_event_callback + rtc_subscribe_video / rtc_subscribe_audio instead—see Subscribing and receiving.

Publisher: publish local audio and video tracks

The SDK only handles transport; you do the capture and encoding yourself. The publishing flow is: create tracks → configure publish options → publish → call rtc_write_sample in a loop to feed encoded raw data.
After you publish video, the SFU uses RTCP (PLI/FIR) to ask you to produce a keyframe immediately when needed (for example, when a new viewer starts playback). Register a callback with rtc_set_keyframe_request_callback before publishing, and have the encoder produce an IDR frame right away in the callback; otherwise newly joined viewers may see a black screen for a long time. See Publishing.

Turn on logging

When troubleshooting, set the log level to RTC_LOG_DEBUG. We recommend calling this before rtc_create:

FAQ


Next steps