Occurs when the most active speaker is detected.
After a successful call of enableAudioVolumeIndication, the SDK continuously determines which remote user has the loudest volume. The remote user determined to be the loudest and most continuous speaker is considered the most active user.
When the number of users is more than or equal to 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.User ID of the active speaker. A uid
of 0 represents the local user.
Occurs when a method is executed by the SDK.
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.
The method executed by the SDK.
The result of the method call.
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.
The device ID.
Device type: MEDIA_DEVICE_TYPE.
Device state: MEDIA_DEVICE_STATE_TYPE.
Occurs when the volume of the playback device, microphone, or application changes.
Device type: MEDIA_DEVICE_TYPE.
Volume of the device. The value ranges between 0 and 255.
Occurs when the local audio effect playback finishes.
The SDK triggers this callback when the local audio effect file playback finishes.
ID of the local audio effect. Each local audio effect has a unique ID.
Occurs when the audio mixing file playback finishes.
Occurs when the state of the local user's audio mixing file changes.
When the state of the audio mixing file changes, the SDK triggers this callback and reports the audio mixing status and the error code of the audio playback failure.
If the local audio mixing file does not exist, or if the SDK does not support the file format or cannot access the music file URL, the SDK returns WARN_AUDIO_MIXING_OPEN_ERROR (701).
The state code. See AUDIO_MIXING_STATE_TYPE.
Occurs when the audio publishing state changes.
This callback indicates the publishing state change of the local audio stream.
The channel name.
The previous publishing state. For details, see STREAM_PUBLISH_STATE.
The current publishing state. For details, see STREAM_PUBLISH_STATE.
The time elapsed (ms) from the previous state to the current state.
Reports the statistics of the audio stream from each remote user/host.
User ID of the speaker.
Audio quality of the user: QUALITY_TYPE.
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.
Packet loss rate (%) of the audio packet sent from the sender to the receiver.
Occurs when the local audio route changes.
The SDK triggers this callback when the local audio route switches to an earpiece, speakerphone, headset, or Bluetooth device.
Audio output routing. See: AUDIO_ROUTE_TYPE.
Occurs when the audio subscribing state changes.
This callback indicates the subscribing state change of a remote audio stream.
The channel name.
The ID of the remote user.
The previous subscribing state. For details, see STREAM_SUBSCRIBE_STATE.
The current subscribing state. For details, see STREAM_SUBSCRIBE_STATE.
The time elapsed (ms) from the previous state to the current state.
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.
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.
Total number of users.
speakerNumber
= 1.speakerNumber
= 3.Total volume after audio mixing. The value ranges between 0 (lowest volume) and 255 (highest volume).
totalVolume
is the volume of the local user who sends a stream.totalVolume
is the sum of the volume of all remote users (at most three) whose
instantaneous volumes are the highest.If the user calls startAudioMixing, totalVolume
is the sum of the voice volume and audio-mixing volume.
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 coordinate of the changed camera exposure area.
y coordinate of the changed camera exposure area.
Width of the changed camera exposure area.
Height of the changed camera exposure area.
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 coordinate of the changed camera focus area.
y coordinate of the changed camera focus area.
Width of the changed camera focus area.
Height of the changed camera focus area.
Occurs when the camera turns on and is ready to capture the video.
Reports events during the media stream relay.
The event code in CHANNEL_MEDIA_RELAY_EVENT.
Occurs when the state of the media stream relay changes.
The SDK returns the state of the current media relay with any error message.
The state code in CHANNEL_MEDIA_RELAY_STATE.
The error code in CHANNEL_MEDIA_RELAY_ERROR.
Occurs when the user role switches in the live interactive streaming. For example, from a host to an audience or vice versa.
This callback notifies the application of a user role switch when the application calls the setClientRole method.
The SDK triggers this callback when the local user switches the user role by calling the setClientRole
method
after joining the channel.
Role that the user switches from: CLIENT_ROLE_TYPE.
Role that the user switches to: CLIENT_ROLE_TYPE.
Occurs when your connection is banned by the Agora Server.
Occurs when the connection between the SDK and the server is interrupted.
Occurs when the SDK cannot reconnect to Agora 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:
onConnectionInterrupted
callback when it loses connection with the server for more than
four seconds after it successfully joins the channel.If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora edge server, the SDK stops rejoining the channel.
Occurs when the connection state between the SDK and the server changes.
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.
Error code: ERROR_CODE_TYPE.
The error message.
Reports the face detection result of the local user.
Once you enable face detection by calling enableFaceDetection (true), you can get the following information on the local user in real-time:
Note
distance
value reported in this callback may be slightly different from the actual distance. Therefore,
Agora does not recommend using it for accurate calculation.The width (px) of the local video.
The height (px) of the local video.
The position and size of the human face on the local video. See Rectangle
x
: The x coordinate (px) of the human face in the local video. Taking the top left corner of the captured video as the origin,
the x coordinate represents the relative lateral displacement of the top left corner of the human face to the origin.y
: The y coordinate (px) of the human face in the local video. Taking the top left corner of the captured video as the origin,
the y coordinate represents the relative longitudinal displacement of the top left corner of the human face to the origin.width
: The width (px) of the human face in the captured video.height
: The height (px) of the human face in the captured video.The distance (cm) between the human face and the screen.
The number of faces detected. If the value is 0, it means that no human face is detected.
Occurs when the engine sends the first local audio frame.
Time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.
Occurs when the first audio frame is published.
The SDK triggers this callback under one of the following circumstances:
The time elapsed (ms) from the local client calling joinChannel until the SDK triggers this callback.
Occurs when the first local video frame is displayed/rendered on the local video view.
Width (px) of the first local video frame.
Height (px) of the first local video frame.
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.
Occurs when the first video frame is published.
The SDK triggers this callback under one of the following circumstances:
The time elapsed (ms) from the local client calling joinChannel until the SDK triggers this callback.
Occurs when the SDK decodes the first remote audio frame for playback.
User ID of the remote user sending the audio stream.
Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.
Occurs when the engine receives the first audio frame from a specific remote user.
User ID of the remote user.
Time elapsed (ms) from the remote user calling joinChannel until the SDK triggers this callback.
Occurs when the first remote video frame is received and decoded.
User ID of the remote user sending the video stream.
Width (px) of the video stream.
Height (px) of the video stream.
Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.
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 retrieve the time elapsed from a user joining the channel until the first video frame is displayed.
User ID of the remote user sending the video stream.
Width (px) of the video frame.
Height (px) of the video stream.
Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.
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 channelId
specified in the joinChannel
method.
If the uid
is not specified in the joinChannel
method, the server automatically assigns a uid
.
The channel name.
User ID of the user joining the channel.
Time elapsed (ms) from the user calling the joinChannel
method until the SDK triggers this callback.
Reports the last-mile network probe result.
The SDK triggers this callback within 30 seconds after the app calls the startLastmileProbeTest method.
The uplink and downlink last-mile network probe test result. See LastmileProbeResult.
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 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.
The last mile network quality: QUALITY_TYPE.
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 retrieves information, such as the call duration and statistics.
Occurs when the local audio state changes. This callback indicates the state change of the local audio stream, including the state of the audio recording and encoding, and allows you to troubleshoot issues when exceptions occur.
State of the local audio. See LOCAL_AUDIO_STREAM_STATE.
The error information of the local audio. See LOCAL_AUDIO_STREAM_ERROR.
Reports the statistics of the local audio stream.
The SDK triggers this callback once every two seconds.
The statistics of the local audio stream. See LocalAudioStats.
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.
Whether the published stream falls back to audio-only or switches back to the video:
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.
The ID of the local user.
The user account of the local user.
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.
State type LOCAL_VIDEO_STREAM_STATE. When the state is
LOCAL_VIDEO_STREAM_STATE_FAILED(3)
, see the error
parameter for details.
The detailed error information: LOCAL_VIDEO_STREAM_ERROR.
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.
Statistics of the local video stream. See LocalVideoStats.
Occurs when the media engine loads.
Occurs when the media engine call starts.
Occurs when the local user receives the metadata.
Occurs when the microphone is enabled/disabled.
Whether the microphone is enabled/disabled:
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 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.
User ID. The network quality of the user with this uid
is reported. If uid
is 0, the local network quality
is reported.
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.
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.
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.
See NETWORK_TYPE.
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.
The channel name.
User ID of the user rejoining the channel.
Time elapsed (ms) from starting to reconnect until the SDK triggers this callback.
Occurs when a remote user starts audio mixing. When a remote user calls startAudioMixing to play the background music, the SDK reports this callback.
Occurs when a remote user finishes audio mixing.
Occurs when the remote audio state changes.
This callback indicates the state change of the remote audio stream.
ID of the remote user whose audio state changes.
State of the remote audio. See REMOTE_AUDIO_STATE.
The reason of the remote audio state change. See REMOTE_AUDIO_STATE_REASON.
Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.
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.
The statistics of the received remote audio streams. See RemoteAudioStats.
Reports the transport-layer statistics of each remote audio stream.
User ID of the remote user sending the audio packet.
Network time delay (ms) from the remote user sending the audio packet to the local user.
Packet loss rate (%) of the audio packet sent from the remote user.
Received bitrate (Kbps) of the audio packet sent from the remote user.
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 uplink conditions, or when the remote media stream switches
back to the video after the uplink network condition improves.
ID of the remote user sending the stream.
Whether the remotely subscribed media stream falls back to audio-only or switches back to the video:
Occurs when the remote video state changes.
ID of the remote user whose video state changes.
State of the remote video. See REMOTE_VIDEO_STATE.
The reason of the remote video state change. See REMOTE_VIDEO_STATE_REASON.
Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.
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.
Statistics of the remote video stream. See RemoteVideoStats.
Reports the transport-layer statistics of each remote video stream.
User ID of the remote user sending the video packet.
Network time delay (ms) from the remote user sending the video packet to the local user.
Packet loss rate (%) of the video packet sent from the remote user.
Received bitrate (Kbps) of the video packet sent from the remote user.
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.
This callback notifies the app to generate a new token and call joinChannel
to rejoin the channel with the new token.
Reports the statistics of the current call.
The SDK triggers this callback once every two seconds after the user joins the channel.
Reports events during the RTMP streaming.
The RTMP streaming URL.
The event code. See RTMP_STREAMING_EVENT.
Occurs when the state of the RTMP streaming changes.
The SDK triggers this callback to report the result of the local user calling the addPublishStreamUrl or removePublishStreamUrl method.
This callback indicates the state of the RTMP streaming. When exceptions occur, you can troubleshoot issues by referring to
the detailed error descriptions in the errCode
parameter.
The RTMP URL address.
The RTMP streaming state. See: RTMP_STREAM_PUBLISH_STATE.
The detailed error information for streaming. See RTMP_STREAM_PUBLISH_ERROR.
Occurs when a voice or video stream URL address is added to the live interactive streaming.
The URL address of the externally injected stream.
User ID.
State of the externally injected stream: INJECT_STREAM_STATUS.
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.
User ID of the remote user sending the message.
Stream ID.
The data received by the local user.
Length of the data in bytes.
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.
User ID of the remote user sending the message.
Stream ID.
Error code: ERROR_CODE_TYPE.
Number of lost messages.
Number of incoming cached messages when the data stream is interrupted.
Reports the result of calling the addPublishStreamUrl method. (CDN live only.)
The RTMP URL address.
Error code: ERROR_CODE_TYPE. Main errors include:
ERR_INVALID_ARGUMENT
.Reports the result of calling the removePublishStreamUrl method. (CDN live only.)
The RTMP URL address.
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.
The token that expires in 30 seconds.
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.
Occurs when a specified remote user enables/disables the local video capturing function.
User ID of the remote user.
Whether the specified remote user enables/disables the local video capturing function:
Occurs when a specific remote user enables/disables the video module.
User ID of the remote user.
Whether the remote user enables/disables the video module:
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 userInfo
, and triggers this callback on the local client.
The ID of the remote user.
agora.UserInfo contains the user ID and user account of the remote user.
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:
User ID of the user or host joining the channel.
Time delay (ms) from the local user calling the joinChannel
method until the SDK triggers this callback.
Occurs when a remote user's audio stream playback pauses/resumes.
User ID of the remote user.
Whether the remote user's audio stream is muted/unmuted:
Occurs when a remote user's video stream playback pauses/resumes.
You can also use the onRemoteVideoStateChanged callback with the following parameters:
The SDK triggers this callback when the remote user stops or resumes sending the video stream by calling the muteLocalVideoStream method.
User ID of the remote user.
Whether the remote user's video stream playback is paused/resumed:
Occurs when a remote user (COMMUNICATION
)/ host (LIVE_BROADCASTING
) leaves the channel.
Reasons why the user is offline:
User ID of the user leaving the channel or going offline.
Reason why the user is offline: USER_OFFLINE_REASON_TYPE.
Occurs when the video device state changes.
The device ID of the video device that changes state.
Device type: MEDIA_DEVICE_TYPE.
Device state: MEDIA_DEVICE_STATE_TYPE.
Occurs when the video publishing state changes.
This callback indicates the publishing state change of the local video stream.
The channel name.
The previous publishing state. For details, see STREAM_PUBLISH_STATE.
The current publishing state. For details, see STREAM_PUBLISH_STATE.
The time elapsed (ms) from the previous state to the current state.
Occurs when the video size or rotation of a specified user changes.
User ID of the remote user or local user (0) whose video size or rotation changes.
New width (pixels) of the video.
New height (pixels) of the video.
New rotation of the video [0 to 360).
Occurs when the video stops playing.
Occurs when the audio subscribing state changes.
This callback indicates the subscribing state change of a remote video stream.
The channel name.
The ID of the remote user.
The previous subscribing state. For details, see STREAM_SUBSCRIBE_STATE.
The current subscribing state. For details, see STREAM_SUBSCRIBE_STATE.
The time elapsed (ms) from the previous state to the current state.
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.
Warning code: WARN_CODE_TYPE.
The warning message.
Generated using TypeDoc
The
AgoraRtcEvents
class reports runtime events to the applications.