IoT SDK for Linux v1.8.0
Data Structures | Macros | Typedefs | Enumerations | Functions
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  rtc_channel_options_t
 
struct  connection_info_t
 
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_USER_ID_MAX_LEN   (255)
 
#define AGORA_RTC_PRODUCT_ID_MAX_LEN   (63)
 
#define AGORA_RTM_UID_MAX_LEN   64
 
#define AGORA_RTM_DATA_MAX_LEN   (32 * 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 uint32_t connection_id_t
 

Enumerations

enum  agora_err_code_e {
  ERR_OKAY = 0 , ERR_FAILED = 1 , ERR_NET_DOWN = 14 , ERR_JOIN_CHANNEL_REJECTED = 17 ,
  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_SEND_VIDEO_OVER_BANDWIDTH_LIMIT = 200 , ERR_AUDIO_DECODER_NOT_MATCH_AUDIO_FRAME = 201 , ERR_NO_AUDIO_DECODER_TO_HANDLE_AUDIO_FRAME = 202
}
 
enum  user_offline_reason_e { USER_OFFLINE_QUIT = 0 , USER_OFFLINE_DROPPED = 1 }
 
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_frame_rate_e {
  VIDEO_FRAME_RATE_FPS_1 = 1 , VIDEO_FRAME_RATE_FPS_7 = 7 , VIDEO_FRAME_RATE_FPS_10 = 10 , VIDEO_FRAME_RATE_FPS_15 = 15 ,
  VIDEO_FRAME_RATE_FPS_24 = 24 , VIDEO_FRAME_RATE_FPS_30 = 30 , VIDEO_FRAME_RATE_FPS_60 = 60
}
 
enum  video_stream_type_e { VIDEO_STREAM_HIGH = 0 , VIDEO_STREAM_LOW = 1 }
 
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 = 8 , AUDIO_DATA_TYPE_HEAAC = 9 , AUDIO_DATA_TYPE_PCM = 100 ,
  AUDIO_DATA_TYPE_GENERIC = 253
}
 
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_OC = 0x00000040 ,
  AREA_CODE_SA = 0x00000080 , AREA_CODE_AF = 0x00000100 , AREA_CODE_KR = 0x00000200 , AREA_CODE_OVS = 0xFFFFFFFE ,
  AREA_CODE_GLOB = (0xFFFFFFFF)
}
 
enum  cloud_proxy_type_e { CLOUD_PROXY_NONE = 0 , CLOUD_PROXY_UDP = 1 , CLOUD_PROXY_TCP = 3 , CLOUD_PROXY_AUTO = 100 }
 
enum  network_event_type_e { NETWORK_EVENT_DOWN = 0 , NETWORK_EVENT_UP , NETWORK_EVENT_CHANGE }
 
enum  rtm_event_type_e { RTM_EVENT_TYPE_LOGIN = 0 , RTM_EVENT_TYPE_KICKOFF = 1 , RTM_EVENT_TYPE_EXIT = 2 }
 
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_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__ 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_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_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_notify_network_event (network_event_type_e event)
 
__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_cloud_proxy (cloud_proxy_type_e type)
 
__agora_api__ int agora_rtc_set_params (const char *params)
 
__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, uint32_t msg_id, const void *msg, size_t msg_len)
 

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_PRODUCT_ID_MAX_LEN

#define AGORA_RTC_PRODUCT_ID_MAX_LEN   (63)

◆ AGORA_RTC_USER_ID_MAX_LEN

#define AGORA_RTC_USER_ID_MAX_LEN   (255)

◆ AGORA_RTM_DATA_MAX_LEN

#define AGORA_RTM_DATA_MAX_LEN   (32 * 1024)

◆ AGORA_RTM_UID_MAX_LEN

#define AGORA_RTM_UID_MAX_LEN   64

◆ CONNECTION_ID_ALL

#define CONNECTION_ID_ALL   ((connection_id_t)0)

All connections created by the SDK.

◆ CONNECTION_ID_INVALID

#define CONNECTION_ID_INVALID   ((connection_id_t)-1)

Invalid connection ID.

Typedef Documentation

◆ connection_id_t

typedef uint32_t connection_id_t

Connection ID.

Enumeration Type Documentation

◆ agora_err_code_e

Error code.

Enumerator
ERR_OKAY 

0: No error.

ERR_FAILED 

1: General error. Refer to the SDK log to diagnose the error.

ERR_NET_DOWN 

14: Network is unavailable. Check the network connection.

ERR_JOIN_CHANNEL_REJECTED 

17: Request to join channel is rejected. It occurs when the local user is already in the channel and tries to join the same channel again. You need to adjust your code to prevent a user from joining the same channel twice.

ERR_INVALID_APP_ID 

101: The Agora App ID is invalid. Check whether you used the correct Agora App ID from Agora console.

ERR_INVALID_CHANNEL_NAME 

102: The channel name is invalid. See agora_rtc_join_channel for valid channel names.

ERR_NO_SERVER_RESOURCES 

103: Fails to get server resources in the specified region.

ERR_LOOKUP_CHANNEL_REJECTED 

105: The Agora server has rejected the request to query a channel. Check whether your RTC Token is valid.

ERR_OPEN_CHANNEL_REJECTED 

107: The Agora server has rejected the request to create a channel. Check whether your RTC Token is valid.

ERR_TOKEN_EXPIRED 

109: Your RTC Token has expired. You need to generate a new RTC Token from your server and call agora_rtc_join_channel to rejoin the RTC channel with the new token.

ERR_INVALID_TOKEN 

110: The token is invalid. Check whether the user ID you used to generate RTC Token is the same as the user ID you use to join an RTC channel.

ERR_DYNAMIC_TOKEN_BUT_USE_STATIC_KEY 

115: This error occurs when you have enabled App Certificate in Agora console but still only use App ID in your code. Please specify an RTC token when calling agora_rtc_join_channel. When you enable App Certificate, you must use RTC token.

ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED 

119: Fails to switch channel role. You need to rejoin the channel.

ERR_DECRYPTION_FAILED 

120: Decryption fails. Check your encryption settings or try rejoining the channel.

ERR_OPEN_CHANNEL_INVALID_TICKET 

121: Fails to create an RTC channel. Please rejoin the RTC channel.

ERR_OPEN_CHANNEL_TRY_NEXT_VOS 

122: Agora is trying to switch to another server to create an RTC channel. There is no need for you to take actions.

ERR_CLIENT_IS_BANNED_BY_SERVER 

123: The client is banned by the Agora server. Check whether the user is kicked out.

ERR_SEND_VIDEO_OVER_BANDWIDTH_LIMIT 

200: The video frame sending speed exceeds bandwidth limit and may result in packet loss. Use on_target_bitrate_changed to adjust the bandwidth.

ERR_AUDIO_DECODER_NOT_MATCH_AUDIO_FRAME 

201: SDK decoding fails because the audio encoding type you have configured does not match the actual encoding type.

ERR_NO_AUDIO_DECODER_TO_HANDLE_AUDIO_FRAME 

202: SDK decoding fails because the SDK built-in encoder only supports Opus, G722, and PCMU.

◆ area_code_e

IP areas.

Enumerator
AREA_CODE_DEFAULT 

0x00000000: The same as AREA_CODE_GLOB.

AREA_CODE_CN 

0x00000001: Mainland China.

AREA_CODE_NA 

0x00000002: North America.

AREA_CODE_EU 

0x00000004: Europe.

AREA_CODE_AS 

0x00000008: Asia, excluding Mainland China.

AREA_CODE_JP 

0x00000010: Japan.

AREA_CODE_IN 

0x00000020: India.

AREA_CODE_OC 

0x00000040: Oceania.

AREA_CODE_SA 

0x00000080: South-America.

AREA_CODE_AF 

0x00000100: Africa.

AREA_CODE_KR 

0x00000200: South Korea.

AREA_CODE_OVS 

0xFFFFFFFE:Global excluding China.

AREA_CODE_GLOB 

0xFFFFFFFF: (Default) Global.

◆ audio_codec_type_e

Type of the SDK built-in encoder and decoder.

Enumerator
AUDIO_CODEC_DISABLED 

0: Disables the SDK built-in encoder and decoder.

AUDIO_CODEC_TYPE_OPUS 

1: Uses the SDK built-in Opus encoder and decoder. For Opus, the SDK supports a sampling frequency of 16 KHz or 48 KHz for a single channel.

AUDIO_CODEC_TYPE_G722 

2: Uses the SDK built-in G722 encoder and decoder. For G722, the SDK supports a sampling frequency of 16 KHz for a single channel.

AUDIO_CODEC_TYPE_G711A 

3: Uses the SDK built-in G711A encoder and decoder. For G711, the SDK supports a sampling frequency of 8 KHz for a single channel.

AUDIO_CODEC_TYPE_G711U 

4: Uses the SDK built-in G711U encoder and decoder. For G711, the SDK supports a sampling frequency of 8 KHz for a single channel.

◆ audio_data_type_e

Audio encoding type.

Enumerator
AUDIO_DATA_TYPE_OPUS 

1: Opus

AUDIO_DATA_TYPE_OPUSFB 

2: OPUSFB

AUDIO_DATA_TYPE_PCMA 

3: PCMA

AUDIO_DATA_TYPE_PCMU 

4: PCMU

AUDIO_DATA_TYPE_G722 

5: G722

AUDIO_DATA_TYPE_AACLC 

8: AAC-LC

AUDIO_DATA_TYPE_HEAAC 

9: HE-AAC

AUDIO_DATA_TYPE_PCM 

100: PCM

AUDIO_DATA_TYPE_GENERIC 

253: Generic

◆ cloud_proxy_type_e

Cloud proxy type.

Enumerator
CLOUD_PROXY_NONE 

0: No cloud proxy.

CLOUD_PROXY_UDP 

1: UDP cloud proxy.

CLOUD_PROXY_TCP 

3: TCP cloud proxy.

CLOUD_PROXY_AUTO 

100: Automatic mode. In this mode, the SDK first connects to SD-RTNâ„¢. If the connection fails, the SDK switches the connection to TCP cloud proxy.

◆ network_event_type_e

Network event type.

Enumerator
NETWORK_EVENT_DOWN 

0: Network connection fails. After connection failure, the SDK tries to rejoin the RTC channel and log into the RTM system.

NETWORK_EVENT_UP 

1: Network connection succeeds.

NETWORK_EVENT_CHANGE 

2: Network type changes. After change, the SDK tries to rejoin the RTC channel and log into the RTM system.

◆ rtc_log_level_e

Log level.

Enumerator
RTC_LOG_DEFAULT 

0: (Default) The same as RTC_LOG_NOTICE.

RTC_LOG_EMERG 

1: Output logs of the EMEG level. We recommend setting your log filter as this level.

RTC_LOG_ALERT 

2: Output logs of the EMEG and ALERT level. We recommend setting your log filter as this level.

RTC_LOG_CRIT 

3: Output logs of the EMEG, ALERT, and CRIT level. We recommend setting your log filter as this level.

RTC_LOG_ERROR 

4: Output logs of the EMEG, ALERT, CRIT, and ERROR level. We recommend setting your log filter as this level.

RTC_LOG_WARNING 

5: Output logs of the EMEG, ALERT, CRIT, ERROR, and WARNING level. We recommend setting your log filter as this level.

RTC_LOG_NOTICE 

6: Output logs of the EMEG, ALERT, CRIT, ERROR, WARNING, and NOTICE level. We recommend setting your log filter as this level.

RTC_LOG_INFO 

7: Output logs of the EMEG, ALERT, CRIT, ERROR, WARNING, NOTICE, and INFO level. We recommend setting your log filter as this level.

RTC_LOG_DEBUG 

8: Output all API logs. Set your log filter as DEBUG if you want to get the most complete log file.

◆ rtm_err_code_e

Enumerator
ERR_RTM_OK 

0: No error.

ERR_RTM_FAILED 

1: General error. You can diagnose issues with the SDK log.

ERR_RTM_LOGIN_REJECTED 

2: Login is rejected by the server. Check whether your App ID, RTM user ID, and RTM token are valid.

ERR_RTM_INVALID_RTM_UID 

3: The RTM user ID is invalid. Check whether the RTM user ID uses supported characters.

ERR_RTM_LOGIN_INVALID_TOKEN 

5: The RTM token is invalid. Check whether your RTM token is valid.

ERR_RTM_LOGIN_NOT_AUTHORIZED 

7: Unauthorized login. You must log into RTM before performing other operations.

ERR_RTM_INVALID_APP_ID 

101: Your App ID is invalid. Check whether your App ID is valid.

WARN_RTM_LOOKUP_CHANNEL_REJECTED 

105: The server rejected the request to look up RTM channel. Check whether your RTM token is valid.

ERR_RTM_TOKEN_EXPIRED 

109: The RTM token has expired. You need to generate a new RTM token from your app server.

ERR_RTM_INVALID_TOKEN 

110: The RTM token is invalid. Check whether your RTM token is valid.

◆ rtm_event_type_e

RTM RTM event type list.

Enumerator
RTM_EVENT_TYPE_LOGIN 

0: The user successfully logs into RTM.

RTM_EVENT_TYPE_KICKOFF 

1: The user is kicked out.

RTM_EVENT_TYPE_EXIT 

2: The user successfully logs out of RTM.

◆ user_offline_reason_e

Reasons that remote users go offline.

Enumerator
USER_OFFLINE_QUIT 

0: The remote user leaves the channel.

USER_OFFLINE_DROPPED 

1: The remote user drops offline because of timeout.

◆ video_data_type_e

Video encoding type.

Enumerator
VIDEO_DATA_TYPE_YUV420 

0: YUV420 (Not yet 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_rate_e

The number of video frames per second (FPS).

Enumerator
VIDEO_FRAME_RATE_FPS_1 

1: 1 fps.

VIDEO_FRAME_RATE_FPS_7 

7: 7 fps.

VIDEO_FRAME_RATE_FPS_10 

10: 10 fps.

VIDEO_FRAME_RATE_FPS_15 

15: 15 fps.

VIDEO_FRAME_RATE_FPS_24 

24: 24 fps.

VIDEO_FRAME_RATE_FPS_30 

30: 30 fps.

VIDEO_FRAME_RATE_FPS_60 

60: 60 fps. Applies to Windows and macOS only.

◆ video_frame_type_e

Video frame type.

Enumerator
VIDEO_FRAME_AUTO_DETECT 

0: Unknown frame type. The SDK automatically detects the frame type.

VIDEO_FRAME_KEY 

3: key frame.

VIDEO_FRAME_DELTA 

4: Delta frame, such as P frame.

◆ 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 
)

Configures the log file.

Parameters
[in]size_per_fileThe size (bytes) of each log file. The value range is [0, 10*1024*1024 (10 MB)] and the default value is 1*1024*1024 (1 MB). Set this parameter to 0 to disable logs.
[in]max_file_countThe maximum number of log file numbers. The value range is [0, 100] and the default value is 10. Set this parameter to 0 to disable logs.
Returns
  • 0: Success.
  • <0: Failure.

◆ agora_rtc_create_connection()

__agora_api__ int agora_rtc_create_connection ( connection_id_t conn_id)

Creates a connection.

Parameters
[out]conn_idConnection ID. A connection can correspond to multiple RTC channels.
Returns
  • 0: Success.
  • <0: Failure.

◆ agora_rtc_destroy_connection()

__agora_api__ int agora_rtc_destroy_connection ( connection_id_t  conn_id)

Destroys a connection.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection. Set this parameter to CONNECTION_ID_ALL to specify all current connections.
Returns
  • 0: Success.
  • <0: Failure.

◆ agora_rtc_err_2_str()

__agora_api__ const char * agora_rtc_err_2_str ( int  err)

Converts an error code to a string.

Note
You do not have to release the string after use.
Parameters
[in]errThe error code.
Returns
The string.

◆ agora_rtc_fini()

__agora_api__ int agora_rtc_fini ( void  )

Releases all resources allocated by the SDK.

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 
)

Gets information about a connection.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[out]conn_infoConnection information.
Returns
  • 0: Success.
  • <0: Failure.

◆ agora_rtc_get_version()

const char * agora_rtc_get_version ( void  )

Gets the SDK version.

Returns
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 
)

Initializes the SDK.

Note
  • In each process, you can only initialize the SDK once.
  • Each time you initialize the SDK, the SDK creates a new folder in your specified log location to save the log files. Agora recommends that you clean the log folder each time you initialize the SDK.
Parameters
[in]app_idAgora App ID.
[in]event_handlerA set of callbacks that handles SDK events.
[in]optionService options.
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 
)

Joins an RTC channel corresponding to a specified connection.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection. Set this parameter to CONNECTION_ID_ALL to specify all current connections.
[in]channel_nameChannel name. The length of a channel name must 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]uidUser ID, which is 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 non-zero uid in the on_join_channel_success callback. You must save the returned uid.
[in]tokenRTC Token for authentication.
  • If you enable App ID authentication in your Agora project, set this parameter to NULL.
  • If you enable App ID + Token authentication in your Agora project, set this parameter to the RTC token generated on your app server.
[in]optionsRTC channel options.
Returns
  • 0: Success.
  • <0: Failure.

◆ agora_rtc_leave_channel()

__agora_api__ int agora_rtc_leave_channel ( connection_id_t  conn_id)

Leaves an RTC channel corresponding to a specified connection.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection. Set this parameter to CONNECTION_ID_ALL to specify all current connections.
Returns
  • 0: Success.
  • <0: Failure.

◆ agora_rtc_license_gen_credential()

__agora_api__ int agora_rtc_license_gen_credential ( char *  credential,
unsigned int *  credential_len 
)

◆ agora_rtc_license_verify()

__agora_api__ int agora_rtc_license_verify ( const char *  certificate,
int  certificate_len,
const char *  credential,
int  credential_len 
)

◆ 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 
)

Logs into RTM.

Parameters
[in]rtm_uidRTM user ID. Length should be less than 64 bytes. Supported characters include:
  • 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 for authentication.
  • If you enable App ID authentication in your Agora project, set this parameter to NULL.
  • If you enable App ID + Token authentication in your Agora project, set this parameter to the RTM token generated on your app server.
[in]handlerRTM event handler.
Returns
  • 0: Success.
  • <0: Failure.

◆ agora_rtc_logout_rtm()

__agora_api__ int agora_rtc_logout_rtm ( void  )

Logs out of RTM.

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 
)

Enables/disables sending local audio data to one or multiple channels corresponding to a connection.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection. Set this parameter to CONNECTION_ID_ALL to specify all current connections.
[in]muteEnables/disables sending local audio data:
  • true: Disable.
  • false: Enable.
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 
)

Enables/disables sending local video data to one or multiple channels corresponding to a connection.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection. Set this parameter to CONNECTION_ID_ALL to specify all current connections.
[in]muteEnables/disables sending local video data:
  • true: Disable.
  • false: Enable.
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 
)

Enables/disables receiving remote audio data from one or multiple channels corresponding to a connection.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection. Set this parameter to CONNECTION_ID_ALL to specify all current connections.
[in]remote_uidRemote user ID. Set this parameter to 0 to specify all remote users.
[in]muteEnables/disables receiving remote audio data:
  • true: Disable.
  • false: Enable.
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 
)

Enables/disables receiving remote video data from one or multiple channels corresponding to a connection.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection. Set this parameter to CONNECTION_ID_ALL to specify all current connections.
[in]remote_uidRemote user ID. Set this parameter to 0 to specify all remote users.
[in]muteEnables/disables receiving remote video data:
  • true: Disable.
  • false: Enable.
Returns
  • 0: Success.
  • <0: Failure.

◆ agora_rtc_notify_network_event()

__agora_api__ int agora_rtc_notify_network_event ( network_event_type_e  event)

Sets the network state.

Parameters
eventNetwork event type.
Returns
  • 0: Success.
  • <0: Failure.

◆ agora_rtc_renew_token()

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

Renews an RTC token for one or multiple channels corresponding to a connection.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection. Set this parameter to CONNECTION_ID_ALL to specify all current connections.
[in]tokenToken for authentication.
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 
)

Requests a keyframe from a remote user in one or multiple channels corresponding to a connection.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection. Set this parameter to CONNECTION_ID_ALL to specify all current connections.
[in]remote_uidRemote user ID. Set this parameter to 0 to specify all remote users.
[in]stream_typeStream type.
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 
)

Sends an audio frame to one or multiple channels corresponding to a connection.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection. Set this parameter to CONNECTION_ID_ALL to specify all current connections.
[in]data_ptrAudio frame buffer.
[in]data_lenAudio frame buffer length (bytes).
[in]info_ptrAudio frame information.
Returns
  • 0: Success.
  • <0: Failure.

◆ agora_rtc_send_rtm_data()

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

Sends an RTM message.

Note
You must log into RTM and receive the on_rtm_event callback before sending RTM message. The call frequency of this method must not exceed 180 within 3 seconds.
Parameters
[in]rtm_uidRTM user ID.
[in]msg_idMessage ID.
[in]msgMessage content. Only supports UTF-8 encoding.
[in]msg_lenLength of the message in bytes. Must not exceed 32 KB.
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 
)

Sends a video frame to one or multiple channels corresponding to a connection.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection. Set this parameter to CONNECTION_ID_ALL to specify all current connections.
[in]data_ptrAudio frame buffer.
[in]data_lenAudio frame buffer length (bytes).
[in]info_ptrAudio frame information.
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 
)

Sets network bandwidth estimation (BWE) parameters.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection. Set this parameter to CONNECTION_ID_ALL to specify all current connections.
[in]min_bpsMinimal bitrate (bps).
[in]max_bpsMaximum bitrate (bps).
[in]start_bpsStarting bitrate (bps).
Returns
:
  • 0: Success.
  • <0: Failure.

◆ agora_rtc_set_cloud_proxy()

__agora_api__ int agora_rtc_set_cloud_proxy ( cloud_proxy_type_e  type)

Sets cloud proxy.

Parameters
[in]typeSets the type of cloud proxy.
Returns
:
  • 0: Success.
  • <0: Failure.

◆ agora_rtc_set_log_level()

__agora_api__ int agora_rtc_set_log_level ( rtc_log_level_e  level)

Sets the log level.

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

◆ agora_rtc_set_params()

__agora_api__ int agora_rtc_set_params ( const char *  params)

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

The JSON options are not public by default. Agora is working on making commonly used JSON options public in a standard way.

Parameters
[in]paramsSets the parameter as a JSON string in the specified format.
Returns
:
  • 0: Success.
  • <0: Failure.