Classes | |
class | AgoraFacePositionInfo |
class | AudioVolumeInfo |
class | ClientRole |
class | ErrorCode |
class | LastmileProbeResult |
class | LocalAudioStats |
class | LocalVideoStats |
class | Quality |
class | RemoteAudioStats |
class | RemoteVideoStats |
class | RtcStats |
class | UserOfflineReason |
class | VideoProfile |
class | WarnCode |
Public Member Functions | |
void | onWarning (int warn) |
void | onError (int err) |
void | onJoinChannelSuccess (String channel, int uid, int elapsed) |
void | onRejoinChannelSuccess (String channel, int uid, int elapsed) |
void | onLeaveChannel (RtcStats stats) |
void | onClientRoleChanged (int oldRole, int newRole) |
void | onLocalUserRegistered (int uid, String userAccount) |
void | onUserInfoUpdated (int uid, UserInfo userInfo) |
void | onUserJoined (int uid, int elapsed) |
void | onUserOffline (int uid, int reason) |
void | onConnectionStateChanged (int state, int reason) |
void | onConnectionInterrupted () |
void | onConnectionLost () |
void | onConnectionBanned () |
void | onApiCallExecuted (int error, String api, String result) |
void | onTokenPrivilegeWillExpire (String token) |
void | onRequestToken () |
void | onMicrophoneEnabled (boolean enabled) |
void | onAudioVolumeIndication (AudioVolumeInfo[] speakers, int totalVolume) |
void | onActiveSpeaker (int uid) |
void | onFirstLocalAudioFrame (int elapsed) |
void | onFirstRemoteAudioFrame (int uid, int elapsed) |
void | onVideoStopped () |
void | onFirstLocalVideoFrame (int width, int height, int elapsed) |
void | onFirstRemoteVideoDecoded (int uid, int width, int height, int elapsed) |
void | onFirstRemoteVideoFrame (int uid, int width, int height, int elapsed) |
void | onUserMuteAudio (int uid, boolean muted) |
void | onUserMuteVideo (int uid, boolean muted) |
void | onUserEnableVideo (int uid, boolean enabled) |
void | onUserEnableLocalVideo (int uid, boolean enabled) |
void | onVideoSizeChanged (int uid, int width, int height, int rotation) |
void | onRemoteAudioStateChanged (int uid, int state, int reason, int elapsed) |
void | onRemoteVideoStateChanged (int uid, int state, int reason, int elapsed) |
void | onChannelMediaRelayStateChanged (int state, int code) |
void | onChannelMediaRelayEvent (int code) |
void | onLocalPublishFallbackToAudioOnly (boolean isFallbackOrRecover) |
void | onRemoteSubscribeFallbackToAudioOnly (int uid, boolean isFallbackOrRecover) |
void | onAudioRouteChanged (int routing) |
void | onCameraReady () |
void | onCameraFocusAreaChanged (Rect rect) |
void | onCameraExposureAreaChanged (Rect rect) |
void | onFacePositionChanged (int imageWidth, int imageHeight, AgoraFacePositionInfo[] faces) |
void | onAudioQuality (int uid, int quality, short delay, short lost) |
void | onRtcStats (RtcStats stats) |
void | onLastmileQuality (int quality) |
void | onLastmileProbeResult (LastmileProbeResult result) |
void | onNetworkQuality (int uid, int txQuality, int rxQuality) |
void | onLocalVideoStats (LocalVideoStats stats) |
void | onRemoteVideoStats (RemoteVideoStats stats) |
void | onLocalAudioStats (LocalAudioStats stats) |
void | onRemoteAudioStats (RemoteAudioStats stats) |
void | onLocalVideoStat (int sentBitrate, int sentFrameRate) |
void | onRemoteVideoStat (int uid, int delay, int receivedBitrate, int receivedFrameRate) |
void | onRemoteAudioTransportStats (int uid, int delay, int lost, int rxKBitRate) |
void | onRemoteVideoTransportStats (int uid, int delay, int lost, int rxKBitRate) |
void | onAudioMixingStateChanged (int state, int errorCode) |
void | onAudioMixingFinished () |
void | onAudioEffectFinished (int soundId) |
void | onFirstRemoteAudioDecoded (int uid, int elapsed) |
void | onLocalAudioStateChanged (int state, int error) |
void | onLocalVideoStateChanged (int localVideoState, int error) |
void | onRtmpStreamingStateChanged (String url, int state, int errCode) |
void | onStreamPublished (String url, int error) |
void | onStreamUnpublished (String url) |
void | onTranscodingUpdated () |
void | onStreamInjectedStatus (String url, int uid, int status) |
void | onStreamMessage (int uid, int streamId, byte[] data) |
void | onStreamMessageError (int uid, int streamId, int error, int missed, int cached) |
void | onMediaEngineLoadSuccess () |
void | onMediaEngineStartCallSuccess () |
void | onNetworkTypeChanged (int type) |
Callbacks.
The SDK uses the IRtcEngineEventHandler interface class to send callbacks to the application, and the application inherits the methods of this interface class to retrieve these callbacks. All methods in this interface class have their (empty) default implementations, and the application can inherit only some of the required events instead of all of them. In the callbacks, the application should avoid time-consuming tasks or call blocking APIs (such as SendMessage), otherwise, the SDK may not work properly.
void io.agora.rtc.IRtcEngineEventHandler.onWarning | ( | int | warn | ) |
Reports a warning during SDK runtime.
In most cases, the app can ignore the warning reported by the SDK because the SDK can usually fix the issue and resume running.
For instance, the SDK may report a WARN_LOOKUP_CHANNEL_TIMEOUT warning upon disconnection with the server and tries to reconnect. For detailed warning codes, see Warning Codes.
warn | Warning code |
void io.agora.rtc.IRtcEngineEventHandler.onError | ( | int | err | ) |
Reports an error during SDK runtime.
In most cases, the SDK cannot fix the issue and resume running. The SDK requires the app 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 app informs the user that the call initialization failed and invokes the leaveChannel method to leave the channel. For detailed error codes, see Error Codes.
err | Error code |
void io.agora.rtc.IRtcEngineEventHandler.onJoinChannelSuccess | ( | String | channel, |
int | uid, | ||
int | elapsed | ||
) |
Occurs when the local user joins a specified channel.
The channel name assignment is based on channelName specified in the joinChannel method.
If the uid
is not specified when joinChannel is called, the server automatically assigns a uid.
channel | Channel name. |
uid | User ID. |
elapsed | Time elapsed (ms) from the user calling joinChannel until this callback is triggered. |
void io.agora.rtc.IRtcEngineEventHandler.onRejoinChannelSuccess | ( | String | channel, |
int | uid, | ||
int | elapsed | ||
) |
Occurs when a user rejoins the channel after being disconnected 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 | Channel name. |
uid | User ID. |
elapsed | Time elapsed (ms) from starting to reconnect until this callback is triggered. |
void io.agora.rtc.IRtcEngineEventHandler.onLeaveChannel | ( | RtcStats | stats | ) |
Occurs when a user leaves the channel.
When the app calls the leaveChannel method, the SDK uses this callback to notify the app when the user leaves the channel.
With this callback, the application retrieves the channel information, such as the call duration and statistics.
stats | Statistics of the call: RtcStats |
void io.agora.rtc.IRtcEngineEventHandler.onClientRoleChanged | ( | int | oldRole, |
int | newRole | ||
) |
Occurs when the user role switches in a live broadcast. For example, from a host to an audience or vice versa.
The SDK triggers this callback when the local user switches the user role by calling the setClientRole method after joining the channel.
oldRole | Role that the user switches from. |
newRole | Role that the user switches to. |
void io.agora.rtc.IRtcEngineEventHandler.onLocalUserRegistered | ( | int | uid, |
String | userAccount | ||
) |
Occurs when the local user registers a user account.
This callback is triggered 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. |
void io.agora.rtc.IRtcEngineEventHandler.onUserInfoUpdated | ( | int | uid, |
UserInfo | userInfo | ||
) |
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. |
userInfo | The UserInfo object that contains the user ID and user account of the remote user. |
void io.agora.rtc.IRtcEngineEventHandler.onUserJoined | ( | int | uid, |
int | elapsed | ||
) |
Occurs when a remote user (Communication)/host (Live Broadcast) joins the channel.
The SDK triggers this callback under one of the following circumstances:
uid | ID of the user or host who joins the channel. |
elapsed | Time delay (ms) from the local user calling joinChannel/setClientRole until this callback is triggered. |
void io.agora.rtc.IRtcEngineEventHandler.onUserOffline | ( | int | uid, |
int | reason | ||
) |
Occurs when a remote user (Communication)/host (Live Broadcast) leaves the channel.
There are two reasons for users to become offline:
uid | ID of the user or host who leaves the channel or goes offline. |
reason | Reason why the user goes offline:
|
void io.agora.rtc.IRtcEngineEventHandler.onConnectionStateChanged | ( | int | state, |
int | reason | ||
) |
Occurs when the network connection state changes.
The Agora SDK returns this callback to report on the current network connection state when it changes, and the reason to such change.
state | The current network connection state:
|
reason | The reason causing the change of the connection state:
|
void io.agora.rtc.IRtcEngineEventHandler.onConnectionInterrupted | ( | ) |
Occurs when the connection between the SDK and the server is interrupted.
The SDK triggers this callback when it loses connection to the server for more than four seconds after the connection is established. After triggering this callback, the SDK tries to reconnect 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 edge server, the SDK stops rejoining the channel.
void io.agora.rtc.IRtcEngineEventHandler.onConnectionLost | ( | ) |
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 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 edge server, the SDK stops rejoining the channel.
void io.agora.rtc.IRtcEngineEventHandler.onConnectionBanned | ( | ) |
Occurs when your connection is banned by the Agora Server.
void io.agora.rtc.IRtcEngineEventHandler.onApiCallExecuted | ( | int | error, |
String | api, | ||
String | result | ||
) |
Occurs when an API method is executed.
error | Error Code that the SDK returns when the method call fails. If the SDK returns 0, then the method call was successful. |
api | The method executed by the SDK. |
result | The result of the method call. |
void io.agora.rtc.IRtcEngineEventHandler.onTokenPrivilegeWillExpire | ( | String | token | ) |
Occurs when the token expires in 30 seconds.
The user becomes offline if the token used when joining the channel expires. This callback is triggered 30 seconds before the token
expires to remind the app to get a new token
. Upon receiving this callback, you need to generate a new token
on the server and call renewToken to pass the new token
to the SDK.
token | The token that will expire in 30 seconds. |
void io.agora.rtc.IRtcEngineEventHandler.onRequestToken | ( | ) |
Occurs when the token has expired.
If a token is specified when the instance joins the channel, the token expires after a certain period of time, and a new token is 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.
void io.agora.rtc.IRtcEngineEventHandler.onMicrophoneEnabled | ( | boolean | enabled | ) |
Occurs when the microphone is enabled/disabled.
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:
|
void io.agora.rtc.IRtcEngineEventHandler.onAudioVolumeIndication | ( | AudioVolumeInfo [] | speakers, |
int | totalVolume | ||
) |
Reports which users are speaking and the speakers' volume, and whether the local user is speaking.
This callback reports the IDs and volumes of the loudest speakers (at most three) at the moment in the channel, and whether the local user is speaking.
By default, this callback is disabled. You can enable it by calling the enableAudioVolumeIndication method. Once enabled, this callback is triggered at the set interval, regardless of whether a user speaks or not.
The SDK triggers two independent onAudioVolumeIndication
callbacks at one time, which separately report the volume information of the local user and all the remote speakers. For more information, see the detailed parameter descriptions.
report_vad
as true
in the enableAudioVolumeIndication method.speakers | An array containing the user ID and volume information for each speaker: AudioVolumeInfo.
|
totalVolume | Total volume after audio mixing. The value ranges between 0 (lowest volume) and 255 (highest volume).
|
void io.agora.rtc.IRtcEngineEventHandler.onActiveSpeaker | ( | int | uid | ) |
Reports which user is the loudest speaker.
This callback reports the speaker with the highest accumulative volume during a certain period. If the user enables the audio volume indication by calling enableAudioVolumeIndication, this callback returns the uid
of the active speaker whose voice is detected by the audio volume detection module of the SDK.
uid | User ID of the active speaker. A uid of 0 represents the local user. |
void io.agora.rtc.IRtcEngineEventHandler.onFirstLocalAudioFrame | ( | int | elapsed | ) |
Occurs when the first local audio frame is sent.
elapsed | Time elapsed (ms) from the local user calling the joinChannel until this callback is triggered. |
void io.agora.rtc.IRtcEngineEventHandler.onFirstRemoteAudioFrame | ( | int | uid, |
int | elapsed | ||
) |
Occurs when the first remote audio frame is received.
uid | User ID of the remote user. |
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until this callback is triggered. |
void io.agora.rtc.IRtcEngineEventHandler.onVideoStopped | ( | ) |
Occurs when the video stops playing.
void io.agora.rtc.IRtcEngineEventHandler.onFirstLocalVideoFrame | ( | int | width, |
int | height, | ||
int | elapsed | ||
) |
Occurs when the first local video frame is rendered.
This callback is triggered after the first local video frame is rendered on the local video window.
width | Width (pixels) of the first local video frame. |
height | Height (pixels) of the first local video frame. |
elapsed | Time elapsed (ms) from the local user calling joinChannel until this callback is triggered. If startPreview is called before joinChannel, elapsed is the time elapsed (ms) from the local user calling startPreview until this callback is triggered. |
void io.agora.rtc.IRtcEngineEventHandler.onFirstRemoteVideoDecoded | ( | int | uid, |
int | width, | ||
int | height, | ||
int | elapsed | ||
) |
Occurs when the first remote video frame is received and decoded.
This callback is triggered in either of the following scenarios:
uid | User ID of the remote user sending the video streams. |
width | Width (pixels) of the video stream. |
height | Height (pixels) of the video stream. |
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until this callback is triggered. |
void io.agora.rtc.IRtcEngineEventHandler.onFirstRemoteVideoFrame | ( | int | uid, |
int | width, | ||
int | height, | ||
int | elapsed | ||
) |
Occurs when the first remote video frame is rendered.
This callback is triggered after the first frame of the remote video is rendered on the video window. The application can retrieve the data of the time elapsed from the user joining the channel until the first video frame is displayed.
uid | User ID of the remote user sending the video streams. |
width | Width (pixels) of the video stream. |
height | Height (pixels) of the video stream. |
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until this callback is triggered. |
void io.agora.rtc.IRtcEngineEventHandler.onUserMuteAudio | ( | int | uid, |
boolean | muted | ||
) |
Occurs when a remote user stops/resumes sending the audio stream.
REMOTE_AUDIO_STATE_STOPPED(0)
and REMOTE_AUDIO_REASON_REMOTE_MUTED(5)
.REMOTE_AUDIO_STATE_DECODING(2)
and REMOTE_AUDIO_REASON_REMOTE_UNMUTED(6)
.The SDK triggers this callback when the remote user stops or resumes sending the audio stream by calling the muteLocalAudioStream method.
uid | ID of the remote user. |
muted | Whether the remote user's audio stream is muted/unmuted:
|
void io.agora.rtc.IRtcEngineEventHandler.onUserMuteVideo | ( | int | uid, |
boolean | muted | ||
) |
Occurs when a remote user stops/resumes sending the video stream.
The SDK triggers this callback when the remote user stops or resumes sending the video stream by calling the muteLocalVideoStream method.
uid | ID of the remote user. |
muted | Whether the remote user's video stream playback pauses/resumes:
|
void io.agora.rtc.IRtcEngineEventHandler.onUserEnableVideo | ( | int | uid, |
boolean | enabled | ||
) |
Occurs when a 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 specific remote user enables/disables the video module:
|
void io.agora.rtc.IRtcEngineEventHandler.onUserEnableLocalVideo | ( | int | uid, |
boolean | enabled | ||
) |
Occurs when a remote user enables/disables the local video capture function.
The SDK triggers this callback when the remote user resumes or stops capturing the video stream by calling the enableLocalVideo method.
This callback is only applicable to the scenario when the remote user only wants to watch the remote video without sending any video stream to the other user.
uid | User ID of the remote user. |
enabled | Whether the specific remote user enables/disables the local video capturing function:
|
void io.agora.rtc.IRtcEngineEventHandler.onVideoSizeChanged | ( | int | uid, |
int | width, | ||
int | height, | ||
int | rotation | ||
) |
Occurs when the video size or rotation information of a remote 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). |
void io.agora.rtc.IRtcEngineEventHandler.onRemoteAudioStateChanged | ( | int | uid, |
int | state, | ||
int | reason, | ||
int | elapsed | ||
) |
Occurs when the remote audio state changes.
This callback indicates the state change of the remote audio stream.
uid | ID of the user whose audio state changes. |
state | State of the remote audio:
|
reason | The reason of the remote audio state change.
|
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
void io.agora.rtc.IRtcEngineEventHandler.onRemoteVideoStateChanged | ( | int | uid, |
int | state, | ||
int | reason, | ||
int | elapsed | ||
) |
Occurs when the remote video state changes.
uid | ID of the remote user whose video state changes. |
state | State of the remote video:
|
reason | The reason of the remote video state change:
|
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
void io.agora.rtc.IRtcEngineEventHandler.onChannelMediaRelayStateChanged | ( | int | state, |
int | code | ||
) |
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.
state | The state code:
|
code | The error code:
|
void io.agora.rtc.IRtcEngineEventHandler.onChannelMediaRelayEvent | ( | int | code | ) |
Reports events during the media stream relay.
code | The event code for media stream relay:
|
void io.agora.rtc.IRtcEngineEventHandler.onLocalPublishFallbackToAudioOnly | ( | boolean | isFallbackOrRecover | ) |
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.
isFallbackOrRecover | Whether the published stream fell back to audio-only or switched back to the video:
|
void io.agora.rtc.IRtcEngineEventHandler.onRemoteSubscribeFallbackToAudioOnly | ( | int | uid, |
boolean | isFallbackOrRecover | ||
) |
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 uplink conditions, or when the remotely subscribed media stream switches back to the video after the uplink network condition improves.
uid | ID of the remote user sending the stream. |
isFallbackOrRecover | Whether the remote media stream fell back to audio-only or switched back to the video:
|
void io.agora.rtc.IRtcEngineEventHandler.onAudioRouteChanged | ( | int | routing | ) |
Occurs when the local audio playback route changes.
This callback returns that the audio route switched to an earpiece, speakerphone, headset, or Bluetooth device.
The definition of the routing is listed as follows:
void io.agora.rtc.IRtcEngineEventHandler.onCameraReady | ( | ) |
Occurs when the camera is turned on and ready to capture video.
void io.agora.rtc.IRtcEngineEventHandler.onCameraFocusAreaChanged | ( | Rect | rect | ) |
Occurs when the camera focus area is changed.
The SDK triggers this callback when the local user changes the camera focus position by calling the setCameraFocusPositionInPreview method.
rect | Rectangular area in the camera zoom specifying the focus area. |
void io.agora.rtc.IRtcEngineEventHandler.onCameraExposureAreaChanged | ( | Rect | rect | ) |
The camera exposure area has changed.
The SDK triggers this callback when the local user changes the camera exposure position by calling the setCameraExposurePosition method.
rect | Rectangular area in the camera zoom specifying the exposure area. |
void io.agora.rtc.IRtcEngineEventHandler.onFacePositionChanged | ( | int | imageWidth, |
int | imageHeight, | ||
AgoraFacePositionInfo [] | faces | ||
) |
Reports the face detection result of the local user.
Once you enable face detection by calling enableFaceDetection, you can get the following information on the local user in real-time:
imageWidth | The width (px) of the local video. |
imageHeight | The height (px) of the local video. |
faces | The information of the detected human face. For details, see AgoraFacePositionInfo. The number of the AgoraFacePositionInfo array depends on the number of human faces detected. If the array length is 0, it means that no human face is detected. |
void io.agora.rtc.IRtcEngineEventHandler.onAudioQuality | ( | int | uid, |
int | quality, | ||
short | delay, | ||
short | lost | ||
) |
Reports the statistics of the audio stream from each remote user/host.
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.
uid | User ID of the speaker. |
quality | Audio quality of the user:
|
delay | Time delay (ms) of the audio packet from the sender to the receiver, including the time delay from audio sampling pre-processing, transmission, and the jitter buffer. |
lost | Packet loss rate (%) of the audio packet sent from the sender to the receiver. |
void io.agora.rtc.IRtcEngineEventHandler.onRtcStats | ( | RtcStats | stats | ) |
void io.agora.rtc.IRtcEngineEventHandler.onLastmileQuality | ( | int | quality | ) |
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.
quality | The last mile network quality based on the uplink and downlink packet loss rate and jitter:
|
void io.agora.rtc.IRtcEngineEventHandler.onLastmileProbeResult | ( | LastmileProbeResult | result | ) |
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. For details, see LastmileProbeResult. |
void io.agora.rtc.IRtcEngineEventHandler.onNetworkQuality | ( | int | uid, |
int | txQuality, | ||
int | rxQuality | ||
) |
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, then this callback will be triggered as many times.
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 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 680 × 480 and a frame rate of 30 fps, but may be inadequate for resolutions higher than 1280 × 720.
|
rxQuality | Downlink network quality rating of the user in terms of packet loss rate, average RTT, and jitter of the downlink network.
|
void io.agora.rtc.IRtcEngineEventHandler.onLocalVideoStats | ( | LocalVideoStats | stats | ) |
Reports the statistics of the local video streams.
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 | The statistics of the local video stream. See LocalVideoStats. |
void io.agora.rtc.IRtcEngineEventHandler.onRemoteVideoStats | ( | RemoteVideoStats | stats | ) |
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 received remote video streams: RemoteVideoStats. |
void io.agora.rtc.IRtcEngineEventHandler.onLocalAudioStats | ( | LocalAudioStats | stats | ) |
Reports the statistics of the local audio stream.
stats | The statistics of the local audio stream. See LocalAudioStats. |
void io.agora.rtc.IRtcEngineEventHandler.onRemoteAudioStats | ( | RemoteAudioStats | stats | ) |
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/host. If a channel includes multiple remote users, the SDK triggers this callback as many times.
Schemes such as FEC (Forward Error Correction) or retransmission counter the frame loss rate. Hence, users may find the overall audio quality acceptable even when the packet loss rate is high.
stats | Statistics of the received remote audio streams: RemoteAudioStats. |
void io.agora.rtc.IRtcEngineEventHandler.onLocalVideoStat | ( | int | sentBitrate, |
int | sentFrameRate | ||
) |
Reports the statistics of the uploading local video streams.
sentBitrate | Data transmission bitrate (Kbps) since last count. |
sentFrameRate | Data transmission frame rate (fps) since last count. |
void io.agora.rtc.IRtcEngineEventHandler.onRemoteVideoStat | ( | int | uid, |
int | delay, | ||
int | receivedBitrate, | ||
int | receivedFrameRate | ||
) |
Reports the statistics of the video stream from each remote user/host.
uid | User ID of the remote user sending the video streams. |
delay | Time delay (ms). |
receivedBitrate | Data receiving bitrate (Kbps). |
receivedFrameRate | Data receiving frame rate (fps). |
void io.agora.rtc.IRtcEngineEventHandler.onRemoteAudioTransportStats | ( | int | uid, |
int | delay, | ||
int | lost, | ||
int | rxKBitRate | ||
) |
Reports the transport-layer statistics of each remote audio stream.
This callback reports the transport-layer statistics, such as the packet loss rate and 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. |
void io.agora.rtc.IRtcEngineEventHandler.onRemoteVideoTransportStats | ( | int | uid, |
int | delay, | ||
int | lost, | ||
int | rxKBitRate | ||
) |
Reports the transport-layer statistics of each remote video stream.
This callback reports the transport-layer statistics, such as the packet loss rate and time delay, once every two seconds after the local user receives the 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. |
void io.agora.rtc.IRtcEngineEventHandler.onAudioMixingStateChanged | ( | int | state, |
int | errorCode | ||
) |
Occurs when the state of the local user's audio mixing file changes.
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.
state | The state code:
|
errorCode | The error code:
|
void io.agora.rtc.IRtcEngineEventHandler.onAudioMixingFinished | ( | ) |
Occurs when the audio mixing file playback finishes.
You can start an audio mixing file playback by calling the startAudioMixing method. This callback is triggered when the audio mixing file playback finishes.
If the startAudioMixing method call fails, an WARN_AUDIO_MIXING_OPEN_ERROR warning returns in the onWarning callback.
void io.agora.rtc.IRtcEngineEventHandler.onAudioEffectFinished | ( | int | soundId | ) |
Occurs when the audio effect file playback finishes.
You can start a local audio effect playback by calling the playEffect method. This callback is triggered when the local audio effect file playback finishes.
soundId | ID of the local audio effect. Each local audio effect has a unique ID. |
void io.agora.rtc.IRtcEngineEventHandler.onFirstRemoteAudioDecoded | ( | int | uid, |
int | elapsed | ||
) |
Occurs when the engine receives the first audio frame from a specified remote user.
This callback is triggered in either of the following scenarios:
uid | User ID of the remote user sending the audio stream. |
elapsed | The time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
void io.agora.rtc.IRtcEngineEventHandler.onLocalAudioStateChanged | ( | int | state, |
int | error | ||
) |
Occurs when the local audio stream 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.
error
parameter for details.state | State of the local audio:
|
error | The error information of the local audio:
|
void io.agora.rtc.IRtcEngineEventHandler.onLocalVideoStateChanged | ( | int | localVideoState, |
int | error | ||
) |
Occurs when the local video state changes.
The SDK returns the current video state in this callback. When the state is LOCAL_VIDEO_STREAM_STATE_FAILED(3), see the error
parameter for details.
localVideoState | The local video state:
|
error | The detailed error information of the local video:
|
void io.agora.rtc.IRtcEngineEventHandler.onRtmpStreamingStateChanged | ( | String | url, |
int | state, | ||
int | errCode | ||
) |
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 returns the URL and its current streaming state. When the streaming state is RTMP_STREAM_PUBLISH_STATE_FAILURE(4), see the errCode
parameter for details.
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.
url | The RTMP URL address. |
state | The RTMP streaming state:
|
errCode | The detailed error information for streaming:
|
void io.agora.rtc.IRtcEngineEventHandler.onStreamPublished | ( | String | url, |
int | error | ||
) |
Reports the result of calling the addPublishStreamUrl method.
This callback indicates whether you have successfully added an RTMP stream to the CDN.
url | The RTMP URL address. |
error | The detailed error information:
|
void io.agora.rtc.IRtcEngineEventHandler.onStreamUnpublished | ( | String | url | ) |
Reports the result of calling the removePublishStreamUrl method.
This callback indicates whether you have successfully removed an RTMP stream from the CDN.
url | The RTMP URL address. |
void io.agora.rtc.IRtcEngineEventHandler.onTranscodingUpdated | ( | ) |
Occurs when the publisher's transcoding settings are updated.
When the LiveTranscoding
class in the setLiveTranscoding method updates, the SDK triggers this callback to report the update information.
setLiveTranscoding
method to set the LiveTranscoding
class for the first time, the SDK does not trigger this callback. void io.agora.rtc.IRtcEngineEventHandler.onStreamInjectedStatus | ( | String | url, |
int | uid, | ||
int | status | ||
) |
Reports the status of injecting the online media stream.
url | The URL address of the externally injected stream. |
uid | User ID. |
status | State of the externally injected stream:
|
void io.agora.rtc.IRtcEngineEventHandler.onStreamMessage | ( | int | uid, |
int | streamId, | ||
byte [] | data | ||
) |
Occurs when the local user receives a remote data stream.
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 data stream. |
streamId | Stream ID. |
data | Data received by the local user. |
void io.agora.rtc.IRtcEngineEventHandler.onStreamMessageError | ( | int | uid, |
int | streamId, | ||
int | error, | ||
int | missed, | ||
int | cached | ||
) |
Occurs when the local user fails to receive a remote data stream.
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 data stream. |
streamId | Stream ID. |
error | Error code. |
missed | The number of lost messages. |
cached | The number of incoming cached messages when the data stream is interrupted. |
void io.agora.rtc.IRtcEngineEventHandler.onMediaEngineLoadSuccess | ( | ) |
Occurs when the media engine is loaded.
void io.agora.rtc.IRtcEngineEventHandler.onMediaEngineStartCallSuccess | ( | ) |
Occurs when the media engine starts.
void io.agora.rtc.IRtcEngineEventHandler.onNetworkTypeChanged | ( | int | type | ) |
Occurs when the network type changes.
The SDK returns the current network type 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.
type | The network type:
|