Skip to main content

IRTCEngine

Create IRTCEngine

Parameters Note: the log switch and log path used to be on IRTCSetting (enable_stream_log / sdk_log_path) and have moved here— they’re consumed while the engine itself initializes, before any channel object exists.

Release IRTCEngine

Parameters

Get the version number

Parameters Note: the caller must allocate the memory before passing it in, at least 100 bytes.

Get the error code description

Parameters Note: the caller must allocate the memory for msg before passing it in, at least 100 bytes. The text is UTF-8, and the language is determined by RTCEngine_SetLanguage(); English by default (don’t branch on the text—use the error code).

Set the language

Parameters Note: process-wide and can be called at any time. It affects srtc’s own error texts and is forwarded to the underlying RTC_SetLanguage (subsequent backend requests then carry Accept-Language). English when never called; older versions always returned Chinese, so callers that display Chinese must set it explicitly after upgrading.

Get the last error message

Parameters Note: writes the text of the error code returned by the last srtc API call into the buffer (UTF-8, same language as RTCEngine_SetLanguage(), English by default). That error code is maintained by srtc itself, not taken from the underlying library, and is updated whenever an API returns non-OK; call it right after a failing synchronous call. Empty when there is no error. With multiple threads, it reads the last error code within the process, which may be overwritten by another thread.

Basic functions

Set the event handler

Parameters

Channel functions

You can join multiple channels at the same time. Each channel corresponds to an IRTCChannel object, and channel-level methods and callbacks are all on that object, instead of being distinguished by a leading channelId parameter on IRTCEngine as in older versions. About channelId
  • channelId is the value of the channel field in the token. The SDK parses it internally, and you get it through IRTCChannel::getChannelId()
  • channelId is used only by leaveChannel and getChannelIds; all other methods are called directly on the channel object

Create a channel object

Parameters Note: this only creates the object and doesn’t join the channel. After you get the object, set up its configuration and event handler, then call IRTCChannel::join(). Creating the same channel again returns Conflict; if no channel can be parsed from the token, it returns SdkTokenInvalid.

Leave a channel

Parameters

Leave all channels

Get the list of joined channels

Parameters

Media streaming functions

Network speed test

Parameters Note: the test results are returned in the callback.

Get camera info

Parameters

Get screen info

Parameters

Get microphone info

Parameters

Get speaker info

Parameters

Other

Add a log to upload

Parameters Logs you add are uploaded to the log server.