Agora Java API Reference for Android
Classes | Public Member Functions | List of all members
io.agora.rtc2.IRtcEngineEventHandler Class Referenceabstract
Inheritance diagram for io.agora.rtc2.IRtcEngineEventHandler:
io.agora.rtc2.IAgoraEventHandler

Classes

class  AgoraFacePositionInfo
 
class  AudioVolumeInfo
 
class  ClientRole
 
class  DownlinkNetworkInfo
 
enum  ENCRYPTION_ERROR_TYPE
 
class  ErrorCode
 
class  LastmileProbeResult
 
enum  LOCAL_AUDIO_STREAM_ERROR
 
enum  LOCAL_AUDIO_STREAM_STATE
 
class  LocalAudioStats
 
class  LocalVideoStats
 
enum  PERMISSION
 
class  Quality
 
enum  REMOTE_AUDIO_STATE
 
enum  REMOTE_AUDIO_STATE_REASON
 
enum  REMOTE_USER_STATE
 
class  RemoteAudioStats
 
class  RemoteVideoStats
 
enum  RHYTHM_PLAYER_ERROR_TYPE
 
enum  RHYTHM_PLAYER_STATE_TYPE
 
class  RtcStats
 
enum  RTMP_STREAM_PUBLISH_ERROR_TYPE
 
enum  RTMP_STREAM_PUBLISH_STATE
 
enum  RTMP_STREAMING_EVENT
 
enum  STREAM_PUBLISH_STATE
 
enum  STREAM_SUBSCRIBE_STATE
 
class  UplinkNetworkInfo
 
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 onClientRoleChangeFailed (int reason, int currentRole)
 
void onLocalUserRegistered (int uid, String userAccount)
 
void onUserInfoUpdated (int uid, UserInfo userInfo)
 
void onUserStateChanged (int uid, int state)
 
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 onAudioVolumeIndication (AudioVolumeInfo[] speakers, int totalVolume)
 
void onActiveSpeaker (int uid)
 
void onFirstLocalAudioFramePublished (int elapsed)
 
void onFirstRemoteAudioFrame (int uid, int elapsed)
 
void onFirstRemoteAudioDecoded (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, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed)
 
void onAudioPublishStateChanged (String channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState)
 
void onVideoPublishStateChanged (String channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState)
 
void onAudioSubscribeStateChanged (String channel, int uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)
 
void onVideoSubscribeStateChanged (String channel, int uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)
 
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 onContentInspectResult (int result)
 
void onSnapshotTaken (String channel, int uid, String filePath, int width, int height, int errCode)
 snapshot taken callback More...
 
void onFacePositionChanged (int imageWidth, int imageHeight, AgoraFacePositionInfo[] faceRectArr)
 
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 onRemoteAudioStats (RemoteAudioStats stats)
 
void onLocalAudioStats (LocalAudioStats stats)
 
void onRemoteVideoStats (RemoteVideoStats 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 onRhythmPlayerStateChanged (RHYTHM_PLAYER_STATE_TYPE state, RHYTHM_PLAYER_ERROR_TYPE errorCode)
 
void onLocalAudioStateChanged (LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_ERROR error)
 
void onLocalVideoStateChanged (int state, int error)
 
void onRtmpStreamingStateChanged (String url, RTMP_STREAM_PUBLISH_STATE state, RTMP_STREAM_PUBLISH_ERROR_TYPE errCode)
 
void onRtmpStreamingEvent (String url, RTMP_STREAMING_EVENT event)
 
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)
 
void onIntraRequestReceived ()
 
void onUplinkNetworkInfoUpdated (UplinkNetworkInfo info)
 
void onDownlinkNetworkInfoUpdated (DownlinkNetworkInfo info)
 
void onRefreshRecordingServiceStatus (int status)
 
void onEncryptionError (ENCRYPTION_ERROR_TYPE errorType)
 
void onPermissionError (PERMISSION permission)
 
void onUploadLogResult (String requestId, boolean success, int reason)
 

Detailed Description

Callback methods.

The SDK uses the IRtcEngineEventHandler interface class to send callback event notifications to the application, and the application inherits the methods of this interface class to retrieve these event notifications. 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 callback methods, the application should avoid time-consuming tasks or call blocking APIs (such as SendMessage), otherwise, the SDK may not work properly.

Member Function Documentation

◆ onWarning()

void io.agora.rtc2.IRtcEngineEventHandler.onWarning ( int  warn)

A warning occurred during SDK runtime.

Deprecated:

In most cases, the application can ignore the warnings 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 attempts to reconnect. warn WarnCode Warning code}

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onError()

void io.agora.rtc2.IRtcEngineEventHandler.onError ( int  err)

An error occurred during SDK runtime.

Deprecated:

In most cases, reporting an error means that the SDK cannot fix the issue and resume running, and therefore requires actions from the application or simply informs the user about the issue. For instance, the SDK reports an ERR_START_CALL error when it fails to initialize a call. In this case, the application informs the user that the call initialization has failed, and calls the leaveChannel method to exit the channel.

Parameters
errError code

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onJoinChannelSuccess()

void io.agora.rtc2.IRtcEngineEventHandler.onJoinChannelSuccess ( String  channel,
int  uid,
int  elapsed 
)

Occurs when the local user successfully joins the specified channel.

Parameters
channelThe channel name.
uidThe user ID.
  • If you specified a uid in the joinChannel method, the SDK returns the specified ID;
  • If not, this callback returns an ID that is automatically assigned by the Agora server.
elapsedThe time elapsed (ms) from the local user calling joinChannel until this event occurs.

◆ onRejoinChannelSuccess()

void io.agora.rtc2.IRtcEngineEventHandler.onRejoinChannelSuccess ( String  channel,
int  uid,
int  elapsed 
)

Occurs when the local user rejoins the channel after being disconnected due to network problems.

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

Parameters
channelThe channel name.
uidThe user ID.
elapsedTime elapsed (ms) from starting to reconnect until this callback is triggered

◆ onLeaveChannel()

void io.agora.rtc2.IRtcEngineEventHandler.onLeaveChannel ( RtcStats  stats)

Occurs when the local user successfully leaves the channel.

When the user successfully leaves the channel after calling leaveChannel, the SDK uses this callback to notify the app that the user has left the channel.

This callback also reports information such as the call duration and the statistics of data received or transmitted by the SDK.

Parameters
statsThe statistics on the call: RtcStats.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onClientRoleChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onClientRoleChanged ( int  oldRole,
int  newRole 
)

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

Parameters
oldRoleThe old role of the user.
newRoleThe new role of the user

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onClientRoleChangeFailed()

void io.agora.rtc2.IRtcEngineEventHandler.onClientRoleChangeFailed ( int  reason,
int  currentRole 
)

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

Parameters
reasonThe reason of the failure of the local user role switches.
currentRoleThe current role of the user

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onLocalUserRegistered()

void io.agora.rtc2.IRtcEngineEventHandler.onLocalUserRegistered ( int  uid,
String  userAccount 
)

Occurs when the local user registers a user account.

Since
v2.8.0.

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.

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

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onUserInfoUpdated()

void io.agora.rtc2.IRtcEngineEventHandler.onUserInfoUpdated ( int  uid,
UserInfo  userInfo 
)

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

Since
v2.8.0.

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

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

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onUserStateChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onUserStateChanged ( int  uid,
int  state 
)

Occurs when the remote user state is updated.

Parameters
uidThe ID of the remote user.
stateState of the remote user: Just & #REMOTE_USER_STATE
  • USER_STATE_MUTE_AUDIO(1 << 0): The remote user has muted the audio.
  • USER_STATE_MUTE_VIDEO(1 << 1): The remote user has muted the video.
  • USER_STATE_ENABLE_VIDEO(1 << 4): The remote user has enabled the video, which includes video capturing and encoding.
  • USER_STATE_ENABLE_LOCAL_VIDEO(1 << 8): The remote user has enabled the local video capturing.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onUserJoined()

void io.agora.rtc2.IRtcEngineEventHandler.onUserJoined ( int  uid,
int  elapsed 
)

Occurs when a remote user or broadcaster joins the channel.

If other users are already in the channel, the SDK also reports to the app on the existing users.

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

  • A broadcaster joins the channel by calling joinChannel.
  • A remote user switches the user role to broadcaster by calling setClientRole. after joining the channel.
  • A remote user or broadcaster rejoins the channel after a network interruption.
Note
When a Web app joins the channel, this callback is triggered as long as the app publishes a stream.
Parameters
uidID of the remote user or broadcaster joining the channel.
elapsedThe time elapsed (ms) from the local user calling joinChannel or setClientRole until this callback is triggered.

◆ onUserOffline()

void io.agora.rtc2.IRtcEngineEventHandler.onUserOffline ( int  uid,
int  reason 
)

Occurs when a remote user or broadcaster goes offline.

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

◆ onConnectionStateChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onConnectionStateChanged ( int  state,
int  reason 
)

Occurs when the network connection state changes.

Since
v2.3.2.

The Agora SDK returns this callback to report on the current network connection state when it changes, and the reason to such change.

Parameters
stateThe current network connection state:
reasonThe reason causing the change of the connection state:

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onConnectionInterrupted()

void io.agora.rtc2.IRtcEngineEventHandler.onConnectionInterrupted ( )

The SDK has lost connection to the server. This method is triggered upon connection is lost, while the onConnectionLost method is triggered when the SDK attempts to reconnect after losing connection. Once the connection is lost, and if the application does not call leaveChannel, the SDK automatically tries to reconnect repeatedly.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onConnectionLost()

void io.agora.rtc2.IRtcEngineEventHandler.onConnectionLost ( )

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

The SDK triggers this callback when it cannot connect to the server 10 seconds after calling joinChannel, regardless of whether it is in the channel or not.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onConnectionBanned()

void io.agora.rtc2.IRtcEngineEventHandler.onConnectionBanned ( )

Your connection is banned by the Agora Server.

Note: The SDK does not try to reconnect.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onApiCallExecuted()

void io.agora.rtc2.IRtcEngineEventHandler.onApiCallExecuted ( int  error,
String  api,
String  result 
)

Occurs when an API method is executed.

Parameters
errorThe error code that the SDK returns when the method call fails.
apiThe API method that the SDK executes.
resultThe result of the method call.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onTokenPrivilegeWillExpire()

void io.agora.rtc2.IRtcEngineEventHandler.onTokenPrivilegeWillExpire ( String  token)

Occurs when the token will expire in 30 seconds.

If the token you specified when calling joinChannel expires, the user will drop offline. This callback is triggered 30 seconds before the token expires, to remind you to renew the token.

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

See also
How to generate a token.
Parameters
tokenThe token that will expire in 30 seconds.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onRequestToken()

void io.agora.rtc2.IRtcEngineEventHandler.onRequestToken ( )

Occurs when the token has expired.

If a token is specified when calling the joinChannel method, the token expires after a certain period of time and you need a new token to reconnect to the server.

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

See also
How to generate a token.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onAudioVolumeIndication()

void io.agora.rtc2.IRtcEngineEventHandler.onAudioVolumeIndication ( AudioVolumeInfo[]  speakers,
int  totalVolume 
)

Reports which users are speaking and the speaker‘s volume.

This callback reports the IDs and volumes of the loudest speakers (at most 3) at the moment in the channel, and whether the local user is speaking. 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.

Calling the muteLocalAudioStream method affects the SDK's behavior.

  • If the local user calls the muteLocalAudioStream method, the SDK stops triggering the local user's callback.
  • 20 seconds after a remote speaker calls the muteLocalAudioStream method, the remote speakers' callback does not include information of this remote user; 20 seconds after all remote users call the muteLocalAudioStream method, the SDK stops triggering the remote speakers' callback.
Parameters
speakersAn array containing the user ID and volume information for each speaker: AudioVolumeInfo.
  • In the local user's callback, this array contains the following members:
    • uid = 0,
    • volume = totalVolume, which reports the sum of the voice volume and audio-mixing volume of the local user.
  • In the remote users' callback, this array contains the following members:

    • uid of each remote speaker.
    • volume, which reports the sum of the voice volume and audio-mixing volume of each remote speaker.

    An empty speakers array in the callback indicates that no remote user is speaking at the moment.

totalVolumeThe total volume after audio mixing. The value ranges between 0 (the lowest volume) and 255 (the highest volume).
  • In the local user's callback, totalVolume is the sum of the voice volume and audio-mixing volume of the local user.
  • In the remote users' callback, totalVolume is the sum of the voice volume and audio-mixing volume of all the remote speakers.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onActiveSpeaker()

void io.agora.rtc2.IRtcEngineEventHandler.onActiveSpeaker ( int  uid)

Occurs when an active speaker is detected.

If you have called the enableAudioVolumeIndication method, this callback is triggered when the volume detecting unit has detected an active speaker in the channel. This callback also returns the uid of the active speaker.

You can add relative functions on your app, for example, the active speaker, once detected, will have the portrait zoomed in.

Note
  • You need to call enableAudioVolumeIndication to receive this callback.
  • The active speaker means the user ID of the speaker who speaks at the highest volume during a certain period of time.
Parameters
uidThe ID of the active speaker. A uid of 0 means the local user.

◆ onFirstLocalAudioFramePublished()

void io.agora.rtc2.IRtcEngineEventHandler.onFirstLocalAudioFramePublished ( int  elapsed)

Occurs when the first audio frame is published.

Parameters
elapsedThe time elapsed (ms) from the local user calling joinChannel to the SDK triggers this callback.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onFirstRemoteAudioFrame()

void io.agora.rtc2.IRtcEngineEventHandler.onFirstRemoteAudioFrame ( int  uid,
int  elapsed 
)

Occurs when the first remote audio frame is received.

Parameters
uidID of the remote user.
elapsedThe time elapsed (ms) from the local user calling RtcEngine#joinChannel until this callback is triggered.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onFirstRemoteAudioDecoded()

void io.agora.rtc2.IRtcEngineEventHandler.onFirstRemoteAudioDecoded ( int  uid,
int  elapsed 
)

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

Parameters
uidUser ID of the remote user sending the audio stream.
elapsedThe time elapsed (ms) from the loca user calling joinChannel() until this callback is triggered.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onVideoStopped()

void io.agora.rtc2.IRtcEngineEventHandler.onVideoStopped ( )

The video has stopped playing.

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

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onFirstLocalVideoFrame()

void io.agora.rtc2.IRtcEngineEventHandler.onFirstLocalVideoFrame ( int  width,
int  height,
int  elapsed 
)

The first local video frame is displayed on the screen.

Parameters
widthWidth (pixels) of the video stream.
heightHeight (pixels) of the video stream.
elapsedTime elapsed (ms) from calling token, java.lang.String channelName, java.lang.String optionalInfo, int optionalUid) joinChannel until this callback is triggered.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onFirstLocalVideoFramePublished()

void io.agora.rtc2.IRtcEngineEventHandler.onFirstLocalVideoFramePublished ( int  elapsed)

Occurs when the first video frame is published.

Parameters
elapsedThe time elapsed (ms) from the local user calling joinChannel to the SDK triggers this callback.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onFirstRemoteVideoDecoded()

void io.agora.rtc2.IRtcEngineEventHandler.onFirstRemoteVideoDecoded ( int  uid,
int  width,
int  height,
int  elapsed 
)

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

Deprecated:
This callback is deprecated. 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:

  • The remote user joins the channel and sends the video stream.
  • The remote user stops sending the video stream and re-sends it after 15 seconds. Possible reasons include:
    • The remote user leaves channel.
    • The remote user drops offline.
    • The remote user calls the muteLocalVideoStream method.
    • The remote user calls the disableVideo method.
Parameters
uidUser ID of the remote user sending the video streams.
widthWidth (pixels) of the video stream.
heightHeight (pixels) of the video stream.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until this callback is triggered.

◆ onFirstRemoteVideoFrame()

void io.agora.rtc2.IRtcEngineEventHandler.onFirstRemoteVideoFrame ( int  uid,
int  width,
int  height,
int  elapsed 
)

The first frame of the remote video appears in the user’s video window.

The application can retrieve the data of time elapsed from user joining the channel until the first video frame is displayed.

Parameters
uidUser ID of the user whose video streams are received.
widthWidth (pixels) of the video stream.
heightHeight (pixels) of the video stream.
elapsedTime elapsed (ms) from calling token, java.lang.String channelName, java.lang.String optionalInfo, int optionalUid) joinChannel until this callback is triggered.

◆ onUserMuteAudio()

void io.agora.rtc2.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.

Note
This callback does not work properly when the number of users (in the COMMUNICATION profile) or hosts (in the LIVE_BROADCASTING profile) in the channel exceeds 17.
Parameters
uidID of the remote user.
mutedWhether the remote user's audio stream playback pauses/resumes:
  • True: User's audio is paused.
  • False: User's audio is resumed.

◆ onUserMuteVideo()

void io.agora.rtc2.IRtcEngineEventHandler.onUserMuteVideo ( int  uid,
boolean  muted 
)

Occurs when a remote user stops/resumes sending the video stream.

Deprecated:
This callback is deprecated. Use the onRemoteVideoStateChanged callback with the following parameters for the same function:
  • REMOTE_VIDEO_STATE_STOPPED(0) and REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED(5).
  • REMOTE_VIDEO_STATE_DECODING(2) and REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED(6).

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

Note
This callback does not work properly when the number of users (in the COMMUNICATION profile) or hosts (in the LIVE_BROADCASTING profile) in the channel exceeds 17.
Parameters
uidID of the remote user.
mutedWhether the remote user's video stream playback pauses/resumes:
  • True: User's video is paused.
  • False: User's video is resumed.

◆ onUserEnableVideo()

void io.agora.rtc2.IRtcEngineEventHandler.onUserEnableVideo ( int  uid,
boolean  enabled 
)

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

Deprecated:
This callback is deprecated and replaced by the onRemoteVideoStateChanged callback with the following parameters:
  • REMOTE_VIDEO_STATE_STOPPED(0) and REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED(5).
  • REMOTE_VIDEO_STATE_DECODING(2) and REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED(6).

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.

Note
This callback is invalid when the number of users or hosts in the channel exceeds 20.
Parameters
uidUser ID of the remote user.
enabledWhether the specific remote user enables/disables the video module:
  • true: Enabled. The remote user can enter a video session.
  • false: Disabled. The remote user can only enter a voice session, and cannot send or receive any video stream.

◆ onUserEnableLocalVideo()

void io.agora.rtc2.IRtcEngineEventHandler.onUserEnableLocalVideo ( int  uid,
boolean  enabled 
)

Occurs when a remote user enables/disables the local video capture function.

Deprecated:
This callback is deprecated and replaced by the onRemoteVideoStateChanged callback with the following parameters:
  • REMOTE_VIDEO_STATE_STOPPED(0) and REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED(5).
  • REMOTE_VIDEO_STATE_DECODING(2) and REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED(6).

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.

Parameters
uidUser ID of the remote user.
enabledWhether the specific remote user enables/disables the local video capturing function:
  • true: Enabled. Other users in the channel can see the video of this remote user.
  • false: Disabled. Other users in the channel can no longer receive the video stream from this remote user, while this remote user can still receive the video streams from other users.

◆ onVideoSizeChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onVideoSizeChanged ( int  uid,
int  width,
int  height,
int  rotation 
)

The local or remote video size or rotation changed.

Parameters
uidUser ID of the user whose video size or rotation has changed.
widthWidth (pixels) of the video stream.
heightHeight (pixels) of the video stream.
rotationRotation [0 to 360).

◆ onRemoteAudioStateChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onRemoteAudioStateChanged ( int  uid,
REMOTE_AUDIO_STATE  state,
REMOTE_AUDIO_STATE_REASON  reason,
int  elapsed 
)

Occurs when the remote audio state changes.

This callback indicates the state change of the remote audio stream.

Parameters
uidID of the user whose audio state changes.
stateThe state of the remote audio:
  • REMOTE_AUDIO_STATE_STOPPED(0): The remote audio is in the default state, probably due to REMOTE_AUDIO_REASON_LOCAL_MUTED(3), REMOTE_AUDIO_REASON_REMOTE_MUTED(5), or REMOTE_AUDIO_REASON_REMOTE_OFFLINE(7).
  • REMOTE_AUDIO_STATE_STARTING(1): The first remote audio packet is received.
  • REMOTE_AUDIO_STATE_DECODING(2): The remote audio stream is decoded and plays normally, probably due to REMOTE_AUDIO_REASON_NETWORK_RECOVERY(2), REMOTE_AUDIO_REASON_LOCAL_UNMUTED(4) or REMOTE_AUDIO_REASON_REMOTE_UNMUTED(6).
  • REMOTE_AUDIO_STATE_FROZEN(3): The remote audio is frozen, probably due to REMOTE_AUDIO_REASON_NETWORK_CONGESTION(1).
  • REMOTE_AUDIO_STATE_FAILED(4): The remote audio fails to start, probably due to REMOTE_AUDIO_REASON_INTERNAL(0).
reasonThe reason of the remote audio state change.
  • REMOTE_AUDIO_REASON_INTERNAL(0): Internal reasons.
  • REMOTE_AUDIO_REASON_NETWORK_CONGESTION(1): Network congestion.
  • REMOTE_AUDIO_REASON_NETWORK_RECOVERY(2): Network recovery.
  • REMOTE_AUDIO_REASON_LOCAL_MUTED(3): The local user stops receiving the remote audio stream or disables the audio module.
  • REMOTE_AUDIO_REASON_LOCAL_UNMUTED(4): The local user resumes receiving the remote audio stream or enables the audio module.
  • REMOTE_AUDIO_REASON_REMOTE_MUTED(5): The remote user stops sending the audio stream or disables the audio module.
  • REMOTE_AUDIO_REASON_REMOTE_UNMUTED(6): The remote user resumes sending the audio stream or enables the audio module.
  • REMOTE_AUDIO_REASON_REMOTE_OFFLINE(7): The remote user leaves the channel.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

◆ onAudioPublishStateChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onAudioPublishStateChanged ( String  channel,
STREAM_PUBLISH_STATE  oldState,
STREAM_PUBLISH_STATE  newState,
int  elapseSinceLastState 
)

Occurs when the audio publish state changed.

Parameters
channelThe channel name of user joined.
oldStateThe old state of the audio stream publish : #STREAM_PUBLISH_STATE.
newStateThe new state of the audio stream publish : #STREAM_PUBLISH_STATE.
elapseSinceLastStateThe time elapsed (ms) from the old state to the new state.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onVideoPublishStateChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onVideoPublishStateChanged ( String  channel,
STREAM_PUBLISH_STATE  oldState,
STREAM_PUBLISH_STATE  newState,
int  elapseSinceLastState 
)

Occurs when the audio publish state changed.

Parameters
channelThe channel name of user joined.
oldStateThe old state of the video stream subscribe state : #STREAM_PUBLISH_STATE.
newStateThe new state of the video stream subscribe state : #STREAM_PUBLISH_STATE.
elapseSinceLastStateThe time elapsed (ms) from the old state to the new state.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onAudioSubscribeStateChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onAudioSubscribeStateChanged ( String  channel,
int  uid,
STREAM_SUBSCRIBE_STATE  oldState,
STREAM_SUBSCRIBE_STATE  newState,
int  elapseSinceLastState 
)

Occurs when the audio subscribe state changed.

Parameters
channelThe channel name of user joined.
uidThe remote user ID that is subscribed to.
oldStateThe old state of the audio stream subscribe : #STREAM_SUBSCRIBE_STATE.
newStateThe new state of the audio stream subscribe : #STREAM_SUBSCRIBE_STATE.
elapseSinceLastStateThe time elapsed (ms) from the old state to the new state.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onVideoSubscribeStateChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onVideoSubscribeStateChanged ( String  channel,
int  uid,
STREAM_SUBSCRIBE_STATE  oldState,
STREAM_SUBSCRIBE_STATE  newState,
int  elapseSinceLastState 
)

Occurs when the video subscribe state changed.

Parameters
channelThe channel name of user joined.
uidThe remote user ID that is subscribed to.
oldStateThe old state of the video stream subscribe state : #STREAM_SUBSCRIBE_STATE.
newStateThe new state of the video stream subscribe state : #STREAM_SUBSCRIBE_STATE.
elapseSinceLastStateThe time elapsed (ms) from the old state to the new state.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onRemoteVideoStateChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onRemoteVideoStateChanged ( int  uid,
int  state,
int  reason,
int  elapsed 
)

Occurs when the remote video state has changed.

Note
This callback does not work properly when the number of users (in the COMMUNICATION profile) or hosts (in the LIVE_BROADCASTING profile) in the channel exceeds 17.
Parameters
uidID of the user whose video state has changed.
stateState of the remote video:
  • REMOTE_VIDEO_STATE_STOPPED(0): The remote video is in the default state, probably due to REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED(3), REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED(5), or REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE(7).
  • REMOTE_VIDEO_STATE_STARTING(1): The first remote video packet is received.
  • REMOTE_VIDEO_STATE_PLAYING(2): The remote video stream is decoded and plays normally, probably due to REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY (2), REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED(4), REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED(6), or REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY(9).
  • REMOTE_VIDEO_STATE_FROZEN(3): The remote video is frozen, probably due to REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION(1) or REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK(8).
  • REMOTE_VIDEO_STATE_FAILED(4): The remote video fails to start, probably due to REMOTE_VIDEO_STATE_REASON_INTERNAL(0).
reasonThe reason of the remote video state change:
elapsedThe time elapsed (ms) from the local user calling joinChannel until this callback is triggered.

◆ onChannelMediaRelayStateChanged()

void io.agora.rtc2.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.

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

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onChannelMediaRelayEvent()

void io.agora.rtc2.IRtcEngineEventHandler.onChannelMediaRelayEvent ( int  code)

Reports events during the media stream relay.

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

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onAudioRouteChanged()

void io.agora.rtc2.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:

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onCameraReady()

void io.agora.rtc2.IRtcEngineEventHandler.onCameraReady ( )

The camera is turned on and ready to capture video.

If the camera fails to turn on, an error is passed in the onError method.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onCameraFocusAreaChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onCameraFocusAreaChanged ( Rect  rect)

Occurs when the camera focus area has changed.

Parameters
rectRectangular area in the camera zoom that specifies the focus area.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onCameraExposureAreaChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onCameraExposureAreaChanged ( Rect  rect)

Occurs when the camera exposure area has changed.

Parameters
rectRectangular area in the camera zoom that specifies the focus area.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onSnapshotTaken()

void io.agora.rtc2.IRtcEngineEventHandler.onSnapshotTaken ( String  channel,
int  uid,
String  filePath,
int  width,
int  height,
int  errCode 
)

snapshot taken callback

Occurs when takeSnapshot API result is obtained

Parameters
channelchannel name
uiduser id
filePathimage is saveed file path
widthimage width
heightimage height
errCode0 is ok negative is error

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onFacePositionChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onFacePositionChanged ( int  imageWidth,
int  imageHeight,
AgoraFacePositionInfo[]  faceRectArr 
)

Occurs when the camera exposure area has changed.

Parameters
imageWidthwidth of output image.
imageHeightheight of output image.
faceRectArrRectangular area in the camera zoom that specifies the focus area.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onAudioQuality()

void io.agora.rtc2.IRtcEngineEventHandler.onAudioQuality ( int  uid,
int  quality,
short  delay,
short  lost 
)

The audio quality of the specified user every two seconds.

By default, this callback is enabled.

Parameters
uidUser ID of the speaker.
qualityRating of the audio quality:
delayTime delay (ms).
lostPacket loss rate (%).

◆ onRtcStats()

void io.agora.rtc2.IRtcEngineEventHandler.onRtcStats ( RtcStats  stats)

Reports the statistics of the current call.

This callback is triggered once every two seconds after the user joins the channel.

Parameters
statsThe statistics on the current call: RtcStats.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onLastmileQuality()

void io.agora.rtc2.IRtcEngineEventHandler.onLastmileQuality ( int  quality)

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

This callback is triggered once after startLastmileProbeTest is called.

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

Parameters
qualityThe network quality:
  • QUALITY_UNKNOWN(0): The quality is unknown.
  • QUALITY_EXCELLENT(1): The quality is excellent.
  • QUALITY_GOOD QUALITY_GOOD(2): The quality is quite good, but the bitrate may be slightly lower than excellent.
  • QUALITY_POOR(3): Users can feel the communication slightly impaired.
  • QUALITY_BAD(4): Users can communicate not very smoothly.
  • QUALITY_VBAD(5): The quality is so bad that users can barely communicate.
  • QUALITY_DOWN(6): The network is disconnected and users cannot communicate at all.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onLastmileProbeResult()

void io.agora.rtc2.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 lastmile network probe test result. For details, see LastmileProbeResult LastmileProbeResult}.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onNetworkQuality()

void io.agora.rtc2.IRtcEngineEventHandler.onNetworkQuality ( int  uid,
int  txQuality,
int  rxQuality 
)

Reports the network quality of each user.

This callback is triggered once every two seconds after the user joins the channel.

Parameters
uidUser ID. If uid is 0, the SDK reports the local network quality.
txQualityThe transmission quality of the user:
  • QUALITY_UNKNOWN(0): The quality is unknown.
  • QUALITY_EXCELLENT(1): The quality is excellent.
  • QUALITY_GOOD QUALITY_GOOD(2): The quality is quite good, but the bitrate may be slightly lower than excellent.
  • QUALITY_POOR(3): Users can feel the communication slightly impaired.
  • QUALITY_BAD(4): Users can communicate not very smoothly.
  • QUALITY_VBAD(5): The quality is so bad that users can barely communicate.
  • QUALITY_DOWN(6): The network is disconnected and users cannot communicate at all.
rxQualityThe receiving quality of the user:
  • QUALITY_UNKNOWN(0): The quality is unknown.
  • QUALITY_EXCELLENT(1): The quality is excellent.
  • QUALITY_GOOD QUALITY_GOOD(2): The quality is quite good, but the bitrate may be slightly lower than excellent.
  • QUALITY_POOR(3): Users can feel the communication slightly impaired.
  • QUALITY_BAD(4): Users can communicate not very smoothly.
  • QUALITY_VBAD(5): The quality is so bad that users can barely communicate.
  • QUALITY_DOWN(6): The network is disconnected and users cannot communicate at all.

◆ onLocalVideoStats()

void io.agora.rtc2.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.

Parameters
statsThe statistics of the local video stream. See LocalVideoStats.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onRemoteAudioStats()

void io.agora.rtc2.IRtcEngineEventHandler.onRemoteAudioStats ( RemoteAudioStats  stats)

Reports the statistics of the audio from each remote user or broadcaster.

The SDK triggers this callback once every two seconds for each remote user or broadcaster. If a channel has multiple remote users, the SDK triggers this callback as many times.

Parameters
statsThe statistics of the received audio: RemoteAudioStats.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onLocalAudioStats()

void io.agora.rtc2.IRtcEngineEventHandler.onLocalAudioStats ( LocalAudioStats  stats)

Reports the statistics of the local audio stream.

The SDK triggers this callback once every two seconds.

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

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onRemoteVideoStats()

void io.agora.rtc2.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.

Parameters
statsThe statistics of the remote video streams. See RemoteVideoStats.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onLocalVideoStat()

void io.agora.rtc2.IRtcEngineEventHandler.onLocalVideoStat ( int  sentBitrate,
int  sentFrameRate 
)
Deprecated:
The statistics of the uploading local video streams once every two seconds.
Parameters
sentBitrateData sending bitrate (kbit/s) since last count.
sentFrameRateData sending frame rate (fps) since last count.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onRemoteVideoStat()

void io.agora.rtc2.IRtcEngineEventHandler.onRemoteVideoStat ( int  uid,
int  delay,
int  receivedBitrate,
int  receivedFrameRate 
)
Deprecated:
The statistics of receiving remote video streams once every two seconds.
Parameters
uidUser ID of the user whose video streams are received.
delayTime delay (ms).
receivedBitrateData receiving bitrate (kbit/s).
receivedFrameRateData receiving frame rate (fps).

◆ onAudioMixingStateChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onAudioMixingStateChanged ( int  state,
int  errorCode 
)

Occurs when the state of the local user's audio mixing file changes.

When you call the startAudioMixing method and the state of audio mixing file changes, the Agora SDK triggers this callback.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onAudioMixingFinished()

void io.agora.rtc2.IRtcEngineEventHandler.onAudioMixingFinished ( )

The audio mixing file playback is finished after calling {startAudioMixing}. If you failed to execute the filePath, boolean loopback, boolean replace, int cycle) startAudioMixing method, it returns the error code in the onError callback.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onAudioEffectFinished()

void io.agora.rtc2.IRtcEngineEventHandler.onAudioEffectFinished ( int  soundId)

The local audio effect playback has finished.

Parameters
soundIdID of the audio effect. Each audio effect has a unique ID.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onRhythmPlayerStateChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onRhythmPlayerStateChanged ( RHYTHM_PLAYER_STATE_TYPE  state,
RHYTHM_PLAYER_ERROR_TYPE  errorCode 
)

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

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

◆ onLocalAudioStateChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onLocalAudioStateChanged ( LOCAL_AUDIO_STREAM_STATE  state,
LOCAL_AUDIO_STREAM_ERROR  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.

Note
When the state is LOCAL_AUDIO_STREAM_STATE_FAILED(3), see the error parameter for details.
Parameters
stateState of the local audio:
  • LOCAL_AUDIO_STREAM_STATE_STOPPED(0): The local audio is in the initial state.
  • LOCAL_AUDIO_STREAM_STATE_RECORDING(1): The recording device starts successfully.
  • LOCAL_AUDIO_STREAM_STATE_ENCODING(2): The first audio frame encodes successfully.
  • LOCAL_AUDIO_STREAM_STATE_FAILED(3): The local audio fails to start.
errorThe error information of the local audio:
  • LOCAL_AUDIO_STREAM_ERROR_OK(0): The local audio is normal.
  • LOCAL_AUDIO_STREAM_ERROR_FAILURE(1): No specified reason for the local audio failure.
  • LOCAL_AUDIO_STREAM_ERROR_DEVICE_NO_PERMISSION(2): No permission to use the local audio device.
  • LOCAL_AUDIO_STREAM_ERROR_DEVICE_BUSY(3): The microphone is in use.
  • LOCAL_AUDIO_STREAM_ERROR_CAPTURE_FAILURE(4): The local audio recording fails. Check whether the recording device is working properly.
  • LOCAL_AUDIO_STREAM_ERROR_ENCODE_FAILURE(5): The local audio encoding fails.

◆ onLocalVideoStateChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onLocalVideoStateChanged ( int  state,
int  error 
)

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.

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

◆ onRtmpStreamingStateChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onRtmpStreamingStateChanged ( String  url,
RTMP_STREAM_PUBLISH_STATE  state,
RTMP_STREAM_PUBLISH_ERROR_TYPE  errCode 
)

Occurs when the state of the RTMP streaming changes.

Parameters
urlThe RTMP URL address.
stateThe RTMP streaming state. See RTMP_STREAM_PUBLISH_STATE.
errCodeThe detailed error information for streaming. See {RTMP_STREAM_PUBLISH_ERROR}.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onRtmpStreamingEvent()

void io.agora.rtc2.IRtcEngineEventHandler.onRtmpStreamingEvent ( String  url,
RTMP_STREAMING_EVENT  event 
)

Reports events during the RTMP or RTMPS streaming.

Since
v3.1.0.
Parameters
urlThe CDN streaming URL.
errorThe event code.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onStreamPublished()

void io.agora.rtc2.IRtcEngineEventHandler.onStreamPublished ( String  url,
int  error 
)

A stream was published.

Parameters
urlURL address to which the publisher publishes the stream.
errorError code

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onStreamUnpublished()

void io.agora.rtc2.IRtcEngineEventHandler.onStreamUnpublished ( String  url)

A stream was unpublished.

Parameters
urlURL address to which the publisher unpublishes the stream.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onTranscodingUpdated()

void io.agora.rtc2.IRtcEngineEventHandler.onTranscodingUpdated ( )

Transcoding was successfully updated.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onStreamInjectedStatus()

void io.agora.rtc2.IRtcEngineEventHandler.onStreamInjectedStatus ( String  url,
int  uid,
int  status 
)

◆ onStreamMessage()

void io.agora.rtc2.IRtcEngineEventHandler.onStreamMessage ( int  uid,
int  streamId,
byte[]  data 
)

Receives the data stream. onRtmpStreamingEvent The SDK triggers this callback when the user receives the data stream that another user sends by calling the sendStreamMessage method within 5 seconds.

Parameters
uidUser ID.
streamIdStream ID.
dataData received by the recipients.

◆ onStreamMessageError()

void io.agora.rtc2.IRtcEngineEventHandler.onStreamMessageError ( int  uid,
int  streamId,
int  error,
int  missed,
int  cached 
)

Fails to receive the data stream.

The SDK triggers this callback when the user does not receive the data stream that another user sends by calling the sendStreamMessage method within 5 seconds.

Parameters
uidID of the user who sends the data stream.
streamIdThe ID of the stream data.
errorThe error code. See Error code.
missedThe number of lost messages.
cachedThe number of incoming cached messages when the data stream is interrupted.

◆ onMediaEngineLoadSuccess()

void io.agora.rtc2.IRtcEngineEventHandler.onMediaEngineLoadSuccess ( )

Occurs when the media engine is loaded.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onMediaEngineStartCallSuccess()

void io.agora.rtc2.IRtcEngineEventHandler.onMediaEngineStartCallSuccess ( )

Occurs when the media engine starts.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onNetworkTypeChanged()

void io.agora.rtc2.IRtcEngineEventHandler.onNetworkTypeChanged ( int  type)

Occurs when the network type is changed.

Parameters
typeThe network type.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onIntraRequestReceived()

void io.agora.rtc2.IRtcEngineEventHandler.onIntraRequestReceived ( )

Occurs when intra request from remote user is received.

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

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onUplinkNetworkInfoUpdated()

void io.agora.rtc2.IRtcEngineEventHandler.onUplinkNetworkInfoUpdated ( UplinkNetworkInfo  info)

Occurs when uplink network info is updated.

This callback is used for notifying user to adjust the send pace based on the target bitrate.

Parameters
infoThe uplink network info.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onDownlinkNetworkInfoUpdated()

void io.agora.rtc2.IRtcEngineEventHandler.onDownlinkNetworkInfoUpdated ( DownlinkNetworkInfo  info)

Occurs when downlink network info is updated.

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

Parameters
infoThe network info.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onEncryptionError()

void io.agora.rtc2.IRtcEngineEventHandler.onEncryptionError ( ENCRYPTION_ERROR_TYPE  errorType)

Reports the error type of encryption.

Parameters
typeSee #ENCRYPTION_ERROR_TYPE.

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onPermissionError()

void io.agora.rtc2.IRtcEngineEventHandler.onPermissionError ( PERMISSION  permission)

Reports the permission error.

Parameters
permissionPERMISSION

Implements io.agora.rtc2.IAgoraEventHandler.

◆ onUploadLogResult()

void io.agora.rtc2.IRtcEngineEventHandler.onUploadLogResult ( String  requestId,
boolean  success,
int  reason 
)

Reports the user log upload result

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

Implements io.agora.rtc2.IAgoraEventHandler.