IoT SDK for Linux v1.9.7
Loading...
Searching...
No Matches
agora_rtc_api.h File Reference
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  video_frame_info_t
struct  audio_frame_info_t
struct  log_config_t
struct  rtc_service_option_t
struct  audio_codec_option_t
struct  crypto_option_t
struct  rtc_channel_options_t
struct  rdt_status_info
struct  connection_info_t
struct  user_info_s
struct  agora_rtc_event_handler_t
struct  agora_rtm_handler_t

Macros

#define __agora_api__
#define AGORA_RTC_CHANNEL_NAME_MAX_LEN   (64)
#define AGORA_RTC_PRODUCT_ID_MAX_LEN   (63)
#define AGORA_RTC_USER_ACCOUNT_MAX_LEN   (256)
#define AGORA_RTC_DATA_STREAM_MAX_LEN   (1024)
#define AGORA_RTM_UID_MAX_LEN   (64)
#define AGORA_RTM_DATA_MAX_LEN   (31 * 1024)
#define AGORA_CREDENTIAL_MAX_LEN   (256)
#define AGORA_CERTIFICATE_MAX_LEN   (1024)
#define AGORA_LICENSE_VALUE_LEN   (32)
#define CONNECTION_ID_ALL   ((connection_id_t)0)
#define CONNECTION_ID_INVALID   ((connection_id_t)-1)

Typedefs

typedef uint16_t video_frame_rate_e
typedef enum rdt_stream_type rdt_stream_type_e
typedef enum rdt_state rdt_state_e
typedef struct rdt_status_info rdt_status_info_t
typedef uint32_t connection_id_t
typedef struct user_info_s user_info_t

Enumerations

enum  agora_err_code_e {
  ERR_OKAY = 0 , ERR_FAILED = 1 , ERR_INVALID_PARAM = 2 , ERR_INVALID_STATE = 3 ,
  ERR_NOT_SUPPORTED = 4 , ERR_NOT_IN_CHANNEL = 6 , ERR_NOT_INITIALIZED = 7 , ERR_NOT_EXIST_CONNECTION = 8 ,
  ERR_TIMEDOUT = 10 , ERR_NO_MEMORY = 11 , ERR_CALL_FAILED = 12 , ERR_NET_DOWN = 14 ,
  ERR_JOIN_CHANNEL_REJECTED = 17 , ERR_LEAVE_CHANNEL_REJECTED = 18 , ERR_LICENSE_VERIFICATION_FAILURE = 23 , ERR_ENCRYPTION = 30 ,
  ERR_DECRYPTION = 31 , ERR_INVALID_APP_ID = 101 , ERR_INVALID_CHANNEL_NAME = 102 , ERR_NO_SERVER_RESOURCES = 103 ,
  ERR_LOOKUP_CHANNEL_REJECTED = 105 , ERR_OPEN_CHANNEL_REJECTED = 107 , ERR_TOKEN_EXPIRED = 109 , ERR_INVALID_TOKEN = 110 ,
  ERR_DYNAMIC_TOKEN_BUT_USE_STATIC_KEY = 115 , ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED = 119 , ERR_DECRYPTION_FAILED = 120 , ERR_OPEN_CHANNEL_INVALID_TICKET = 121 ,
  ERR_OPEN_CHANNEL_TRY_NEXT_VOS = 122 , ERR_CLIENT_IS_BANNED_BY_SERVER = 123 , ERR_AUDIO_CODEC_NOT_SUPPORT = 200 , ERR_AUDIO_INVALID_PCM_LEN = 201 ,
  ERR_AUDIO_INVALID_CODEC_PARAM = 202 , ERR_VIDEO_SEND_OVER_BANDWIDTH_LIMIT = 300 , ERR_VIDEO_SEND_PACKETIZE_FAILED = 301 , ERR_RDT_USER_NOT_EXIST = 600 ,
  ERR_RDT_USER_NOT_READY = 601 , ERR_RDT_DATA_BLOCKED = 602 , ERR_RDT_CMD_EXCEED_LIMIT = 603 , ERR_RDT_DATA_EXCEED_LIMIT = 604 ,
  ERR_TOO_MANY_DATA_STREAMS = 621 , ERR_DATA_STREAM_SIZE_TOO_LARGE = 622 , ERR_NOT_EXIST_STREAM_ID = 623 , ERR_DATA_STREAM_BITRATE_LIMIT = 624 ,
  ERR_DATA_STREAM_SEND_TOO_OFTEN = 625 , ERR_DATA_STREAM_TIME_OUT = 626 , ERR_RTM_NOT_LOGINED = 1001 , ERR_RTM_HAD_LOGINED = 1002 ,
  ERR_RTM_SEND_TO_SELF = 1003 , ERR_RTM_EXCEED_MSG_SIZE = 1004 , ERR_RTM_EXCEED_MSG_CNT = 1005 , ERR_RTM_EXCEED_SND_BUFFER = 1006
}
enum  license_err_reason_e {
  ERR_LICENSE_INVALID = 1 , ERR_LICENSE_EXPIRE = 2 , ERR_LICENSE_MINUTES_EXCEED = 3 , ERR_LICENSE_LIMITED_PERIOD = 4 ,
  ERR_LICENSE_DIFF_DEVICES = 5 , ERR_LICENSE_INTERNAL = 99
}
enum  user_offline_reason_e { USER_OFFLINE_QUIT = 0 , USER_OFFLINE_DROPPED = 1 , USER_OFFLINE_BECOME_AUDIENCE = 2 }
enum  video_data_type_e {
  VIDEO_DATA_TYPE_YUV420 = 0 , VIDEO_DATA_TYPE_H264 = 2 , VIDEO_DATA_TYPE_H265 = 3 , VIDEO_DATA_TYPE_GENERIC = 6 ,
  VIDEO_DATA_TYPE_GENERIC_JPEG = 20
}
enum  video_frame_type_e { VIDEO_FRAME_AUTO_DETECT = 0 , VIDEO_FRAME_KEY = 3 , VIDEO_FRAME_DELTA = 4 }
enum  video_stream_type_e { VIDEO_STREAM_HIGH = 0 , VIDEO_STREAM_LOW = 1 }
enum  video_orientation_e { VIDEO_ORIENTATION_0 = 0 , VIDEO_ORIENTATION_90 = 1 , VIDEO_ORIENTATION_180 = 2 , VIDEO_ORIENTATION_270 = 3 }
enum  audio_codec_type_e {
  AUDIO_CODEC_DISABLED = 0 , AUDIO_CODEC_TYPE_OPUS = 1 , AUDIO_CODEC_TYPE_G722 = 2 , AUDIO_CODEC_TYPE_G711A = 3 ,
  AUDIO_CODEC_TYPE_G711U = 4
}
enum  audio_data_type_e {
  AUDIO_DATA_TYPE_OPUS = 1 , AUDIO_DATA_TYPE_OPUSFB = 2 , AUDIO_DATA_TYPE_PCMA = 3 , AUDIO_DATA_TYPE_PCMU = 4 ,
  AUDIO_DATA_TYPE_G722 = 5 , AUDIO_DATA_TYPE_AACLC_8K = 6 , AUDIO_DATA_TYPE_AACLC_16K = 7 , AUDIO_DATA_TYPE_AACLC = 8 ,
  AUDIO_DATA_TYPE_HEAAC = 9 , AUDIO_DATA_TYPE_HEAAC2 = 10 , AUDIO_DATA_TYPE_AACLC_8K_2CH = 11 , AUDIO_DATA_TYPE_AACLC_16K_2CH = 12 ,
  AUDIO_DATA_TYPE_AACLC_2CH = 13 , AUDIO_DATA_TYPE_HEAAC_2CH = 14 , AUDIO_DATA_TYPE_HEAAC2_2CH = 15 , AUDIO_DATA_TYPE_AACLC1 = 16 ,
  AUDIO_DATA_TYPE_AACLC1_2CH = 17 , AUDIO_DATA_TYPE_HWAAC = 18 , AUDIO_DATA_TYPE_OPUSSWB = 20 , AUDIO_DATA_TYPE_OPUSFB_2CH = 21 ,
  AUDIO_DATA_TYPE_PCM = 100 , AUDIO_DATA_TYPE_GENERIC = 253 , AUDIO_DATA_TYPE_UNKNOW = 254
}
enum  rtc_log_level_e {
  RTC_LOG_DEFAULT = 0 , RTC_LOG_EMERG , RTC_LOG_ALERT , RTC_LOG_CRIT ,
  RTC_LOG_ERROR , RTC_LOG_WARNING , RTC_LOG_NOTICE , RTC_LOG_INFO ,
  RTC_LOG_DEBUG
}
enum  area_code_e {
  AREA_CODE_DEFAULT = 0x00000000 , AREA_CODE_CN = 0x00000001 , AREA_CODE_NA = 0x00000002 , AREA_CODE_EU = 0x00000004 ,
  AREA_CODE_AS = 0x00000008 , AREA_CODE_JP = 0x00000010 , AREA_CODE_IN = 0x00000020 , AREA_CODE_GLOB = (0xFFFFFFFF)
}
enum  crypto_mode_e {
  AES_128_XTS = 1 , AES_128_ECB = 2 , AES_256_XTS = 3 , SM4_128_ECB = 4 ,
  AES_128_GCM = 5 , AES_256_GCM = 6 , AES_128_GCM2 = 7 , AES_256_GCM2 = 8 ,
  CRYPTO_MODE_END
}
enum  rdt_stream_type { RDT_STREAM_CMD , RDT_STREAM_DATA , RDT_STREAM_COUNT }
enum  rdt_state {
  RDT_STATE_CLOSED , RDT_STATE_OPENED , RDT_STATE_BLOCKED , RDT_STATE_PENDING ,
  RDT_STATE_BROKEN
}
enum  rtm_event_type_e { RTM_EVENT_TYPE_LOGIN = 0 , RTM_EVENT_TYPE_KICKOFF = 1 , RTM_EVENT_TYPE_EXIT = 2 }
enum  rtm_msg_state_e { RTM_MSG_STATE_INIT = 0 , RTM_MSG_STATE_RECEIVED , RTM_MSG_STATE_UNREACHABLE , RTM_MSG_STATE_TIMEOUT }
enum  rtm_err_code_e {
  ERR_RTM_OK = 0 , ERR_RTM_FAILED = 1 , ERR_RTM_LOGIN_REJECTED = 2 , ERR_RTM_INVALID_RTM_UID = 3 ,
  ERR_RTM_LOGIN_INVALID_TOKEN = 5 , ERR_RTM_LOGIN_NOT_AUTHORIZED = 7 , ERR_RTM_LOCAL_NETDOWN = 8 , ERR_RTM_LOCAL_INTERRUPT = 9 ,
  ERR_RTM_LOCAL_TIMEOUT = 10 , ERR_RTM_SERVER_TIMEOUT = 11 , ERR_RTM_INVALID_APP_ID = ERR_INVALID_APP_ID , WARN_RTM_LOOKUP_CHANNEL_REJECTED = ERR_LOOKUP_CHANNEL_REJECTED ,
  ERR_RTM_TOKEN_EXPIRED = ERR_TOKEN_EXPIRED , ERR_RTM_INVALID_TOKEN = ERR_INVALID_TOKEN
}

Functions

const char * agora_rtc_get_version (void)
__agora_api__ const char * agora_rtc_err_2_str (int err)
__agora_api__ int agora_rtc_license_gen_credential (char *credential, unsigned int *credential_len)
__agora_api__ int agora_rtc_license_verify (const char *certificate, int certificate_len, const char *credential, int credential_len)
__agora_api__ const char * agora_rtc_license_strerror (int err)
__agora_api__ int agora_rtc_init (const char *app_id, const agora_rtc_event_handler_t *event_handler, rtc_service_option_t *option)
__agora_api__ int agora_rtc_fini (void)
__agora_api__ int agora_rtc_set_log_level (rtc_log_level_e level)
__agora_api__ int agora_rtc_config_log (int size_per_file, int max_file_count)
__agora_api__ int agora_rtc_create_connection (connection_id_t *conn_id)
__agora_api__ int agora_rtc_destroy_connection (connection_id_t conn_id)
__agora_api__ int agora_rtc_get_connection_info (connection_id_t conn_id, connection_info_t *conn_info)
__agora_api__ int agora_rtc_get_user_info_by_user_account (connection_id_t conn_id, const char *user_account, user_info_t *user)
__agora_api__ int agora_rtc_get_user_info_by_uid (connection_id_t conn_id, uint32_t uid, user_info_t *user)
__agora_api__ int agora_rtc_join_channel (connection_id_t conn_id, const char *channel_name, uint32_t uid, const char *token, rtc_channel_options_t *options)
__agora_api__ int agora_rtc_join_channel_with_user_account (connection_id_t conn_id, const char *channel_name, const char *user_account, const char *token, rtc_channel_options_t *options)
__agora_api__ int agora_rtc_leave_channel (connection_id_t conn_id)
__agora_api__ int agora_rtc_renew_token (connection_id_t conn_id, const char *token)
__agora_api__ int agora_rtc_mute_local_audio (connection_id_t conn_id, bool mute)
__agora_api__ int agora_rtc_mute_local_video (connection_id_t conn_id, bool mute)
__agora_api__ int agora_rtc_mute_remote_audio (connection_id_t conn_id, uint32_t remote_uid, bool mute)
__agora_api__ int agora_rtc_mute_remote_video (connection_id_t conn_id, uint32_t remote_uid, bool mute)
__agora_api__ int agora_rtc_request_video_key_frame (connection_id_t conn_id, uint32_t remote_uid, video_stream_type_e stream_type)
__agora_api__ int agora_rtc_send_audio_data (connection_id_t conn_id, const void *data_ptr, size_t data_len, audio_frame_info_t *info_ptr)
__agora_api__ int agora_rtc_send_video_data (connection_id_t conn_id, const void *data_ptr, size_t data_len, video_frame_info_t *info_ptr)
__agora_api__ int agora_rtc_set_bwe_param (connection_id_t conn_id, uint32_t min_bps, uint32_t max_bps, uint32_t start_bps)
__agora_api__ int agora_rtc_set_params (connection_id_t conn_id, const char *params)
__agora_api__ int agora_rtc_send_media_ctrl_msg (connection_id_t conn_id, uint32_t remote_uid, const void *payload, size_t length)
__agora_api__ int agora_rtc_send_rdt_msg (connection_id_t conn_id, uint32_t remote_uid, rdt_stream_type_e type, const void *msg, size_t length)
__agora_api__ int agora_rtc_get_rdt_status_info (connection_id_t conn_id, uint32_t remote_uid, rdt_status_info_t *info)
__agora_api__ int agora_rtc_create_data_stream (connection_id_t conn_id, int *stream_id, bool reliable, bool ordered)
__agora_api__ int agora_rtc_send_stream_message (connection_id_t conn_id, int stream_id, const char *data, size_t length)
__agora_api__ int agora_rtc_login_rtm (const char *rtm_uid, const char *rtm_token, const agora_rtm_handler_t *handler)
__agora_api__ int agora_rtc_logout_rtm (void)
__agora_api__ int agora_rtc_send_rtm_data (const char *rtm_uid, const void *msg, size_t msg_len, uint32_t msg_id)

Macro Definition Documentation

◆ __agora_api__

#define __agora_api__

◆ AGORA_CERTIFICATE_MAX_LEN

#define AGORA_CERTIFICATE_MAX_LEN   (1024)

◆ AGORA_CREDENTIAL_MAX_LEN

#define AGORA_CREDENTIAL_MAX_LEN   (256)

◆ AGORA_LICENSE_VALUE_LEN

#define AGORA_LICENSE_VALUE_LEN   (32)

◆ AGORA_RTC_CHANNEL_NAME_MAX_LEN

#define AGORA_RTC_CHANNEL_NAME_MAX_LEN   (64)

◆ AGORA_RTC_DATA_STREAM_MAX_LEN

#define AGORA_RTC_DATA_STREAM_MAX_LEN   (1024)

◆ AGORA_RTC_PRODUCT_ID_MAX_LEN

#define AGORA_RTC_PRODUCT_ID_MAX_LEN   (63)

◆ AGORA_RTC_USER_ACCOUNT_MAX_LEN

#define AGORA_RTC_USER_ACCOUNT_MAX_LEN   (256)

◆ AGORA_RTM_DATA_MAX_LEN

#define AGORA_RTM_DATA_MAX_LEN   (31 * 1024)

◆ AGORA_RTM_UID_MAX_LEN

#define AGORA_RTM_UID_MAX_LEN   (64)

◆ CONNECTION_ID_ALL

#define CONNECTION_ID_ALL   ((connection_id_t)0)

Special connection id

◆ CONNECTION_ID_INVALID

#define CONNECTION_ID_INVALID   ((connection_id_t)-1)

An invalid connection ID.

Typedef Documentation

◆ connection_id_t

typedef uint32_t connection_id_t

Connection identification

◆ rdt_state_e

typedef enum rdt_state rdt_state_e

Reliable Data Transmission tunnel state

◆ rdt_status_info_t

Reliable Data Transmission tunnel status info

◆ rdt_stream_type_e

Reliable Data Transmission Tunnel message type

◆ user_info_t

typedef struct user_info_s user_info_t

User information for a string user ID scenario.

Since
v1.9.5

◆ video_frame_rate_e

typedef uint16_t video_frame_rate_e

Deprecated video frame rate type.

Enumeration Type Documentation

◆ agora_err_code_e

Error code.

Enumerator
ERR_OKAY 

No error.

ERR_FAILED 

General error

ERR_INVALID_PARAM 

2: An invalid parameter is passed, for example, a channel name containing illegal characters. Reset the parameter.

ERR_INVALID_STATE 

3: The API call is invalid in the current state, for example, publishing audio or video after local capture is disabled.

ERR_NOT_SUPPORTED 

4: The operation is not supported in the current state.

ERR_NOT_IN_CHANNEL 

6: The connection has not successfully joined a channel.

ERR_NOT_INITIALIZED 

7: The service is not initialized. Call agora_rtc_init first.

ERR_NOT_EXIST_CONNECTION 

8: The connection does not exist.

ERR_TIMEDOUT 

An API timeout occurs. Some API methods require the SDK to return the execution result, and this error occurs if the request takes too long (more than 10 seconds) for the SDK to process.

ERR_NO_MEMORY 

11: Insufficient memory.

ERR_CALL_FAILED 

12: The API call failed.

ERR_NET_DOWN 

14: The network is unavailable. Check the system network connection.

ERR_JOIN_CHANNEL_REJECTED 

Request to join channel is rejected. It occurs when local user is already in channel and try to join the same channel again.

ERR_LEAVE_CHANNEL_REJECTED 

Request to leave channel is rejected. It occurs when local user is already not in channel and try to leave the channel.

ERR_LICENSE_VERIFICATION_FAILURE 

23: SDK initialization failed because license validation failed. This error is reported only for legacy licenses.

ERR_ENCRYPTION 

30: An encryption error occurred.

ERR_DECRYPTION 

31: A decryption error occurred.

ERR_INVALID_APP_ID 

101: The App ID is invalid. Replace it with a valid App ID and join the channel again.

ERR_INVALID_CHANNEL_NAME 

102: The channel name is invalid. The parameter may have the wrong data type. Use a valid channel name and join the channel again.

ERR_NO_SERVER_RESOURCES 

103: Failed to obtain server resources in the specified region.

ERR_LOOKUP_CHANNEL_REJECTED 

105: The Agora server rejected the channel lookup request. Check whether the RTC token is valid.

ERR_OPEN_CHANNEL_REJECTED 

107: The Agora server rejected the request to open the channel. Check whether the RTC token is valid.

ERR_TOKEN_EXPIRED 

109: The RTC token has expired. Generate a new RTC token on your server and call agora_rtc_join_channel to rejoin the channel with it.

The token may expire for either of the following reasons:

  • The authorized timestamp expires: A user must use the token to join a channel within five minutes after it is generated.
  • The call expiration timestamp expires: This timestamp specifies when a user can no longer use Agora services, for example, when the user is forced to leave a call. In this case, the token itself has not expired, but the user is removed from the channel.
ERR_INVALID_TOKEN 

Token is invalid due to reasons belows:

  • If application certificate is enabled on the Dashboard, valid token SHOULD be set when invoke.
  • If uid field is mandatory, users must specify the same uid as the one used to generate the token, when calling agora_rtc_join_channel.
ERR_DYNAMIC_TOKEN_BUT_USE_STATIC_KEY 

115: Token authentication is enabled, but an App ID was passed to the join method instead of a token. Pass a valid token when calling agora_rtc_join_channel.

ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED 

119: Failed to switch the user role. Try joining the channel again.

ERR_DECRYPTION_FAILED 

120: Decryption failed. The user may have used a different encryption password to join the channel. Check your settings or try rejoining the channel.

ERR_OPEN_CHANNEL_INVALID_TICKET 

121: A signaling error occurred while opening the channel. Try joining the channel again.

ERR_OPEN_CHANNEL_TRY_NEXT_VOS 

122: The system is switching servers. No additional action is usually required because the system automatically tries another server to open the channel.

ERR_CLIENT_IS_BANNED_BY_SERVER 

123: The server banned this client. Check whether the license is valid.

ERR_AUDIO_CODEC_NOT_SUPPORT 

200: The SDK does not support the selected audio codec.

ERR_AUDIO_INVALID_PCM_LEN 

201: The PCM audio data length is invalid.

ERR_AUDIO_INVALID_CODEC_PARAM 

202: The audio codec parameter is invalid.

ERR_VIDEO_SEND_OVER_BANDWIDTH_LIMIT 

Sending video data too fast and over the bandwidth limit. Very likely that packet loss occurs with this sending speed.

ERR_VIDEO_SEND_PACKETIZE_FAILED 

301: Failed to packetize the video packet.

ERR_RDT_USER_NOT_EXIST 

600: The user does not exist.

ERR_RDT_USER_NOT_READY 

601: The user is not ready.

ERR_RDT_DATA_BLOCKED 

602: The data is blocked.

ERR_RDT_CMD_EXCEED_LIMIT 

603: The command exceeds the limit.

ERR_RDT_DATA_EXCEED_LIMIT 

604: The data message size exceeds the limit.

ERR_TOO_MANY_DATA_STREAMS 

621: Too many data streams have been created.

ERR_DATA_STREAM_SIZE_TOO_LARGE 

622: The data stream size exceeds 1 KB.

ERR_NOT_EXIST_STREAM_ID 

623: The specified data stream ID does not exist.

ERR_DATA_STREAM_BITRATE_LIMIT 

624: The data stream bitrate exceeds the 6 Kbps limit.

ERR_DATA_STREAM_SEND_TOO_OFTEN 

625: Data stream packets are sent too frequently, exceeding the limit of 60 packets per second.

ERR_DATA_STREAM_TIME_OUT 

626: The connection to the remote user receiving the data stream timed out.

ERR_RTM_NOT_LOGINED 

1001: The user is not logged in to RTM.

ERR_RTM_HAD_LOGINED 

1002: The user is already logged in to RTM.

ERR_RTM_SEND_TO_SELF 

1003: The local user's own user ID was specified in rtmUid.

ERR_RTM_EXCEED_MSG_SIZE 

1004: The RTM message exceeds the maximum length of 31 KB.

ERR_RTM_EXCEED_MSG_CNT 

1005: The RTM message rate exceeds the limit of 60 messages per second.

ERR_RTM_EXCEED_SND_BUFFER 

1006: The message channel is full. Wait one second and try again.

◆ area_code_e

region code

Enumerator
AREA_CODE_DEFAULT 

The same as AREA_CODE_GLOB: the global region.

AREA_CODE_CN 

Mainland China.

AREA_CODE_NA 

North America.

AREA_CODE_EU 

Europe.

AREA_CODE_AS 

Asia, excluding Mainland China.

AREA_CODE_JP 

Japan.

AREA_CODE_IN 

India.

AREA_CODE_GLOB 

The global region (default).

◆ audio_codec_type_e

Audio codec type list.

Enumerator
AUDIO_CODEC_DISABLED 

0: Disable

AUDIO_CODEC_TYPE_OPUS 

1: Use the SDK's built-in Opus codec to encode and decode audio. Opus supports a sample rate of 16 kHz or 48 kHz for each channel.

AUDIO_CODEC_TYPE_G722 

2: Use the SDK's built-in G722 codec to encode and decode audio. G722 currently supports a sample rate of 16 kHz for each channel.

AUDIO_CODEC_TYPE_G711A 

3: Use the SDK's built-in G711A codec to encode and decode audio. G711 currently supports a sample rate of 8 kHz for each channel.

AUDIO_CODEC_TYPE_G711U 

4: Use the SDK's built-in G711U codec to encode and decode audio. G711 currently supports a sample rate of 8 kHz for each channel.

◆ audio_data_type_e

Audio data type list.

Enumerator
AUDIO_DATA_TYPE_OPUS 

1: OPUS, sample=16k

AUDIO_DATA_TYPE_OPUSFB 

2: OPUSFB, sample=48k

AUDIO_DATA_TYPE_PCMA 

3: PCMA, sample=8k

AUDIO_DATA_TYPE_PCMU 

4: PCMU, sample=8k

AUDIO_DATA_TYPE_G722 

5: G722, sample=16k

AUDIO_DATA_TYPE_AACLC_8K 

6: AAC-LC with an 8000 Hz sample rate.

AUDIO_DATA_TYPE_AACLC_16K 

7: AAC-LC with a 16000 Hz sample rate.

AUDIO_DATA_TYPE_AACLC 

8: AAC-LC with a 48000 Hz sample rate.

AUDIO_DATA_TYPE_HEAAC 

9: HE-AAC with a 32000 Hz sample rate.

AUDIO_DATA_TYPE_HEAAC2 

10: HE-AAC v2 with a 48000 Hz sample rate.

AUDIO_DATA_TYPE_AACLC_8K_2CH 

11: AACLC3 with an 8000 Hz sample rate and two channels.

AUDIO_DATA_TYPE_AACLC_16K_2CH 

12: AACLC2 with a 16000 Hz sample rate and two channels.

AUDIO_DATA_TYPE_AACLC_2CH 

13: AAC-LC with a 48000 Hz sample rate and two channels.

AUDIO_DATA_TYPE_HEAAC_2CH 

14: HE-AAC with a 48000 Hz sample rate and two channels.

AUDIO_DATA_TYPE_HEAAC2_2CH 

15: HE-AAC v2 with a 48000 Hz sample rate and two channels.

AUDIO_DATA_TYPE_AACLC1 

16: AAC-LC with a 44100 Hz sample rate.

AUDIO_DATA_TYPE_AACLC1_2CH 

17: AAC-LC with a 48000 Hz sample rate and two channels.

AUDIO_DATA_TYPE_HWAAC 

18: hardware AAC with a 32000 Hz sample rate.

AUDIO_DATA_TYPE_OPUSSWB 

20: Opus super-wideband with a 32000 Hz sample rate.

AUDIO_DATA_TYPE_OPUSFB_2CH 

21: Opus fullband with a 48000 Hz sample rate and two channels.

AUDIO_DATA_TYPE_PCM 

100: PCM (audio codec should be enabled)

AUDIO_DATA_TYPE_GENERIC 

253: GENERIC

AUDIO_DATA_TYPE_UNKNOW 

254: Unknown

◆ crypto_mode_e

Encryption mode.

Agora recommends AES_128_GCM2 or AES_256_GCM2 because these modes support a salt and provide stronger security.

Enumerator
AES_128_XTS 

1: 128-bit AES encryption, XTS mode.

AES_128_ECB 

2: 128-bit AES encryption, ECB mode.

AES_256_XTS 

3: 256-bit AES encryption, XTS mode.

SM4_128_ECB 

4: 128-bit SM4 encryption, ECB mode.

AES_128_GCM 

5: 128-bit AES encryption, GCM mode.

AES_256_GCM 

6: 256-bit AES encryption, GCM mode.

AES_128_GCM2 

7: 128-bit AES encryption in GCM mode. This mode requires a salt.

AES_256_GCM2 

8: 256-bit AES encryption in GCM mode. This mode requires a salt.

CRYPTO_MODE_END 

Enumerator boundary.

◆ license_err_reason_e

Error codes for device license validation failures.

Enumerator
ERR_LICENSE_INVALID 

1: The license is invalid. Call agora_rtc_init again and provide a valid license in the license_value member of rtc_service_option_t.

ERR_LICENSE_EXPIRE 

2: License expired

ERR_LICENSE_MINUTES_EXCEED 

3: The license has no remaining call minutes. Contact sales.nosp@m.@she.nosp@m.ngwan.nosp@m.g.cn to purchase a license with additional minutes.

ERR_LICENSE_LIMITED_PERIOD 

4: Calls are not allowed during the current time period. Use the service during a period permitted by the license, or contact sales.nosp@m.@she.nosp@m.ngwan.nosp@m.g.cn to purchase a license with a longer permitted period.

ERR_LICENSE_DIFF_DEVICES 

5: The license is already in use on another device. A license can be used on only one device. Call agora_rtc_init again and provide a new license in the license_value member of rtc_service_option_t.

ERR_LICENSE_INTERNAL 

99: SDK internal error

◆ rdt_state

enum rdt_state

Reliable Data Transmission tunnel state

Enumerator
RDT_STATE_CLOSED 

The initial state. The RDT channel is not connected, and the user cannot send or receive RDT messages.

RDT_STATE_OPENED 

The RDT channel is connected, and the user can send and receive RDT messages.

RDT_STATE_BLOCKED 

The RDT channel's send buffer is full. The user cannot send data messages (RDT_STREAM_DATA), but can still send control messages (RDT_STREAM_CMD).

RDT_STATE_PENDING 

The SDK is reconnecting the RDT channel.

  • If reconnection succeeds, the state changes to RDT_STATE_OPENED and the SDK retains buffered send and receive data.
  • If reconnection fails, the state changes to RDT_STATE_CLOSED and the SDK clears buffered send and receive data.
RDT_STATE_BROKEN 

The RDT channel connection is broken and the SDK attempts to reconnect. The SDK clears buffered send and receive data whether reconnection succeeds or fails.

◆ rdt_stream_type

Reliable Data Transmission Tunnel message type

Enumerator
RDT_STREAM_CMD 

A control message. It has high priority, is not constrained by congestion control, and does not block sending. You can send up to 100 packets per second, with up to 256 bytes per packet.

RDT_STREAM_DATA 

A data message. It has low priority and is constrained by congestion control. Sending fails when the buffer is full. The packet rate is unlimited, and each packet can contain up to 128 KB.

RDT_STREAM_COUNT 

The enumeration boundary.

◆ rtc_log_level_e

The definition of log level enum

Enumerator
RTC_LOG_DEFAULT 

0: (Default) Outputs logs at the EMERG, ALERT, CRIT, ERROR, WARNING, and NOTICE levels.

RTC_LOG_EMERG 

1: Outputs logs at the EMERG level.

RTC_LOG_ALERT 

2: Outputs logs at the EMERG and ALERT levels.

RTC_LOG_CRIT 

3: Outputs logs at the EMERG, ALERT, and CRIT levels.

RTC_LOG_ERROR 

4: Outputs logs at the EMERG, ALERT, CRIT, and ERROR levels.

RTC_LOG_WARNING 

5: Outputs logs at the EMERG, ALERT, CRIT, ERROR, and WARNING levels.

RTC_LOG_NOTICE 

6: (Default) Outputs logs at the EMERG, ALERT, CRIT, ERROR, WARNING, and NOTICE levels.

RTC_LOG_INFO 

7: Outputs logs at the EMERG, ALERT, CRIT, ERROR, WARNING, NOTICE, and INFO levels.

RTC_LOG_DEBUG 

8: Outputs all API logs. Set the log level to this value to obtain the most complete logs.

◆ rtm_err_code_e

RTM error code

Enumerator
ERR_RTM_OK 

no error

ERR_RTM_FAILED 

general error

ERR_RTM_LOGIN_REJECTED 

2: The server rejected the RTM login. Check the RTM token, App ID, and user ID.

ERR_RTM_INVALID_RTM_UID 

3: The RTM user ID is invalid. Check that the user ID meets the requirements.

ERR_RTM_LOGIN_INVALID_TOKEN 

The token is invalid.

ERR_RTM_LOGIN_NOT_AUTHORIZED 

7: The login is unauthorized. Log in before performing other operations.

ERR_RTM_LOCAL_NETDOWN 

8: A network-interface failure is detected.

ERR_RTM_LOCAL_INTERRUPT 

9: The local user's network is interrupted. Check the network connection.

ERR_RTM_LOCAL_TIMEOUT 

10: The local user does not receive a heartbeat response from the server.

ERR_RTM_SERVER_TIMEOUT 

11: The server does not receive a heartbeat from the local user.

ERR_RTM_INVALID_APP_ID 

101: The RTM App ID is invalid. Check that the App ID meets the requirements.

WARN_RTM_LOOKUP_CHANNEL_REJECTED 

105: The server rejected the RTM channel lookup. Check the RTM token.

ERR_RTM_TOKEN_EXPIRED 

109: The RTM token has expired. Generate a new RTM token.

ERR_RTM_INVALID_TOKEN 

110: The RTM token is invalid. Check the token.

◆ rtm_event_type_e

RTM RTM event type list

Enumerator
RTM_EVENT_TYPE_LOGIN 

0: LOGIN

RTM_EVENT_TYPE_KICKOFF 

1: KICKOFF

RTM_EVENT_TYPE_EXIT 

2: The user exits the RTM service. Possible causes include:

The SDK automatically reconnects and restores the login when reconnection succeeds.

◆ rtm_msg_state_e

RTM message send state

Enumerator
RTM_MSG_STATE_INIT 

0: The initial state.

RTM_MSG_STATE_RECEIVED 

1: The message has been received.

RTM_MSG_STATE_UNREACHABLE 

2: The message reached the server, but delivery to the remote user is uncertain.

RTM_MSG_STATE_TIMEOUT 

The server does not respond within 10 seconds, and the SDK deletes the message with the unknown state.

◆ user_offline_reason_e

The definition of the user_offline_reason_e enum.

Enumerator
USER_OFFLINE_QUIT 

0: Remote user leaves channel actively

USER_OFFLINE_DROPPED 

1: The SDK considers the remote user offline because it has not received packets from that user for too long. This determination can be inaccurate on an unstable network. Use the Signaling SDK for reliable offline detection.

USER_OFFLINE_BECOME_AUDIENCE 

2: The user switches the client role from the host to the audience.

◆ video_data_type_e

The definition of the video_data_type_e enum.

Enumerator
VIDEO_DATA_TYPE_YUV420 

0: YUV420 (not currently supported).

VIDEO_DATA_TYPE_H264 

2: H264。

VIDEO_DATA_TYPE_H265 

3: H265。

VIDEO_DATA_TYPE_GENERIC 

6: Generic。

VIDEO_DATA_TYPE_GENERIC_JPEG 

20: Generic JPEG。

◆ video_frame_type_e

The definition of the video_frame_type_e enum.

Enumerator
VIDEO_FRAME_AUTO_DETECT 

0: unknow frame type If you set it ,the SDK will judge the frame type

VIDEO_FRAME_KEY 

3: key frame

VIDEO_FRAME_DELTA 

4: A delta frame, such as a P-frame.

◆ video_orientation_e

Rotation of an encoded video frame.

Enumerator
VIDEO_ORIENTATION_0 

0: Rotate the video by 0 degree clockwise.

VIDEO_ORIENTATION_90 

90: Rotate the video by 90 degrees clockwise.

VIDEO_ORIENTATION_180 

180: Rotate the video by 180 degrees clockwise.

VIDEO_ORIENTATION_270 

270: Rotate the video by 270 degrees clockwise.

◆ video_stream_type_e

Video stream types.

Enumerator
VIDEO_STREAM_HIGH 

0: The high-quality video stream, which has a higher resolution and bitrate.

VIDEO_STREAM_LOW 

1: The low-quality video stream, which has a lower resolution and bitrate.

Function Documentation

◆ agora_rtc_config_log()

__agora_api__ int agora_rtc_config_log ( int size_per_file,
int max_file_count )
extern

Sets the log file configuration.

Parameters
[in]size_per_fileThe size (bytes) of each log file. The value range is [0, 10*1024*1024(10MB)], default 1*1024*1024(1MB). 0 means set log off
[in]max_file_countThe maximum number of log files. The value range is [0, 100], default 10. 0 means set log off
Returns
  • 0: Success.
  • <0: Failure.

◆ agora_rtc_create_connection()

__agora_api__ int agora_rtc_create_connection ( connection_id_t * conn_id)
extern

Creates a connection.

Create a connection before joining a channel. Create multiple connections to join different channels with one user ID or to join one channel with different user IDs.

Parameters
[out]conn_idThe created connection ID.
Returns
  • 0: Success.
  • < 0: Failure.

◆ agora_rtc_create_data_stream()

__agora_api__ int agora_rtc_create_data_stream ( connection_id_t conn_id,
int * stream_id,
bool reliable,
bool ordered )
extern

Creates a data stream.

Since
v1.9.5

Each user can create up to five data streams during a connection lifecycle.

Note
Call this method after joining a channel. The SDK does not support reliable = true together with ordered = false.
Parameters
[in]conn_idConnection identification.
[out]stream_idPointer to the generated stream ID.
[in]reliableWhether to provide limited reliability through packet-loss detection and retransmission for five seconds: true enables it; false disables it.
[in]orderedWhether receivers obtain messages in sending order: true preserves order; false does not.
Returns
  • 0: Success.
  • < 0: Failure.

◆ agora_rtc_destroy_connection()

__agora_api__ int agora_rtc_destroy_connection ( connection_id_t conn_id)
extern

Destroys a connection.

Parameters
[in]conn_idConnection ID. Set to CONNECTION_ID_ALL to target all created connections. See agora_rtc_create_connection.
Returns
  • 0: Success.
  • < 0: Failure.

◆ agora_rtc_err_2_str()

__agora_api__ const char * agora_rtc_err_2_str ( int err)
extern

Convert error code to const static string.

Note
You do not have to release the string after use.
Parameters
[in]errError code
Returns
Const static error string

◆ agora_rtc_fini()

__agora_api__ int agora_rtc_fini ( void )
extern

Releases all RTSA service resources allocated by agora_rtc_init.

Returns
  • 0: Success.
  • < 0: Failure.

◆ agora_rtc_get_connection_info()

__agora_api__ int agora_rtc_get_connection_info ( connection_id_t conn_id,
connection_info_t * conn_info )
extern

Gets connection information.

Parameters
[in]conn_idConnection ID. Set to CONNECTION_ID_ALL to target all created connections. See agora_rtc_create_connection.
[out]conn_infoConnection information. See connection_info_t.
Returns
  • 0: Success.
  • < 0: Failure.

◆ agora_rtc_get_rdt_status_info()

__agora_api__ int agora_rtc_get_rdt_status_info ( connection_id_t conn_id,
uint32_t remote_uid,
rdt_status_info_t * info )
extern

Gets information about an RDT channel.

Since
v1.9.2

The returned state and buffer sizes indicate whether the remote user has received all RDT messages and whether more messages can be sent. For example, a send_queue_size of 0 means that the remote user has received all queued messages.

Parameters
[in]conn_idConnection identification.
[in]remote_uidRemote user ID.
[out]infoRDT channel information. See rdt_status_info_t.
Returns
  • 0: Success.
  • < 0: Failure.

◆ agora_rtc_get_user_info_by_uid()

__agora_api__ int agora_rtc_get_user_info_by_uid ( connection_id_t conn_id,
uint32_t uid,
user_info_t * user )
extern

Gets user information by integer user ID.

Since
v1.9.5
Parameters
[in]conn_id: Connection identification
[in]uid: user id
[out]userUser information. See user_info_t.
Returns
  • =0: Success
  • <0: Failure

◆ agora_rtc_get_user_info_by_user_account()

__agora_api__ int agora_rtc_get_user_info_by_user_account ( connection_id_t conn_id,
const char * user_account,
user_info_t * user )
extern

Gets user information by user account.

Since
v1.9.5
Parameters
[in]conn_id: Connection identification
[in]user_account: user account
[out]userUser information. See user_info_t.
Returns
  • =0: Success
  • <0: Failure

◆ agora_rtc_get_version()

const char * agora_rtc_get_version ( void )
extern

Get SDK version.

Returns
A const static string describes the SDK version

◆ agora_rtc_init()

__agora_api__ int agora_rtc_init ( const char * app_id,
const agora_rtc_event_handler_t * event_handler,
rtc_service_option_t * option )
extern

Initializes the RTSA service.

Note
  • Each process can initialize the SDK only once.
  • On each initialization, the SDK creates a randomly named directory under the configured log path for that run. The SDK does not remove directories from earlier runs. Clear the log directory before initialization to avoid excessive disk usage.
Parameters
[in]app_idApp ID issued by Agora.
[in]event_handlerEvent callbacks. See agora_rtc_event_handler_t.
[in]optionService options. Set to NULL if no options are required. See rtc_service_option_t.
Returns
  • 0: Success.
  • < 0: Failure.

◆ agora_rtc_join_channel()

__agora_api__ int agora_rtc_join_channel ( connection_id_t conn_id,
const char * channel_name,
uint32_t uid,
const char * token,
rtc_channel_options_t * options )
extern

Joins the RTC channel associated with a connection.

Users in the same channel with the same App ID can exchange data.

Note
  • A user can join multiple channels, and all joined channels receive the audio and video sent by that user.
  • To join different channels with the same user ID, or the same channel with different user IDs, call agora_rtc_create_connection for each connection and pass the corresponding connection ID to agora_rtc_join_channel.
Parameters
[in]conn_idConnection identification. Set to CONNECTION_ID_ALL to target all created connections.
[in]channel_name: Channel name Length=strlen(channel_name) should be less than 64 bytes. Supported character scopes are:
  • The 26 lowercase English letters: a to z
  • The 26 uppercase English letters: A to Z
  • The 10 numbers: 0 to 9
  • The space
  • "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ","
[in]uid: User ID. A 32-bit unsigned integer with a value ranging from 1 to 2^32-1. The uid must be unique. If a uid is set to 0, the SDK assigns and returns a uid in the on_join_channel_success callback. Your application must record and maintain the returned uid, because the SDK does not do so.
[in]tokenRTC token used for authentication. Set it to NULL for App ID authentication. For App ID and token authentication, pass a server-generated token. See RTC token authentication. RTSA Lite SDK v1.8.0 and later support AccessToken2; earlier versions support AccessToken.
[in]optionsChannel options. See rtc_channel_options_t.
Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_join_channel_with_user_account()

__agora_api__ int agora_rtc_join_channel_with_user_account ( connection_id_t conn_id,
const char * channel_name,
const char * user_account,
const char * token,
rtc_channel_options_t * options )
extern

Joins the RTC channel associated with a connection by using a user account.

Note
Users in the same channel with the same App ID can send data to each other. To join different channels with the same user account, or the same channel with different user accounts, call agora_rtc_create_connection for each connection and pass the corresponding connection ID to agora_rtc_join_channel_with_user_account.
Parameters
[in]conn_id: Connection identification
[in]channel_name: Channel name Length=strlen(channel_name) should be less than 64 bytes, Supported character scopes are:
  • The 26 lowercase English letters: a to z
  • The 26 uppercase English letters: A to Z
  • The 10 numbers: 0 to 9
  • The space
  • "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ","
[in]user_account: The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are:
  • All lowercase English letters: a to z.
  • All uppercase English letters: A to Z.
  • All numeric characters: 0 to 9.
  • The space character.
  • Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
Since
v1.9.5
Parameters
[in]tokenRTC token used for authentication. Set it to NULL for App ID authentication. For App ID and token authentication, pass a server-generated token. See RTC token authentication. RTSA Lite SDK v1.8.0 and later support AccessToken2; earlier versions support AccessToken.
[in]optionsChannel options. See rtc_channel_options_t.
Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_leave_channel()

__agora_api__ int agora_rtc_leave_channel ( connection_id_t conn_id)
extern

Leaves the RTC channel associated with a connection.

Leave a channel after data transmission to that channel stops.

Parameters
[in]conn_idConnection identification. Set to CONNECTION_ID_ALL to target all connections created by agora_rtc_create_connection.
Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_license_gen_credential()

__agora_api__ int agora_rtc_license_gen_credential ( char * credential,
unsigned int * credential_len )
extern
Deprecated
Deprecated since v1.9.0.

Generates the credential that uniquely identifies the device.

Note
This method is used only by the Agora License mechanism. Ignore it if your implementation does not use a license.
Parameters
[out]credentialBuffer that receives the credential.
[in,out]credential_lenOn input, the available buffer size in bytes, which must be greater than AGORA_CREDENTIAL_MAX_LEN; on output, the actual credential length in bytes.
Returns
  • 0: Success.
  • < 0: Failure.

◆ agora_rtc_license_strerror()

__agora_api__ const char * agora_rtc_license_strerror ( int err)
extern

Gets the license error description.

Parameters
[in]errError code.
Returns
The error description.

◆ agora_rtc_license_verify()

__agora_api__ int agora_rtc_license_verify ( const char * certificate,
int certificate_len,
const char * credential,
int credential_len )
extern
Deprecated
Deprecated since v1.9.0. Use on_license_validation_failure to obtain the license validation error code.

Authenticates the SDK.

When the Agora License mechanism is enabled, a device can join an Agora channel and transfer data only after its certificate is validated.

Note
  • This method is used only by the Agora License mechanism. Ignore it if your implementation does not use a license.
  • Call this method before agora_rtc_init. Other RTSA SDK APIs are available only after authentication succeeds.
Parameters
[in]certificateLicense certificate.
[in]certificate_lenCertificate length.
[in]credentialDevice credential.
[in]credential_lenCredential length.
Returns
  • 0: Success.
  • < 0: Failure.

◆ agora_rtc_login_rtm()

__agora_api__ int agora_rtc_login_rtm ( const char * rtm_uid,
const char * rtm_token,
const agora_rtm_handler_t * handler )
extern

Logs in to the Agora RTM service.

Parameters
[in]rtm_uidRTM user id (different from uid) Length should be less than 64 bytes Supported character scopes are:
  • The 26 lowercase English letters: a to z
  • The 26 uppercase English letters: A to Z
  • The 10 numbers: 0 to 9
  • The space
  • "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ","
[in]rtm_tokenRTM token generated by the token server. Set it to NULL when token authentication is disabled; the literal string "NULL" is not a valid user ID or token.
  • if token authorization is enabled on developer website, it should be set correctly
  • else token can be set as NULL
[in]handlerRTM event callbacks. See agora_rtm_handler_t.
Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_logout_rtm()

__agora_api__ int agora_rtc_logout_rtm ( void )
extern

Logout agora RTM service

Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_mute_local_audio()

__agora_api__ int agora_rtc_mute_local_audio ( connection_id_t conn_id,
bool mute )
extern

Pauses or resumes sending local audio in a specific channel or all channels.

Parameters
[in]conn_idConnection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection.
[in]muteToggle sending local audio
  • false(0): unmuted
  • true (1): muted
Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_mute_local_video()

__agora_api__ int agora_rtc_mute_local_video ( connection_id_t conn_id,
bool mute )
extern

Pauses or resumes sending local video in a specific channel or all channels.

Parameters
[in]conn_idConnection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection.
[in]muteToggle sending local video
  • false(0): unmuted
  • true (1): muted
Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_mute_remote_audio()

__agora_api__ int agora_rtc_mute_remote_audio ( connection_id_t conn_id,
uint32_t remote_uid,
bool mute )
extern

Pauses or resumes receiving audio from a remote user in a specific channel or all channels.

Parameters
[in]conn_idConnection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection.
[in]remote_uidRemote user ID
  • if remote_uid is set 0, it's for all users
  • else it's for specific user
[in]muteToggle receiving remote audio
  • false(0): unmuted
  • true (1): muted
Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_mute_remote_video()

__agora_api__ int agora_rtc_mute_remote_video ( connection_id_t conn_id,
uint32_t remote_uid,
bool mute )
extern

Pauses or resumes receiving video from a remote user in a specific channel or all channels. You can pause video in all channels and then resume it for a selected channel.

Parameters
[in]conn_idConnection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection.
[in]remote_uidRemote user ID
  • if remote_uid is set 0, it's for all users
  • else it's for specific user
[in]muteToggle receiving remote video
  • false(0): unmuted
  • true (1): muted
Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_renew_token()

__agora_api__ int agora_rtc_renew_token ( connection_id_t conn_id,
const char * token )
extern

Renews the token for a specific channel or all channels.

Note
Renew the token before its validity period expires.
Parameters
[in]conn_idConnection identification. Set to CONNECTION_ID_ALL to target all connections created by agora_rtc_create_connection.
[in]tokenToken string, strlen(token) Range is [32, 512]
Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_request_video_key_frame()

__agora_api__ int agora_rtc_request_video_key_frame ( connection_id_t conn_id,
uint32_t remote_uid,
video_stream_type_e stream_type )
extern

Requests a keyframe for a specified remote video stream.

Parameters
[in]conn_idConnection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection.
[in]remote_uidRemote user ID
  • if remote_uid is set 0, it's for all users
  • else it's for specific user
[in]stream_typeVideo stream type. See video_stream_type_e.
Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_send_audio_data()

__agora_api__ int agora_rtc_send_audio_data ( connection_id_t conn_id,
const void * data_ptr,
size_t data_len,
audio_frame_info_t * info_ptr )
extern

Send an audio frame to all channels OR specific channel. All remote users in this channel will receive the audio frame.

Note
All channels that you joined will receive the audio frame that you send unless you stop sending the local audio to a specific channel.
Parameters
[in]conn_idConnection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection.
[in]data_ptrAudio frame buffer
[in]data_lenAudio frame buffer length (bytes)
[in]info_ptrAudio frame info, see audio_frame_info_t
Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_send_media_ctrl_msg()

__agora_api__ int agora_rtc_send_media_ctrl_msg ( connection_id_t conn_id,
uint32_t remote_uid,
const void * payload,
size_t length )
extern

Sends a message to all channels or a specified channel.

All remote users in this channel will receive the message.

Note
All channels that you joined will receive the message that you send unless you stop sending the message to a specific channel.
Parameters
[in]conn_idConnection identification
[in]remote_uidRemote user ID
  • if remote_uid is set 0, it's for all users
  • else it's for specific use
[in]payloadMessage's payload buffer
[in]lengthMessage payload length, up to 1 KB. On success, remote users receive on_media_ctrl_msg.
Since
1.9.5
Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_send_rdt_msg()

__agora_api__ int agora_rtc_send_rdt_msg ( connection_id_t conn_id,
uint32_t remote_uid,
rdt_stream_type_e type,
const void * msg,
size_t length )
extern

Sends an RDT (Reliable Data Transmission) message.

Since
v1.9.2

For reliable scenarios such as file transfer and download:

  1. Set rtc_channel_options_t::enable_rdt to true when joining a channel.
  2. Wait until on_rdt_state reports RDT_STATE_OPENED.
  3. Send either a high-priority control message (RDT_STREAM_CMD) or a congestion-controlled data message (RDT_STREAM_DATA).

The remote user receives on_rdt_msg. Call agora_rtc_get_rdt_status_info to inspect delivery and buffer status.

Note
Each connection is limited to 4 Mbps. Control messages are limited to 100 packets per second and 256 bytes per packet. Data messages are limited to 128 KB per packet.
Parameters
[in]conn_idConnection identification.
[in]remote_uidRemote user ID.
[in]typeRDT message type. See rdt_stream_type_e. Enable it by setting enable_rdt in rtc_channel_options_t before calling agora_rtc_send_rdt_msg.
[in]msgMessage payload.
[in]lengthMessage length.
Returns

◆ agora_rtc_send_rtm_data()

__agora_api__ int agora_rtc_send_rtm_data ( const char * rtm_uid,
const void * msg,
size_t msg_len,
uint32_t msg_id )
extern

Sends a message through the RTM service.

RTM transport is always protected with TLS and cannot be disabled.

Note
Send only after RTM login succeeds and on_rtm_event is triggered. The send rate cannot exceed 60 messages per second.
Parameters
[in]rtm_uidRTM user ID.
[in]msgUTF-8 message content.
[in]msg_lenMessage length in bytes, up to 31 KB.
[in]msg_idMessage ID.
Returns

◆ agora_rtc_send_stream_message()

__agora_api__ int agora_rtc_send_stream_message ( connection_id_t conn_id,
int stream_id,
const char * data,
size_t length )
extern

Sends a data-stream message to all users in a channel.

Since
v1.9.5

Call this method after agora_rtc_create_data_stream. The remote users receive on_stream_message.

Note
  • Call this method only after joining the channel and creating a data stream.
  • A channel supports at most 60 packets per second and 1 KB per packet.
  • Each client supports up to five streams, 6 KB/s per stream, and 30 Kbps in total.
Parameters
[in]conn_idConnection identification.
[in]stream_idStream ID returned by agora_rtc_create_data_stream.
[in]dataData to send.
[in]lengthData length.
Returns
  • 0: Success.
  • < 0: Failure.

◆ agora_rtc_send_video_data()

__agora_api__ int agora_rtc_send_video_data ( connection_id_t conn_id,
const void * data_ptr,
size_t data_len,
video_frame_info_t * info_ptr )
extern

Send a video frame to all channels OR specific channel. All remote users in the channel will receive the video frame.

Note
All channels that you join will receive the video frame that you send unless you stop sending the local video to a specific channel.
Parameters
[in]conn_idConnection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection.
[in]data_ptrVideo frame buffer
[in]data_lenVideo frame buffer length (bytes)
[in]info_ptrVideo frame information. See video_frame_info_t.
Returns
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_set_bwe_param()

__agora_api__ int agora_rtc_set_bwe_param ( connection_id_t conn_id,
uint32_t min_bps,
uint32_t max_bps,
uint32_t start_bps )
extern

Sets bandwidth estimation (BWE) parameters.

Parameters
[in]conn_idConnection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection.
[in]min_bps: bwe min bps
[in]max_bps: bwe max bps
[in]start_bps: bwe start bps
Returns
:
  • = 0: Success
  • < 0: Failure

◆ agora_rtc_set_log_level()

__agora_api__ int agora_rtc_set_log_level ( rtc_log_level_e level)
extern

Sets the SDK log level. The SDK outputs messages at this level and all more severe levels.

Parameters
[in]levelLog level. See rtc_log_level_e.
Returns
  • 0: Success.
  • < 0: Failure.

◆ agora_rtc_set_params()

__agora_api__ int agora_rtc_set_params ( connection_id_t conn_id,
const char * params )
extern

Configures technical-preview or customized SDK functionality with JSON. JSON options are not public by default.

Parameters
[in]conn_idConnection identification. Set to CONNECTION_ID_ALL (0) for all connections.
[in]paramsConfiguration parameters represented as JSON.
Returns
:
  • = 0: Success
  • < 0: Failure