Classes | |
class | AgoraFacePositionInfo |
class | AudioFileInfo |
class | AudioVolumeInfo |
class | ClientRole |
class | ErrorCode |
class | ExperiencePoorReason |
class | ExperienceQuality |
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 | onProxyConnected (String channel, int uid, int proxyType, String localProxyIp, int elapsed) |
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 | onLocalVoicePitchInHz (int pitchInHz) |
void | onActiveSpeaker (int uid) |
void | onFirstLocalAudioFrame (int elapsed) |
void | onFirstLocalAudioFramePublished (int elapsed) |
void | onFirstRemoteAudioFrame (int uid, int elapsed) |
void | onVideoStopped () |
void | onFirstLocalVideoFrame (int width, int height, int elapsed) |
void | onFirstLocalVideoFramePublished (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 | onAudioPublishStateChanged (String channel, int oldState, int newState, int elapseSinceLastState) |
void | onVideoPublishStateChanged (String channel, int oldState, int newState, int elapseSinceLastState) |
void | onAudioSubscribeStateChanged (String channel, int uid, int oldState, int newState, int elapseSinceLastState) |
void | onVideoSubscribeStateChanged (String channel, int uid, int oldState, int newState, int elapseSinceLastState) |
void | onRemoteVideoStateChanged (int uid, int state, int reason, int elapsed) |
void | onUserSuperResolutionEnabled (int uid, boolean enabled, int reason) |
void | onVirtualBackgroundSourceEnabled (boolean enabled, int reason) |
void | onSnapshotTaken (String channel, int uid, String filePath, int width, int height, int errCode) |
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 reason) |
void | onAudioMixingFinished () |
void | onAudioEffectFinished (int soundId) |
void | onFirstRemoteAudioDecoded (int uid, int elapsed) |
void | onLocalAudioStateChanged (int state, int error) |
void | onRequestAudioFileInfo (AudioFileInfo info, 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 | onRtmpStreamingEvent (String url, int error) |
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) |
void | onClientRoleChangeFailed (int reason, int currentRole) |
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.
IRtcEngineEventHandler
class. You need to catch and handle the exceptions yourself; otherwise, it can cause a crash. 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 the user calling joinChannel until the SDK triggers this callback. |
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 gets 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 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:
|
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_BROADCASTING
) joins the channel.
COMMUNICATION
profile: This callback notifies the app when another user joins the channel. If other users are already in the channel, the SDK also reports to the app on the existing users.LIVE_BROADCASTING
profile: This callback notifies the app when the host joins the channel. If other hosts are already in the channel, the SDK also reports to the app on the existing hosts. We recommend having at most 17 hosts in a channel.The SDK triggers this callback under one of the following circumstances:
joinChannel
method.setClientRole
method after joining the channel.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. |
LIVE_BROADCASTING
profile: void io.agora.rtc.IRtcEngineEventHandler.onUserOffline | ( | int | uid, |
int | reason | ||
) |
Occurs when a remote user (COMMUNICATION
)/host (LIVE_BROADCASTING
) 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.onProxyConnected | ( | String | channel, |
int | uid, | ||
int | proxyType, | ||
String | localProxyIp, | ||
int | elapsed | ||
) |
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:
|
localProxyIp | Reserved for future use. |
elapsed | The time elapsed (ms) from the user calling joinChannel until this callback is triggered. |
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.
onConnectionStateChanged
instead.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
:
onConnectionInterrupted
callback when the SDK loses connection with the server for more than four seconds after it joins the channel. onConnectionLost
callback when it loses connection with the server for more than 10 seconds, regardless of whether it joins 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.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.
onConnectionStateChanged
instead.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.
After a token is specified when joining the channel, the token expires after a certain period of time, and a new token is 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.
void io.agora.rtc.IRtcEngineEventHandler.onMicrophoneEnabled | ( | boolean | enabled | ) |
Occurs when the microphone is enabled/disabled.
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:
|
void io.agora.rtc.IRtcEngineEventHandler.onAudioVolumeIndication | ( | AudioVolumeInfo[] | speakers, |
int | totalVolume | ||
) |
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
affects the SDK's behavior as follows: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. |
totalVolume | Total volume after audio mixing. The value ranges between 0 (lowest volume) and 255 (highest volume).
|
void io.agora.rtc.IRtcEngineEventHandler.onLocalVoicePitchInHz | ( | int | pitchInHz | ) |
Reports the voice pitch of the local user.
After the local audio capture is enabled and you call enableLocalVoicePitchCallback
, the SDK triggers the onLocalVoicePitchInHz
callback at the time interval set in enableLocalVoicePitchCallback
.
enableLocalAudio(false)
, the SDK immediately stops sending the onLocalVoicePitchInHz
callback.pitchInHz | The voice pitch (Hz) of the local user. |
void io.agora.rtc.IRtcEngineEventHandler.onActiveSpeaker | ( | int | uid | ) |
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. |
void io.agora.rtc.IRtcEngineEventHandler.onFirstLocalAudioFrame | ( | int | elapsed | ) |
Occurs when the first local audio frame is sent.
IRtcEngineEventHandler#onFirstLocalAudioFramePublished()
instead. elapsed | Time elapsed (ms) from the local user calling the joinChannel until this callback is triggered. |
void io.agora.rtc.IRtcEngineEventHandler.onFirstLocalAudioFramePublished | ( | int | elapsed | ) |
Occurs when the first audio frame is published.
The SDK triggers this callback under one of the following circumstances:
joinChannel
successfully.muteLocalAudioStream
(true) and muteLocalAudioStream
(false) in sequence.disableAudio
and enableAudio
in sequence.pushExternalAudioFrame
to successfully push the audio frame to the SDK.elapsed | The time elapsed (ms) from the local client calling joinChannel until the SDK triggers this callback. |
void io.agora.rtc.IRtcEngineEventHandler.onFirstRemoteAudioFrame | ( | int | uid, |
int | elapsed | ||
) |
Occurs when the first remote audio frame is received.
onRemoteAudioStateChanged
instead.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.
LOCAL_VIDEO_STREAM_STATE_STOPPED(0)
in the onLocalVideoStateChanged
callback instead. 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. 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.onFirstLocalVideoFramePublished | ( | int | elapsed | ) |
Occurs when the first video frame is published.
The SDK triggers this callback under one of the following circumstances:
joinChannel
successfully.muteLocalVideoStream
(true) and muteLocalVideoStream
(false) in sequence.disableVideo
and enableVideo
in sequence.pushExternalVideoFrame
to successfully push the video frame to the SDK.elapsed | The time elapsed (ms) from the local client calling joinChannel until the SDK triggers this callback. |
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.
You can also use REMOTE_VIDEO_STATE_STARTING(1) or REMOTE_VIDEO_STATE_DECODING(2) in the onRemoteVideoStateChanged
callback instead.
This callback is triggered in either of the following scenarios:
muteLocalVideoStream
method. disableVideo
method. 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 get 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.
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 | 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 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
|
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.
COMMUNICATION
profile) or hosts (in the LIVE_BROADCASTING profile) in a channel exceeds 17.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.onAudioPublishStateChanged | ( | String | channel, |
int | oldState, | ||
int | newState, | ||
int | elapseSinceLastState | ||
) |
Occurs when the audio publishing state changes.
This callback indicates the publishing state change of the local audio stream.
The publishing states include:
channel | The channel name. |
oldState | The previous publishing state. |
newState | The current publishing state. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
void io.agora.rtc.IRtcEngineEventHandler.onVideoPublishStateChanged | ( | String | channel, |
int | oldState, | ||
int | newState, | ||
int | elapseSinceLastState | ||
) |
Occurs when the local video publishing state changes.
This callback indicates the publishing state change of the local video stream.
The publishing states include:
channel | The channel name. |
oldState | The previous publishing state. |
newState | The current publishing state. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
void io.agora.rtc.IRtcEngineEventHandler.onAudioSubscribeStateChanged | ( | String | channel, |
int | uid, | ||
int | oldState, | ||
int | newState, | ||
int | elapseSinceLastState | ||
) |
Occurs when the remote audio subscribing state changes.
This callback indicates the subscribing state change of the remote audio stream.
The subscribing states include:
channel | The channel name. |
uid | The ID of the remote user whose audio subscribing state changes. |
oldState | The previous subscribing state. |
newState | The current subscribing state. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
void io.agora.rtc.IRtcEngineEventHandler.onVideoSubscribeStateChanged | ( | String | channel, |
int | uid, | ||
int | oldState, | ||
int | newState, | ||
int | elapseSinceLastState | ||
) |
Occurs when the remote video subscribe state changes.
This callback indicates the subscribe state change of the remote video stream.
The subscribing states include:
channel | The channel name. |
uid | The ID of the remote user whose video subscribe state changes. |
oldState | The previous subscribing state. |
newState | The current subscribing state. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
void io.agora.rtc.IRtcEngineEventHandler.onRemoteVideoStateChanged | ( | int | uid, |
int | state, | ||
int | reason, | ||
int | elapsed | ||
) |
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:
|
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.onUserSuperResolutionEnabled | ( | int | uid, |
boolean | enabled, | ||
int | reason | ||
) |
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.
|
void io.agora.rtc.IRtcEngineEventHandler.onVirtualBackgroundSourceEnabled | ( | boolean | enabled, |
int | reason | ||
) |
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:
|
void io.agora.rtc.IRtcEngineEventHandler.onSnapshotTaken | ( | String | channel, |
int | uid, | ||
String | filePath, | ||
int | width, | ||
int | height, | ||
int | errCode | ||
) |
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:
|
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 downlink conditions, or when the remotely subscribed 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 remote media stream fell back to audio-only or switched back to the video:
|
onRemoteVideoStats
callback. void io.agora.rtc.IRtcEngineEventHandler.onAudioRouteChanged | ( | int | routing | ) |
Occurs when the local audio playback route changes.
routing | The current audio routing:
|
void io.agora.rtc.IRtcEngineEventHandler.onCameraReady | ( | ) |
Occurs when the camera is turned on and ready to capture video.
LOCAL_VIDEO_STREAM_STATE_CAPTURING(1)
in the onLocalVideoStateChanged
callback instead. If the camera fails to turn on, fix the error reported in the onError
callback. 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.
onRemoteAudioStats
instead.The SDK triggers this callback once every two seconds to report the audio quality of each remote user/host sending an audio stream. If a channel has multiple remote users/hosts sending audio streams, the SDK triggers this callback as many times.
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.
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 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.
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.
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.
onLocalVideoStats
to get the local video statistics. 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.
onRemoteVideoStats
to get the remote video statistics.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.
onRemoteAudioStats
instead.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.
onRemoteVideoStats
instead.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 | reason | ||
) |
Occurs when the playback 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.
state | The current music file playback state:
|
reason | The reason for the change of the music file playback state:
|
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.
onRemoteAudioStateChanged
instead.This callback is triggered in either of the following scenarios:
muteLocalAudioStream
method. disableAudio
method. 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 sampling and encoding, and allows you to troubleshoot issues when exceptions occur.
state | State of the local audio:
|
error | The error information of the local audio:
|
void io.agora.rtc.IRtcEngineEventHandler.onRequestAudioFileInfo | ( | AudioFileInfo | info, |
int | error | ||
) |
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:
|
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.
The SDK triggers the onLocalVideoStateChanged(LOCAL_VIDEO_STREAM_STATE_FAILED,LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE)
callback in the following situations:
- The camera starts normally, but the captured video is not output for four seconds.When the third-party application releases the camera, the SDK triggers the
onLocalVideoStateChanged(LOCAL_VIDEO_STREAM_STATE_CAPTURING,LOCAL_VIDEO_STREAM_ERROR_OK)
callback.
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 | 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 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.
This callback indicates the state of the RTMP or RTMPS streaming. 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:
|
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.
onRtmpStreamingStateChanged
instead.This callback indicates whether you have successfully added an RTMP or RTMPS stream to the CDN.
url | The CDN streaming URL. |
error | The detailed error information:
|
void io.agora.rtc.IRtcEngineEventHandler.onStreamUnpublished | ( | String | url | ) |
Reports the result of calling the removePublishStreamUrl
method.
onRtmpStreamingStateChanged
instead.This callback indicates whether you have successfully removed an RTMP or RTMPS stream from the CDN.
url | The CDN streaming URL. |
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.onRtmpStreamingEvent | ( | String | url, |
int | error | ||
) |
Reports events during the RTMP or RTMPS streaming.
url | The CDN streaming URL. |
error | The event code.
|
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:
|
void io.agora.rtc.IRtcEngineEventHandler.onClientRoleChangeFailed | ( | int | reason, |
int | currentRole | ||
) |
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: |
currentRole | The current user role: |