Agora RTC Objective-C API Reference  Refactor
Public Member Functions
IRtcEngineEventHandlerEx Class Reference

Inherits IRtcEngineEventHandler.

Public Member Functions

virtual void onJoinChannelSuccess (const RtcConnection &connection, int elapsed)
 
virtual void onRejoinChannelSuccess (const RtcConnection &connection, int elapsed)
 
virtual void onAudioQuality (const RtcConnection &connection, uid_t remoteUid, int quality, unsigned short delay, unsigned short lost)
 
virtual void onAudioVolumeIndication (const RtcConnection &connection, const AudioVolumeInfo *speakers, unsigned int speakerNumber, int totalVolume)
 
virtual void onLeaveChannel (const RtcConnection &connection, const RtcStats &stats)
 
virtual void onRtcStats (const RtcConnection &connection, const RtcStats &stats)
 
virtual void onNetworkQuality (const RtcConnection &connection, uid_t remoteUid, int txQuality, int rxQuality)
 
virtual void onIntraRequestReceived (const RtcConnection &connection)
 
virtual void onFirstLocalVideoFrame (const RtcConnection &connection, int width, int height, int elapsed)
 
virtual void onFirstLocalVideoFramePublished (const RtcConnection &connection, int elapsed)
 
virtual void onFirstRemoteVideoDecoded (const RtcConnection &connection, uid_t remoteUid, int width, int height, int elapsed)
 
virtual void onVideoSizeChanged (const RtcConnection &connection, VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation)
 
virtual void onLocalVideoStateChanged (const RtcConnection &connection, LOCAL_VIDEO_STREAM_STATE state, LOCAL_VIDEO_STREAM_ERROR errorCode)
 
virtual void onRemoteVideoStateChanged (const RtcConnection &connection, uid_t remoteUid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed)
 
virtual void onFirstRemoteVideoFrame (const RtcConnection &connection, uid_t remoteUid, int width, int height, int elapsed)
 
virtual void onUserJoined (const RtcConnection &connection, uid_t remoteUid, int elapsed)
 
virtual void onUserOffline (const RtcConnection &connection, uid_t remoteUid, USER_OFFLINE_REASON_TYPE reason)
 
virtual void onUserMuteAudio (const RtcConnection &connection, uid_t remoteUid, bool muted) 1
 
virtual void onUserMuteVideo (const RtcConnection &connection, uid_t remoteUid, bool muted)
 
virtual void onUserEnableVideo (const RtcConnection &connection, uid_t remoteUid, bool enabled) 1
 
virtual void onUserEnableLocalVideo (const RtcConnection &connection, uid_t remoteUid, bool enabled) 1
 
virtual void onUserStateChanged (const RtcConnection &connection, uid_t remoteUid, uint32_t state)
 
virtual void onLocalAudioStats (const RtcConnection &connection, const LocalAudioStats &stats)
 
virtual void onRemoteAudioStats (const RtcConnection &connection, const RemoteAudioStats &stats)
 
virtual void onLocalVideoStats (const RtcConnection &connection, const LocalVideoStats &stats)
 
virtual void onRemoteVideoStats (const RtcConnection &connection, const RemoteVideoStats &stats)
 
virtual void onConnectionLost (const RtcConnection &connection)
 
virtual void onConnectionInterrupted (const RtcConnection &connection)
 
virtual void onConnectionBanned (const RtcConnection &connection)
 
virtual void onStreamMessage (const RtcConnection &connection, uid_t remoteUid, int streamId, const char *data, size_t length, uint64_t sentTs)
 
virtual void onStreamMessageError (const RtcConnection &connection, uid_t remoteUid, int streamId, int code, int missed, int cached)
 
virtual void onRequestToken (const RtcConnection &connection)
 
virtual void onLicenseValidationFailure (const RtcConnection &connection, LICENSE_ERROR_TYPE reason)
 
virtual void onTokenPrivilegeWillExpire (const RtcConnection &connection, const char *token)
 
virtual void onFirstLocalAudioFramePublished (const RtcConnection &connection, int elapsed)
 
virtual void onFirstRemoteAudioFrame (const RtcConnection &connection, uid_t userId, int elapsed)
 
virtual void onFirstRemoteAudioDecoded (const RtcConnection &connection, uid_t uid, int elapsed)
 
virtual void onLocalAudioStateChanged (const RtcConnection &connection, LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_ERROR error)
 
virtual void onRemoteAudioStateChanged (const RtcConnection &connection, uid_t remoteUid, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed)
 
virtual void onActiveSpeaker (const RtcConnection &connection, uid_t uid)
 
virtual void onClientRoleChanged (const RtcConnection &connection, CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole, const ClientRoleOptions &newRoleOptions)
 
virtual void onClientRoleChangeFailed (const RtcConnection &connection, CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole)
 
virtual void onRemoteAudioTransportStats (const RtcConnection &connection, uid_t remoteUid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate)
 
virtual void onRemoteVideoTransportStats (const RtcConnection &connection, uid_t remoteUid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate)
 
virtual void onConnectionStateChanged (const RtcConnection &connection, CONNECTION_STATE_TYPE state, CONNECTION_CHANGED_REASON_TYPE reason)
 
virtual void onWlAccMessage (const RtcConnection &connection, WLACC_MESSAGE_REASON reason, WLACC_SUGGEST_ACTION action, const char *wlAccMsg)
 
virtual void onWlAccStats (const RtcConnection &connection, WlAccStats currentStats, WlAccStats averageStats)
 
virtual void onNetworkTypeChanged (const RtcConnection &connection, NETWORK_TYPE type)
 
virtual void onEncryptionError (const RtcConnection &connection, ENCRYPTION_ERROR_TYPE errorType)
 
virtual void onUploadLogResult (const RtcConnection &connection, const char *requestId, bool success, UPLOAD_ERROR_REASON reason)
 
virtual void onUserAccountUpdated (const RtcConnection &connection, uid_t remoteUid, const char *userAccount)
 
virtual void onSnapshotTaken (const RtcConnection &connection, uid_t uid, const char *filePath, int width, int height, int errCode)
 
virtual void onVideoRenderingTracingResult (const RtcConnection &connection, uid_t uid, MEDIA_TRACE_EVENT currentEvent, VideoRenderingTracingInfo tracingInfo)
 
virtual void onJoinChannelSuccess (const char *channel, uid_t uid, int elapsed)
 
virtual void onRejoinChannelSuccess (const char *channel, uid_t uid, int elapsed)
 
virtual void onAudioQuality (uid_t uid, int quality, unsigned short delay, unsigned short lost)
 
virtual void onAudioVolumeIndication (const AudioVolumeInfo *speakers, unsigned int speakerNumber, int totalVolume)
 
virtual void onLeaveChannel (const RtcStats &stats)
 
virtual void onRtcStats (const RtcStats &stats)
 
virtual void onNetworkQuality (uid_t uid, int txQuality, int rxQuality)
 
virtual void onIntraRequestReceived ()
 
virtual void onFirstLocalVideoFrame (VIDEO_SOURCE_TYPE source, int width, int height, int elapsed)
 
virtual void onFirstLocalVideoFramePublished (VIDEO_SOURCE_TYPE source, int elapsed)
 
virtual void onFirstRemoteVideoDecoded (uid_t uid, int width, int height, int elapsed) 1
 
virtual void onVideoSizeChanged (VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation)
 
virtual void onLocalVideoStateChanged (VIDEO_SOURCE_TYPE source, LOCAL_VIDEO_STREAM_STATE state, LOCAL_VIDEO_STREAM_ERROR error)
 
virtual void onRemoteVideoStateChanged (uid_t uid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed)
 
virtual void onFirstRemoteVideoFrame (uid_t userId, int width, int height, int elapsed)
 
virtual void onUserJoined (uid_t uid, int elapsed)
 
virtual void onUserOffline (uid_t uid, USER_OFFLINE_REASON_TYPE reason)
 
virtual void onUserMuteAudio (uid_t uid, bool muted)
 
virtual void onUserMuteVideo (uid_t userId, bool muted)
 
virtual void onUserEnableVideo (uid_t uid, bool enabled) 1
 
virtual void onUserEnableLocalVideo (uid_t uid, bool enabled) 1
 
virtual void onUserStateChanged (uid_t uid, uint32_t state)
 
virtual void onLocalAudioStats (const LocalAudioStats &stats)
 
virtual void onRemoteAudioStats (const RemoteAudioStats &stats)
 
virtual void onLocalVideoStats (VIDEO_SOURCE_TYPE source, const LocalVideoStats &stats)
 
virtual void onRemoteVideoStats (const RemoteVideoStats &stats)
 
virtual void onConnectionLost ()
 
virtual void onConnectionInterrupted ()
 
virtual void onConnectionBanned ()
 
virtual void onStreamMessage (uid_t userId, int streamId, const char *data, size_t length, uint64_t sentTs)
 
virtual void onStreamMessageError (uid_t userId, int streamId, int code, int missed, int cached)
 
virtual void onRequestToken ()
 
virtual void onTokenPrivilegeWillExpire (const char *token)
 
virtual void onLicenseValidationFailure (LICENSE_ERROR_TYPE error)
 
virtual void onFirstLocalAudioFramePublished (int elapsed)
 
virtual void onFirstRemoteAudioFrame (uid_t uid, int elapsed)
 
virtual void onFirstRemoteAudioDecoded (uid_t uid, int elapsed)
 
virtual void onLocalAudioStateChanged (LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_ERROR error)
 
virtual void onRemoteAudioStateChanged (uid_t uid, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed)
 
virtual void onActiveSpeaker (uid_t userId)
 
virtual void onClientRoleChanged (CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole, const ClientRoleOptions &newRoleOptions)
 
virtual void onClientRoleChangeFailed (CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole)
 
virtual void onRemoteAudioTransportStats (uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate)
 
virtual void onRemoteVideoTransportStats (uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate)
 
virtual void onConnectionStateChanged (CONNECTION_STATE_TYPE state, CONNECTION_CHANGED_REASON_TYPE reason)
 
virtual void onWlAccMessage (WLACC_MESSAGE_REASON reason, WLACC_SUGGEST_ACTION action, const char *wlAccMsg)
 
virtual void onWlAccStats (WlAccStats currentStats, WlAccStats averageStats)
 
virtual void onNetworkTypeChanged (NETWORK_TYPE type)
 
virtual void onEncryptionError (ENCRYPTION_ERROR_TYPE errorType)
 
virtual void onUploadLogResult (const char *requestId, bool success, UPLOAD_ERROR_REASON reason)
 
virtual void onUserAccountUpdated (uid_t uid, const char *userAccount)
 
virtual void onAudioSubscribeStateChanged (const char *channel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)
 
virtual void onVideoSubscribeStateChanged (const char *channel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)
 
virtual void onAudioPublishStateChanged (const char *channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState)
 
virtual void onVideoPublishStateChanged (VIDEO_SOURCE_TYPE source, const char *channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState)
 
virtual void onSnapshotTaken (uid_t uid, const char *filePath, int width, int height, int errCode)
 
virtual void onVideoRenderingTracingResult (uid_t uid, MEDIA_TRACE_EVENT currentEvent, VideoRenderingTracingInfo tracingInfo)
 
virtual void onJoinChannelSuccess (const char *channel, uid_t uid, int elapsed)
 
virtual void onRejoinChannelSuccess (const char *channel, uid_t uid, int elapsed)
 
virtual void onProxyConnected (const char *channel, uid_t uid, PROXY_TYPE proxyType, const char *localProxyIp, int elapsed)
 
virtual void onError (int err, const char *msg)
 
virtual void onAudioQuality (uid_t uid, int quality, unsigned short delay, unsigned short lost)
 
virtual void onLastmileProbeResult (const LastmileProbeResult &result)
 
virtual void onAudioVolumeIndication (const AudioVolumeInfo *speakers, unsigned int speakerNumber, int totalVolume)
 
virtual void onLeaveChannel (const RtcStats &stats)
 
virtual void onRtcStats (const RtcStats &stats)
 
virtual void onAudioDeviceStateChanged (const char *deviceId, int deviceType, int deviceState)
 
virtual void onVideoDeviceStateChanged (const char *deviceId, int deviceType, int deviceState)
 
virtual void onNetworkQuality (uid_t uid, int txQuality, int rxQuality)
 
virtual void onUplinkNetworkInfoUpdated (const UplinkNetworkInfo &info)
 
virtual void onDownlinkNetworkInfoUpdated (const DownlinkNetworkInfo &info)
 
virtual void onLastmileQuality (int quality)
 
virtual void onFirstLocalVideoFrame (VIDEO_SOURCE_TYPE source, int width, int height, int elapsed)
 
virtual void onFirstLocalVideoFramePublished (VIDEO_SOURCE_TYPE source, int elapsed)
 
virtual void onFirstRemoteVideoDecoded (uid_t uid, int width, int height, int elapsed) 1
 
virtual void onVideoSizeChanged (VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation)
 
virtual void onLocalVideoStateChanged (VIDEO_SOURCE_TYPE source, LOCAL_VIDEO_STREAM_STATE state, LOCAL_VIDEO_STREAM_ERROR error)
 
virtual void onRemoteVideoStateChanged (uid_t uid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed)
 
virtual void onFirstRemoteVideoFrame (uid_t userId, int width, int height, int elapsed)
 
virtual void onUserJoined (uid_t uid, int elapsed)
 
virtual void onUserOffline (uid_t uid, USER_OFFLINE_REASON_TYPE reason)
 
virtual void onUserMuteAudio (uid_t uid, bool muted)
 
virtual void onUserMuteVideo (uid_t userId, bool muted)
 
virtual void onUserEnableVideo (uid_t uid, bool enabled) 1
 
virtual void onUserStateChanged (uid_t uid, uint32_t state)
 
virtual void onUserEnableLocalVideo (uid_t uid, bool enabled) 1
 
virtual void onApiCallExecuted (int err, const char *api, const char *result) 1
 
virtual void onLocalAudioStats (const LocalAudioStats &stats)
 
virtual void onRemoteAudioStats (const RemoteAudioStats &stats)
 
virtual void onLocalVideoStats (VIDEO_SOURCE_TYPE source, const LocalVideoStats &stats)
 
virtual void onRemoteVideoStats (const RemoteVideoStats &stats)
 
virtual void onCameraReady ()
 
virtual void onCameraFocusAreaChanged (int x, int y, int width, int height)
 
virtual void onCameraExposureAreaChanged (int x, int y, int width, int height)
 
virtual void onVideoStopped ()
 
virtual void onRhythmPlayerStateChanged (RHYTHM_PLAYER_STATE_TYPE state, RHYTHM_PLAYER_ERROR_TYPE errorCode)
 
virtual void onStreamMessage (uid_t userId, int streamId, const char *data, size_t length, uint64_t sentTs)
 
virtual void onStreamMessageError (uid_t userId, int streamId, int code, int missed, int cached)
 
virtual void onTokenPrivilegeWillExpire (const char *token)
 
virtual void onLicenseValidationFailure (LICENSE_ERROR_TYPE error)
 
virtual void onFirstLocalAudioFramePublished (int elapsed)
 
virtual void onFirstRemoteAudioFrame (uid_t uid, int elapsed)
 
virtual void onFirstRemoteAudioDecoded (uid_t uid, int elapsed)
 
virtual void onLocalAudioStateChanged (LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_ERROR error)
 
virtual void onRemoteAudioStateChanged (uid_t uid, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed)
 
virtual void onActiveSpeaker (uid_t userId)
 
virtual void onContentInspectResult (media::CONTENT_INSPECT_RESULT result)
 
virtual void onSnapshotTaken (uid_t uid, const char *filePath, int width, int height, int errCode)
 
virtual void onClientRoleChanged (CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole, const ClientRoleOptions &newRoleOptions)
 
virtual void onClientRoleChangeFailed (CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole)
 
virtual void onAudioDeviceVolumeChanged (MEDIA_DEVICE_TYPE deviceType, int volume, bool muted)
 
virtual void onRtmpStreamingStateChanged (const char *url, RTMP_STREAM_PUBLISH_STATE state, RTMP_STREAM_PUBLISH_ERROR_TYPE errCode)
 
virtual void onRtmpStreamingEvent (const char *url, RTMP_STREAMING_EVENT eventCode)
 
virtual void onTranscodingUpdated ()
 
virtual void onAudioRoutingChanged (int routing)
 
virtual void onChannelMediaRelayStateChanged (int state, int code)
 
virtual void onChannelMediaRelayEvent (int code)
 
virtual void onLocalPublishFallbackToAudioOnly (bool isFallbackOrRecover)
 
virtual void onRemoteSubscribeFallbackToAudioOnly (uid_t uid, bool isFallbackOrRecover)
 
virtual void onRemoteAudioTransportStats (uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate)
 
virtual void onRemoteVideoTransportStats (uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate)
 
virtual void onConnectionStateChanged (CONNECTION_STATE_TYPE state, CONNECTION_CHANGED_REASON_TYPE reason)
 
virtual void onWlAccMessage (WLACC_MESSAGE_REASON reason, WLACC_SUGGEST_ACTION action, const char *wlAccMsg)
 
virtual void onWlAccStats (WlAccStats currentStats, WlAccStats averageStats)
 
virtual void onNetworkTypeChanged (NETWORK_TYPE type)
 
virtual void onEncryptionError (ENCRYPTION_ERROR_TYPE errorType)
 
virtual void onPermissionError (PERMISSION_TYPE permissionType)
 
virtual void onLocalUserRegistered (uid_t uid, const char *userAccount)
 
virtual void onUserInfoUpdated (uid_t uid, const UserInfo &info)
 
virtual void onUploadLogResult (const char *requestId, bool success, UPLOAD_ERROR_REASON reason)
 
virtual void onAudioSubscribeStateChanged (const char *channel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)
 
virtual void onVideoSubscribeStateChanged (const char *channel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)
 
virtual void onAudioPublishStateChanged (const char *channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState)
 
virtual void onVideoPublishStateChanged (VIDEO_SOURCE_TYPE source, const char *channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState)
 
virtual void onExtensionEvent (const char *provider, const char *extension, const char *key, const char *value)
 
virtual void onExtensionStarted (const char *provider, const char *extension)
 
virtual void onExtensionStopped (const char *provider, const char *extension)
 
virtual void onExtensionError (const char *provider, const char *extension, int error, const char *message)
 
virtual void onUserAccountUpdated (uid_t uid, const char *userAccount)
 
virtual void onVideoRenderingTracingResult (uid_t uid, MEDIA_TRACE_EVENT currentEvent, VideoRenderingTracingInfo tracingInfo)
 

Member Function Documentation

◆ eventHandlerType() [1/2]

virtual const char* eventHandlerType ( ) const
inlinevirtual

Reimplemented from IRtcEngineEventHandler.

◆ onJoinChannelSuccess() [1/3]

virtual void onJoinChannelSuccess ( const RtcConnection connection,
int  elapsed 
)
inlinevirtual

Occurs when a user joins a channel.

This callback notifies the application that a user joins a specified channel.

Parameters
connectionThe RtcConnection object.
elapsedThe time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

◆ onRejoinChannelSuccess() [1/3]

virtual void onRejoinChannelSuccess ( const RtcConnection connection,
int  elapsed 
)
inlinevirtual

Occurs when a user rejoins the channel.

When a user loses connection with the server because of network problems, the SDK automatically tries to reconnect and triggers this callback upon reconnection.

Parameters
connectionThe RtcConnection object.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until this callback is triggered.

◆ onAudioQuality() [1/3]

virtual void onAudioQuality ( const RtcConnection connection,
uid_t  remoteUid,
int  quality,
unsigned short  delay,
unsigned short  lost 
)
inlinevirtual

Reports the statistics of the audio stream from each remote user/broadcaster.

Deprecated:
This callback is deprecated. Use onRemoteAudioStats instead.

The SDK triggers this callback once every two seconds to report the audio quality of each remote user/host sending an audio stream. If a channel has multiple remote users/hosts sending audio streams, the SDK triggers this callback as many times.

Parameters
connectionThe RtcConnection object.
remoteUidThe user ID of the remote user sending the audio stream.
qualityThe audio quality of the user: QUALITY_TYPE
delayThe network delay (ms) from the sender to the receiver, including the delay caused by audio sampling pre-processing, network transmission, and network jitter buffering.
lostThe audio packet loss rate (%) from the sender to the receiver.

◆ onAudioVolumeIndication() [1/3]

virtual void onAudioVolumeIndication ( const RtcConnection connection,
const AudioVolumeInfo speakers,
unsigned int  speakerNumber,
int  totalVolume 
)
inlinevirtual

Reports the volume information of users.

By default, this callback is disabled. You can enable it by calling enableAudioVolumeIndication. Once this callback is enabled and users send streams in the channel, the SDK triggers the onAudioVolumeIndication callback at the time interval set in enableAudioVolumeIndication. The SDK triggers two independent onAudioVolumeIndication callbacks simultaneously, which separately report the volume information of the local user who sends a stream and the remote users (up to three) whose instantaneous volume is the highest.

Note
After you enable this callback, calling muteLocalAudioStream affects the SDK's behavior as follows:
  • If the local user stops publishing the audio stream, the SDK stops triggering the local user's callback.
  • 20 seconds after a remote user whose volume is one of the three highest stops publishing the audio stream, the callback excludes this user's information; 20 seconds after all remote users stop publishing audio streams, the SDK stops triggering the callback for remote users.
Parameters
connectionThe RtcConnection object.
speakersThe volume information of the users, see AudioVolumeInfo. An empty speakers array in the callback indicates that no remote user is in the channel or sending a stream at the moment.
speakerNumberThe total number of speakers.
  • In the local user's callback, when the local user sends a stream, speakerNumber is 1.
  • In the callback for remote users, the value range of speakerNumber is [0,3]. If the number of remote users who send streams is greater than or equal to three, the value of speakerNumber is 3.
totalVolumeThe volume of the speaker. The value ranges between 0 (lowest volume) and 255 (highest volume).
  • In the local user's callback, totalVolume is the volume of the local user who sends a stream.
  • In the remote users' callback, totalVolume is the sum of all remote users (up to three) whose instantaneous volume is the highest. If the user calls startAudioMixing, totalVolume is the volume after audio mixing.

◆ onLeaveChannel() [1/3]

virtual void onLeaveChannel ( const RtcConnection connection,
const RtcStats stats 
)
inlinevirtual

Occurs when a user leaves a channel.

This callback notifies the app that the user leaves the channel by calling leaveChannel. From this callback, the app can get information such as the call duration and quality statistics.

Parameters
connectionThe RtcConnection object.
statsThe statistics on the call: RtcStats.

◆ onRtcStats() [1/3]

virtual void onRtcStats ( const RtcConnection connection,
const RtcStats stats 
)
inlinevirtual

Reports the statistics of the current call.

The SDK triggers this callback once every two seconds after the user joins the channel.

Parameters
connectionThe RtcConnection object.
statsThe statistics of the current call: RtcStats.

◆ onNetworkQuality() [1/3]

virtual void onNetworkQuality ( const RtcConnection connection,
uid_t  remoteUid,
int  txQuality,
int  rxQuality 
)
inlinevirtual

Reports the last mile network quality of each user in the channel.

This callback reports the last mile network conditions of each user in the channel. Last mile refers to the connection between the local device and Agora's edge server.

The SDK triggers this callback once every two seconds. If a channel includes multiple users, the SDK triggers this callback as many times.

Note
txQuality is UNKNOWN when the user is not sending a stream; rxQuality is UNKNOWN when the user is not receiving a stream.
Parameters
connectionThe RtcConnection object.
remoteUidThe user ID. The network quality of the user with this user ID is reported.
txQualityUplink network quality rating of the user in terms of the transmission bit rate, packet loss rate, average RTT (Round-Trip Time) and jitter of the uplink network. This parameter is a quality rating helping you understand how well the current uplink network conditions can support the selected video encoder configuration. For example, a 1000 Kbps uplink network may be adequate for video frames with a resolution of 640 × 480 and a frame rate of 15 fps in the LIVE_BROADCASTING profile, but may be inadequate for resolutions higher than 1280 × 720. See QUALITY_TYPE.
rxQualityDownlink network quality rating of the user in terms of packet loss rate, average RTT, and jitter of the downlink network. See QUALITY_TYPE.

◆ onIntraRequestReceived() [1/2]

virtual void onIntraRequestReceived ( const RtcConnection connection)
inlinevirtual

Occurs when intra request from remote user is received.

This callback is triggered once remote user needs one Key frame.

Parameters
connectionThe RtcConnection object.

◆ onFirstLocalVideoFrame() [1/3]

virtual void onFirstLocalVideoFrame ( const RtcConnection connection,
int  width,
int  height,
int  elapsed 
)
inlinevirtual

Occurs when the first local video frame is displayed on the video window.

Deprecated:
4.0.0 This callback is deprecated, use void onFirstLocalVideoFrame(VIDEO_SOURCE_TYPE source, int width, int height, int elapsed) instead.
Parameters
connectionThe RtcConnection object.
widthThe width (pixels) of the video stream.
heightThe height (pixels) of the video stream.
elapsedThe time elapsed (ms) from the local user calling joinChannel until this callback is triggered.

◆ onFirstLocalVideoFramePublished() [1/3]

virtual void onFirstLocalVideoFramePublished ( const RtcConnection connection,
int  elapsed 
)
inlinevirtual

Occurs when the first local video frame is published. The SDK triggers this callback under one of the following circumstances:

  • The local client enables the video module and calls joinChannel successfully.
  • The local client calls muteLocalVideoStream(true) and muteLocalVideoStream(false) in sequence.
  • The local client calls disableVideo and enableVideo in sequence.
  • The local client calls pushVideoFrame to successfully push the video frame to the SDK.
Parameters
connectionThe RtcConnection object.
elapsedThe time elapsed (ms) from the local user calling joinChannel` to the SDK triggers this callback.

◆ onFirstRemoteVideoDecoded() [1/3]

virtual void onFirstRemoteVideoDecoded ( const RtcConnection connection,
uid_t  remoteUid,
int  width,
int  height,
int  elapsed 
)
inlinevirtual

Occurs when the first remote video frame is received and decoded.

The SDK triggers this callback under one of the following circumstances:

  • The remote user joins the channel and sends the video stream.
  • The remote user stops sending the video stream and re-sends it after 15 seconds. Reasons for such an interruption include:
    • The remote user leaves the channel.
    • The remote user drops offline.
    • The remote user calls muteLocalVideoStream to stop sending the video stream.
    • The remote user calls disableVideo to disable video.
Parameters
connectionThe RtcConnection object.
remoteUidThe user ID of the remote user sending the video stream.
widthThe width (pixels) of the video stream.
heightThe height (pixels) of the video stream.
elapsedThe time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

◆ onVideoSizeChanged() [1/3]

virtual void onVideoSizeChanged ( const RtcConnection connection,
VIDEO_SOURCE_TYPE  sourceType,
uid_t  uid,
int  width,
int  height,
int  rotation 
)
inlinevirtual

Occurs when the local or remote video size or rotation has changed.

Parameters
connectionThe RtcConnection object.
sourceTypeThe video source type: VIDEO_SOURCE_TYPE.
uidThe user ID. 0 indicates the local user.
widthThe new width (pixels) of the video.
heightThe new height (pixels) of the video.
rotationThe rotation information of the video.

◆ onLocalVideoStateChanged() [1/3]

virtual void onLocalVideoStateChanged ( const RtcConnection connection,
LOCAL_VIDEO_STREAM_STATE  state,
LOCAL_VIDEO_STREAM_ERROR  errorCode 
)
inlinevirtual

Occurs when the local video stream state changes.

When the state of the local video stream changes (including the state of the video capture and encoding), the SDK triggers this callback to report the current state. This callback indicates the state of the local video stream, including camera capturing and video encoding, and allows you to troubleshoot issues when exceptions occur.

The SDK triggers the onLocalVideoStateChanged callback with the state code of LOCAL_VIDEO_STREAM_STATE_FAILED and error code of LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE in the following situations:

  • The app switches to the background, and the system gets the camera resource.
  • The camera starts normally, but does not output video for four consecutive seconds.

When the camera outputs the captured video frames, if the video frames are the same for 15 consecutive frames, the SDK triggers the onLocalVideoStateChanged callback with the state code of LOCAL_VIDEO_STREAM_STATE_CAPTURING and error code of LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE. Note that the video frame duplication detection is only available for video frames with a resolution greater than 200 × 200, a frame rate greater than or equal to 10 fps, and a bitrate less than 20 Kbps.

Note
For some device models, the SDK does not trigger this callback when the state of the local video changes while the local video capturing device is in use, so you have to make your own timeout judgment.
Parameters
connectionThe RtcConnection object.
stateThe state of the local video. See LOCAL_VIDEO_STREAM_STATE.
errorThe detailed error information. See LOCAL_VIDEO_STREAM_ERROR.

◆ onRemoteVideoStateChanged() [1/3]

virtual void onRemoteVideoStateChanged ( const RtcConnection connection,
uid_t  remoteUid,
REMOTE_VIDEO_STATE  state,
REMOTE_VIDEO_STATE_REASON  reason,
int  elapsed 
)
inlinevirtual

Occurs when the remote video state changes.

Note
This callback does not work properly when the number of users (in the voice/video call channel) or hosts (in the live streaming channel) in the channel exceeds 17.
Parameters
connectionThe RtcConnection object.
remoteUidThe ID of the user whose video state has changed.
stateThe remote video state: REMOTE_VIDEO_STATE.
reasonThe reason of the remote video state change: REMOTE_VIDEO_STATE_REASON.
elapsedThe time elapsed (ms) from the local client calling joinChannel until this callback is triggered.

◆ onFirstRemoteVideoFrame() [1/3]

virtual void onFirstRemoteVideoFrame ( const RtcConnection connection,
uid_t  remoteUid,
int  width,
int  height,
int  elapsed 
)
inlinevirtual

Occurs when the renderer receives the first frame of the remote video.

Parameters
connectionThe RtcConnection object.
remoteUidThe user ID of the remote user sending the video stream.
widthThe width (px) of the video frame.
heightThe height (px) of the video stream.
elapsedThe time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

◆ onUserJoined() [1/3]

virtual void onUserJoined ( const RtcConnection connection,
uid_t  remoteUid,
int  elapsed 
)
inlinevirtual

Occurs when a remote user or broadcaster joins the channel.

  • In the COMMUNICATION channel profile, this callback indicates that a remote user joins the channel. The SDK also triggers this callback to report the existing users in the channel when a user joins the channel. In the LIVE_BROADCASTING channel profile, this callback indicates that a host joins the channel. The SDK also triggers this callback to report the existing hosts in the channel when a host joins the channel. Agora recommends limiting the number of hosts to 17.

The SDK triggers this callback under one of the following circumstances:

  • A remote user/host joins the channel by calling the joinChannel method.
  • A remote user switches the user role to the host after joining the channel.
  • A remote user/host rejoins the channel after a network interruption.
Parameters
connectionThe RtcConnection object.
remoteUidThe ID of the remote user or broadcaster joining the channel.
elapsedThe time elapsed (ms) from the local user calling joinChannel or setClientRole until this callback is triggered.

◆ onUserOffline() [1/3]

virtual void onUserOffline ( const RtcConnection connection,
uid_t  remoteUid,
USER_OFFLINE_REASON_TYPE  reason 
)
inlinevirtual

Occurs when a remote user or broadcaster goes offline.

There are two reasons for a user to go offline:

  • Leave the channel: When the user leaves the channel, the user sends a goodbye message. When this message is received, the SDK determines that the user leaves the channel.
  • Drop offline: When no data packet of the user is received for a certain period of time, the SDK assumes that the user drops offline. A poor network connection may lead to false detection, so we recommend using the RTM SDK for reliable offline detection.
  • The user switches the user role from a broadcaster to an audience.
Parameters
connectionThe RtcConnection object.
remoteUidThe ID of the remote user or broadcaster who leaves the channel or drops offline.
reasonThe reason why the remote user goes offline: USER_OFFLINE_REASON_TYPE.

◆ onUserMuteAudio() [1/3]

virtual void onUserMuteAudio ( const RtcConnection connection,
uid_t  remoteUid,
bool  muted 
)
inlinevirtual

Occurs when a remote user's audio stream playback pauses/resumes. The SDK triggers this callback when the remote user stops or resumes sending the audio stream by calling the muteLocalAudioStream method.

Note
This callback can be inaccurate when the number of users (in the COMMUNICATION profile) or hosts (in the LIVE_BROADCASTING profile) in the channel exceeds 17.
Parameters
connectionThe RtcConnection object.
remoteUidThe user ID.
mutedWhether the remote user's audio stream is muted/unmuted:
  • true: Muted.
  • false: Unmuted.

◆ onUserMuteVideo() [1/3]

virtual void onUserMuteVideo ( const RtcConnection connection,
uid_t  remoteUid,
bool  muted 
)
inlinevirtual

Occurs when a remote user pauses or resumes sending the video stream.

When a remote user calls muteLocalVideoStream to stop or resume publishing the video stream, the SDK triggers this callback to report the state of the remote user's publishing stream to the local user.

Note
This callback can be inaccurate when the number of users or broadacasters in a channel exceeds 20.
Parameters
connectionThe RtcConnection object.
remoteUidID of the remote user.
mutedWhether the remote user stops publishing the video stream:
  • true: The remote user has paused sending the video stream.
  • false: The remote user has resumed sending the video stream.

◆ onUserEnableVideo() [1/3]

virtual void onUserEnableVideo ( const RtcConnection connection,
uid_t  remoteUid,
bool  enabled 
)
inlinevirtual

Occurs when a remote user enables or disables the video module.

Once the video function is disabled, the users cannot see any video.

The SDK triggers this callback when a remote user enables or disables the video module by calling the enableVideo or disableVideo method.

Parameters
connectionThe RtcConnection object.
remoteUidThe ID of the remote user.
enabledWhether the video of the remote user is enabled:
  • true: The remote user has enabled video.
  • false: The remote user has disabled video.

◆ onUserEnableLocalVideo() [1/3]

virtual void onUserEnableLocalVideo ( const RtcConnection connection,
uid_t  remoteUid,
bool  enabled 
)
inlinevirtual

Occurs when a remote user enables or disables local video capturing.

The SDK triggers this callback when the remote user resumes or stops capturing the video stream by calling the enableLocalVideo method.

Parameters
connectionThe RtcConnection object.
remoteUidThe ID of the remote user.
enabledWhether the specified remote user enables/disables local video:
  • true: The remote user has enabled local video capturing.
  • false: The remote user has disabled local video capturing.

◆ onUserStateChanged() [1/3]

virtual void onUserStateChanged ( const RtcConnection connection,
uid_t  remoteUid,
uint32_t  state 
)
inlinevirtual

Occurs when the remote user state is updated.

Parameters
connectionThe RtcConnection object.
remoteUidThe uid of the remote user.
stateThe remote user state: REMOTE_USER_STATE.

◆ onLocalAudioStats() [1/3]

virtual void onLocalAudioStats ( const RtcConnection connection,
const LocalAudioStats stats 
)
inlinevirtual

Reports the statistics of the local audio stream.

The SDK triggers this callback once every two seconds.

Parameters
connectionThe RtcConnection object.
statsThe statistics of the local audio stream. See LocalAudioStats.

◆ onRemoteAudioStats() [1/3]

virtual void onRemoteAudioStats ( const RtcConnection connection,
const RemoteAudioStats stats 
)
inlinevirtual

Reports the statistics of the audio stream from each remote user/host.

The SDK triggers this callback once every two seconds for each remote user who is sending audio streams. If a channel includes multiple remote users, the SDK triggers this callback as many times.

Parameters
connectionThe RtcConnection object.
statsStatistics of the received remote audio streams. See RemoteAudioStats.

◆ onLocalVideoStats() [1/3]

virtual void onLocalVideoStats ( const RtcConnection connection,
const LocalVideoStats stats 
)
inlinevirtual

Reports the statistics of the local video stream.

The SDK triggers this callback once every two seconds for each user/host. If there are multiple users/hosts in the channel, the SDK triggers this callback as many times.

Note
If you have called the enableDualStreamMode method, this callback reports the statistics of the high-video stream (high bitrate, and high-resolution video stream).
Parameters
connectionThe RtcConnection object.
statsStatistics of the local video stream. See LocalVideoStats.

◆ onRemoteVideoStats() [1/3]

virtual void onRemoteVideoStats ( const RtcConnection connection,
const RemoteVideoStats stats 
)
inlinevirtual

Reports the statistics of the video stream from each remote user/host.

The SDK triggers this callback once every two seconds for each remote user. If a channel has multiple users/hosts sending video streams, the SDK triggers this callback as many times.

Parameters
connectionThe RtcConnection object.
statsStatistics of the remote video stream. See RemoteVideoStats.

◆ onConnectionLost() [1/2]

virtual void onConnectionLost ( const RtcConnection connection)
inlinevirtual

Occurs when the SDK cannot reconnect to the server 10 seconds after its connection to the server is interrupted.

The SDK triggers this callback when it cannot connect to the server 10 seconds after calling joinChannel, regardless of whether it is in the channel or not. If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora's edge server, the SDK stops rejoining the channel.

Parameters
connectionThe RtcConnection object.

◆ onConnectionInterrupted() [1/2]

virtual void onConnectionInterrupted ( const RtcConnection connection)
inlinevirtual

Occurs when the connection between the SDK and the server is interrupted.

Deprecated:
Use onConnectionStateChanged instead.

The SDK triggers this callback when it loses connection with the serer for more than 4 seconds after the connection is established. After triggering this callback, the SDK tries to reconnect to the server. If the reconnection fails within a certain period (10 seconds by default), the onConnectionLost() callback is triggered. If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora's edge server, the SDK stops rejoining the channel.

Parameters
connectionThe RtcConnection object.

◆ onConnectionBanned() [1/2]

virtual void onConnectionBanned ( const RtcConnection connection)
inlinevirtual

Occurs when your connection is banned by the Agora Server.

Parameters
connectionThe RtcConnection object.

◆ onStreamMessage() [1/3]

virtual void onStreamMessage ( const RtcConnection connection,
uid_t  remoteUid,
int  streamId,
const char *  data,
size_t  length,
uint64_t  sentTs 
)
inlinevirtual

Occurs when the local user receives the data stream from the remote user.

The SDK triggers this callback when the user receives the data stream that another user sends by calling the sendStreamMessage method.

Parameters
connectionThe RtcConnection object.
remoteUidID of the user who sends the data stream.
streamIdThe ID of the stream data.
dataThe data stream.
lengthThe length (byte) of the data stream.
sentTsThe time when the data stream sent.

◆ onStreamMessageError() [1/3]

virtual void onStreamMessageError ( const RtcConnection connection,
uid_t  remoteUid,
int  streamId,
int  code,
int  missed,
int  cached 
)
inlinevirtual

Occurs when the local user does not receive the data stream from the remote user.

The SDK triggers this callback when the user fails to receive the data stream that another user sends by calling the sendStreamMessage method.

Parameters
connectionThe RtcConnection object.
remoteUidID of the user who sends the data stream.
streamIdThe ID of the stream data.
codeThe error code.
missedThe number of lost messages.
cachedThe number of incoming cached messages when the data stream is interrupted.

◆ onRequestToken() [1/2]

virtual void onRequestToken ( const RtcConnection connection)
inlinevirtual

Occurs when the token expires.

When the token expires during a call, the SDK triggers this callback to remind the app to renew the token.

Upon receiving this callback, generate a new token at your app server and call joinChannel to pass the new token to the SDK.

Parameters
connectionThe RtcConnection object.

◆ onLicenseValidationFailure() [1/3]

virtual void onLicenseValidationFailure ( const RtcConnection connection,
LICENSE_ERROR_TYPE  reason 
)
inlinevirtual

Occurs when connection license verification fails.

You can know the reason accordding to error code

◆ onTokenPrivilegeWillExpire() [1/3]

virtual void onTokenPrivilegeWillExpire ( const RtcConnection connection,
const char *  token 
)
inlinevirtual

Occurs when the token will expire in 30 seconds.

When the token is about to expire in 30 seconds, the SDK triggers this callback to remind the app to renew the token.

Upon receiving this callback, generate a new token at your app server and call renewToken to pass the new Token to the SDK.

Parameters
connectionThe RtcConnection object.
tokenThe token that will expire in 30 seconds.

◆ onFirstLocalAudioFramePublished() [1/3]

virtual void onFirstLocalAudioFramePublished ( const RtcConnection connection,
int  elapsed 
)
inlinevirtual

Occurs when the first local audio frame is published.

The SDK triggers this callback under one of the following circumstances:

  • The local client enables the audio module and calls joinChannel successfully.
  • The local client calls muteLocalAudioStream(true) and muteLocalAudioStream(false) in sequence.
  • The local client calls disableAudio and enableAudio in sequence.
  • The local client calls pushAudioFrame to successfully push the audio frame to the SDK.
Parameters
connectionThe RtcConnection object.
elapsedThe time elapsed (ms) from the local user calling joinChannel to the SDK triggers this callback.

◆ onFirstRemoteAudioFrame() [1/3]

virtual void onFirstRemoteAudioFrame ( const RtcConnection connection,
uid_t  userId,
int  elapsed 
)
inlinevirtual

Occurs when the SDK receives the first audio frame from a specific remote user.

Deprecated:
Use onRemoteAudioStateChanged instead.
Parameters
connectionThe RtcConnection object.
userIdID of the remote user.
elapsedThe time elapsed (ms) from the loca user calling joinChannel until this callback is triggered.

◆ onFirstRemoteAudioDecoded() [1/3]

virtual void onFirstRemoteAudioDecoded ( const RtcConnection connection,
uid_t  uid,
int  elapsed 
)
inlinevirtual

Occurs when the SDK decodes the first remote audio frame for playback.

Deprecated:
Use onRemoteAudioStateChanged instead. The SDK triggers this callback under one of the following circumstances:
  • The remote user joins the channel and sends the audio stream for the first time.
  • The remote user's audio is offline and then goes online to re-send audio. It means the local user cannot receive audio in 15 seconds. Reasons for such an interruption include:
    • The remote user leaves channel.
    • The remote user drops offline.
    • The remote user calls muteLocalAudioStream to stop sending the audio stream.
    • The remote user calls disableAudio to disable audio.
Parameters
connectionThe RtcConnection object.
uidUser ID of the remote user sending the audio stream.
elapsedThe time elapsed (ms) from the loca user calling joinChannel until this callback is triggered.

◆ onLocalAudioStateChanged() [1/3]

virtual void onLocalAudioStateChanged ( const RtcConnection connection,
LOCAL_AUDIO_STREAM_STATE  state,
LOCAL_AUDIO_STREAM_ERROR  error 
)
inlinevirtual

Occurs when the local audio state changes.

When the state of the local audio stream changes (including the state of the audio capture and encoding), the SDK triggers this callback to report the current state. This callback indicates the state of the local audio stream, and allows you to troubleshoot issues when audio exceptions occur.

Note
When the state is LOCAL_AUDIO_STREAM_STATE_FAILED(3), see the error parameter for details.
Parameters
connectionThe RtcConnection object.
stateState of the local audio. See LOCAL_AUDIO_STREAM_STATE.
errorThe error information of the local audio. See LOCAL_AUDIO_STREAM_ERROR.

◆ onRemoteAudioStateChanged() [1/3]

virtual void onRemoteAudioStateChanged ( const RtcConnection connection,
uid_t  remoteUid,
REMOTE_AUDIO_STATE  state,
REMOTE_AUDIO_STATE_REASON  reason,
int  elapsed 
)
inlinevirtual

Occurs when the remote audio state changes.

When the audio state of a remote user (in the voice/video call channel) or host (in the live streaming channel) changes, the SDK triggers this callback to report the current state of the remote audio stream.

Note
This callback does not work properly when the number of users (in the voice/video call channel) or hosts (in the live streaming channel) in the channel exceeds 17.
Parameters
connectionThe RtcConnection object.
remoteUidID of the remote user whose audio state changes.
stateState of the remote audio. See REMOTE_AUDIO_STATE.
reasonThe reason of the remote audio state change. See REMOTE_AUDIO_STATE_REASON.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

◆ onActiveSpeaker() [1/3]

virtual void onActiveSpeaker ( const RtcConnection connection,
uid_t  uid 
)
inlinevirtual

Occurs when an active speaker is detected.

After a successful call of enableAudioVolumeIndication, the SDK continuously detects which remote user has the loudest volume. During the current period, the remote user, who is detected as the loudest for the most times, is the most active user.

When the number of users is no less than two and an active remote speaker exists, the SDK triggers this callback and reports the uid of the most active remote speaker.

  • If the most active remote speaker is always the same user, the SDK triggers the onActiveSpeaker callback only once.
  • If the most active remote speaker changes to another user, the SDK triggers this callback again and reports the uid of the new active remote speaker.
Parameters
connectionThe RtcConnection object.
uidThe ID of the active speaker. A uid of 0 means the local user.

◆ onClientRoleChanged() [1/3]

virtual void onClientRoleChanged ( const RtcConnection connection,
CLIENT_ROLE_TYPE  oldRole,
CLIENT_ROLE_TYPE  newRole,
const ClientRoleOptions newRoleOptions 
)
inlinevirtual

Occurs when the user role switches in the interactive live streaming.

Parameters
connectionThe RtcConnection of the local user: #RtcConnection
oldRoleThe old role of the user: CLIENT_ROLE_TYPE
newRoleThe new role of the user: CLIENT_ROLE_TYPE
newRoleOptionsThe client role options of the new role: #ClientRoleOptions.

◆ onClientRoleChangeFailed() [1/3]

virtual void onClientRoleChangeFailed ( const RtcConnection connection,
CLIENT_ROLE_CHANGE_FAILED_REASON  reason,
CLIENT_ROLE_TYPE  currentRole 
)
inlinevirtual

Occurs when the user role in a Live-Broadcast channel fails to switch, for example, from a broadcaster to an audience or vice versa.

Parameters
connectionThe RtcConnection object.
reasonThe reason for failing to change the client role: CLIENT_ROLE_CHANGE_FAILED_REASON.
currentRoleThe current role of the user: CLIENT_ROLE_TYPE.

◆ onRemoteAudioTransportStats() [1/3]

virtual void onRemoteAudioTransportStats ( const RtcConnection connection,
uid_t  remoteUid,
unsigned short  delay,
unsigned short  lost,
unsigned short  rxKBitRate 
)
inlinevirtual

Reports the transport-layer statistics of each remote audio stream.

Deprecated:
Use onRemoteAudioStats instead.

This callback reports the transport-layer statistics, such as the packet loss rate and network time delay, once every two seconds after the local user receives an audio packet from a remote user. During a call, when the user receives the audio packet sent by the remote user/host, the callback is triggered every 2 seconds.

Parameters
connectionThe RtcConnection object.
remoteUidID of the remote user whose audio data packet is received.
delayThe network time delay (ms) from the sender to the receiver.
lostThe Packet loss rate (%) of the audio packet sent from the remote user.
rxKBitRateReceived bitrate (Kbps) of the audio packet sent from the remote user.

◆ onRemoteVideoTransportStats() [1/3]

virtual void onRemoteVideoTransportStats ( const RtcConnection connection,
uid_t  remoteUid,
unsigned short  delay,
unsigned short  lost,
unsigned short  rxKBitRate 
)
inlinevirtual

Reports the transport-layer statistics of each remote video stream.

Deprecated:
Use onRemoteVideoStats instead.

This callback reports the transport-layer statistics, such as the packet loss rate and network time delay, once every two seconds after the local user receives a video packet from a remote user.

During a call, when the user receives the video packet sent by the remote user/host, the callback is triggered every 2 seconds.

Parameters
connectionThe RtcConnection object.
remoteUidID of the remote user whose video packet is received.
delayThe network time delay (ms) from the remote user sending the video packet to the local user.
lostThe packet loss rate (%) of the video packet sent from the remote user.
rxKBitRateThe bitrate (Kbps) of the video packet sent from the remote user.

◆ onConnectionStateChanged() [1/3]

virtual void onConnectionStateChanged ( const RtcConnection connection,
CONNECTION_STATE_TYPE  state,
CONNECTION_CHANGED_REASON_TYPE  reason 
)
inlinevirtual

Occurs when the network connection state changes.

When the network connection state changes, the SDK triggers this callback and reports the current connection state and the reason for the change.

Parameters
connectionThe RtcConnection object.
stateThe current connection state. See #CONNECTION_STATE_TYPE.
reasonThe reason for a connection state change. See CONNECTION_CHANGED_REASON_TYPE.

◆ onWlAccMessage() [1/3]

virtual void onWlAccMessage ( const RtcConnection connection,
WLACC_MESSAGE_REASON  reason,
WLACC_SUGGEST_ACTION  action,
const char *  wlAccMsg 
)
inlinevirtual

Occurs when the WIFI message need be sent to the user.

Parameters
connectionThe RtcConnection object.
reasonThe reason of notifying the user of a message.
actionSuggest an action for the user.
wlAccMsgThe message content of notifying the user.

◆ onWlAccStats() [1/3]

virtual void onWlAccStats ( const RtcConnection connection,
WlAccStats  currentStats,
WlAccStats  averageStats 
)
inlinevirtual

Occurs when SDK statistics wifi acceleration optimization effect.

Parameters
connectionThe RtcConnection object.
currentStatsInstantaneous value of optimization effect.
averageStatsAverage value of cumulative optimization effect.

◆ onNetworkTypeChanged() [1/3]

virtual void onNetworkTypeChanged ( const RtcConnection connection,
NETWORK_TYPE  type 
)
inlinevirtual

Occurs when the local network type changes.

This callback occurs when the connection state of the local user changes. You can get the connection state and reason for the state change in this callback. When the network connection is interrupted, this callback indicates whether the interruption is caused by a network type change or poor network conditions.

Parameters
connectionThe RtcConnection object.
typeThe type of the local network connection. See NETWORK_TYPE.

◆ onEncryptionError() [1/3]

virtual void onEncryptionError ( const RtcConnection connection,
ENCRYPTION_ERROR_TYPE  errorType 
)
inlinevirtual

Reports the built-in encryption errors.

When encryption is enabled by calling enableEncryption, the SDK triggers this callback if an error occurs in encryption or decryption on the sender or the receiver side.

Parameters
connectionThe RtcConnection object.
errorTypeThe error type. See ENCRYPTION_ERROR_TYPE.

◆ onUploadLogResult() [1/3]

virtual void onUploadLogResult ( const RtcConnection connection,
const char *  requestId,
bool  success,
UPLOAD_ERROR_REASON  reason 
)
inlinevirtual

Reports the user log upload result

Parameters
connectionThe RtcConnection object.
requestIdRequestId of the upload
successIs upload success
reasonReason of the upload, 0: OK, 1 Network Error, 2 Server Error.

◆ onUserAccountUpdated() [1/3]

virtual void onUserAccountUpdated ( const RtcConnection connection,
uid_t  remoteUid,
const char *  userAccount 
)
inlinevirtual

Occurs when the user account is updated.

Parameters
connectionThe RtcConnection object.
remoteUidThe user ID.
userAccountThe user account.

◆ onSnapshotTaken() [1/3]

virtual void onSnapshotTaken ( const RtcConnection connection,
uid_t  uid,
const char *  filePath,
int  width,
int  height,
int  errCode 
)
inlinevirtual

Reports the result of taking a video snapshot.

After a successful takeSnapshot method call, the SDK triggers this callback to report whether the snapshot is successfully taken, as well as the details for that snapshot.

Parameters
connectionThe RtcConnection object.
uidThe user ID. A uid of 0 indicates the local user.
filePathThe local path of the snapshot.
widthThe width (px) of the snapshot.
heightThe height (px) of the snapshot.
errCodeThe message that confirms success or gives the reason why the snapshot is not successfully taken:
  • 0: Success.
  • < 0: Failure.
    • -1: The SDK fails to write data to a file or encode a JPEG image.
    • -2: The SDK does not find the video stream of the specified user within one second after the takeSnapshot method call succeeds.
    • -3: Calling the takeSnapshot method too frequently. Call the takeSnapshot method after receiving the onSnapshotTaken callback from the previous call.

◆ onVideoRenderingTracingResult() [1/3]

virtual void onVideoRenderingTracingResult ( const RtcConnection connection,
uid_t  uid,
MEDIA_TRACE_EVENT  currentEvent,
VideoRenderingTracingInfo  tracingInfo 
)
inlinevirtual

Reports the tracing result of video rendering event of the user.

Parameters
connectionThe RtcConnection object.
uidThe user ID.
currentEventThe current event of the tracing result: MEDIA_TRACE_EVENT.
tracingInfoThe tracing result: #VideoRenderingTracingInfo.

◆ eventHandlerType() [2/2]

virtual const char* eventHandlerType
inline

◆ onJoinChannelSuccess() [2/3]

virtual void onJoinChannelSuccess
inline

Occurs when a user joins a channel.

This callback notifies the application that a user joins a specified channel.

Parameters
channelThe channel name.
uidThe ID of the user who joins the channel.
elapsedThe time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

◆ onRejoinChannelSuccess() [2/3]

virtual void onRejoinChannelSuccess
inline

Occurs when a user rejoins the channel.

When a user loses connection with the server because of network problems, the SDK automatically tries to reconnect and triggers this callback upon reconnection.

Parameters
channelThe channel name.
uidThe ID of the user who rejoins the channel.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until this callback is triggered.

◆ onAudioQuality() [2/3]

virtual void onAudioQuality
inline

Reports the statistics of the audio stream from each remote user/broadcaster.

Deprecated:
This callback is deprecated. Use onRemoteAudioStats instead.

The SDK triggers this callback once every two seconds to report the audio quality of each remote user/host sending an audio stream. If a channel has multiple remote users/hosts sending audio streams, the SDK triggers this callback as many times.

Parameters
uidThe user ID of the remote user sending the audio stream.
qualityThe audio quality of the user: QUALITY_TYPE
delayThe network delay (ms) from the sender to the receiver, including the delay caused by audio sampling pre-processing, network transmission, and network jitter buffering.
lostThe audio packet loss rate (%) from the sender to the receiver.

◆ onAudioVolumeIndication() [2/3]

virtual void onAudioVolumeIndication
inline

Reports the volume information of users.

By default, this callback is disabled. You can enable it by calling enableAudioVolumeIndication. Once this callback is enabled and users send streams in the channel, the SDK triggers the onAudioVolumeIndication callback at the time interval set in enableAudioVolumeIndication. The SDK triggers two independent onAudioVolumeIndication callbacks simultaneously, which separately report the volume information of the local user who sends a stream and the remote users (up to three) whose instantaneous volume is the highest.

Note
After you enable this callback, calling muteLocalAudioStream affects the SDK's behavior as follows:
  • If the local user stops publishing the audio stream, the SDK stops triggering the local user's callback.
  • 20 seconds after a remote user whose volume is one of the three highest stops publishing the audio stream, the callback excludes this user's information; 20 seconds after all remote users stop publishing audio streams, the SDK stops triggering the callback for remote users.
Parameters
speakersThe volume information of the users, see AudioVolumeInfo. An empty speakers array in the callback indicates that no remote user is in the channel or sending a stream at the moment.
speakerNumberThe total number of speakers.
  • In the local user's callback, when the local user sends a stream, speakerNumber is 1.
  • In the callback for remote users, the value range of speakerNumber is [0,3]. If the number of remote users who send streams is greater than or equal to three, the value of speakerNumber is 3.
totalVolumeThe volume of the speaker. The value ranges between 0 (lowest volume) and 255 (highest volume).
  • In the local user's callback, totalVolume is the volume of the local user who sends a stream.
  • In the remote users' callback, totalVolume is the sum of all remote users (up to three) whose instantaneous volume is the highest. If the user calls startAudioMixing, totalVolume is the volume after audio mixing.

◆ onLeaveChannel() [2/3]

virtual void onLeaveChannel
inline

Occurs when a user leaves a channel.

This callback notifies the app that the user leaves the channel by calling leaveChannel. From this callback, the app can get information such as the call duration and quality statistics.

Parameters
statsThe statistics on the call: RtcStats.

◆ onRtcStats() [2/3]

virtual void onRtcStats
inline

Reports the statistics of the current call.

The SDK triggers this callback once every two seconds after the user joins the channel.

Parameters
statsThe statistics of the current call: RtcStats.

◆ onNetworkQuality() [2/3]

virtual void onNetworkQuality
inline

Reports the last mile network quality of each user in the channel.

This callback reports the last mile network conditions of each user in the channel. Last mile refers to the connection between the local device and Agora's edge server.

The SDK triggers this callback once every two seconds. If a channel includes multiple users, the SDK triggers this callback as many times.

Note
txQuality is UNKNOWN when the user is not sending a stream; rxQuality is UNKNOWN when the user is not receiving a stream.
Parameters
uidThe user ID. The network quality of the user with this user ID is reported.
txQualityUplink network quality rating of the user in terms of the transmission bit rate, packet loss rate, average RTT (Round-Trip Time) and jitter of the uplink network. This parameter is a quality rating helping you understand how well the current uplink network conditions can support the selected video encoder configuration. For example, a 1000 Kbps uplink network may be adequate for video frames with a resolution of 640 × 480 and a frame rate of 15 fps in the LIVE_BROADCASTING profile, but may be inadequate for resolutions higher than 1280 × 720. See QUALITY_TYPE.
rxQualityDownlink network quality rating of the user in terms of packet loss rate, average RTT, and jitter of the downlink network. See QUALITY_TYPE.

◆ onIntraRequestReceived() [2/2]

virtual void onIntraRequestReceived
inlinevirtual

Occurs when intra request from remote user is received.

This callback is triggered once remote user needs one Key frame.

Reimplemented from IRtcEngineEventHandler.

◆ onFirstLocalVideoFrame() [2/3]

virtual void onFirstLocalVideoFrame
inline

Occurs when the first local video frame is rendered on the local video view.

Parameters
sourceThe video source: VIDEO_SOURCE_TYPE.
widthThe width (px) of the first local video frame.
heightThe height (px) of the first local video frame.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. If you call the startPreview method before calling the joinChannel method, then elapsed is the time elapsed from calling the startPreview method until the SDK triggers this callback.

◆ onFirstLocalVideoFramePublished() [2/3]

virtual void onFirstLocalVideoFramePublished
inline

Occurs when the first local video frame is published. The SDK triggers this callback under one of the following circumstances:

  • The local client enables the video module and calls joinChannel successfully.
  • The local client calls muteLocalVideoStream(true) and muteLocalVideoStream(false) in sequence.
  • The local client calls disableVideo and enableVideo in sequence.
  • The local client calls pushVideoFrame to successfully push the video frame to the SDK.
    Parameters
    sourceThe video source type.
    elapsedThe time elapsed (ms) from the local user calling joinChannel` to the SDK triggers this callback.

◆ onFirstRemoteVideoDecoded() [2/3]

virtual void onFirstRemoteVideoDecoded
inline

Occurs when the first remote video frame is received and decoded.

The SDK triggers this callback under one of the following circumstances:

  • The remote user joins the channel and sends the video stream.
  • The remote user stops sending the video stream and re-sends it after 15 seconds. Reasons for such an interruption include:
    • The remote user leaves the channel.
    • The remote user drops offline.
    • The remote user calls muteLocalVideoStream to stop sending the video stream.
    • The remote user calls disableVideo to disable video.
Parameters
uidThe user ID of the remote user sending the video stream.
widthThe width (pixels) of the video stream.
heightThe height (pixels) of the video stream.
elapsedThe time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

◆ onVideoSizeChanged() [2/3]

virtual void onVideoSizeChanged
inline

Occurs when the local or remote video size or rotation has changed.

Parameters
sourceTypeThe video source type: VIDEO_SOURCE_TYPE.
uidThe user ID. 0 indicates the local user.
widthThe new width (pixels) of the video.
heightThe new height (pixels) of the video.
rotationThe rotation information of the video.

◆ onLocalVideoStateChanged() [2/3]

virtual void onLocalVideoStateChanged
inline

Occurs when the local video stream state changes.

When the state of the local video stream changes (including the state of the video capture and encoding), the SDK triggers this callback to report the current state. This callback indicates the state of the local video stream, including camera capturing and video encoding, and allows you to troubleshoot issues when exceptions occur.

The SDK triggers the onLocalVideoStateChanged callback with the state code of LOCAL_VIDEO_STREAM_STATE_FAILED and error code of LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE in the following situations:

  • The app switches to the background, and the system gets the camera resource.
  • The camera starts normally, but does not output video for four consecutive seconds.

When the camera outputs the captured video frames, if the video frames are the same for 15 consecutive frames, the SDK triggers the onLocalVideoStateChanged callback with the state code of LOCAL_VIDEO_STREAM_STATE_CAPTURING and error code of LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE. Note that the video frame duplication detection is only available for video frames with a resolution greater than 200 × 200, a frame rate greater than or equal to 10 fps, and a bitrate less than 20 Kbps.

Note
For some device models, the SDK does not trigger this callback when the state of the local video changes while the local video capturing device is in use, so you have to make your own timeout judgment.
Parameters
sourceThe video source type: VIDEO_SOURCE_TYPE.
stateThe state of the local video. See LOCAL_VIDEO_STREAM_STATE.
errorThe detailed error information. See LOCAL_VIDEO_STREAM_ERROR.

◆ onRemoteVideoStateChanged() [2/3]

virtual void onRemoteVideoStateChanged
inline

Occurs when the remote video state changes.

Note
This callback does not work properly when the number of users (in the voice/video call channel) or hosts (in the live streaming channel) in the channel exceeds 17.
Parameters
uidThe ID of the user whose video state has changed.
stateThe remote video state: REMOTE_VIDEO_STATE.
reasonThe reason of the remote video state change: REMOTE_VIDEO_STATE_REASON.
elapsedThe time elapsed (ms) from the local client calling joinChannel until this callback is triggered.

◆ onFirstRemoteVideoFrame() [2/3]

virtual void onFirstRemoteVideoFrame
inline

Occurs when the renderer receives the first frame of the remote video.

Parameters
userIdThe user ID of the remote user sending the video stream.
widthThe width (px) of the video frame.
heightThe height (px) of the video stream.
elapsedThe time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

◆ onUserJoined() [2/3]

virtual void onUserJoined
inline

Occurs when a remote user or broadcaster joins the channel.

  • In the COMMUNICATION channel profile, this callback indicates that a remote user joins the channel. The SDK also triggers this callback to report the existing users in the channel when a user joins the channel. In the LIVE_BROADCASTING channel profile, this callback indicates that a host joins the channel. The SDK also triggers this callback to report the existing hosts in the channel when a host joins the channel. Agora recommends limiting the number of hosts to 17.

The SDK triggers this callback under one of the following circumstances:

  • A remote user/host joins the channel by calling the joinChannel method.
  • A remote user switches the user role to the host after joining the channel.
  • A remote user/host rejoins the channel after a network interruption.
Parameters
uidThe ID of the remote user or broadcaster joining the channel.
elapsedThe time elapsed (ms) from the local user calling joinChannel or setClientRole until this callback is triggered.

◆ onUserOffline() [2/3]

virtual void onUserOffline
inline

Occurs when a remote user or broadcaster goes offline.

There are two reasons for a user to go offline:

  • Leave the channel: When the user leaves the channel, the user sends a goodbye message. When this message is received, the SDK determines that the user leaves the channel.
  • Drop offline: When no data packet of the user is received for a certain period of time, the SDK assumes that the user drops offline. A poor network connection may lead to false detection, so we recommend using the RTM SDK for reliable offline detection.
  • The user switches the user role from a broadcaster to an audience.
Parameters
uidThe ID of the remote user or broadcaster who leaves the channel or drops offline.
reasonThe reason why the remote user goes offline: USER_OFFLINE_REASON_TYPE.

◆ onUserMuteAudio() [2/3]

virtual void onUserMuteAudio
inline

Occurs when a remote user's audio stream playback pauses/resumes.

The SDK triggers this callback when the remote user stops or resumes sending the audio stream by calling the muteLocalAudioStream method.

Note
This callback can be inaccurate when the number of users (in the COMMUNICATION profile) or hosts (in the LIVE_BROADCASTING profile) in the channel exceeds 17.
Parameters
uidThe user ID.
mutedWhether the remote user's audio stream is muted/unmuted:
  • true: Muted.
  • false: Unmuted.

◆ onUserMuteVideo() [2/3]

virtual void onUserMuteVideo
inline

Occurs when a remote user pauses or resumes sending the video stream.

When a remote user calls muteLocalVideoStream to stop or resume publishing the video stream, the SDK triggers this callback to report the state of the remote user's publishing stream to the local user.

Note
This callback is invalid when the number of users or broadacasters in a channel exceeds 20.
Parameters
userIdID of the remote user.
mutedWhether the remote user stops publishing the video stream:
  • true: The remote user has paused sending the video stream.
  • false: The remote user has resumed sending the video stream.

◆ onUserEnableVideo() [2/3]

virtual void onUserEnableVideo
inline

Occurs when a remote user enables or disables the video module.

Once the video function is disabled, the users cannot see any video.

The SDK triggers this callback when a remote user enables or disables the video module by calling the enableVideo or disableVideo method.

Parameters
uidThe ID of the remote user.
enabledWhether the video of the remote user is enabled:
  • true: The remote user has enabled video.
  • false: The remote user has disabled video.

◆ onUserEnableLocalVideo() [2/3]

virtual void onUserEnableLocalVideo
inline

Occurs when a remote user enables or disables local video capturing.

The SDK triggers this callback when the remote user resumes or stops capturing the video stream by calling the enableLocalVideo method.

Parameters
uidThe ID of the remote user.
enabledWhether the specified remote user enables/disables local video:
  • true: The remote user has enabled local video capturing.
  • false: The remote user has disabled local video capturing.

◆ onUserStateChanged() [2/3]

virtual void onUserStateChanged
inline

Occurs when the remote user state is updated.

Parameters
uidThe uid of the remote user.
stateThe remote user state: REMOTE_USER_STATE.

◆ onLocalAudioStats() [2/3]

virtual void onLocalAudioStats
inline

Reports the statistics of the local audio stream.

The SDK triggers this callback once every two seconds.

Parameters
statsThe statistics of the local audio stream. See LocalAudioStats.

◆ onRemoteAudioStats() [2/3]

virtual void onRemoteAudioStats
inline

Reports the statistics of the audio stream from each remote user/host.

The SDK triggers this callback once every two seconds for each remote user who is sending audio streams. If a channel includes multiple remote users, the SDK triggers this callback as many times.

Parameters
statsStatistics of the received remote audio streams. See RemoteAudioStats.

◆ onLocalVideoStats() [2/3]

virtual void onLocalVideoStats
inline

Reports the statistics of the local video stream.

The SDK triggers this callback once every two seconds for each user/host. If there are multiple users/hosts in the channel, the SDK triggers this callback as many times.

Note
If you have called the enableDualStreamMode method, this callback reports the statistics of the high-video stream (high bitrate, and high-resolution video stream).
Parameters
sourceThe video source type. See VIDEO_SOURCE_TYPE.
statsStatistics of the local video stream. See LocalVideoStats.

◆ onRemoteVideoStats() [2/3]

virtual void onRemoteVideoStats
inline

Reports the statistics of the video stream from each remote user/host.

The SDK triggers this callback once every two seconds for each remote user. If a channel has multiple users/hosts sending video streams, the SDK triggers this callback as many times.

Parameters
statsStatistics of the remote video stream. See RemoteVideoStats.

◆ onConnectionLost() [2/2]

virtual void onConnectionLost
inlinevirtual

Occurs when the SDK cannot reconnect to the server 10 seconds after its connection to the server is interrupted.

The SDK triggers this callback when it cannot connect to the server 10 seconds after calling joinChannel, regardless of whether it is in the channel or not. If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora's edge server, the SDK stops rejoining the channel.

Reimplemented from IRtcEngineEventHandler.

◆ onConnectionInterrupted() [2/2]

virtual void onConnectionInterrupted
inlinevirtual

Occurs when the connection between the SDK and the server is interrupted.

Deprecated:
Use onConnectionStateChanged instead.

The SDK triggers this callback when it loses connection with the serer for more than 4 seconds after the connection is established. After triggering this callback, the SDK tries to reconnect to the server. If the reconnection fails within a certain period (10 seconds by default), the onConnectionLost() callback is triggered. If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora's edge server, the SDK stops rejoining the channel.

Reimplemented from IRtcEngineEventHandler.

◆ onConnectionBanned() [2/2]

virtual void onConnectionBanned
inlinevirtual

Occurs when your connection is banned by the Agora Server.

Deprecated:
Use onConnectionStateChanged instead.

Reimplemented from IRtcEngineEventHandler.

◆ onStreamMessage() [2/3]

virtual void onStreamMessage
inline

Occurs when the local user receives the data stream from the remote user.

The SDK triggers this callback when the user receives the data stream that another user sends by calling the sendStreamMessage method.

Parameters
userIdID of the user who sends the data stream.
streamIdThe ID of the stream data.
dataThe data stream.
lengthThe length (byte) of the data stream.
sentTsThe time when the data stream sent.

◆ onStreamMessageError() [2/3]

virtual void onStreamMessageError
inline

Occurs when the local user does not receive the data stream from the remote user.

The SDK triggers this callback when the user fails to receive the data stream that another user sends by calling the sendStreamMessage method.

Parameters
userIdID of the user who sends the data stream.
streamIdThe ID of the stream data.
codeThe error code.
missedThe number of lost messages.
cachedThe number of incoming cached messages when the data stream is interrupted.

◆ onRequestToken() [2/2]

virtual void onRequestToken
inlinevirtual

Occurs when the token expires.

When the token expires during a call, the SDK triggers this callback to remind the app to renew the token.

Upon receiving this callback, generate a new token at your app server and call joinChannel to pass the new token to the SDK.

Reimplemented from IRtcEngineEventHandler.

◆ onTokenPrivilegeWillExpire() [2/3]

virtual void onTokenPrivilegeWillExpire
inline

Occurs when the token will expire in 30 seconds.

When the token is about to expire in 30 seconds, the SDK triggers this callback to remind the app to renew the token.

Upon receiving this callback, generate a new token at your app server and call renewToken to pass the new Token to the SDK.

Parameters
tokenThe token that will expire in 30 seconds.

◆ onLicenseValidationFailure() [2/3]

virtual void onLicenseValidationFailure
inline

Occurs when connection license verification fails.

You can know the reason accordding to error code

◆ onFirstLocalAudioFramePublished() [2/3]

virtual void onFirstLocalAudioFramePublished
inline

Occurs when the first local audio frame is published.

The SDK triggers this callback under one of the following circumstances:

  • The local client enables the audio module and calls joinChannel successfully.
  • The local client calls muteLocalAudioStream(true) and muteLocalAudioStream(false) in sequence.
  • The local client calls disableAudio and enableAudio in sequence.
  • The local client calls pushAudioFrame to successfully push the audio frame to the SDK.
Parameters
elapsedThe time elapsed (ms) from the local user calling joinChannel to the SDK triggers this callback.

◆ onFirstRemoteAudioFrame() [2/3]

virtual void onFirstRemoteAudioFrame
inline

Occurs when the SDK receives the first audio frame from a specific remote user.

Deprecated:
Use onRemoteAudioStateChanged instead.
Parameters
uidID of the remote user.
elapsedThe time elapsed (ms) from the loca user calling joinChannel until this callback is triggered.

◆ onFirstRemoteAudioDecoded() [2/3]

virtual void onFirstRemoteAudioDecoded
inline

Occurs when the SDK decodes the first remote audio frame for playback.

Deprecated:
Use onRemoteAudioStateChanged instead. The SDK triggers this callback under one of the following circumstances:
  • The remote user joins the channel and sends the audio stream for the first time.
  • The remote user's audio is offline and then goes online to re-send audio. It means the local user cannot receive audio in 15 seconds. Reasons for such an interruption include:
    • The remote user leaves channel.
    • The remote user drops offline.
    • The remote user calls muteLocalAudioStream to stop sending the audio stream.
    • The remote user calls disableAudio to disable audio.
Parameters
uidUser ID of the remote user sending the audio stream.
elapsedThe time elapsed (ms) from the loca user calling joinChannel until this callback is triggered.

◆ onLocalAudioStateChanged() [2/3]

virtual void onLocalAudioStateChanged
inline

Occurs when the local audio state changes.

When the state of the local audio stream changes (including the state of the audio capture and encoding), the SDK triggers this callback to report the current state. This callback indicates the state of the local audio stream, and allows you to troubleshoot issues when audio exceptions occur.

Note
When the state is LOCAL_AUDIO_STREAM_STATE_FAILED(3), see the error parameter for details.
Parameters
stateState of the local audio. See LOCAL_AUDIO_STREAM_STATE.
errorThe error information of the local audio. See LOCAL_AUDIO_STREAM_ERROR.

◆ onRemoteAudioStateChanged() [2/3]

virtual void onRemoteAudioStateChanged
inline

Occurs when the remote audio state changes.

When the audio state of a remote user (in the voice/video call channel) or host (in the live streaming channel) changes, the SDK triggers this callback to report the current state of the remote audio stream.

Note
This callback does not work properly when the number of users (in the voice/video call channel) or hosts (in the live streaming channel) in the channel exceeds 17.
Parameters
uidID of the remote user whose audio state changes.
stateState of the remote audio. See REMOTE_AUDIO_STATE.
reasonThe reason of the remote audio state change. See REMOTE_AUDIO_STATE_REASON.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

◆ onActiveSpeaker() [2/3]

virtual void onActiveSpeaker
inline

Occurs when an active speaker is detected.

After a successful call of enableAudioVolumeIndication, the SDK continuously detects which remote user has the loudest volume. During the current period, the remote user, who is detected as the loudest for the most times, is the most active user.

When the number of users is no less than two and an active remote speaker exists, the SDK triggers this callback and reports the uid of the most active remote speaker.

  • If the most active remote speaker is always the same user, the SDK triggers the onActiveSpeaker callback only once.
  • If the most active remote speaker changes to another user, the SDK triggers this callback again and reports the uid of the new active remote speaker.
Parameters
userIdThe ID of the active speaker. A uid of 0 means the local user.

◆ onClientRoleChanged() [2/3]

virtual void onClientRoleChanged
inline

Occurs when the user role switches in the interactive live streaming.

Parameters
oldRoleThe old role of the user: CLIENT_ROLE_TYPE.
newRoleThe new role of the user: CLIENT_ROLE_TYPE.
newRoleOptionsThe client role options of the new role: #ClientRoleOptions.

◆ onClientRoleChangeFailed() [2/3]

virtual void onClientRoleChangeFailed
inline

Occurs when the user role in a Live-Broadcast channel fails to switch, for example, from a broadcaster to an audience or vice versa.

Parameters
reasonThe reason for failing to change the client role: CLIENT_ROLE_CHANGE_FAILED_REASON.
currentRoleThe current role of the user: CLIENT_ROLE_TYPE.

◆ onRemoteAudioTransportStats() [2/3]

virtual void onRemoteAudioTransportStats
inline

Reports the transport-layer statistics of each remote audio stream.

Deprecated:
Use onRemoteAudioStats instead.

This callback reports the transport-layer statistics, such as the packet loss rate and network time delay, once every two seconds after the local user receives an audio packet from a remote user. During a call, when the user receives the audio packet sent by the remote user/host, the callback is triggered every 2 seconds.

Parameters
uidID of the remote user whose audio data packet is received.
delayThe network time delay (ms) from the sender to the receiver.
lostThe Packet loss rate (%) of the audio packet sent from the remote user.
rxKBitRateReceived bitrate (Kbps) of the audio packet sent from the remote user.

◆ onRemoteVideoTransportStats() [2/3]

virtual void onRemoteVideoTransportStats
inline

Reports the transport-layer statistics of each remote video stream.

Deprecated:
Use onRemoteVideoStats instead.

This callback reports the transport-layer statistics, such as the packet loss rate and network time delay, once every two seconds after the local user receives a video packet from a remote user.

During a call, when the user receives the video packet sent by the remote user/host, the callback is triggered every 2 seconds.

Parameters
uidID of the remote user whose video packet is received.
delayThe network time delay (ms) from the remote user sending the video packet to the local user.
lostThe packet loss rate (%) of the video packet sent from the remote user.
rxKBitRateThe bitrate (Kbps) of the video packet sent from the remote user.

◆ onConnectionStateChanged() [2/3]

virtual void onConnectionStateChanged
inline

Occurs when the network connection state changes.

When the network connection state changes, the SDK triggers this callback and reports the current connection state and the reason for the change.

Parameters
stateThe current connection state. See #CONNECTION_STATE_TYPE.
reasonThe reason for a connection state change. See CONNECTION_CHANGED_REASON_TYPE.

◆ onWlAccMessage() [2/3]

virtual void onWlAccMessage
inline

Occurs when the WIFI message need be sent to the user.

Parameters
reasonThe reason of notifying the user of a message.
actionSuggest an action for the user.
wlAccMsgThe message content of notifying the user.

◆ onWlAccStats() [2/3]

virtual void onWlAccStats
inline

Occurs when SDK statistics wifi acceleration optimization effect.

Parameters
currentStatsInstantaneous value of optimization effect.
averageStatsAverage value of cumulative optimization effect.

◆ onNetworkTypeChanged() [2/3]

virtual void onNetworkTypeChanged
inline

Occurs when the local network type changes.

This callback occurs when the connection state of the local user changes. You can get the connection state and reason for the state change in this callback. When the network connection is interrupted, this callback indicates whether the interruption is caused by a network type change or poor network conditions.

Parameters
typeThe type of the local network connection. See NETWORK_TYPE.

◆ onEncryptionError() [2/3]

virtual void onEncryptionError
inline

Reports the built-in encryption errors.

When encryption is enabled by calling enableEncryption, the SDK triggers this callback if an error occurs in encryption or decryption on the sender or the receiver side.

Parameters
errorTypeThe error type. See ENCRYPTION_ERROR_TYPE.

◆ onUploadLogResult() [2/3]

virtual void onUploadLogResult
inline

Reports the user log upload result

Parameters
requestIdRequestId of the upload
successIs upload success
reasonReason of the upload, 0: OK, 1 Network Error, 2 Server Error.

◆ onUserAccountUpdated() [2/3]

virtual void onUserAccountUpdated
inline

Occurs when the user account is updated.

Parameters
uidThe user ID.
userAccountThe user account.

◆ onAudioSubscribeStateChanged() [1/2]

virtual void onAudioSubscribeStateChanged
inline

Occurs when the audio subscribing state changes.

Parameters
channelThe name of the channel.
uidThe ID of the remote user.
oldStateThe previous subscribing status: STREAM_SUBSCRIBE_STATE.
newStateThe current subscribing status: STREAM_SUBSCRIBE_STATE.
elapseSinceLastStateThe time elapsed (ms) from the previous state to the current state.

◆ onVideoSubscribeStateChanged() [1/2]

virtual void onVideoSubscribeStateChanged
inline

Occurs when the video subscribing state changes.

Parameters
channelThe name of the channel.
uidThe ID of the remote user.
oldStateThe previous subscribing status: STREAM_SUBSCRIBE_STATE.
newStateThe current subscribing status: STREAM_SUBSCRIBE_STATE.
elapseSinceLastStateThe time elapsed (ms) from the previous state to the current state.

◆ onAudioPublishStateChanged() [1/2]

virtual void onAudioPublishStateChanged
inline

Occurs when the audio publishing state changes.

Parameters
channelThe name of the channel.
oldStateThe previous publishing state: STREAM_PUBLISH_STATE.
newStateThe current publishing state: STREAM_PUBLISH_STATE.
elapseSinceLastStateThe time elapsed (ms) from the previous state to the current state.

◆ onVideoPublishStateChanged() [1/2]

virtual void onVideoPublishStateChanged
inline

Occurs when the video publishing state changes.

Parameters
sourceThe video source type.
channelThe name of the channel.
oldStateThe previous publishing state: STREAM_PUBLISH_STATE.
newStateThe current publishing state: STREAM_PUBLISH_STATE.
elapseSinceLastStateThe time elapsed (ms) from the previous state to the current state.

◆ onSnapshotTaken() [2/3]

virtual void onSnapshotTaken
inline

Reports the result of taking a video snapshot.

After a successful takeSnapshot method call, the SDK triggers this callback to report whether the snapshot is successfully taken, as well as the details for that snapshot.

Parameters
uidThe user ID. A uid of 0 indicates the local user.
filePathThe local path of the snapshot.
widthThe width (px) of the snapshot.
heightThe height (px) of the snapshot.
errCodeThe message that confirms success or gives the reason why the snapshot is not successfully taken:
  • 0: Success.
  • < 0: Failure.
    • -1: The SDK fails to write data to a file or encode a JPEG image.
    • -2: The SDK does not find the video stream of the specified user within one second after the takeSnapshot method call succeeds.
    • -3: Calling the takeSnapshot method too frequently. Call the takeSnapshot method after receiving the onSnapshotTaken callback from the previous call.

◆ onVideoRenderingTracingResult() [2/3]

virtual void onVideoRenderingTracingResult
inline

Reports the tracing result of video rendering event of the user.

Parameters
uidThe user ID.
currentEventThe current event of the tracing result: MEDIA_TRACE_EVENT.
tracingInfoThe tracing result: #VideoRenderingTracingInfo.

◆ onJoinChannelSuccess() [3/3]

virtual void onJoinChannelSuccess ( const char *  channel,
uid_t  uid,
int  elapsed 
)
inlinevirtualinherited

Occurs when a user joins a channel.

This callback notifies the application that a user joins a specified channel.

Parameters
channelThe channel name.
uidThe ID of the user who joins the channel.
elapsedThe time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

◆ onRejoinChannelSuccess() [3/3]

virtual void onRejoinChannelSuccess ( const char *  channel,
uid_t  uid,
int  elapsed 
)
inlinevirtualinherited

Occurs when a user rejoins the channel.

When a user loses connection with the server because of network problems, the SDK automatically tries to reconnect and triggers this callback upon reconnection.

Parameters
channelThe channel name.
uidThe ID of the user who rejoins the channel.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until this callback is triggered.

◆ onProxyConnected()

virtual void onProxyConnected ( const char *  channel,
uid_t  uid,
PROXY_TYPE  proxyType,
const char *  localProxyIp,
int  elapsed 
)
inlinevirtualinherited

Occurs when join success after calling setLocalAccessPoint or setCloudProxy

Parameters
channelChannel name.
uidUser ID of the user joining the channel.
proxyTypetype of proxy agora sdk connected, proxyType will be NONE_PROXY_TYPE if not connected to proxy(fallback).
localProxyIplocal proxy ip. if not join local proxy, it will be "".
elapsedTime elapsed (ms) from the user calling the joinChannel method until the SDK triggers this callback.

◆ onError()

virtual void onError ( int  err,
const char *  msg 
)
inlinevirtualinherited

An error occurs during the SDK runtime.

Parameters
errThe error code: ERROR_CODE_TYPE.
msgThe detailed error message.

◆ onAudioQuality() [3/3]

virtual void onAudioQuality ( uid_t  uid,
int  quality,
unsigned short  delay,
unsigned short  lost 
)
inlinevirtualinherited

Reports the statistics of the audio stream from each remote user/broadcaster.

Deprecated:
This callback is deprecated. Use onRemoteAudioStats instead.

The SDK triggers this callback once every two seconds to report the audio quality of each remote user/host sending an audio stream. If a channel has multiple remote users/hosts sending audio streams, the SDK triggers this callback as many times.

Parameters
uidThe user ID of the remote user sending the audio stream.
qualityThe audio quality of the user: QUALITY_TYPE
delayThe network delay (ms) from the sender to the receiver, including the delay caused by audio sampling pre-processing, network transmission, and network jitter buffering.
lostThe audio packet loss rate (%) from the sender to the receiver.

◆ onLastmileProbeResult()

virtual void onLastmileProbeResult ( const LastmileProbeResult result)
inlinevirtualinherited

Reports the result of the last-mile network probe result.

The SDK triggers this callback within 30 seconds after the app calls the startLastmileProbeTest method.

Parameters
resultThe uplink and downlink last-mile network probe test result: LastmileProbeResult.

◆ onAudioVolumeIndication() [3/3]

virtual void onAudioVolumeIndication ( const AudioVolumeInfo speakers,
unsigned int  speakerNumber,
int  totalVolume 
)
inlinevirtualinherited

Reports the volume information of users.

By default, this callback is disabled. You can enable it by calling enableAudioVolumeIndication. Once this callback is enabled and users send streams in the channel, the SDK triggers the onAudioVolumeIndication callback at the time interval set in enableAudioVolumeIndication. The SDK triggers two independent onAudioVolumeIndication callbacks simultaneously, which separately report the volume information of the local user who sends a stream and the remote users (up to three) whose instantaneous volume is the highest.

Note
After you enable this callback, calling muteLocalAudioStream affects the SDK's behavior as follows:
  • If the local user stops publishing the audio stream, the SDK stops triggering the local user's callback.
  • 20 seconds after a remote user whose volume is one of the three highest stops publishing the audio stream, the callback excludes this user's information; 20 seconds after all remote users stop publishing audio streams, the SDK stops triggering the callback for remote users.
Parameters
speakersThe volume information of the users, see AudioVolumeInfo. An empty speakers array in the callback indicates that no remote user is in the channel or sending a stream at the moment.
speakerNumberThe total number of speakers.
  • In the local user's callback, when the local user sends a stream, speakerNumber is 1.
  • In the callback for remote users, the value range of speakerNumber is [0,3]. If the number of remote users who send streams is greater than or equal to three, the value of speakerNumber is 3.
totalVolumeThe volume of the speaker. The value ranges between 0 (lowest volume) and 255 (highest volume).
  • In the local user's callback, totalVolume is the volume of the local user who sends a stream.
  • In the remote users' callback, totalVolume is the sum of all remote users (up to three) whose instantaneous volume is the highest. If the user calls startAudioMixing, totalVolume is the volume after audio mixing.

◆ onLeaveChannel() [3/3]

virtual void onLeaveChannel ( const RtcStats stats)
inlinevirtualinherited

Occurs when a user leaves a channel.

This callback notifies the app that the user leaves the channel by calling leaveChannel. From this callback, the app can get information such as the call duration and quality statistics.

Parameters
statsThe statistics on the call: RtcStats.

◆ onRtcStats() [3/3]

virtual void onRtcStats ( const RtcStats stats)
inlinevirtualinherited

Reports the statistics of the current call.

The SDK triggers this callback once every two seconds after the user joins the channel.

Parameters
statsThe statistics of the current call: RtcStats.

◆ onAudioDeviceStateChanged()

virtual void onAudioDeviceStateChanged ( const char *  deviceId,
int  deviceType,
int  deviceState 
)
inlinevirtualinherited

Occurs when the audio device state changes.

This callback notifies the application that the system's audio device state is changed. For example, a headset is unplugged from the device.

Parameters
deviceIdThe device ID.
deviceTypeThe device type: MEDIA_DEVICE_TYPE.
deviceStateThe device state:

◆ onVideoDeviceStateChanged()

virtual void onVideoDeviceStateChanged ( const char *  deviceId,
int  deviceType,
int  deviceState 
)
inlinevirtualinherited

Occurs when the video device state changes.

This callback notifies the application that the system's video device state is changed.

Parameters
deviceIdPointer to the device ID.
deviceTypeDevice type: MEDIA_DEVICE_TYPE.
deviceStateDevice state: MEDIA_DEVICE_STATE_TYPE.

◆ onNetworkQuality() [3/3]

virtual void onNetworkQuality ( uid_t  uid,
int  txQuality,
int  rxQuality 
)
inlinevirtualinherited

Reports the last mile network quality of each user in the channel.

This callback reports the last mile network conditions of each user in the channel. Last mile refers to the connection between the local device and Agora's edge server.

The SDK triggers this callback once every two seconds. If a channel includes multiple users, the SDK triggers this callback as many times.

Note
txQuality is UNKNOWN when the user is not sending a stream; rxQuality is UNKNOWN when the user is not receiving a stream.
Parameters
uidThe user ID. The network quality of the user with this user ID is reported.
txQualityUplink network quality rating of the user in terms of the transmission bit rate, packet loss rate, average RTT (Round-Trip Time) and jitter of the uplink network. This parameter is a quality rating helping you understand how well the current uplink network conditions can support the selected video encoder configuration. For example, a 1000 Kbps uplink network may be adequate for video frames with a resolution of 640 × 480 and a frame rate of 15 fps in the LIVE_BROADCASTING profile, but may be inadequate for resolutions higher than 1280 × 720. See QUALITY_TYPE.
rxQualityDownlink network quality rating of the user in terms of packet loss rate, average RTT, and jitter of the downlink network. See QUALITY_TYPE.

◆ onUplinkNetworkInfoUpdated()

virtual void onUplinkNetworkInfoUpdated ( const UplinkNetworkInfo info)
inlinevirtualinherited

Occurs when uplink network info is updated.

The SDK triggers this callback when the uplink network information changes.

Note
This callback only applies to scenarios where you push externally encoded video data in H.264 format to the SDK.
Parameters
infoThe uplink network information. See UplinkNetworkInfo.

◆ onDownlinkNetworkInfoUpdated()

virtual void onDownlinkNetworkInfoUpdated ( const DownlinkNetworkInfo info)
inlinevirtualinherited

Occurs when downlink network info is updated.

This callback is used for notifying user to switch major/minor stream if needed.

Parameters
infoThe downlink network info collections.

◆ onLastmileQuality()

virtual void onLastmileQuality ( int  quality)
inlinevirtualinherited

Reports the last-mile network quality of the local user.

This callback reports the last-mile network conditions of the local user before the user joins the channel. Last mile refers to the connection between the local device and Agora's edge server.

When the user is not in a channel and the last-mile network test is enabled (by calling startLastmileProbeTest), this callback function is triggered to update the app on the network connection quality of the local user.

Parameters
qualityThe last mile network quality. See QUALITY_TYPE.

◆ onFirstLocalVideoFrame() [3/3]

virtual void onFirstLocalVideoFrame ( VIDEO_SOURCE_TYPE  source,
int  width,
int  height,
int  elapsed 
)
inlinevirtualinherited

Occurs when the first local video frame is rendered on the local video view.

Parameters
sourceThe video source: VIDEO_SOURCE_TYPE.
widthThe width (px) of the first local video frame.
heightThe height (px) of the first local video frame.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. If you call the startPreview method before calling the joinChannel method, then elapsed is the time elapsed from calling the startPreview method until the SDK triggers this callback.

◆ onFirstLocalVideoFramePublished() [3/3]

virtual void onFirstLocalVideoFramePublished ( VIDEO_SOURCE_TYPE  source,
int  elapsed 
)
inlinevirtualinherited

Occurs when the first local video frame is published. The SDK triggers this callback under one of the following circumstances:

  • The local client enables the video module and calls joinChannel successfully.
  • The local client calls muteLocalVideoStream(true) and muteLocalVideoStream(false) in sequence.
  • The local client calls disableVideo and enableVideo in sequence.
  • The local client calls pushVideoFrame to successfully push the video frame to the SDK.
    Parameters
    sourceThe video source type.
    elapsedThe time elapsed (ms) from the local user calling joinChannel` to the SDK triggers this callback.

◆ onFirstRemoteVideoDecoded() [3/3]

virtual void onFirstRemoteVideoDecoded ( uid_t  uid,
int  width,
int  height,
int  elapsed 
)
inlinevirtualinherited

Occurs when the first remote video frame is received and decoded.

The SDK triggers this callback under one of the following circumstances:

  • The remote user joins the channel and sends the video stream.
  • The remote user stops sending the video stream and re-sends it after 15 seconds. Reasons for such an interruption include:
    • The remote user leaves the channel.
    • The remote user drops offline.
    • The remote user calls muteLocalVideoStream to stop sending the video stream.
    • The remote user calls disableVideo to disable video.
Parameters
uidThe user ID of the remote user sending the video stream.
widthThe width (pixels) of the video stream.
heightThe height (pixels) of the video stream.
elapsedThe time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

◆ onVideoSizeChanged() [3/3]

virtual void onVideoSizeChanged ( VIDEO_SOURCE_TYPE  sourceType,
uid_t  uid,
int  width,
int  height,
int  rotation 
)
inlinevirtualinherited

Occurs when the local or remote video size or rotation has changed.

Parameters
sourceTypeThe video source type: VIDEO_SOURCE_TYPE.
uidThe user ID. 0 indicates the local user.
widthThe new width (pixels) of the video.
heightThe new height (pixels) of the video.
rotationThe rotation information of the video.

◆ onLocalVideoStateChanged() [3/3]

virtual void onLocalVideoStateChanged ( VIDEO_SOURCE_TYPE  source,
LOCAL_VIDEO_STREAM_STATE  state,
LOCAL_VIDEO_STREAM_ERROR  error 
)
inlinevirtualinherited

Occurs when the local video stream state changes.

When the state of the local video stream changes (including the state of the video capture and encoding), the SDK triggers this callback to report the current state. This callback indicates the state of the local video stream, including camera capturing and video encoding, and allows you to troubleshoot issues when exceptions occur.

The SDK triggers the onLocalVideoStateChanged callback with the state code of LOCAL_VIDEO_STREAM_STATE_FAILED and error code of LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE in the following situations:

  • The app switches to the background, and the system gets the camera resource.
  • The camera starts normally, but does not output video for four consecutive seconds.

When the camera outputs the captured video frames, if the video frames are the same for 15 consecutive frames, the SDK triggers the onLocalVideoStateChanged callback with the state code of LOCAL_VIDEO_STREAM_STATE_CAPTURING and error code of LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE. Note that the video frame duplication detection is only available for video frames with a resolution greater than 200 × 200, a frame rate greater than or equal to 10 fps, and a bitrate less than 20 Kbps.

Note
For some device models, the SDK does not trigger this callback when the state of the local video changes while the local video capturing device is in use, so you have to make your own timeout judgment.
Parameters
sourceThe video source type: VIDEO_SOURCE_TYPE.
stateThe state of the local video. See LOCAL_VIDEO_STREAM_STATE.
errorThe detailed error information. See LOCAL_VIDEO_STREAM_ERROR.

◆ onRemoteVideoStateChanged() [3/3]

virtual void onRemoteVideoStateChanged ( uid_t  uid,
REMOTE_VIDEO_STATE  state,
REMOTE_VIDEO_STATE_REASON  reason,
int  elapsed 
)
inlinevirtualinherited

Occurs when the remote video state changes.

Note
This callback does not work properly when the number of users (in the voice/video call channel) or hosts (in the live streaming channel) in the channel exceeds 17.
Parameters
uidThe ID of the user whose video state has changed.
stateThe remote video state: REMOTE_VIDEO_STATE.
reasonThe reason of the remote video state change: REMOTE_VIDEO_STATE_REASON.
elapsedThe time elapsed (ms) from the local client calling joinChannel until this callback is triggered.

◆ onFirstRemoteVideoFrame() [3/3]

virtual void onFirstRemoteVideoFrame ( uid_t  userId,
int  width,
int  height,
int  elapsed 
)
inlinevirtualinherited

Occurs when the renderer receives the first frame of the remote video.

Parameters
userIdThe user ID of the remote user sending the video stream.
widthThe width (px) of the video frame.
heightThe height (px) of the video stream.
elapsedThe time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

◆ onUserJoined() [3/3]

virtual void onUserJoined ( uid_t  uid,
int  elapsed 
)
inlinevirtualinherited

Occurs when a remote user or broadcaster joins the channel.

  • In the COMMUNICATION channel profile, this callback indicates that a remote user joins the channel. The SDK also triggers this callback to report the existing users in the channel when a user joins the channel. In the LIVE_BROADCASTING channel profile, this callback indicates that a host joins the channel. The SDK also triggers this callback to report the existing hosts in the channel when a host joins the channel. Agora recommends limiting the number of hosts to 17.

The SDK triggers this callback under one of the following circumstances:

  • A remote user/host joins the channel by calling the joinChannel method.
  • A remote user switches the user role to the host after joining the channel.
  • A remote user/host rejoins the channel after a network interruption.
Parameters
uidThe ID of the remote user or broadcaster joining the channel.
elapsedThe time elapsed (ms) from the local user calling joinChannel or setClientRole until this callback is triggered.

◆ onUserOffline() [3/3]

virtual void onUserOffline ( uid_t  uid,
USER_OFFLINE_REASON_TYPE  reason 
)
inlinevirtualinherited

Occurs when a remote user or broadcaster goes offline.

There are two reasons for a user to go offline:

  • Leave the channel: When the user leaves the channel, the user sends a goodbye message. When this message is received, the SDK determines that the user leaves the channel.
  • Drop offline: When no data packet of the user is received for a certain period of time, the SDK assumes that the user drops offline. A poor network connection may lead to false detection, so we recommend using the RTM SDK for reliable offline detection.
  • The user switches the user role from a broadcaster to an audience.
Parameters
uidThe ID of the remote user or broadcaster who leaves the channel or drops offline.
reasonThe reason why the remote user goes offline: USER_OFFLINE_REASON_TYPE.

◆ onUserMuteAudio() [3/3]

virtual void onUserMuteAudio ( uid_t  uid,
bool  muted 
)
inlinevirtualinherited

Occurs when a remote user's audio stream playback pauses/resumes.

The SDK triggers this callback when the remote user stops or resumes sending the audio stream by calling the muteLocalAudioStream method.

Note
This callback can be inaccurate when the number of users (in the COMMUNICATION profile) or hosts (in the LIVE_BROADCASTING profile) in the channel exceeds 17.
Parameters
uidThe user ID.
mutedWhether the remote user's audio stream is muted/unmuted:
  • true: Muted.
  • false: Unmuted.

◆ onUserMuteVideo() [3/3]

virtual void onUserMuteVideo ( uid_t  userId,
bool  muted 
)
inlinevirtualinherited

Occurs when a remote user pauses or resumes sending the video stream.

When a remote user calls muteLocalVideoStream to stop or resume publishing the video stream, the SDK triggers this callback to report the state of the remote user's publishing stream to the local user.

Note
This callback is invalid when the number of users or broadacasters in a channel exceeds 20.
Parameters
userIdID of the remote user.
mutedWhether the remote user stops publishing the video stream:
  • true: The remote user has paused sending the video stream.
  • false: The remote user has resumed sending the video stream.

◆ onUserEnableVideo() [3/3]

virtual void onUserEnableVideo ( uid_t  uid,
bool  enabled 
)
inlinevirtualinherited

Occurs when a remote user enables or disables the video module.

Once the video function is disabled, the users cannot see any video.

The SDK triggers this callback when a remote user enables or disables the video module by calling the enableVideo or disableVideo method.

Parameters
uidThe ID of the remote user.
enabledWhether the video of the remote user is enabled:
  • true: The remote user has enabled video.
  • false: The remote user has disabled video.

◆ onUserStateChanged() [3/3]

virtual void onUserStateChanged ( uid_t  uid,
uint32_t  state 
)
inlinevirtualinherited

Occurs when the remote user state is updated.

Parameters
uidThe uid of the remote user.
stateThe remote user state: REMOTE_USER_STATE.

◆ onUserEnableLocalVideo() [3/3]

virtual void onUserEnableLocalVideo ( uid_t  uid,
bool  enabled 
)
inlinevirtualinherited

Occurs when a remote user enables or disables local video capturing.

The SDK triggers this callback when the remote user resumes or stops capturing the video stream by calling the enableLocalVideo method.

Parameters
uidThe ID of the remote user.
enabledWhether the specified remote user enables/disables local video:
  • true: The remote user has enabled local video capturing.
  • false: The remote user has disabled local video capturing.

◆ onApiCallExecuted()

virtual void onApiCallExecuted ( int  err,
const char *  api,
const char *  result 
)
inlinevirtualinherited

Occurs when a method is executed by the SDK.

Deprecated:
This callback is deprecated. Use other specific event callbacks instead.
Parameters
apiThe method executed by the SDK.
errThe error code returned by the SDK when the method call fails. If the SDK returns 0, then the method call is successful.
resultThe result of the method call.

◆ onLocalAudioStats() [3/3]

virtual void onLocalAudioStats ( const LocalAudioStats stats)
inlinevirtualinherited

Reports the statistics of the local audio stream.

The SDK triggers this callback once every two seconds.

Parameters
statsThe statistics of the local audio stream. See LocalAudioStats.

◆ onRemoteAudioStats() [3/3]

virtual void onRemoteAudioStats ( const RemoteAudioStats stats)
inlinevirtualinherited

Reports the statistics of the audio stream from each remote user/host.

The SDK triggers this callback once every two seconds for each remote user who is sending audio streams. If a channel includes multiple remote users, the SDK triggers this callback as many times.

Parameters
statsStatistics of the received remote audio streams. See RemoteAudioStats.

◆ onLocalVideoStats() [3/3]

virtual void onLocalVideoStats ( VIDEO_SOURCE_TYPE  source,
const LocalVideoStats stats 
)
inlinevirtualinherited

Reports the statistics of the local video stream.

The SDK triggers this callback once every two seconds for each user/host. If there are multiple users/hosts in the channel, the SDK triggers this callback as many times.

Note
If you have called the enableDualStreamMode method, this callback reports the statistics of the high-video stream (high bitrate, and high-resolution video stream).
Parameters
sourceThe video source type. See VIDEO_SOURCE_TYPE.
statsStatistics of the local video stream. See LocalVideoStats.

◆ onRemoteVideoStats() [3/3]

virtual void onRemoteVideoStats ( const RemoteVideoStats stats)
inlinevirtualinherited

Reports the statistics of the video stream from each remote user/host.

The SDK triggers this callback once every two seconds for each remote user. If a channel has multiple users/hosts sending video streams, the SDK triggers this callback as many times.

Parameters
statsStatistics of the remote video stream. See RemoteVideoStats.

◆ onCameraReady()

virtual void onCameraReady ( )
inlinevirtualinherited

Occurs when the camera turns on and is ready to capture the video.

Deprecated:
Use LOCAL_VIDEO_STREAM_STATE_CAPTURING(1) in onLocalVideoStateChanged instead. This callback indicates that the camera has been successfully turned on and you can start to capture video.

◆ onCameraFocusAreaChanged()

virtual void onCameraFocusAreaChanged ( int  x,
int  y,
int  width,
int  height 
)
inlinevirtualinherited

Occurs when the camera focus area changes.

Note
This method is for Andriod and iOS only.
Parameters
xThe x coordinate of the changed camera focus area.
yThe y coordinate of the changed camera focus area.
widthThe width of the changed camera focus area.
heightThe height of the changed camera focus area.

◆ onCameraExposureAreaChanged()

virtual void onCameraExposureAreaChanged ( int  x,
int  y,
int  width,
int  height 
)
inlinevirtualinherited

Occurs when the camera exposure area changes.

Parameters
xThe x coordinate of the changed camera exposure area.
yThe y coordinate of the changed camera exposure area.
widthThe width of the changed camera exposure area.
heightThe height of the changed exposure area.

◆ onVideoStopped()

virtual void onVideoStopped ( )
inlinevirtualinherited

Occurs when the video stops playing.

Deprecated:
Use LOCAL_VIDEO_STREAM_STATE_STOPPED(0) in the onLocalVideoStateChanged callback instead.

The app can use this callback to change the configuration of the view (for example, displaying other pictures in the view) after the video stops playing.

◆ onRhythmPlayerStateChanged()

virtual void onRhythmPlayerStateChanged ( RHYTHM_PLAYER_STATE_TYPE  state,
RHYTHM_PLAYER_ERROR_TYPE  errorCode 
)
inlinevirtualinherited

Occurs when the state of the rhythm player changes. When you call the startRhythmPlayer method and the state of rhythm player changes, the SDK triggers this callback.

Parameters
stateThe state code. See #RHYTHM_PLAYER_STATE_TYPE.
errorCodeThe error code. See #RHYTHM_PLAYER_ERROR_TYPE.

◆ onStreamMessage() [3/3]

virtual void onStreamMessage ( uid_t  userId,
int  streamId,
const char *  data,
size_t  length,
uint64_t  sentTs 
)
inlinevirtualinherited

Occurs when the local user receives the data stream from the remote user.

The SDK triggers this callback when the user receives the data stream that another user sends by calling the sendStreamMessage method.

Parameters
userIdID of the user who sends the data stream.
streamIdThe ID of the stream data.
dataThe data stream.
lengthThe length (byte) of the data stream.
sentTsThe time when the data stream sent.

◆ onStreamMessageError() [3/3]

virtual void onStreamMessageError ( uid_t  userId,
int  streamId,
int  code,
int  missed,
int  cached 
)
inlinevirtualinherited

Occurs when the local user does not receive the data stream from the remote user.

The SDK triggers this callback when the user fails to receive the data stream that another user sends by calling the sendStreamMessage method.

Parameters
userIdID of the user who sends the data stream.
streamIdThe ID of the stream data.
codeThe error code.
missedThe number of lost messages.
cachedThe number of incoming cached messages when the data stream is interrupted.

◆ onTokenPrivilegeWillExpire() [3/3]

virtual void onTokenPrivilegeWillExpire ( const char *  token)
inlinevirtualinherited

Occurs when the token will expire in 30 seconds.

When the token is about to expire in 30 seconds, the SDK triggers this callback to remind the app to renew the token.

Upon receiving this callback, generate a new token at your app server and call renewToken to pass the new Token to the SDK.

Parameters
tokenThe token that will expire in 30 seconds.

◆ onLicenseValidationFailure() [3/3]

virtual void onLicenseValidationFailure ( LICENSE_ERROR_TYPE  error)
inlinevirtualinherited

Occurs when connection license verification fails.

You can know the reason accordding to error code

◆ onFirstLocalAudioFramePublished() [3/3]

virtual void onFirstLocalAudioFramePublished ( int  elapsed)
inlinevirtualinherited

Occurs when the first local audio frame is published.

The SDK triggers this callback under one of the following circumstances:

  • The local client enables the audio module and calls joinChannel successfully.
  • The local client calls muteLocalAudioStream(true) and muteLocalAudioStream(false) in sequence.
  • The local client calls disableAudio and enableAudio in sequence.
  • The local client calls pushAudioFrame to successfully push the audio frame to the SDK.
Parameters
elapsedThe time elapsed (ms) from the local user calling joinChannel to the SDK triggers this callback.

◆ onFirstRemoteAudioFrame() [3/3]

virtual void onFirstRemoteAudioFrame ( uid_t  uid,
int  elapsed 
)
inlinevirtualinherited

Occurs when the SDK receives the first audio frame from a specific remote user.

Deprecated:
Use onRemoteAudioStateChanged instead.
Parameters
uidID of the remote user.
elapsedThe time elapsed (ms) from the loca user calling joinChannel until this callback is triggered.

◆ onFirstRemoteAudioDecoded() [3/3]

virtual void onFirstRemoteAudioDecoded ( uid_t  uid,
int  elapsed 
)
inlinevirtualinherited

Occurs when the SDK decodes the first remote audio frame for playback.

Deprecated:
Use onRemoteAudioStateChanged instead. The SDK triggers this callback under one of the following circumstances:
  • The remote user joins the channel and sends the audio stream for the first time.
  • The remote user's audio is offline and then goes online to re-send audio. It means the local user cannot receive audio in 15 seconds. Reasons for such an interruption include:
    • The remote user leaves channel.
    • The remote user drops offline.
    • The remote user calls muteLocalAudioStream to stop sending the audio stream.
    • The remote user calls disableAudio to disable audio.
Parameters
uidUser ID of the remote user sending the audio stream.
elapsedThe time elapsed (ms) from the loca user calling joinChannel until this callback is triggered.

◆ onLocalAudioStateChanged() [3/3]

virtual void onLocalAudioStateChanged ( LOCAL_AUDIO_STREAM_STATE  state,
LOCAL_AUDIO_STREAM_ERROR  error 
)
inlinevirtualinherited

Occurs when the local audio state changes.

When the state of the local audio stream changes (including the state of the audio capture and encoding), the SDK triggers this callback to report the current state. This callback indicates the state of the local audio stream, and allows you to troubleshoot issues when audio exceptions occur.

Note
When the state is LOCAL_AUDIO_STREAM_STATE_FAILED(3), see the error parameter for details.
Parameters
stateState of the local audio. See LOCAL_AUDIO_STREAM_STATE.
errorThe error information of the local audio. See LOCAL_AUDIO_STREAM_ERROR.

◆ onRemoteAudioStateChanged() [3/3]

virtual void onRemoteAudioStateChanged ( uid_t  uid,
REMOTE_AUDIO_STATE  state,
REMOTE_AUDIO_STATE_REASON  reason,
int  elapsed 
)
inlinevirtualinherited

Occurs when the remote audio state changes.

When the audio state of a remote user (in the voice/video call channel) or host (in the live streaming channel) changes, the SDK triggers this callback to report the current state of the remote audio stream.

Note
This callback does not work properly when the number of users (in the voice/video call channel) or hosts (in the live streaming channel) in the channel exceeds 17.
Parameters
uidID of the remote user whose audio state changes.
stateState of the remote audio. See REMOTE_AUDIO_STATE.
reasonThe reason of the remote audio state change. See REMOTE_AUDIO_STATE_REASON.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

◆ onActiveSpeaker() [3/3]

virtual void onActiveSpeaker ( uid_t  userId)
inlinevirtualinherited

Occurs when an active speaker is detected.

After a successful call of enableAudioVolumeIndication, the SDK continuously detects which remote user has the loudest volume. During the current period, the remote user, who is detected as the loudest for the most times, is the most active user.

When the number of users is no less than two and an active remote speaker exists, the SDK triggers this callback and reports the uid of the most active remote speaker.

  • If the most active remote speaker is always the same user, the SDK triggers the onActiveSpeaker callback only once.
  • If the most active remote speaker changes to another user, the SDK triggers this callback again and reports the uid of the new active remote speaker.
Parameters
userIdThe ID of the active speaker. A uid of 0 means the local user.

◆ onContentInspectResult()

virtual void onContentInspectResult ( media::CONTENT_INSPECT_RESULT  result)
inlinevirtualinherited

Reports result of content inspection.

Parameters
resultThe result of content inspection: #CONTENT_INSPECT_RESULT.

◆ onSnapshotTaken() [3/3]

virtual void onSnapshotTaken ( uid_t  uid,
const char *  filePath,
int  width,
int  height,
int  errCode 
)
inlinevirtualinherited

Reports the result of taking a video snapshot.

After a successful takeSnapshot method call, the SDK triggers this callback to report whether the snapshot is successfully taken, as well as the details for that snapshot.

Parameters
uidThe user ID. A uid of 0 indicates the local user.
filePathThe local path of the snapshot.
widthThe width (px) of the snapshot.
heightThe height (px) of the snapshot.
errCodeThe message that confirms success or gives the reason why the snapshot is not successfully taken:
  • 0: Success.
  • < 0: Failure.
    • -1: The SDK fails to write data to a file or encode a JPEG image.
    • -2: The SDK does not find the video stream of the specified user within one second after the takeSnapshot method call succeeds.
    • -3: Calling the takeSnapshot method too frequently. Call the takeSnapshot method after receiving the onSnapshotTaken callback from the previous call.

◆ onClientRoleChanged() [3/3]

virtual void onClientRoleChanged ( CLIENT_ROLE_TYPE  oldRole,
CLIENT_ROLE_TYPE  newRole,
const ClientRoleOptions newRoleOptions 
)
inlinevirtualinherited

Occurs when the user role switches in the interactive live streaming.

Parameters
oldRoleThe old role of the user: CLIENT_ROLE_TYPE.
newRoleThe new role of the user: CLIENT_ROLE_TYPE.
newRoleOptionsThe client role options of the new role: #ClientRoleOptions.

◆ onClientRoleChangeFailed() [3/3]

virtual void onClientRoleChangeFailed ( CLIENT_ROLE_CHANGE_FAILED_REASON  reason,
CLIENT_ROLE_TYPE  currentRole 
)
inlinevirtualinherited

Occurs when the user role in a Live-Broadcast channel fails to switch, for example, from a broadcaster to an audience or vice versa.

Parameters
reasonThe reason for failing to change the client role: CLIENT_ROLE_CHANGE_FAILED_REASON.
currentRoleThe current role of the user: CLIENT_ROLE_TYPE.

◆ onAudioDeviceVolumeChanged()

virtual void onAudioDeviceVolumeChanged ( MEDIA_DEVICE_TYPE  deviceType,
int  volume,
bool  muted 
)
inlinevirtualinherited

Occurs when the audio device volume changes.

Parameters
deviceTypeThe device type, see MEDIA_DEVICE_TYPE
volumeThe volume of the audio device.
mutedWhether the audio device is muted:
  • true: The audio device is muted.
  • false: The audio device is not muted.

◆ onRtmpStreamingStateChanged()

virtual void onRtmpStreamingStateChanged ( const char *  url,
RTMP_STREAM_PUBLISH_STATE  state,
RTMP_STREAM_PUBLISH_ERROR_TYPE  errCode 
)
inlinevirtualinherited

Occurs when the state of the RTMP streaming changes.

When the media push state changes, the SDK triggers this callback and reports the URL address and the current state of the media push. This callback indicates the state of the media push. When exceptions occur, you can troubleshoot issues by referring to the detailed error descriptions in the error code.

Parameters
urlThe URL address where the state of the media push changes.
stateThe current state of the media push: RTMP_STREAM_PUBLISH_STATE.
errCodeThe detailed error information for the media push: RTMP_STREAM_PUBLISH_ERROR_TYPE.

◆ onRtmpStreamingEvent()

virtual void onRtmpStreamingEvent ( const char *  url,
RTMP_STREAMING_EVENT  eventCode 
)
inlinevirtualinherited

Reports events during the media push.

Parameters
urlThe URL for media push.
eventCodeThe event code of media push. See RTMP_STREAMING_EVENT for details.

◆ onTranscodingUpdated()

virtual void onTranscodingUpdated ( )
inlinevirtualinherited

Occurs when the publisher's transcoding settings are updated.

When the LiveTranscoding class in setLiveTranscoding updates, the SDK triggers this callback to report the update information.

Note
If you call the setLiveTranscoding method to set the LiveTranscoding class for the first time, the SDK does not trigger this callback.

◆ onAudioRoutingChanged()

virtual void onAudioRoutingChanged ( int  routing)
inlinevirtualinherited

Occurs when the local audio route changes (for Android, iOS, and macOS only).

The SDK triggers this callback when the local audio route switches to an earpiece, speakerphone, headset, or Bluetooth device.

Parameters
routingThe current audio output routing:
  • -1: Default.
  • 0: Headset.
  • 1: Earpiece.
  • 2: Headset with no microphone.
  • 3: Speakerphone.
  • 4: Loudspeaker.
  • 5: Bluetooth headset.

◆ onChannelMediaRelayStateChanged()

virtual void onChannelMediaRelayStateChanged ( int  state,
int  code 
)
inlinevirtualinherited

Occurs when the state of the media stream relay changes.

The SDK reports the state of the current media relay and possible error messages in this callback.

Parameters
stateThe state code:
  • RELAY_STATE_IDLE(0): The SDK is initializing.
  • RELAY_STATE_CONNECTING(1): The SDK tries to relay the media stream to the destination channel.
  • RELAY_STATE_RUNNING(2): The SDK successfully relays the media stream to the destination channel.
  • RELAY_STATE_FAILURE(3): A failure occurs. See the details in code.
codeThe error code:
  • RELAY_OK(0): The state is normal.
  • RELAY_ERROR_SERVER_ERROR_RESPONSE(1): An error occurs in the server response.
  • RELAY_ERROR_SERVER_NO_RESPONSE(2): No server response. You can call the leaveChannel method to leave the channel.
  • RELAY_ERROR_NO_RESOURCE_AVAILABLE(3): The SDK fails to access the service, probably due to limited resources of the server.
  • RELAY_ERROR_FAILED_JOIN_SRC(4): Fails to send the relay request.
  • RELAY_ERROR_FAILED_JOIN_DEST(5): Fails to accept the relay request.
  • RELAY_ERROR_FAILED_PACKET_RECEIVED_FROM_SRC(6): The server fails to receive the media stream.
  • RELAY_ERROR_FAILED_PACKET_SENT_TO_DEST(7): The server fails to send the media stream.
  • RELAY_ERROR_SERVER_CONNECTION_LOST(8): The SDK disconnects from the server due to poor network connections. You can call the leaveChannel method to leave the channel.
  • RELAY_ERROR_INTERNAL_ERROR(9): An internal error occurs in the server.
  • RELAY_ERROR_SRC_TOKEN_EXPIRED(10): The token of the source channel has expired.
  • RELAY_ERROR_DEST_TOKEN_EXPIRED(11): The token of the destination channel has expired.

◆ onChannelMediaRelayEvent()

virtual void onChannelMediaRelayEvent ( int  code)
inlinevirtualinherited

Reports events during the media stream relay.

Parameters
codeThe event code for media stream relay:
  • RELAY_EVENT_NETWORK_DISCONNECTED(0): The user disconnects from the server due to poor network connections.
  • RELAY_EVENT_NETWORK_CONNECTED(1): The network reconnects.
  • RELAY_EVENT_PACKET_JOINED_SRC_CHANNEL(2): The user joins the source channel.
  • RELAY_EVENT_PACKET_JOINED_DEST_CHANNEL(3): The user joins the destination channel.
  • RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL(4): The SDK starts relaying the media stream to the destination channel.
  • RELAY_EVENT_PACKET_RECEIVED_VIDEO_FROM_SRC(5): The server receives the video stream from the source channel.
  • RELAY_EVENT_PACKET_RECEIVED_AUDIO_FROM_SRC(6): The server receives the audio stream from the source channel.
  • RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL(7): The destination channel is updated.
  • RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_REFUSED(8): The destination channel update fails due to internal reasons. Deprecated from 4.1.0
  • RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE(9): The destination channel does not change, which means that the destination channel fails to be updated.
  • RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_IS_NULL(10): The destination channel name is NULL.
  • RELAY_EVENT_VIDEO_PROFILE_UPDATE(11): The video profile is sent to the server.

◆ onLocalPublishFallbackToAudioOnly()

virtual void onLocalPublishFallbackToAudioOnly ( bool  isFallbackOrRecover)
inlinevirtualinherited

Occurs when the published media stream falls back to an audio-only stream due to poor network conditions or switches back to video stream after the network conditions improve.

If you call setLocalPublishFallbackOption and set option as STREAM_FALLBACK_OPTION_AUDIO_ONLY(2), this callback is triggered when the locally published stream falls back to audio-only mode due to poor uplink conditions, or when the audio stream switches back to the video after the uplink network condition improves. Once the published stream falls back to audio only, the remote app receives the onRemoteVideoStateChanged callback.

Parameters
isFallbackOrRecoverWhether the published stream fell back to audio-only or switched back to the video:
  • true: The published stream fell back to audio-only due to poor network conditions.
  • false: The published stream switched back to the video after the network conditions improved.

◆ onRemoteSubscribeFallbackToAudioOnly()

virtual void onRemoteSubscribeFallbackToAudioOnly ( uid_t  uid,
bool  isFallbackOrRecover 
)
inlinevirtualinherited

Occurs when the remote media stream falls back to audio-only stream due to poor network conditions or switches back to video stream after the network conditions improve.

If you call setRemoteSubscribeFallbackOption and set option as STREAM_FALLBACK_OPTION_AUDIO_ONLY(2), this callback is triggered when the remotely subscribed media stream falls back to audio-only mode due to poor downlink conditions, or when the remotely subscribed media stream switches back to the video after the downlink network condition improves.

Note
Once the remote media stream is switched to the low stream due to poor network conditions, you can monitor the stream switch between a high and low stream in the onRemoteVideoStats callback.
Parameters
uidID of the remote user sending the stream.
isFallbackOrRecoverWhether the remote media stream fell back to audio-only or switched back to the video:
  • true: The remote media stream fell back to audio-only due to poor network conditions.
  • false: The remote media stream switched back to the video stream after the network conditions improved.

◆ onRemoteAudioTransportStats() [3/3]

virtual void onRemoteAudioTransportStats ( uid_t  uid,
unsigned short  delay,
unsigned short  lost,
unsigned short  rxKBitRate 
)
inlinevirtualinherited

Reports the transport-layer statistics of each remote audio stream.

Deprecated:
Use onRemoteAudioStats instead.

This callback reports the transport-layer statistics, such as the packet loss rate and network time delay, once every two seconds after the local user receives an audio packet from a remote user. During a call, when the user receives the audio packet sent by the remote user/host, the callback is triggered every 2 seconds.

Parameters
uidID of the remote user whose audio data packet is received.
delayThe network time delay (ms) from the sender to the receiver.
lostThe Packet loss rate (%) of the audio packet sent from the remote user.
rxKBitRateReceived bitrate (Kbps) of the audio packet sent from the remote user.

◆ onRemoteVideoTransportStats() [3/3]

virtual void onRemoteVideoTransportStats ( uid_t  uid,
unsigned short  delay,
unsigned short  lost,
unsigned short  rxKBitRate 
)
inlinevirtualinherited

Reports the transport-layer statistics of each remote video stream.

Deprecated:
Use onRemoteVideoStats instead.

This callback reports the transport-layer statistics, such as the packet loss rate and network time delay, once every two seconds after the local user receives a video packet from a remote user.

During a call, when the user receives the video packet sent by the remote user/host, the callback is triggered every 2 seconds.

Parameters
uidID of the remote user whose video packet is received.
delayThe network time delay (ms) from the remote user sending the video packet to the local user.
lostThe packet loss rate (%) of the video packet sent from the remote user.
rxKBitRateThe bitrate (Kbps) of the video packet sent from the remote user.

◆ onConnectionStateChanged() [3/3]

virtual void onConnectionStateChanged ( CONNECTION_STATE_TYPE  state,
CONNECTION_CHANGED_REASON_TYPE  reason 
)
inlinevirtualinherited

Occurs when the network connection state changes.

When the network connection state changes, the SDK triggers this callback and reports the current connection state and the reason for the change.

Parameters
stateThe current connection state. See #CONNECTION_STATE_TYPE.
reasonThe reason for a connection state change. See CONNECTION_CHANGED_REASON_TYPE.

◆ onWlAccMessage() [3/3]

virtual void onWlAccMessage ( WLACC_MESSAGE_REASON  reason,
WLACC_SUGGEST_ACTION  action,
const char *  wlAccMsg 
)
inlinevirtualinherited

Occurs when the WIFI message need be sent to the user.

Parameters
reasonThe reason of notifying the user of a message.
actionSuggest an action for the user.
wlAccMsgThe message content of notifying the user.

◆ onWlAccStats() [3/3]

virtual void onWlAccStats ( WlAccStats  currentStats,
WlAccStats  averageStats 
)
inlinevirtualinherited

Occurs when SDK statistics wifi acceleration optimization effect.

Parameters
currentStatsInstantaneous value of optimization effect.
averageStatsAverage value of cumulative optimization effect.

◆ onNetworkTypeChanged() [3/3]

virtual void onNetworkTypeChanged ( NETWORK_TYPE  type)
inlinevirtualinherited

Occurs when the local network type changes.

This callback occurs when the connection state of the local user changes. You can get the connection state and reason for the state change in this callback. When the network connection is interrupted, this callback indicates whether the interruption is caused by a network type change or poor network conditions.

Parameters
typeThe type of the local network connection. See NETWORK_TYPE.

◆ onEncryptionError() [3/3]

virtual void onEncryptionError ( ENCRYPTION_ERROR_TYPE  errorType)
inlinevirtualinherited

Reports the built-in encryption errors.

When encryption is enabled by calling enableEncryption, the SDK triggers this callback if an error occurs in encryption or decryption on the sender or the receiver side.

Parameters
errorTypeThe error type. See ENCRYPTION_ERROR_TYPE.

◆ onPermissionError()

virtual void onPermissionError ( PERMISSION_TYPE  permissionType)
inlinevirtualinherited

Occurs when the SDK cannot get the device permission.

When the SDK fails to get the device permission, the SDK triggers this callback to report which device permission cannot be got.

Note
This method is for Android and iOS only.
Parameters
permissionTypeThe type of the device permission. See PERMISSION_TYPE.

◆ onLocalUserRegistered()

virtual void onLocalUserRegistered ( uid_t  uid,
const char *  userAccount 
)
inlinevirtualinherited

Occurs when the local user registers a user account.

After the local user successfully calls registerLocalUserAccount to register the user account or calls joinChannelWithUserAccount to join a channel, the SDK triggers the callback and informs the local user's UID and User Account.

Parameters
uidThe ID of the local user.
userAccountThe user account of the local user.

◆ onUserInfoUpdated()

virtual void onUserInfoUpdated ( uid_t  uid,
const UserInfo info 
)
inlinevirtualinherited

Occurs when the SDK gets the user ID and user account of the remote user.

After a remote user joins the channel, the SDK gets the UID and user account of the remote user, caches them in a mapping table object (userInfo), and triggers this callback on the local client.

Parameters
uidThe ID of the remote user.
infoThe UserInfo object that contains the user ID and user account of the remote user.

◆ onUploadLogResult() [3/3]

virtual void onUploadLogResult ( const char *  requestId,
bool  success,
UPLOAD_ERROR_REASON  reason 
)
inlinevirtualinherited

Reports the user log upload result

Parameters
requestIdRequestId of the upload
successIs upload success
reasonReason of the upload, 0: OK, 1 Network Error, 2 Server Error.

◆ onAudioSubscribeStateChanged() [2/2]

virtual void onAudioSubscribeStateChanged ( const char *  channel,
uid_t  uid,
STREAM_SUBSCRIBE_STATE  oldState,
STREAM_SUBSCRIBE_STATE  newState,
int  elapseSinceLastState 
)
inlinevirtualinherited

Occurs when the audio subscribing state changes.

Parameters
channelThe name of the channel.
uidThe ID of the remote user.
oldStateThe previous subscribing status: STREAM_SUBSCRIBE_STATE.
newStateThe current subscribing status: STREAM_SUBSCRIBE_STATE.
elapseSinceLastStateThe time elapsed (ms) from the previous state to the current state.

◆ onVideoSubscribeStateChanged() [2/2]

virtual void onVideoSubscribeStateChanged ( const char *  channel,
uid_t  uid,
STREAM_SUBSCRIBE_STATE  oldState,
STREAM_SUBSCRIBE_STATE  newState,
int  elapseSinceLastState 
)
inlinevirtualinherited

Occurs when the video subscribing state changes.

Parameters
channelThe name of the channel.
uidThe ID of the remote user.
oldStateThe previous subscribing status: STREAM_SUBSCRIBE_STATE.
newStateThe current subscribing status: STREAM_SUBSCRIBE_STATE.
elapseSinceLastStateThe time elapsed (ms) from the previous state to the current state.

◆ onAudioPublishStateChanged() [2/2]

virtual void onAudioPublishStateChanged ( const char *  channel,
STREAM_PUBLISH_STATE  oldState,
STREAM_PUBLISH_STATE  newState,
int  elapseSinceLastState 
)
inlinevirtualinherited

Occurs when the audio publishing state changes.

Parameters
channelThe name of the channel.
oldStateThe previous publishing state: STREAM_PUBLISH_STATE.
newStateThe current publishing state: STREAM_PUBLISH_STATE.
elapseSinceLastStateThe time elapsed (ms) from the previous state to the current state.

◆ onVideoPublishStateChanged() [2/2]

virtual void onVideoPublishStateChanged ( VIDEO_SOURCE_TYPE  source,
const char *  channel,
STREAM_PUBLISH_STATE  oldState,
STREAM_PUBLISH_STATE  newState,
int  elapseSinceLastState 
)
inlinevirtualinherited

Occurs when the video publishing state changes.

Parameters
sourceThe video source type.
channelThe name of the channel.
oldStateThe previous publishing state: STREAM_PUBLISH_STATE.
newStateThe current publishing state: STREAM_PUBLISH_STATE.
elapseSinceLastStateThe time elapsed (ms) from the previous state to the current state.

◆ onExtensionEvent()

virtual void onExtensionEvent ( const char *  provider,
const char *  extension,
const char *  key,
const char *  value 
)
inlinevirtualinherited

The event callback of the extension.

To listen for events while the extension is running, you need to register this callback.

Parameters
providerThe name of the extension provider.
extensionThe name of the extension.
keyThe key of the extension.
valueThe value of the extension key.

◆ onExtensionStarted()

virtual void onExtensionStarted ( const char *  provider,
const char *  extension 
)
inlinevirtualinherited

Occurs when the extension is enabled.

After a successful call of enableExtension(true), the extension triggers this callback.

Parameters
providerThe name of the extension provider.
extensionThe name of the extension.

◆ onExtensionStopped()

virtual void onExtensionStopped ( const char *  provider,
const char *  extension 
)
inlinevirtualinherited

Occurs when the extension is disabled.

After a successful call of enableExtension(false), the extension triggers this callback.

Parameters
providerThe name of the extension provider.
extensionThe name of the extension.

◆ onExtensionError()

virtual void onExtensionError ( const char *  provider,
const char *  extension,
int  error,
const char *  message 
)
inlinevirtualinherited

Occurs when the extension runs incorrectly.

When calling enableExtension(true) fails or the extension runs in error, the extension triggers this callback and reports the error code and reason.

Parameters
providerThe name of the extension provider.
extensionThe name of the extension.
errorThe error code. For details, see the extension documentation provided by the extension provider.
messageThe error message. For details, see the extension documentation provided by the extension provider.

◆ onUserAccountUpdated() [3/3]

virtual void onUserAccountUpdated ( uid_t  uid,
const char *  userAccount 
)
inlinevirtualinherited

Occurs when the user account is updated.

Parameters
uidThe user ID.
userAccountThe user account.

◆ onVideoRenderingTracingResult() [3/3]

virtual void onVideoRenderingTracingResult ( uid_t  uid,
MEDIA_TRACE_EVENT  currentEvent,
VideoRenderingTracingInfo  tracingInfo 
)
inlinevirtualinherited

Reports the tracing result of video rendering event of the user.

Parameters
uidThe user ID.
currentEventThe current event of the tracing result: MEDIA_TRACE_EVENT.
tracingInfoThe tracing result: #VideoRenderingTracingInfo.