IoT SDK for Linux v1.8.0
Data Fields
agora_rtc_event_handler_t Struct Reference

#include <agora_rtc_api.h>

Data Fields

void(* on_join_channel_success )(connection_id_t conn_id, uint32_t uid, int elapsed_ms)
 
void(* on_connection_lost )(connection_id_t conn_id)
 
void(* on_rejoin_channel_success )(connection_id_t conn_id, uint32_t uid, int elapsed_ms)
 
void(* on_error )(connection_id_t conn_id, int code, const char *msg)
 
void(* on_user_joined )(connection_id_t conn_id, uint32_t uid, int elapsed_ms)
 
void(* on_user_offline )(connection_id_t conn_id, uint32_t uid, int reason)
 
void(* on_user_mute_audio )(connection_id_t conn_id, uint32_t uid, bool muted)
 
void(* on_user_mute_video )(connection_id_t conn_id, uint32_t uid, bool muted)
 
void(* on_audio_data )(connection_id_t conn_id, uint32_t uid, uint16_t sent_ts, const void *data_ptr, size_t data_len, const audio_frame_info_t *info_ptr)
 
void(* on_mixed_audio_data )(connection_id_t conn_id, const void *data_ptr, size_t data_len, const audio_frame_info_t *info_ptr)
 
void(* on_video_data )(connection_id_t conn_id, uint32_t uid, uint16_t sent_ts, const void *data_ptr, size_t data_len, const video_frame_info_t *info_ptr)
 
void(* on_target_bitrate_changed )(connection_id_t conn_id, uint32_t target_bps)
 
void(* on_key_frame_gen_req )(connection_id_t conn_id, uint32_t uid, video_stream_type_e stream_type)
 
void(* on_local_user_registered )(const char *uname, uint32_t uid)
 
void(* on_remote_user_registered )(const char *uname, uint32_t uid)
 
void(* on_token_privilege_will_expire )(connection_id_t conn_id, const char *token)
 

Detailed Description

Event handler.

Field Documentation

◆ on_audio_data

void(* on_audio_data) (connection_id_t conn_id, uint32_t uid, uint16_t sent_ts, const void *data_ptr, size_t data_len, const audio_frame_info_t *info_ptr)

Occurs when receiving the audio frame of a remote user in the channel.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[in]uidRemote user ID.
[in]sent_tsUnix timestamp (ms) of the time when the remote user calls agora_rtc_send_audio_data to send data.
[in]data_ptrAudio frame buffer.
[in]data_lenAudio frame buffer length (bytes).
[in]frame_infoAudio frame information.

◆ on_connection_lost

void(* on_connection_lost) (connection_id_t conn_id)

Occurs when the local user disconnects from an RTC channel.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.

◆ on_error

void(* on_error) (connection_id_t conn_id, int code, const char *msg)

Occurs when the SDK reports an error.

In most cases, it means the SDK cannot recover from the error and you must take actions accordingly.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[in]codeError code.
[in]msgError message.

◆ on_join_channel_success

void(* on_join_channel_success) (connection_id_t conn_id, uint32_t uid, int elapsed_ms)

Occurs when the local user joins an RTC channel successfully.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[in]uidUser ID.
[in]elapsed_msTime elapsed (ms) since the local user joins an RTC channel.

◆ on_key_frame_gen_req

void(* on_key_frame_gen_req) (connection_id_t conn_id, uint32_t uid, video_stream_type_e stream_type)

Occurs when a remote user requests a keyframe.

This callback notifies the sender to generate a new keyframe.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[in]uidRemote user ID.
[in]stream_typeStream type of the keyframe.

◆ on_local_user_registered

void(* on_local_user_registered) (const char *uname, uint32_t uid)

Occurs when initialization completes with a given user name.

Parameters
[in]unameLocal user name provided on initialization
[in]uidLocal user ID allocated by server

◆ on_mixed_audio_data

void(* on_mixed_audio_data) (connection_id_t conn_id, const void *data_ptr, size_t data_len, const audio_frame_info_t *info_ptr)

Occurs when receiving the mixed audio frame of local and remote users. This callback occurs every 20 ms.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[in]data_ptrAudio frame buffer.
[in]data_lenAudio frame buffer length (bytes).
[in]frame_infoAudio frame information.

◆ on_rejoin_channel_success

void(* on_rejoin_channel_success) (connection_id_t conn_id, uint32_t uid, int elapsed_ms)

Occurs when the local user rejoins an RTC channel successfully.

When the client disconnects from the RTC channel due to network issues, the SDK reconnects to the RTC channel and triggers this callback if successful.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[in]uidUser ID.
[in]elapsed_msTime elapsed (ms) since the local user rejoins an RTC channel.

◆ on_remote_user_registered

void(* on_remote_user_registered) (const char *uname, uint32_t uid)

Occurs when remote user registered.

Parameters
[in]unameRemote user name.
[in]uidRemote user ID.

◆ on_target_bitrate_changed

void(* on_target_bitrate_changed) (connection_id_t conn_id, uint32_t target_bps)

Occurs when network bandwidth change is detected. Use this callback to adjust your bitrate.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[in]target_bpsTarget value (bps) that you are recommended to set the bitrate to.

◆ on_token_privilege_will_expire

void(* on_token_privilege_will_expire) (connection_id_t conn_id, const char *token)

Occurs when the RTC token expires in 30 seconds.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[in]tokenThe RTC token which is about to expire.

If you specify the RTC token when calling agora_rtc_join_channel, the SDK triggers this callback if the RTC token expires in 30 seconds. You must request a new RTC token from your app server, and call agora_rtc_renew_token to pass the new RTC token to the SDK.

◆ on_user_joined

void(* on_user_joined) (connection_id_t conn_id, uint32_t uid, int elapsed_ms)

Occurs when a remote user joins an RTC channel successfully.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[in]uidRemote user ID.
[in]elapsed_msTime elapsed (ms) since the remote user joins the RTC channel.

◆ on_user_mute_audio

void(* on_user_mute_audio) (connection_id_t conn_id, uint32_t uid, bool muted)

Occurs when a remote user enables/disables sending audio.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[in]uidRemote user ID.
[in]mutedEnables/disables sending audio.
  • false: Enables sending audio.
  • true: Disables sending audio.

◆ on_user_mute_video

void(* on_user_mute_video) (connection_id_t conn_id, uint32_t uid, bool muted)

Occurs when a remote user enables/disables sending video.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[in]uidRemote user ID.
[in]mutedEnables/disables sending video.
  • false: Enables sending video.
  • true: Disables sending video.

◆ on_user_offline

void(* on_user_offline) (connection_id_t conn_id, uint32_t uid, int reason)

Occurs when a remote user leaves an RTC channel.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[in]uidRemote user ID.
[in]reasonReason why the remote user leaves the RTC channel. See user_offline_reason_e.

◆ on_video_data

void(* on_video_data) (connection_id_t conn_id, uint32_t uid, uint16_t sent_ts, const void *data_ptr, size_t data_len, const video_frame_info_t *info_ptr)

Occurs when receiving the video frame of a remote user in the channel.

Parameters
[in]conn_idConnection ID. A connection can correspond to multiple RTC channels. Use agora_rtc_create_connection to create a connection.
[in]uidRemote user ID.
[in]sent_tsTimestamp (ms) for sending data.
[in]data_ptrVideo frame buffer.
[in]data_lenVideo frame buffer length (bytes).
[in]frame_infoVideo frame info.

The documentation for this struct was generated from the following file: