Rte

The fundamental interface class of the RTE API, which provides major methods for enabling real-time audio video interaction.

Destroy

Destroys an RTE object.

bool Destroy(Error *err = nullptr){
    return RteDestroy(&c_rte, err != nullptr ? err->get_underlying_impl() : nullptr);
  }
Since
v4.5.0

This method releases all resources used by the RTE object.

Restrictions

None.

Parameters

err
The state or error information: Error.

Returns

Whether the RTE object is successfully destroyed:
  • true: The RTE object is destroyed.
  • false: The RTE object is not destroyed.

GetAppId

Gets the App ID you set.

const char* GetAppId(Error *err);
Since
v4.5.0

Restrictions

None.

Parameters

err
The state or error information: Error.

Returns

  • The App ID you set, if the method call succeeds.
  • An empty string, if the method call fails.

GetConfigs [1/3]

Gets the configuration of the RTE object.

bool GetConfigs(Config *config, Error *err);
Since
v4.5.0

Call timing

Call this method after Rte.

Restrictions

None.

Parameters

config
Configurations of the RTE object: Config.
err
The state or error information: Error.

Returns

Whether the RTE object is configured successfully:
  • true: Yes.
  • false: No.

GetFromBridge

Bridges an RTE object from IRtcEngine.

static Rte GetFromBridge(Error* err = nullptr);
Since
v4.5.0

The RTE object created by calling this method does not need to be initialized again using InitMediaEngine. If you have not created and initialized the RTC engine before, you can first call Rte to create an RTE object, and then call InitMediaEngine to initialize it.

Call timing

Before calling this method, ensure that you have initialized the RTC engine using initialize.

Restrictions

None.

Parameters

err
Pointer to the Error object, which receives state and error codes.

Returns

An RTE object.

GetJsonParameter

Gets the SDK JSON configuration that has been set.

std::string GetJsonParameter(Error *err = nullptr)
Since
v4.5.0

After you call SetJsonParameter to set JSON configuration, you can call this method to get the configured information.

Call timing

Call this method after GetConfigs [1/3].

Restrictions

None.

Parameters

err
The state or error information: Error.

Returns

  • The JSON configuration, if the method call succeeds.
  • An empty string, if the method call fails.

InitMediaEngine

Initializes the RTE engine.

bool InitMediaEngine(std::function<void(rte::Error *err)> cb, Error *err = nullptr);
Since
v4.5.0

This method is asynchronous, which means that the result of initialization is returned through a callback.

Call timing

Call this method after the intializing the RTE object and setting the App ID.

Restrictions

None.

Parameters

cb
An asynchronous callback, which is used to return the initialization result. You can get the initialization result or the error code using the err parameter of this callback. For details, see Error.
err
The error information during initialization: Error. When initializing the RTE engine using InitMediaEngine, if errors that can be instantly detected occur, such as an invalid parameter or insufficient resource, the SDK synchronizes the error information in this parameter.

Returns

Whether the asynchronous operation is added to the queue:
  • true: Yes.
  • false: No.
Attention: The return value indicates whether initialization is added in the asynchronous queue; it does not indicate whether the initialization is successful or not.

Rte

Constructs an RTE object.

explicit Rte(InitialConfig *config = nullptr);
Since
v4.5.0

The RTE object manages the internal resources of Rte.

Call timing

Call this method before InitMediaEngine.

Restrictions

None.

Parameters

config
The initial configuration. Set it to null.

SetAppId

Sets an App ID.

void SetAppId(const char *app_id, Error *err);
Since
v4.5.0

Call timing

Call this method after InitMediaEngine.

Restrictions

None.

Parameters

appId
Your project's App ID, which can be obtained from Agora Console.
err
The state or error information: Error.

SetConfigs [1/3]

Configures the RTE object.

bool SetConfigs(Config *config, Error *err);
Since
v4.5.0

You can use this method to set information such as the App ID.

Call timing

Call this method after Rte.

Restrictions

None.

Parameters

config
Configurations of the RTE object: Config.
err
The state or error information: Error.

Returns

Whether the RTE object is configured successfully:
  • true: Yes.
  • false: No.

SetJsonParameter

Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options.

void SetJsonParameter(const char *json_parameter, Error *err = nullptr);
Since
v4.5.0

Applicable scenarios

When you need to set private parameters or use custom features, you can call this method.

Call timing

Call this method after SetConfigs [1/3].

Restrictions

None.

Parameters

json_parameter
Pointer to the set parameters in a JSON string.
err
The state or error information: Error.