IoT SDK for Linux v1.8.0
|
#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 |
#define __agora_api__ |
#define AGORA_CERTIFICATE_MAX_LEN 1024 |
#define AGORA_CREDENTIAL_MAX_LEN 256 |
#define AGORA_LICENSE_VALUE_LEN 32 |
#define AGORA_RTC_CHANNEL_NAME_MAX_LEN (64) |
#define AGORA_RTC_PRODUCT_ID_MAX_LEN (63) |
#define AGORA_RTC_USER_ID_MAX_LEN (255) |
#define AGORA_RTM_DATA_MAX_LEN (32 * 1024) |
#define AGORA_RTM_UID_MAX_LEN 64 |
#define CONNECTION_ID_ALL ((connection_id_t)0) |
All connections created by the SDK.
#define CONNECTION_ID_INVALID ((connection_id_t)-1) |
Invalid connection ID.
typedef uint32_t connection_id_t |
Connection ID.
enum 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 |
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. |
enum area_code_e |
IP areas.
enum audio_codec_type_e |
Type of the SDK built-in encoder and decoder.
enum audio_data_type_e |
Audio encoding type.
enum cloud_proxy_type_e |
Cloud proxy type.
enum network_event_type_e |
Network event type.
enum rtc_log_level_e |
Log level.
enum rtm_err_code_e |
enum rtm_event_type_e |
enum video_data_type_e |
enum video_frame_rate_e |
The number of video frames per second (FPS).
enum video_frame_type_e |
enum video_stream_type_e |
__agora_api__ int agora_rtc_config_log | ( | int | size_per_file, |
int | max_file_count | ||
) |
Configures the log file.
[in] | size_per_file | The 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_count | The 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. |
__agora_api__ int agora_rtc_create_connection | ( | connection_id_t * | conn_id | ) |
Creates a connection.
[out] | conn_id | Connection ID. A connection can correspond to multiple RTC channels. |
__agora_api__ int agora_rtc_destroy_connection | ( | connection_id_t | conn_id | ) |
Destroys a connection.
[in] | conn_id | Connection 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. |
__agora_api__ const char * agora_rtc_err_2_str | ( | int | err | ) |
Converts an error code to a string.
[in] | err | The error code. |
__agora_api__ int agora_rtc_fini | ( | void | ) |
Releases all resources allocated by the SDK.
__agora_api__ int agora_rtc_get_connection_info | ( | connection_id_t | conn_id, |
connection_info_t * | conn_info | ||
) |
Gets information about a connection.
[in] | conn_id | Connection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection. |
[out] | conn_info | Connection information. |
const char * agora_rtc_get_version | ( | void | ) |
Gets the SDK version.
__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.
[in] | app_id | Agora App ID. |
[in] | event_handler | A set of callbacks that handles SDK events. |
[in] | option | Service options. |
__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.
[in] | conn_id | Connection 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_name | Channel name. The length of a channel name must be less than 64 bytes. Supported character scopes are:
|
[in] | uid | User 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] | token | RTC Token for authentication.
|
[in] | options | RTC channel options. |
__agora_api__ int agora_rtc_leave_channel | ( | connection_id_t | conn_id | ) |
Leaves an RTC channel corresponding to a specified connection.
[in] | conn_id | Connection 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. |
__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_login_rtm | ( | const char * | rtm_uid, |
const char * | rtm_token, | ||
const agora_rtm_handler_t * | handler | ||
) |
Logs into RTM.
[in] | rtm_uid | RTM user ID. Length should be less than 64 bytes. Supported characters include:
|
[in] | rtm_token | RTM Token for authentication.
|
[in] | handler | RTM event handler. |
__agora_api__ int agora_rtc_logout_rtm | ( | void | ) |
Logs out of RTM.
__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.
[in] | conn_id | Connection 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] | mute | Enables/disables sending local audio data:
|
__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.
[in] | conn_id | Connection 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] | mute | Enables/disables sending local video data:
|
__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.
[in] | conn_id | Connection 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_uid | Remote user ID. Set this parameter to 0 to specify all remote users. |
[in] | mute | Enables/disables receiving remote audio data:
|
__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.
[in] | conn_id | Connection 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_uid | Remote user ID. Set this parameter to 0 to specify all remote users. |
[in] | mute | Enables/disables receiving remote video data:
|
__agora_api__ int agora_rtc_notify_network_event | ( | network_event_type_e | event | ) |
Sets the network state.
event | Network event type. |
__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.
[in] | conn_id | Connection 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] | token | Token for authentication. |
__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.
[in] | conn_id | Connection 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_uid | Remote user ID. Set this parameter to 0 to specify all remote users. |
[in] | stream_type | 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 | ||
) |
Sends an audio frame to one or multiple channels corresponding to a connection.
[in] | conn_id | Connection 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_ptr | Audio frame buffer. |
[in] | data_len | Audio frame buffer length (bytes). |
[in] | info_ptr | Audio frame information. |
__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.
on_rtm_event
callback before sending RTM message. The call frequency of this method must not exceed 180 within 3 seconds.[in] | rtm_uid | RTM user ID. |
[in] | msg_id | Message ID. |
[in] | msg | Message content. Only supports UTF-8 encoding. |
[in] | msg_len | Length of the message in bytes. Must not exceed 32 KB. |
__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.
[in] | conn_id | Connection 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_ptr | Audio frame buffer. |
[in] | data_len | Audio frame buffer length (bytes). |
[in] | info_ptr | Audio frame information. |
__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.
[in] | conn_id | Connection 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_bps | Minimal bitrate (bps). |
[in] | max_bps | Maximum bitrate (bps). |
[in] | start_bps | Starting bitrate (bps). |
__agora_api__ int agora_rtc_set_cloud_proxy | ( | cloud_proxy_type_e | type | ) |
Sets cloud proxy.
[in] | type | Sets the type of cloud proxy. |
__agora_api__ int agora_rtc_set_log_level | ( | rtc_log_level_e | level | ) |
Sets the log level.
[in] | level | Log level. |
__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.
[in] | params | Sets the parameter as a JSON string in the specified format. |