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

Public Member Functions

void onWarning (int warn)
 
void onError (int err)
 
void onApiCallExecuted (int error, String api, String result)
 
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)
 
void onFacePositionChanged (int imageWidth, int imageHeight, IRtcEngineEventHandler.AgoraFacePositionInfo[] faceRectArr)
 
void onVideoStopped ()
 
void onLeaveChannel (IRtcEngineEventHandler.RtcStats stats)
 
void onRtcStats (IRtcEngineEventHandler.RtcStats stats)
 
void onAudioVolumeIndication (IRtcEngineEventHandler.AudioVolumeInfo[] speakers, int totalVolume)
 
void onLastmileQuality (int quality)
 
void onLastmileProbeResult (IRtcEngineEventHandler.LastmileProbeResult result)
 
void onLocalVideoStat (int sentBitrate, int sentFrameRate)
 
void onRemoteVideoStats (IRtcEngineEventHandler.RemoteVideoStats stats)
 
void onRemoteAudioStats (IRtcEngineEventHandler.RemoteAudioStats stats)
 
void onLocalVideoStats (IRtcEngineEventHandler.LocalVideoStats stats)
 
void onLocalAudioStats (IRtcEngineEventHandler.LocalAudioStats stats)
 
void onFirstLocalVideoFrame (int width, int height, int elapsed)
 
void onConnectionLost ()
 
void onConnectionInterrupted ()
 
void onConnectionStateChanged (int state, int reason)
 
void onNetworkTypeChanged (int type)
 
void onConnectionBanned ()
 
void onRefreshRecordingServiceStatus (int status)
 
void onMediaEngineLoadSuccess ()
 
void onMediaEngineStartCallSuccess ()
 
void onAudioMixingFinished ()
 When audio mixing file playback finished, this callback will be triggered.
 
void onRequestToken ()
 when token is enabled, and specified token is invalid or expired, this function will be called. APP should generate a new token and call renewToken() to refresh the token. NOTE: to be compatible with previous version, ERR_TOKEN_EXPIRED and ERR_INVALID_TOKEN are also reported via onError() callback. You should move renew of token logic into this callback.
 
void onAudioRouteChanged (int routing)
 : when sdk is responsible for monitoring audio routing, this function will be called by sdk to notify app that audio routing changed.
 
void onAudioMixingStateChanged (int state, int errorCode)
 
void onFirstLocalAudioFramePublished (int elapsed)
 
void onAudioEffectFinished (int soundId)
 
void onClientRoleChanged (int oldRole, int newRole)
 
void onRtmpStreamingStateChanged (String url, IRtcEngineEventHandler.RTMP_STREAM_PUBLISH_STATE state, IRtcEngineEventHandler.RTMP_STREAM_PUBLISH_ERROR errCode)
 
void onStreamPublished (String url, int error)
 
void onStreamUnpublished (String url)
 
void onTranscodingUpdated ()
 
void onTokenPrivilegeWillExpire (String token)
 
void onLocalPublishFallbackToAudioOnly (boolean isFallbackOrRecover)
 
void onChannelMediaRelayStateChanged (int state, int code)
 
void onChannelMediaRelayEvent (int code)
 
void onIntraRequestReceived ()
 
void onUplinkNetworkInfoUpdated (IRtcEngineEventHandler.UplinkNetworkInfo info)
 
void onDownlinkNetworkInfoUpdated (IRtcEngineEventHandler.DownlinkNetworkInfo info)
 
void onEncryptionError (IRtcEngineEventHandler.ENCRYPTION_ERROR_TYPE errorType)
 
void onPermissionError (IRtcEngineEventHandler.PERMISSION permission)
 
void onLocalUserRegistered (int uid, String userAccount)
 
void onUserInfoUpdated (int uid, UserInfo info)
 
void onFirstLocalVideoFramePublished (int elapsed)
 
void onAudioSubscribeStateChanged (String channel, int uid, IRtcEngineEventHandler.STREAM_SUBSCRIBE_STATE oldState, IRtcEngineEventHandler.STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)
 
void onVideoSubscribeStateChanged (String channel, int uid, IRtcEngineEventHandler.STREAM_SUBSCRIBE_STATE oldState, IRtcEngineEventHandler.STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)
 
void onAudioPublishStateChanged (String channel, IRtcEngineEventHandler.STREAM_PUBLISH_STATE oldState, IRtcEngineEventHandler.STREAM_PUBLISH_STATE newState, int elapseSinceLastState)
 
void onVideoPublishStateChanged (String channel, IRtcEngineEventHandler.STREAM_PUBLISH_STATE oldState, IRtcEngineEventHandler.STREAM_PUBLISH_STATE newState, int elapseSinceLastState)
 

Detailed Description

Created by eaglewangy on 29/03/2018.

Member Function Documentation

◆ onWarning()

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

警告信息回调

Parameters
warn警告号

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onError()

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

错误信息回调

Parameters
err错误号

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onApiCallExecuted()

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

API执行完毕后,该回调会被触发

Parameters
error如果调用失败这里返回错误号,0为成功
api所调用的API
result调用结果

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onCameraReady()

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

摄像头设备就绪之后,该回调将被触发

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onCameraFocusAreaChanged()

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

摄像头对焦区域或状态发生变化之后,该回调将会被触发

Parameters
rect对焦的区域

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onCameraExposureAreaChanged()

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

Since
v2.3.2.
Parameters
rectRectangular area in the camera zoom specifying the exposure area.

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onFacePositionChanged()

void io.agora.rtc2.IAgoraEventHandler.onFacePositionChanged ( int  imageWidth,
int  imageHeight,
IRtcEngineEventHandler.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.

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onVideoStopped()

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

所有视频流都停止之后,该回调会被触发

Note
可在该回调被触发时重绘视频窗口

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onLeaveChannel()

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

退出频道的回调

Parameters
stats状态信息
Note
RecStats类细节请参考其定义

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onRtcStats()

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

状态信息回调

Parameters
stats状态信息
Note
RecStats类细节请参考其定义

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onAudioVolumeIndication()

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

远端音频流音量强度回调

Parameters
speakers音频信息数组,包含每个远端用户的UID及其音量
totalVolume所有音频流信息混音后总音量强度
Note
必须事先调用enableAudioVolumeIndication后该回调才会被触发

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onLastmileQuality()

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

Lastmile测试得到的网络质量回调

Parameters
quality网络质量评分

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onRemoteVideoStats()

void io.agora.rtc2.IAgoraEventHandler.onRemoteVideoStats ( IRtcEngineEventHandler.RemoteVideoStats  stats)

远端视频流质量回调

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onRemoteAudioStats()

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

远端音频流质量回调

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onLocalVideoStats()

void io.agora.rtc2.IAgoraEventHandler.onLocalVideoStats ( IRtcEngineEventHandler.LocalVideoStats  stats)

近端视频流质量回调

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onFirstLocalVideoFrame()

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

当引擎获取到本地首帧视频信息之后,该回调会被调用

Parameters
width帧宽度
height帧高度
elapsed此刻距离用户发出登陆请求包的时间间隔

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onConnectionLost()

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

确认连接不可用后,该回调会被调用

Note
意外掉线之后,SDK会自动进行重连,重连多次都失败之后,该回调会被触发,判定为连接不可用

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onConnectionInterrupted()

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

连接意外断开后,该回调会被触发

Note
意外断开之后,SDK会自动尝试掉线重连

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onConnectionStateChanged()

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

连接状态改变后,该回调会被触发

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onNetworkTypeChanged()

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

网络类型改变后,该回调会被触发

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onConnectionBanned()

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

连接被服务器禁止,该回调会被触发

Note
连接禁止后,SDK不会重新连接服务器

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onAudioMixingStateChanged()

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

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

When the audio mixing file plays, pauses playing, or stops playing, this callback returns 710, 711, or 713 in state, and 0 in errorCode. When exceptions occur during playback, this callback returns 714 in state and an error in errorCode. If the local audio mixing file does not exist, or if the SDK does not support the file format or cannot access the music file URL, the SDK returns WARN_AUDIO_MIXING_OPEN_ERROR = 701.

Parameters
stateThe state code. See #AUDIO_MIXING_STATE_*.
errorCodeThe error code. See #AUDIO_MIXING_ERROR_*.

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onFirstLocalAudioFramePublished()

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

当引擎发送本地首帧音频帧时,该回调会被调用

Parameters
elapsed此刻距离用户发出登陆请求包的时间间隔

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onLocalUserRegistered()

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

Occurs when the local user successfully registers a user account by calling the registerLocalUserAccount method or joins a channel by calling the joinChannelWithUserAccount method. This callback reports the user ID and user account of the local user.

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

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onUserInfoUpdated()

void io.agora.rtc2.IAgoraEventHandler.onUserInfoUpdated ( int  uid,
UserInfo  info 
)

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.

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

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onFirstLocalVideoFramePublished()

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

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onAudioSubscribeStateChanged()

void io.agora.rtc2.IAgoraEventHandler.onAudioSubscribeStateChanged ( String  channel,
int  uid,
IRtcEngineEventHandler.STREAM_SUBSCRIBE_STATE  oldState,
IRtcEngineEventHandler.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.

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onVideoSubscribeStateChanged()

void io.agora.rtc2.IAgoraEventHandler.onVideoSubscribeStateChanged ( String  channel,
int  uid,
IRtcEngineEventHandler.STREAM_SUBSCRIBE_STATE  oldState,
IRtcEngineEventHandler.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 : #STREAM_SUBSCRIBE_STATE.
newStateThe new state of the video stream subscribe : #STREAM_SUBSCRIBE_STATE.
elapseSinceLastStateThe time elapsed (ms) from the old state to the new state.

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onAudioPublishStateChanged()

void io.agora.rtc2.IAgoraEventHandler.onAudioPublishStateChanged ( String  channel,
IRtcEngineEventHandler.STREAM_PUBLISH_STATE  oldState,
IRtcEngineEventHandler.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.

Implemented in io.agora.rtc2.IRtcEngineEventHandler.

◆ onVideoPublishStateChanged()

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

Occurs when the video publish state changed.

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

Implemented in io.agora.rtc2.IRtcEngineEventHandler.