Agora C++ API Reference for All Platforms
|
#include <IAgoraRtcEngine.h>
Public Member Functions | |
virtual | ~IRtcEngineEventHandler () |
virtual void | onWarning (int warn, const char *msg) |
virtual void | onError (int err, const char *msg) |
virtual void | onJoinChannelSuccess (const char *channel, uid_t uid, int elapsed) |
virtual void | onRejoinChannelSuccess (const char *channel, uid_t uid, int elapsed) |
virtual void | onLeaveChannel (const RtcStats &stats) |
virtual void | onClientRoleChanged (CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole) |
virtual void | onClientRoleChangeFailed (CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole) |
virtual void | onUserJoined (uid_t uid, int elapsed) |
virtual void | onUserOffline (uid_t uid, USER_OFFLINE_REASON_TYPE reason) |
virtual void | onProxyConnected (const char *channel, uid_t uid, PROXY_TYPE proxyType, const char *localProxyIp, int elapsed) |
virtual void | onLastmileQuality (int quality) |
virtual void | onLastmileProbeResult (const LastmileProbeResult &result) |
virtual void | onConnectionInterrupted () |
virtual void | onConnectionLost () |
virtual void | onConnectionBanned () |
virtual void | onApiCallExecuted (int err, const char *api, const char *result) |
virtual void | onRequestToken () |
virtual void | onTokenPrivilegeWillExpire (const char *token) |
virtual void | onAudioQuality (uid_t uid, int quality, unsigned short delay, unsigned short lost) |
virtual void | onRtcStats (const RtcStats &stats) |
virtual void | onNetworkQuality (uid_t uid, int txQuality, int rxQuality) |
virtual void | onLocalVideoStats (const LocalVideoStats &stats) |
virtual void | onRemoteVideoStats (const RemoteVideoStats &stats) |
virtual void | onLocalAudioStats (const LocalAudioStats &stats) |
virtual void | onRemoteAudioStats (const RemoteAudioStats &stats) |
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 | onAudioPublishStateChanged (const char *channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) |
virtual void | onVideoPublishStateChanged (const char *channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) |
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 | onAudioVolumeIndication (const AudioVolumeInfo *speakers, unsigned int speakerNumber, int totalVolume) |
virtual void | onLocalVoicePitchInHz (int pitchInHz) |
virtual void | onAudioDeviceTestVolumeIndication (AudioDeviceTestVolumeType volumeType, int volume) |
virtual void | onActiveSpeaker (uid_t uid) |
virtual void | onVideoStopped () |
virtual void | onFirstLocalVideoFrame (int width, int height, int elapsed) |
virtual void | onFirstLocalVideoFramePublished (int elapsed) |
virtual void | onFirstRemoteVideoDecoded (uid_t uid, int width, int height, int elapsed) AGORA_DEPRECATED_ATTRIBUTE |
virtual void | onFirstRemoteVideoFrame (uid_t uid, int width, int height, int elapsed) |
virtual void | onUserMuteAudio (uid_t uid, bool muted) |
virtual void | onUserMuteVideo (uid_t uid, bool muted) |
virtual void | onUserEnableVideo (uid_t uid, bool enabled) |
virtual void | onAudioDeviceStateChanged (const char *deviceId, int deviceType, int deviceState) |
virtual void | onAudioDeviceVolumeChanged (MEDIA_DEVICE_TYPE deviceType, int volume, bool muted) |
virtual void | onCameraReady () |
virtual void | onCameraFocusAreaChanged (int x, int y, int width, int height) |
virtual void | onFacePositionChanged (int imageWidth, int imageHeight, Rectangle *vecRectangle, int *vecDistance, int numFaces) |
virtual void | onCameraExposureAreaChanged (int x, int y, int width, int height) |
virtual void | onAudioMixingFinished () |
virtual void | onAudioMixingStateChanged (AUDIO_MIXING_STATE_TYPE state, AUDIO_MIXING_REASON_TYPE reason) |
virtual void | onRemoteAudioMixingBegin () |
virtual void | onRemoteAudioMixingEnd () |
virtual void | onRequestAudioFileInfo (const AudioFileInfo &info, AUDIO_FILE_INFO_ERROR error) |
virtual void | onAudioEffectFinished (int soundId) |
virtual void | onFirstRemoteAudioDecoded (uid_t uid, int elapsed) AGORA_DEPRECATED_ATTRIBUTE |
virtual void | onVideoDeviceStateChanged (const char *deviceId, int deviceType, int deviceState) |
virtual void | onLocalVideoStateChanged (LOCAL_VIDEO_STREAM_STATE localVideoState, LOCAL_VIDEO_STREAM_ERROR error) |
virtual void | onVideoSizeChanged (uid_t uid, int width, int height, int rotation) |
virtual void | onRemoteVideoStateChanged (uid_t uid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed) |
virtual void | onUserEnableLocalVideo (uid_t uid, bool enabled) |
virtual void | onStreamMessage (uid_t uid, int streamId, const char *data, size_t length) |
virtual void | onStreamMessageError (uid_t uid, int streamId, int code, int missed, int cached) |
virtual void | onMediaEngineLoadSuccess () |
virtual void | onMediaEngineStartCallSuccess () |
virtual void | onUserSuperResolutionEnabled (uid_t uid, bool enabled, SUPER_RESOLUTION_STATE_REASON reason) |
virtual void | onVirtualBackgroundSourceEnabled (bool enabled, VIRTUAL_BACKGROUND_SOURCE_STATE_REASON reason) |
virtual void | onSnapshotTaken (const char *channel, uid_t uid, const char *filePath, int width, int height, int errCode) |
virtual void | onChannelMediaRelayStateChanged (CHANNEL_MEDIA_RELAY_STATE state, CHANNEL_MEDIA_RELAY_ERROR code) |
virtual void | onChannelMediaRelayEvent (CHANNEL_MEDIA_RELAY_EVENT code) |
virtual void | onFirstLocalAudioFrame (int elapsed) AGORA_DEPRECATED_ATTRIBUTE |
virtual void | onFirstLocalAudioFramePublished (int elapsed) |
virtual void | onFirstRemoteAudioFrame (uid_t uid, int elapsed) AGORA_DEPRECATED_ATTRIBUTE |
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 | onStreamPublished (const char *url, int error) AGORA_DEPRECATED_ATTRIBUTE |
virtual void | onStreamUnpublished (const char *url) AGORA_DEPRECATED_ATTRIBUTE |
virtual void | onTranscodingUpdated () |
virtual void | onAudioRouteChanged (AUDIO_ROUTE_TYPE routing) |
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) AGORA_DEPRECATED_ATTRIBUTE |
virtual void | onRemoteVideoTransportStats (uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) AGORA_DEPRECATED_ATTRIBUTE |
virtual void | onMicrophoneEnabled (bool enabled) AGORA_DEPRECATED_ATTRIBUTE |
virtual void | onConnectionStateChanged (CONNECTION_STATE_TYPE state, CONNECTION_CHANGED_REASON_TYPE reason) |
virtual void | onNetworkTypeChanged (NETWORK_TYPE type) |
virtual void | onLocalUserRegistered (uid_t uid, const char *userAccount) |
virtual void | onUserInfoUpdated (uid_t uid, const UserInfo &info) |
virtual void | onScreenCaptureInfoUpdated (ScreenCaptureInfo &info) |
The SDK uses the IRtcEngineEventHandler interface class to send callbacks to the application. The application inherits the methods of this interface class to retrieve these callbacks.
All methods in this interface class have default (empty) implementations. Therefore, the application can only inherit some required events. In the callbacks, avoid time-consuming tasks or calling blocking APIs, such as the SendMessage method. Otherwise, the SDK may not work properly.
|
inlinevirtual |
|
inlinevirtual |
Reports a warning during SDK runtime.
In most cases, the application can ignore the warning reported by the SDK because the SDK can usually fix the issue and resume running. For example, when losing connection with the server, the SDK may report WARN_LOOKUP_CHANNEL_TIMEOUT and automatically try to reconnect.
warn | Warning code: WARN_CODE_TYPE. |
msg | Pointer to the warning message. |
|
inlinevirtual |
Reports an error during SDK runtime.
In most cases, the SDK cannot fix the issue and resume running. The SDK requires the application to take action or informs the user about the issue.
For example, the SDK reports an ERR_START_CALL error when failing to initialize a call. The application informs the user that the call initialization failed and invokes the leaveChannel method to leave the channel.
err | Error code: ERROR_CODE_TYPE. |
msg | Pointer to the error message. |
|
inlinevirtual |
Occurs when a user joins a channel.
This callback notifies the application that a user joins a specified channel when the application calls the joinChannel method.
The channel name assignment is based on channelName
specified in the joinChannel method.
If the uid
is not specified in the joinChannel method, the server automatically assigns a uid
.
channel | Pointer to the channel name. |
uid | User ID of the user joining the channel. |
elapsed | Time elapsed (ms) from the user calling the joinChannel method until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when a user rejoins the channel after disconnection due to network problems.
When a user loses connection with the server because of network problems, the SDK automatically tries to reconnect and triggers this callback upon reconnection.
channel | Pointer to the channel name. |
uid | User ID of the user rejoining the channel. |
elapsed | Time elapsed (ms) from starting to reconnect until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when a user leaves the channel.
This callback notifies the application that a user leaves the channel when the application calls the leaveChannel method.
The application gets information, such as the call duration and statistics.
stats | Pointer to the statistics of the call: RtcStats. |
|
inlinevirtual |
Occurs when the user role switches successfully in the interactive live streaming.
In the LIVE_BROADCASTING
channel profile, when the local user successfully calls setClientRole to switch their user role after joining the channel, for example, from a host to an audience member or vice versa, the SDK triggers this callback to report the user role before and after the switch.
oldRole | Role that the user switches from: CLIENT_ROLE_TYPE. |
newRole | Role that the user switches to: CLIENT_ROLE_TYPE. |
|
inlinevirtual |
Occurs when the user role switch fails in the interactive live streaming.
In the LIVE_BROADCASTING
channel profile, when the local user calls setClientRole to switch their user role after joining the channel but the switch fails, the SDK triggers this callback to report the reason for the failure and the current user role.
reason | The reason for the user role switch failure. See CLIENT_ROLE_CHANGE_FAILED_REASON. |
currentRole | The current user role. See CLIENT_ROLE_TYPE. |
|
inlinevirtual |
Occurs when a remote user (COMMUNICATION
)/ host (LIVE_BROADCASTING
) joins the channel.
COMMUNICATION
profile: This callback notifies the application that another user joins the channel. If other users are already in the channel, the SDK also reports to the application on the existing users.LIVE_BROADCASTING
profile: This callback notifies the application that the host joins the channel. If other hosts are already in the channel, the SDK also reports to the application on the existing hosts. We recommend limiting the number of hosts to 17.The SDK triggers this callback under one of the following circumstances:
LIVE_BROADCASTING
profile:uid | User ID of the user or host joining the channel. |
elapsed | Time delay (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when a remote user (COMMUNICATION
)/ host (LIVE_BROADCASTING
) leaves the channel.
Reasons why the user is offline:
uid | User ID of the user leaving the channel or going offline. |
reason | Reason why the user is offline: USER_OFFLINE_REASON_TYPE. |
|
inlinevirtual |
Reports the proxy connection state.
You can use this callback to listen for the state of the SDK connecting to a proxy. For example, when a user calls setCloudProxy and joins a channel successfully, the SDK triggers this callback to report the user ID, the proxy type connected, and the time elapsed from the user calling joinChannel until this callback is triggered.
channel | The channel name. |
uid | The user ID. |
proxyType | The proxy type connected. See PROXY_TYPE. |
localProxyIp | Reserved for future use. |
elapsed | The time elapsed (ms) from the user calling joinChannel until this callback is triggered. |
|
inlinevirtual |
Reports the last mile network quality of the local user once every two seconds before the user joins the channel.
Last mile refers to the connection between the local device and Agora's edge server. After the application calls the enableLastmileTest method, this callback reports once every two seconds the uplink and downlink last mile network conditions of the local user before the user joins the channel.
quality | The last mile network quality: QUALITY_TYPE. |
|
inlinevirtual |
Reports the last-mile network probe result.
The SDK triggers this callback within 30 seconds after the app calls the startLastmileProbeTest method.
result | The uplink and downlink last-mile network probe test result. See LastmileProbeResult. |
|
inlinevirtual |
Deprecated as of v2.3.2. Replaced by the onConnectionStateChanged(CONNECTION_STATE_RECONNECTING, CONNECTION_CHANGED_INTERRUPTED) callback.
The SDK triggers this callback when it loses connection with the server for more than four seconds after the connection is established.
After triggering this callback, the SDK tries reconnecting to the server. You can use this callback to implement pop-up reminders.
This callback is different from onConnectionLost:
If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora's edge server, the SDK stops rejoining the channel.
|
inlinevirtual |
Occurs when the SDK cannot reconnect to Agora's edge 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 the joinChannel method, whether or not it is in the channel.
This callback is different from onConnectionInterrupted:
If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora's edge server, the SDK stops rejoining the channel.
|
inlinevirtual |
Occurs when your connection is banned by the Agora Server.
|
inlinevirtual |
Occurs when a method is executed by the SDK.
err | The error code (ERROR_CODE_TYPE) returned by the SDK when a method call fails. If the SDK returns 0, then the method call is successful. |
api | Pointer to the method executed by the SDK. |
result | Pointer to the result of the method call. |
|
inlinevirtual |
Occurs when the token expires.
After a token is specified by calling the joinChannel method, if the SDK losses connection with the Agora server due to network issues, the token may expire after a certain period of time and a new token may be required to reconnect to the server.
Once you receive this callback, generate a new token on your app server, and call renewToken to pass the new token to the SDK.
|
inlinevirtual |
Occurs when the token expires in 30 seconds.
The user becomes offline if the token used in the joinChannel method expires. The SDK triggers this callback 30 seconds before the token expires to remind the application to get a new token. Upon receiving this callback, generate a new token on the server and call the renewToken method to pass the new token to the SDK.
token | The token that expires in 30 seconds. |
|
inlinevirtual |
Deprecated as of v2.3.2. Use the onRemoteAudioStats callback 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 users/hosts sending audio streams, the SDK triggers this callback as many times.
uid | User ID of the speaker. |
quality | Audio quality of the user: QUALITY_TYPE. |
delay | Time delay (ms) of sending the audio packet from the sender to the receiver, including the time delay of audio sampling pre-processing, transmission, and the jitter buffer. |
lost | Packet loss rate (%) of the audio packet sent from the sender to the receiver. |
|
inlinevirtual |
Reports the statistics of the current call.
The SDK triggers this callback once every two seconds after the user joins the channel.
stats | Statistics of the IRtcEngine: RtcStats. |
|
inlinevirtual |
Reports the last mile network quality of each user in the channel once every two seconds.
Last mile refers to the connection between the local device and Agora's edge server. This callback reports once every two seconds the last mile network conditions of each user in the channel. If a channel includes multiple users, the SDK triggers this callback as many times.
txQuality
is UNKNOWN
when the user is not sending a stream; rxQuality
is UNKNOWN
when the user is not receiving a stream.uid | User ID. The network quality of the user with this uid is reported. If uid is 0, the local network quality is reported. |
txQuality | Uplink transmission quality rating of the user in terms of the transmission bitrate, packet loss rate, average RTT (Round-Trip Time), and jitter of the uplink network. txQuality is a quality rating helping you understand how well the current uplink network conditions can support the selected VideoEncoderConfiguration. 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. |
rxQuality | Downlink network quality rating of the user in terms of the packet loss rate, average RTT, and jitter of the downlink network. See QUALITY_TYPE. |
|
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.
stats | Statistics of the local video stream. See LocalVideoStats. |
|
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/host. If a channel includes multiple remote users, the SDK triggers this callback as many times.
stats | Statistics of the remote video stream. See RemoteVideoStats. |
|
inlinevirtual |
Reports the statistics of the local audio stream.
The SDK triggers this callback once every two seconds.
stats | The statistics of the local audio stream. See LocalAudioStats. |
|
inlinevirtual |
Reports the statistics of the audio stream from each remote user/host.
This callback replaces the onAudioQuality callback.
The SDK triggers this callback once every two seconds for each remote user/host. If a channel includes multiple remote users, the SDK triggers this callback as many times.
stats | Pointer to the statistics of the received remote audio streams. See RemoteAudioStats. |
|
inlinevirtual |
Occurs when the local audio state changes. This callback indicates the state change of the local audio stream, including the state of the audio capturing and encoding, and allows you to troubleshoot issues when exceptions occur.
error
parameter for details.state | State of the local audio. See LOCAL_AUDIO_STREAM_STATE. |
error | The error information of the local audio. See LOCAL_AUDIO_STREAM_ERROR. |
|
inlinevirtual |
Occurs when the remote audio state changes.
This callback indicates the state change of the remote audio stream.
COMMUNICATION
profile) or hosts (in the LIVE_BROADCASTING
profile) in a channel exceeds 17.uid | ID of the remote user whose audio state changes. |
state | State of the remote audio. See REMOTE_AUDIO_STATE. |
reason | The reason of the remote audio state change. See REMOTE_AUDIO_STATE_REASON. |
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when the audio publishing state changes.
This callback indicates the publishing state change of the local audio stream.
channel | The channel name. |
oldState | The previous publishing state. For details, see STREAM_PUBLISH_STATE. |
newState | The current publishing state. For details, see STREAM_PUBLISH_STATE. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
|
inlinevirtual |
Occurs when the video publishing state changes.
This callback indicates the publishing state change of the local video stream.
channel | The channel name. |
oldState | The previous publishing state. For details, see STREAM_PUBLISH_STATE. |
newState | The current publishing state. For details, see STREAM_PUBLISH_STATE. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
|
inlinevirtual |
Occurs when the audio subscribing state changes.
This callback indicates the subscribing state change of a remote audio stream.
channel | The channel name. |
uid | The ID of the remote user. |
oldState | The previous subscribing state. For details, see STREAM_SUBSCRIBE_STATE. |
newState | The current subscribing state. For details, see STREAM_SUBSCRIBE_STATE. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
|
inlinevirtual |
Occurs when the audio subscribing state changes.
This callback indicates the subscribing state change of a remote video stream.
channel | The channel name. |
uid | The ID of the remote user. |
oldState | The previous subscribing state. For details, see STREAM_SUBSCRIBE_STATE. |
newState | The current subscribing state. For details, see STREAM_SUBSCRIBE_STATE. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
|
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 volumes are the highest.
muteLocalAudioStream
, the SDK stops triggering the local user's callback.muteLocalAudioStream
, the remote users' callback excludes this remote user's information; 20 seconds after all remote users call muteLocalAudioStream
, the SDK stops triggering the remote users' callback.speakers | The volume information of 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.
speakerNumber | Total number of users.
|
totalVolume | Total volume after audio mixing. The value ranges between 0 (lowest volume) and 255 (highest volume).
|
If the user calls startAudioMixing, totalVolume
is the sum of the voice volume and audio-mixing volume.
|
inlinevirtual |
Reports the voice pitch of the local user.
After the local audio capture is enabled, and you call enableLocalVoicePitchCallback , the SDK triggers this callback at the time interval set in enableLocalVoicePitchCallback
.
onLocalVoicePitchInHz
callback.pitchInHz | The voice pitch (Hz) of the local user. |
|
inlinevirtual |
Reports the result of an audio device test.
After successfully calling startRecordingDeviceTest, startPlaybackDeviceTest, or startAudioDeviceLoopbackTest to start an audio device test, the SDK triggers the onAudioDeviceTestVolumeIndication
callback at the set time interval to report the volume information of the audio device tested.
volumeType | The volume type. See AudioDeviceTestVolumeType. |
volume | The volume, in the range of [0,255]. |
|
inlinevirtual |
Occurs when the most active remote 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 user is no less than two and an active speaker exists, the SDK triggers this callback and reports the uid
of the most active speaker.
uid
of the new active speaker.uid | The user ID of the most active remote speaker. |
|
inlinevirtual |
The application can use this callback to change the configuration of the view (for example, displaying other pictures in the view) after the video stops playing.
Deprecated as of v2.4.1. Use LOCAL_VIDEO_STREAM_STATE_STOPPED(0) in the onLocalVideoStateChanged callback instead.
|
inlinevirtual |
Occurs when the first local video frame is displayed/rendered on the local video view.
width | Width (px) of the first local video frame. |
height | Height (px) of the first local video frame. |
elapsed | Time 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. |
|
inlinevirtual |
Occurs when the first video frame is published.
The SDK triggers this callback under one of the following circumstances:
elapsed | The time elapsed (ms) from the local client calling joinChannel until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when the first remote video frame is received and decoded.
This callback is triggered in either of the following scenarios:
The application can configure the user view settings in this callback.
uid | User ID of the remote user sending the video stream. |
width | Width (px) of the video stream. |
height | Height (px) of the video stream. |
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when the first remote video frame is rendered.
The SDK triggers this callback when the first frame of the remote video is displayed in the user's video window. The application can get the time elapsed from a user joining the channel until the first video frame is displayed.
uid | User ID of the remote user sending the video stream. |
width | Width (px) of the video frame. |
height | Height (px) of the video stream. |
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
|
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.
COMMUNICATION
profile) or hosts (in the LIVE_BROADCASTING
profile) in a channel exceeds 17.uid | User ID of the remote user. |
muted | Whether the remote user's audio stream is muted/unmuted:
|
|
inlinevirtual |
Occurs when a remote user stops or resumes publishing 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.
COMMUNICATION
profile) or hosts (in the LIVE_BROADCASTING
profile) in a channel exceeds 17.uid | The user ID of the remote user. |
muted | Whether the remote user stops publishing the video stream:
|
|
inlinevirtual |
Occurs when a specific remote user enables/disables the video module.
Once the video module is disabled, the remote user can only use a voice call. The remote user cannot send or receive any video from other users.
The SDK triggers this callback when the remote user enables or disables the video module by calling the enableVideo or disableVideo method.
uid | User ID of the remote user. |
enabled | Whether the remote user enables/disables the video module:
|
|
inlinevirtual |
Occurs when the audio device state changes (for macOS and Windows only).
This callback notifies the application that the system's audio device state is changed. For example, a headset is unplugged from the device.
deviceId | Pointer to the device ID. |
deviceType | Device type: MEDIA_DEVICE_TYPE. |
deviceState | The state of the device:
|
|
inlinevirtual |
Occurs when the volume of the playback device, microphone, or application changes.
deviceType | Device type: MEDIA_DEVICE_TYPE. |
volume | Volume of the device. The value ranges between 0 and 255. |
muted |
|
|
inlinevirtual |
If the camera fails to turn on, fix the error reported in the onError callback.
Deprecated as of v2.4.1. Use LOCAL_VIDEO_STREAM_STATE_CAPTURING (1) in the onLocalVideoStateChanged callback instead.
|
inlinevirtual |
Occurs when the camera focus area changes.
The SDK triggers this callback when the local user changes the camera focus position by calling the setCameraFocusPositionInPreview method.
x | x coordinate of the changed camera focus area. |
y | y coordinate of the changed camera focus area. |
width | Width of the changed camera focus area. |
height | Height of the changed camera focus area. |
|
inlinevirtual |
Reports the face detection result of the local user. Applies to Android and iOS only.
Once you enable face detection by calling enableFaceDetection(true), you can get the following information on the local user in real-time:
distance
value reported in this callback may be slightly different from the actual distance. Therefore, Agora does not recommend using it for accurate calculation. imageWidth | The width (px) of the local video. |
imageHeight | The height (px) of the local video. |
vecRectangle | The position and size of the human face on the local video:
|
vecDistance | The distance (cm) between the human face and the screen. |
numFaces | The number of faces detected. If the value is 0, it means that no human face is detected. |
|
inlinevirtual |
Occurs when the camera exposure area changes.
The SDK triggers this callback when the local user changes the camera exposure position by calling the setCameraExposurePosition method.
x | x coordinate of the changed camera exposure area. |
y | y coordinate of the changed camera exposure area. |
width | Width of the changed camera exposure area. |
height | Height of the changed camera exposure area. |
|
inlinevirtual |
Occurs when the audio mixing file playback finishes.
You can start an audio mixing file playback by calling the startAudioMixing method. The SDK triggers this callback when the audio mixing file playback finishes.
If the startAudioMixing method call fails, an error code returns in the onError callback.
|
inlinevirtual |
Occurs when the state of the local user's music file changes.
When the playback state of the local user's music file changes, the SDK triggers this callback and reports the current playback state and the reason for the change.
onAudioMixingStateChanged
callback reports AUDIO_MIXING_STATE_PLAYING
can be different from the moment when the user hears the music if network conditions are poor. Because the SDK triggers this callback to report the PLAYING
state after decoding the first audio frame, but the SDK cannot receive online audio packets stably under poor network conditions, the music playback is unstable; and the moment when the user subjectively experiences the audio start playing can be later than the moment when the first audio frame is decoded.state | The current music file playback state. See AUDIO_MIXING_STATE_TYPE. |
reason | The reason for the change of the music file playback state. See AUDIO_MIXING_REASON_TYPE. |
|
inlinevirtual |
Occurs when a remote user starts audio mixing.
When a remote user calls startAudioMixing to play the background music, the SDK reports this callback.
|
inlinevirtual |
Occurs when a remote user finishes audio mixing.
|
inlinevirtual |
Reports the information of an audio file.
After successfully calling getAudioFileInfo, the SDK triggers this callback to report the information of the audio file, such as the file path and duration.
info | The information of an audio file. See AudioFileInfo. |
error | The information acquisition state. See AUDIO_FILE_INFO_ERROR. |
|
inlinevirtual |
Occurs when the local audio effect playback finishes.
The SDK triggers this callback when the local audio effect file playback finishes.
soundId | ID of the local audio effect. Each local audio effect has a unique ID. |
|
inlinevirtual |
Occurs when the SDK decodes the first remote audio frame for playback.
This callback is deprecated. Use onRemoteAudioStateChanged
instead.
This callback is triggered in either of the following scenarios:
uid | User ID of the remote user sending the audio stream. |
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when the video device state changes (for macOS and Windows only).
deviceId | Pointer to the device ID of the video device that changes state. |
deviceType | Device type: MEDIA_DEVICE_TYPE. |
deviceState | The state of the device:
|
|
inlinevirtual |
Occurs when the local video stream state changes.
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(LOCAL_VIDEO_STREAM_STATE_FAILED, LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE)
callback in the following situations:
When the camera outputs the captured video frames, if all the video frames are the same for 15 consecutive frames, the SDK triggers the onLocalVideoStateChanged(LOCAL_VIDEO_STREAM_STATE_CAPTURING, LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE)
callback. 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.
localVideoState | State type LOCAL_VIDEO_STREAM_STATE. |
error | The detailed error information: LOCAL_VIDEO_STREAM_ERROR. |
|
inlinevirtual |
Occurs when the video size or rotation of a specified user changes.
uid | User ID of the remote user or local user (0) whose video size or rotation changes. |
width | New width (pixels) of the video. |
height | New height (pixels) of the video. |
rotation | New rotation of the video [0 to 360). |
|
inlinevirtual |
Occurs when the remote video state changes.
COMMUNICATION
profile) or hosts (in the LIVE_BROADCASTING
profile) in a channel exceeds 17.uid | ID of the remote user whose video state changes. |
state | State of the remote video. See REMOTE_VIDEO_STATE. |
reason | The reason of the remote video state change. See REMOTE_VIDEO_STATE_REASON. |
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when a specified remote user enables/disables the local video capturing function.
This callback is only applicable to the scenario when the user only wants to watch the remote video without sending any video stream to the other user.
The SDK triggers this callback when the remote user resumes or stops capturing the video stream by calling the enableLocalVideo method.
uid | User ID of the remote user. |
enabled | Whether the specified remote user enables/disables the local video capturing function:
|
|
inlinevirtual |
Occurs when the local user receives the data stream from the remote user within five seconds.
The SDK triggers this callback when the local user receives the stream message that the remote user sends by calling the sendStreamMessage method.
uid | User ID of the remote user sending the message. |
streamId | Stream ID. |
data | Pointer to the data received by the local user. |
length | Length of the data in bytes. |
|
inlinevirtual |
Occurs when the local user does not receive the data stream from the remote user within five seconds.
The SDK triggers this callback when the local user fails to receive the stream message that the remote user sends by calling the sendStreamMessage method.
uid | User ID of the remote user sending the message. |
streamId | Stream ID. |
code | Error code: ERROR_CODE_TYPE. |
missed | Number of lost messages. |
cached | Number of incoming cached messages when the data stream is interrupted. |
|
inlinevirtual |
Occurs when the media engine loads.
|
inlinevirtual |
Occurs when the media engine call starts.
|
inlinevirtual |
Reports whether the super resolution feature is successfully enabled. (beta feature)
After calling enableRemoteSuperResolution, the SDK triggers this callback to report whether super resolution is successfully enabled. If it is not successfully enabled, use reason
for troubleshooting.
uid | The user ID of the remote user. |
enabled | Whether super resolution is successfully enabled:
|
reason | The reason why super resolution is not successfully enabled or the message that confirms success. See SUPER_RESOLUTION_STATE_REASON. |
|
inlinevirtual |
Reports whether the virtual background is successfully enabled.
After you call enableVirtualBackground, the SDK triggers this callback to report whether the virtual background is successfully enabled.
enabled | Whether the virtual background is successfully enabled:
|
reason | The reason why the virtual background is not successfully enabled or the message that confirms success. See VIRTUAL_BACKGROUND_SOURCE_STATE_REASON. |
|
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 the snapshot taken.
channel | The channel name. |
uid | The user ID of the user. A uid of 0 indicates the local user. |
filePath | The local path of the snapshot. |
width | The width (px) of the snapshot. |
height | The height (px) of the snapshot. |
errCode | The message that confirms success or the reason why the snapshot is not successfully taken:
|
|
inlinevirtual |
Occurs when the state of the media stream relay changes.
The SDK returns the state of the current media relay with any error message.
state | The state code in CHANNEL_MEDIA_RELAY_STATE. |
code | The error code in CHANNEL_MEDIA_RELAY_ERROR. |
|
inlinevirtual |
Reports events during the media stream relay.
code | The event code in CHANNEL_MEDIA_RELAY_EVENT. |
|
inlinevirtual |
Occurs when the engine sends the first local audio frame.
elapsed | Time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when the first audio frame is published.
The SDK triggers this callback under one of the following circumstances:
elapsed | The time elapsed (ms) from the local client calling joinChannel until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when the engine receives the first audio frame from a specific remote user.
This callback is deprecated. Use onRemoteAudioStateChanged
instead.
uid | User ID of the remote user. |
elapsed | Time elapsed (ms) from the remote user calling joinChannel until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when the state of the RTMP or RTMPS streaming changes.
When the CDN live streaming state changes, the SDK triggers this callback to report the current state and the reason why the state has changed.
When exceptions occur, you can troubleshoot issues by referring to the detailed error descriptions in the errCode parameter.
url | The CDN streaming URL. |
state | The RTMP or RTMPS streaming state. See: RTMP_STREAM_PUBLISH_STATE. |
errCode | The detailed error information for streaming. See: RTMP_STREAM_PUBLISH_ERROR_TYPE. |
|
inlinevirtual |
Reports events during the RTMP or RTMPS streaming.
url | The RTMP or RTMPS streaming URL. |
eventCode | The event code. See RTMP_STREAMING_EVENT |
|
inlinevirtual |
Reports the result of calling the addPublishStreamUrl method. (CDN live only.)
url | The CDN streaming URL. |
error | Error code: ERROR_CODE_TYPE. Main errors include:
|
|
inlinevirtual |
Reports the result of calling the removePublishStreamUrl method. (CDN live only.)
This callback indicates whether you have successfully removed an RTMP or RTMPS stream from the CDN.
url | The CDN streaming URL. |
|
inlinevirtual |
Occurs when the publisher's transcoding is updated.
When the LiveTranscoding
class in the setLiveTranscoding method updates, the SDK triggers the onTranscodingUpdated
callback to report the update information to the local host.
setLiveTranscoding
method to set the LiveTranscoding class for the first time, the SDK does not trigger the onTranscodingUpdated
callback.
|
inlinevirtual |
Occurs when the local audio route changes.
routing | The current audio routing. See: AUDIO_ROUTE_TYPE. |
|
inlinevirtual |
Occurs when the published media stream falls back to an audio-only stream due to poor network conditions or switches back to the video after the network conditions improve.
If you call setLocalPublishFallbackOption and set option as STREAM_FALLBACK_OPTION_AUDIO_ONLY, the SDK triggers this callback when the 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.
isFallbackOrRecover | Whether the published stream falls back to audio-only or switches back to the video:
|
|
inlinevirtual |
Occurs when the remote media stream falls back to audio-only stream due to poor network conditions or switches back to the video stream after the network conditions improve.
If you call setRemoteSubscribeFallbackOption and set option
as STREAM_FALLBACK_OPTION_AUDIO_ONLY, the SDK triggers this callback when the remote media stream falls back to audio-only mode due to poor downlink conditions, or when the remote media stream switches back to the video after the downlink network condition improves.
uid | ID of the remote user sending the stream. |
isFallbackOrRecover | Whether the remotely subscribed media stream falls back to audio-only or switches back to the video:
|
|
inlinevirtual |
Reports the transport-layer statistics of each remote audio stream.
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.
uid | User ID of the remote user sending the audio packet. |
delay | Network time delay (ms) from the remote user sending the audio packet to the local user. |
lost | Packet loss rate (%) of the audio packet sent from the remote user. |
rxKBitRate | Received bitrate (Kbps) of the audio packet sent from the remote user. |
|
inlinevirtual |
Reports the transport-layer statistics of each remote video stream.
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.
uid | User ID of the remote user sending the video packet. |
delay | Network time delay (ms) from the remote user sending the video packet to the local user. |
lost | Packet loss rate (%) of the video packet sent from the remote user. |
rxKBitRate | Received bitrate (Kbps) of the video packet sent from the remote user. |
|
inlinevirtual |
Occurs when the microphone is enabled/disabled.
The onMicrophoneEnabled callback is deprecated. Use LOCAL_AUDIO_STREAM_STATE_STOPPED (0) or LOCAL_AUDIO_STREAM_STATE_RECORDING (1) in the onLocalAudioStateChanged callback instead.
The SDK triggers this callback when the local user resumes or stops capturing the local audio stream by calling the enableLocalAudio method.
enabled | Whether the microphone is enabled/disabled:
|
|
inlinevirtual |
Occurs when the connection state between the SDK and the server changes.
state | See CONNECTION_STATE_TYPE. |
reason | See CONNECTION_CHANGED_REASON_TYPE. |
|
inlinevirtual |
Occurs when the local network type changes.
When the network connection is interrupted, this callback indicates whether the interruption is caused by a network type change or poor network conditions.
type | See NETWORK_TYPE. |
|
inlinevirtual |
Occurs when the local user successfully registers a user account by calling the registerLocalUserAccount method or joins a channel by calling the joinChannelWithUserAccount method.This callback reports the user ID and user account of the local user.
uid | The ID of the local user. |
userAccount | The user account of the local user. |
|
inlinevirtual |
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.
uid | The ID of the remote user. |
info | The UserInfo object that contains the user ID and user account of the remote user. |
|
inlinevirtual |
Occurs when the screen sharing information is updated.
When you call startScreenCaptureByDisplayId or startScreenCaptureByScreenRect to start screen sharing and use the excludeWindowList
attribute to block the specified window, the SDK triggers this callback if the window blocking fails.
info | The screen sharing information. See ScreenCaptureInfo |