public abstract class IRtcEngineEventHandler extends java.lang.Object implements IAgoraEventHandler
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.
Modifier and Type | Class and Description |
---|---|
static class |
IRtcEngineEventHandler.AgoraFacePositionInfo
The information of the detected human face.
|
static class |
IRtcEngineEventHandler.AudioVolumeInfo
Audio volume information.
|
static class |
IRtcEngineEventHandler.ClientRole
Deprecated.
Use the new
Constants class
with the same constants value |
static class |
IRtcEngineEventHandler.DownlinkNetworkInfo
The statistics of the downlink network info.
|
static class |
IRtcEngineEventHandler.ErrorCode
The error codes.
|
static class |
IRtcEngineEventHandler.LastmileProbeResult
Statistics of the last-mile probe.
|
static class |
IRtcEngineEventHandler.LocalAudioStats
The statistics of the local audio.
|
static class |
IRtcEngineEventHandler.LocalVideoStats
Statistics of the local video.
|
static class |
IRtcEngineEventHandler.Quality
Deprecated.
Use the new
Constants class
with the same constants value |
static class |
IRtcEngineEventHandler.RemoteAudioStats
Statistics of the remote audio.
|
static class |
IRtcEngineEventHandler.RemoteVideoStats
Statistics of the remote video.
|
static class |
IRtcEngineEventHandler.RtcStats
Statistics of RtcEngine.
|
static class |
IRtcEngineEventHandler.UplinkNetworkInfo
The statistics of the uplink network info.
|
static class |
IRtcEngineEventHandler.UserOfflineReason
Deprecated.
Use the new
Constants class
with the same constants value |
static class |
IRtcEngineEventHandler.VideoProfile
Deprecated.
Use the new
Constants class
with the same constants value |
static class |
IRtcEngineEventHandler.WarnCode
The warning code.
|
static class |
IRtcEngineEventHandler.WlAccStats
Indicator optimization degree.
|
Constructor and Description |
---|
IRtcEngineEventHandler() |
Modifier and Type | Method and Description |
---|---|
void |
onActiveSpeaker(int uid)
Occurs when an active speaker is detected.
|
void |
onApiCallExecuted(int error,
java.lang.String api,
java.lang.String result)
Occurs when an API method is executed.
|
void |
onAudioEffectFinished(int soundId)
The local audio effect playback has finished.
|
void |
onAudioMixingFinished()
The audio mixing file playback is finished after calling
startAudioMixing . |
void |
onAudioMixingPositionChanged(long position) |
void |
onAudioMixingStateChanged(int state,
int reasonCode)
Occurs when the state of the local user's audio mixing file changes.
|
void |
onAudioPublishStateChanged(java.lang.String channel,
int oldState,
int newState,
int elapseSinceLastState)
Occurs when the audio publish state changed.
|
void |
onAudioQuality(int uid,
int quality,
short delay,
short lost)
The audio quality of the specified user every two seconds.
|
void |
onAudioRouteChanged(int routing)
Occurs when the local audio playback route changes.
|
void |
onAudioSubscribeStateChanged(java.lang.String channel,
int uid,
int oldState,
int newState,
int elapseSinceLastState)
Occurs when the audio subscribe state changed.
|
void |
onAudioVolumeIndication(IRtcEngineEventHandler.AudioVolumeInfo[] speakers,
int totalVolume)
Reports which users are speaking and the speaker‘s volume.
|
void |
onCameraExposureAreaChanged(Rect rect)
Occurs when the camera exposure area has changed.
|
void |
onCameraFocusAreaChanged(Rect rect)
Occurs when the camera focus area has changed.
|
void |
onCameraReady()
The camera is turned on and ready to capture video.
|
void |
onChannelMediaRelayEvent(int code)
Reports events during the media stream relay.
|
void |
onChannelMediaRelayStateChanged(int state,
int code)
Occurs when the state of the media stream relay changes.
|
void |
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.
|
void |
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.
|
void |
onConnectionBanned()
Your connection is banned by the Agora Server.
|
void |
onConnectionInterrupted()
The SDK has lost connection to the server.
|
void |
onConnectionLost()
Occurs when the SDK cannot reconnect to the server 10 seconds after its connection to the
server is interrupted.
|
void |
onConnectionStateChanged(int state,
int reason)
Occurs when the network connection state changes.
|
void |
onContentInspectResult(int result) |
void |
onDownlinkNetworkInfoUpdated(IRtcEngineEventHandler.DownlinkNetworkInfo info)
Occurs when downlink network info is updated.
|
void |
onEncryptionError(int errorType)
Reports the error type of encryption.
|
void |
onError(int err)
An error occurred during SDK runtime.
|
void |
onFacePositionChanged(int imageWidth,
int imageHeight,
IRtcEngineEventHandler.AgoraFacePositionInfo[] faceRectArr)
Occurs when the camera exposure area has changed.
|
void |
onFirstLocalAudioFramePublished(int elapsed)
Occurs when the first audio frame is published.
|
void |
onFirstLocalVideoFrame(Constants.VideoSourceType source,
int width,
int height,
int elapsed)
The first local video frame is displayed on the screen.
|
void |
onFirstLocalVideoFramePublished(Constants.VideoSourceType source,
int elapsed)
Occurs when the first video frame is published.
|
void |
onFirstRemoteAudioDecoded(int uid,
int elapsed)
Occurs when the SDK decodes the first remote audio frame for playback.
|
void |
onFirstRemoteAudioFrame(int uid,
int elapsed)
Occurs when the first remote audio frame is received.
|
void |
onFirstRemoteVideoDecoded(int uid,
int width,
int height,
int elapsed)
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:
|
void |
onFirstRemoteVideoFrame(int uid,
int width,
int height,
int elapsed)
The first frame of the remote video appears in the user’s video window.
|
void |
onIntraRequestReceived()
Occurs when intra request from remote user is received.
|
void |
onJoinChannelSuccess(java.lang.String channel,
int uid,
int elapsed)
Occurs when the local user successfully joins the specified channel.
|
void |
onLastmileProbeResult(IRtcEngineEventHandler.LastmileProbeResult result)
Reports the last-mile network probe result.
|
void |
onLastmileQuality(int quality)
Reports the last-mile network quality of the local user.
|
void |
onLeaveChannel(IRtcEngineEventHandler.RtcStats stats)
Occurs when the local user successfully leaves the channel.
|
void |
onLicenseValidationFailure(int error)
Occurs when connection license verification fails
You can know the reason according to error code
|
void |
onLocalAudioStateChanged(int state,
int error)
Occurs when the local audio stream state changes.
|
void |
onLocalAudioStats(IRtcEngineEventHandler.LocalAudioStats stats)
Reports the statistics of the local audio stream.
|
void |
onLocalPublishFallbackToAudioOnly(boolean isFallbackOrRecover) |
void |
onLocalUserRegistered(int uid,
java.lang.String userAccount)
Occurs when the local user registers a user account.
|
void |
onLocalVideoStat(int sentBitrate,
int sentFrameRate)
Deprecated.
The statistics of the uploading local video streams once every two seconds.
|
void |
onLocalVideoStateChanged(Constants.VideoSourceType source,
int state,
int error)
Occurs when the local video stream state changes.
|
void |
onLocalVideoStats(Constants.VideoSourceType source,
IRtcEngineEventHandler.LocalVideoStats stats)
Reports the statistics of the local video streams.
|
void |
onMediaEngineLoadSuccess()
Occurs when the media engine is loaded.
|
void |
onMediaEngineStartCallSuccess()
Occurs when the media engine starts.
|
void |
onNetworkQuality(int uid,
int txQuality,
int rxQuality)
Reports the network quality of each user.
|
void |
onNetworkTypeChanged(int type)
Occurs when the network type is changed.
|
void |
onPermissionError(int permission)
Reports the permission error.
|
void |
onProxyConnected(java.lang.String channel,
int uid,
int proxyType,
java.lang.String localProxyIp,
int elapsed)
Occurs when the local user joins a specified channel after calling
setLocalAccessPoint or setCloudProxy . |
void |
onRejoinChannelSuccess(java.lang.String channel,
int uid,
int elapsed)
Occurs when the local user rejoins the channel after being disconnected due to
network problems.
|
void |
onRemoteAudioStateChanged(int uid,
int state,
int reason,
int elapsed)
Occurs when the remote audio state changes.
|
void |
onRemoteAudioStats(IRtcEngineEventHandler.RemoteAudioStats stats)
Reports the statistics of the audio from each remote user or broadcaster.
|
void |
onRemoteAudioTransportStats(int uid,
int delay,
int lost,
int rxKBitRate) |
void |
onRemoteSubscribeFallbackToAudioOnly(int uid,
boolean isFallbackOrRecover) |
void |
onRemoteVideoStat(int uid,
int delay,
int receivedBitrate,
int receivedFrameRate)
Deprecated.
The statistics of receiving remote video streams once every two seconds.
|
void |
onRemoteVideoStateChanged(int uid,
int state,
int reason,
int elapsed)
Occurs when the remote video state has changed.
|
void |
onRemoteVideoStats(IRtcEngineEventHandler.RemoteVideoStats stats)
Reports the statistics of the video stream from each remote user/host.
|
void |
onRemoteVideoTransportStats(int uid,
int delay,
int lost,
int rxKBitRate) |
void |
onRequestToken()
Occurs when the token has expired.
|
void |
onRhythmPlayerStateChanged(int state,
int errorCode)
Occurs when the state of the local user's rhythm player changes.
|
void |
onRtcStats(IRtcEngineEventHandler.RtcStats stats)
Reports the statistics of the current call.
|
void |
onRtmpStreamingEvent(java.lang.String url,
int event)
Reports events during the RTMP or RTMPS streaming.
|
void |
onRtmpStreamingStateChanged(java.lang.String url,
int state,
int errCode)
Occurs when the state of the RTMP streaming changes.
|
void |
onSnapshotTaken(int uid,
java.lang.String filePath,
int width,
int height,
int errCode)
Occurs when takeSnapshot API result is obtained
|
void |
onStreamInjectedStatus(java.lang.String url,
int uid,
int status)
The status of the injected stream.
|
void |
onStreamMessage(int uid,
int streamId,
byte[] data)
Receives the data stream.
|
void |
onStreamMessageError(int uid,
int streamId,
int error,
int missed,
int cached)
Fails to receive the data stream.
|
void |
onTokenPrivilegeWillExpire(java.lang.String token)
Occurs when the token will expire in 30 seconds.
|
void |
onTranscodingUpdated()
Transcoding was successfully updated.
|
void |
onUplinkNetworkInfoUpdated(IRtcEngineEventHandler.UplinkNetworkInfo info)
Occurs when uplink network info is updated.
|
void |
onUploadLogResult(java.lang.String requestId,
boolean success,
int reason)
Reports the user log upload result
|
void |
onUserEnableLocalVideo(int uid,
boolean enabled)
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. |
void |
onUserEnableVideo(int uid,
boolean enabled)
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. |
void |
onUserInfoUpdated(int uid,
UserInfo userInfo)
Occurs when the SDK gets the user ID and user account of the remote user.
|
void |
onUserJoined(int uid,
int elapsed)
Occurs when a remote user or broadcaster joins the channel.
|
void |
onUserMuteAudio(int uid,
boolean muted)
Occurs when a remote user stops/resumes sending the audio stream.
|
void |
onUserMuteVideo(int uid,
boolean muted)
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. |
void |
onUserOffline(int uid,
int reason)
Occurs when a remote user or broadcaster goes offline.
|
void |
onUserStateChanged(int uid,
int state)
Occurs when the remote user state is updated.
|
void |
onVideoPublishStateChanged(Constants.VideoSourceType source,
java.lang.String channel,
int oldState,
int newState,
int elapseSinceLastState)
Occurs when the audio publish state changed.
|
void |
onVideoSizeChanged(Constants.VideoSourceType source,
int uid,
int width,
int height,
int rotation)
Occurs when the local or remote video size or rotation has changed.
|
void |
onVideoStopped()
The video has stopped playing.
|
void |
onVideoSubscribeStateChanged(java.lang.String channel,
int uid,
int oldState,
int newState,
int elapseSinceLastState)
Occurs when the video subscribe state changed.
|
void |
onWarning(int warn)
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 |
void |
onWlAccMessage(int reason,
int action,
java.lang.String wlAccMsg)
Occurs when the WIFI message need be sent to the user.
|
void |
onWlAccStats(IRtcEngineEventHandler.WlAccStats currentStats,
IRtcEngineEventHandler.WlAccStats averageStats)
Occurs when SDK statistics WIFI acceleration optimization effect.
|
@Deprecated public void onWarning(int warn)
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.
A warning occurred during SDK runtime.
onWarning
in interface IAgoraEventHandler
warn
- Warning code
public void onError(int err)
An error occurred during SDK runtime.
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. In this case, the application informs the user that
the call initialization has failed, and calls the leaveChannel
method to exit the channel.
onError
in interface IAgoraEventHandler
err
- Error code
public void onJoinChannelSuccess(java.lang.String channel, int uid, int elapsed)
channel
- The channel name.uid
- The 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.elapsed
- The time elapsed (ms) from the local user calling joinChannel
until this event occurs.public void onRejoinChannelSuccess(java.lang.String channel, int uid, int elapsed)
channel
- The channel name.uid
- The user ID.elapsed
- Time elapsed (ms) from starting to reconnect until this callback is triggeredpublic void onLeaveChannel(IRtcEngineEventHandler.RtcStats stats)
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.onLeaveChannel
in interface IAgoraEventHandler
stats
- The statistics on the call: RtcStats
.public void onClientRoleChanged(int oldRole, int newRole)
onClientRoleChanged
in interface IAgoraEventHandler
oldRole
- The old role of the user.newRole
- The new role of the userpublic void onClientRoleChangeFailed(int reason, int currentRole)
onClientRoleChangeFailed
in interface IAgoraEventHandler
reason
- The reason of the failure of the local user role switches.currentRole
- The current role of the userpublic void onLocalUserRegistered(int uid, java.lang.String userAccount)
onLocalUserRegistered
in interface IAgoraEventHandler
uid
- The ID of the local user.userAccount
- The user account of the local user.registerLocalUserAccount
method, or joins a
channel by calling the joinChannelWithUserAccount
method. This callback reports the user ID and user account of the local user.public void onUserInfoUpdated(int uid, UserInfo userInfo)
onUserInfoUpdated
in interface IAgoraEventHandler
uid
- The ID of the remote user.userInfo
- The UserInfo
object that contains the user
ID and user account of the remote user.UserInfo
),
and triggers this callback on the local client.public void onUserStateChanged(int uid, int state)
onUserStateChanged
in interface IAgoraEventHandler
uid
- The ID of the remote user.state
- State 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.public void onUserJoined(int uid, int elapsed)
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.uid
- ID of the remote user or broadcaster joining the channel.elapsed
- The time elapsed (ms) from the local user calling `joinChannel` or
`setClientRole`
until this callback is triggered.public void onUserOffline(int uid, int reason)
uid
- ID of the remote user or broadcaster who leaves the channel or drops offline.reason
- The 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.public void onConnectionStateChanged(int state, int reason)
onConnectionStateChanged
in interface IAgoraEventHandler
state
- The current network connection state:
CONNECTION_STATE_DISCONNECTED(1)
: The
SDK is disconnected from Agora's edge server.
CONNECTION_STATE_CONNECTING(2)
: The SDK
is connecting to Agora's edge server. CONNECTION_STATE_CONNECTED(3)
: The SDK joined a channel and is connected to Agora's edge
server. You can now publish or subscribe to a media stream in the channel. CONNECTION_STATE_RECONNECTING(4)
: The SDK keeps
rejoining the channel after being disconnected from a joined channel because of network issues.
CONNECTION_STATE_FAILED(5)
: The SDK fails to
join the channel.
reason
- The reason causing the change of the connection state:
CONNECTION_CHANGED_CONNECTING(0)
:
Connecting. CONNECTION_CHANGED_JOIN_SUCCESS(1)
: The SDK has joined the channel successfully. CONNECTION_CHANGED_INTERRUPTED(2)
: The connection is
interrupted. CONNECTION_CHANGED_BANNED_BY_SERVER(3)
: The connection is banned by Agora's edge server.
CONNECTION_CHANGED_JOIN_FAILED(4)
: The
SDK fails to join the channel for more than 20 minutes and stops reconnecting to the channel.
CONNECTION_CHANGED_LEAVE_CHANNEL(5)
:
The SDK has left the channel.
CONNECTION_CHANGED_INVALID_APP_ID(6)
: The specified App ID is invalid. Try to rejoin the
channel with a valid App ID.
CONNECTION_CHANGED_INVALID_CHANNEL_NAME(7)
: The specified channel name is invalid. Try to
rejoin the channel with a valid channel name.
CONNECTION_CHANGED_INVALID_TOKEN(8)
:
The generated token is invalid probably due to the following reasons: joinChannel
method is different from the
uid that you pass for generating the token.
CONNECTION_CHANGED_TOKEN_EXPIRED(9)
:
The token has expired. Generate a new token from your server.
CONNECTION_CHANGED_REJECTED_BY_SERVER(10)
: The user is banned by the server. CONNECTION_CHANGED_SETTING_PROXY_SERVER(11)
:
The SDK tries to reconnect after setting a proxy server. CONNECTION_CHANGED_RENEW_TOKEN(12)
: The token renews.
CONNECTION_CHANGED_CLIENT_IP_ADDRESS_CHANGED(13)
: The client IP address has changed, probably
due to a change of the network type, IP address, or network port.
CONNECTION_CHANGED_KEEP_ALIVE_TIMEOUT(14)
: Timeout for the keep-alive of the connection
between the SDK and Agora's edge server. The connection state changes to CONNECTION_STATE_RECONNECTING(4)
.
public void onWlAccMessage(int reason, int action, java.lang.String wlAccMsg)
onWlAccMessage
in interface IAgoraEventHandler
reason
- The reason of notifying the user of a message.action
- Suggest an action for the user.wlAccMsg
- Notification message to the user.public void onWlAccStats(IRtcEngineEventHandler.WlAccStats currentStats, IRtcEngineEventHandler.WlAccStats averageStats)
onWlAccStats
in interface IAgoraEventHandler
currentStats
- Instantaneous value of optimization effect.averageStats
- Average value of cumulative optimization effect.public void onConnectionInterrupted()
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.onConnectionInterrupted
in interface IAgoraEventHandler
public void onConnectionLost()
joinChannel
, regardless of whether it is in the channel or not.onConnectionLost
in interface IAgoraEventHandler
public void onConnectionBanned()
Your connection is banned by the Agora Server.
Note: The SDK does not try to reconnect.
onConnectionBanned
in interface IAgoraEventHandler
public void onApiCallExecuted(int error, java.lang.String api, java.lang.String result)
onApiCallExecuted
in interface IAgoraEventHandler
error
- The error code that the SDK returns when the method call fails.api
- The API method that the SDK executes.result
- The result of the method call.public void onTokenPrivilegeWillExpire(java.lang.String token)
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.onTokenPrivilegeWillExpire
in interface IAgoraEventHandler
token
- The token that will expire in 30 seconds.public void onRequestToken()
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.onRequestToken
in interface IAgoraEventHandler
public void onLicenseValidationFailure(int error)
onLicenseValidationFailure
in interface IAgoraEventHandler
error
- license verify fail reason:
- `LICENSE_ERR_INVALID(1)`: Invalid license.
- `LICENSE_ERR_EXPIRE(2)`: License expired.
- `LICENSE_ERR_MINUTES_EXCEED(3)`: Exceed license minutes limit.
- `LICENSE_ERR_LIMITED_PERIOD(4)`: License use in limited period.
- `LICENSE_ERR_DIFF_DEVICES(5)`: Same license used in different devices at the same time.
- `LICENSE_ERR_INTERNAL(99)`: SDK internal error.public void onAudioVolumeIndication(IRtcEngineEventHandler.AudioVolumeInfo[] speakers, int totalVolume)
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.onAudioVolumeIndication
in interface IAgoraEventHandler
speakers
- An 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.totalVolume
- The 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.public void onActiveSpeaker(int uid)
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.uid
- The ID of the active speaker. A `uid` of 0 means the local user.public void onFirstLocalAudioFramePublished(int elapsed)
onFirstLocalAudioFramePublished
in interface IAgoraEventHandler
elapsed
- The time elapsed (ms) from the local user calling joinChannel to the SDK
triggers this callback.public void onFirstRemoteAudioFrame(int uid, int elapsed)
onFirstRemoteAudioFrame
in interface IAgoraEventHandler
uid
- ID of the remote user.elapsed
- The time elapsed (ms) from the local user calling
RtcEngine.joinChannel(java.lang.String, java.lang.String, java.lang.String, int)
until this callback is triggered.public void onFirstRemoteAudioDecoded(int uid, int elapsed)
onFirstRemoteAudioDecoded
in interface IAgoraEventHandler
uid
- User ID of the remote user sending the audio stream.elapsed
- The time elapsed (ms) from the loca user calling
\ref IRtcEngine::joinChannel "joinChannel()" until this callback is triggered.public void 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.
onVideoStopped
in interface IAgoraEventHandler
public void onFirstLocalVideoFrame(Constants.VideoSourceType source, int width, int height, int elapsed)
onFirstLocalVideoFrame
in interface IAgoraEventHandler
source
- source type of the originated video source.width
- Width (pixels) of the video stream.height
- Height (pixels) of the video stream.elapsed
- Time elapsed (ms) from calling joinChannel
until this callback is triggered.public void onFirstLocalVideoFramePublished(Constants.VideoSourceType source, int elapsed)
onFirstLocalVideoFramePublished
in interface IAgoraEventHandler
source
- source type of the originated video source.elapsed
- The time elapsed (ms) from the local user calling joinChannel to the SDK
triggers this callback.public void onFirstRemoteVideoDecoded(int uid, int width, int height, int elapsed)
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.public void 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.
uid
- User ID of the user whose video streams are received.width
- Width (pixels) of the video stream.height
- Height (pixels) of the video stream.elapsed
- Time elapsed (ms) from calling joinChannel
until this callback is triggered.public void onUserMuteAudio(int uid, boolean muted)
muteLocalAudioStream
method.uid
- ID of the remote user.muted
- Whether the remote user's audio stream playback pauses/resumes:
@Deprecated public void onUserMuteVideo(int uid, boolean muted)
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.uid
- ID of the remote user.muted
- Whether the remote user's video stream playback pauses/resumes:
@Deprecated public void onUserEnableVideo(int uid, boolean enabled)
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.uid
- User ID of the remote user.enabled
- Whether the specific remote user enables/disables the video module:
@Deprecated public void onUserEnableLocalVideo(int uid, boolean enabled)
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.uid
- User ID of the remote user.enabled
- Whether the specific remote user enables/disables the local video capturing
function: public void onVideoSizeChanged(Constants.VideoSourceType source, int uid, int width, int height, int rotation)
source
- The video source type.uid
- The user ID. 0 indicates the local user.width
- The new width (pixels) of the video.height
- The new height (pixels) of the video.rotation
- The rotation information of the video.public void onRemoteAudioStateChanged(int uid, int state, int reason, int elapsed)
uid
- ID of the user whose audio state changes.state
- The 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)`.
reason
- The 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.
elapsed
- Time elapsed (ms) from the local user calling the joinChannel
method until the SDK triggers this callback.public void onAudioPublishStateChanged(java.lang.String channel, int oldState, int newState, int elapseSinceLastState)
PUB_STATE_IDLE(0)
- PUB_STATE_NO_PUBLISHED(1)
- PUB_STATE_PUBLISHING(2)
- PUB_STATE_PUBLISHED(3)
onAudioPublishStateChanged
in interface IAgoraEventHandler
channel
- The channel name of user joined.oldState
- The old state of the audio stream publish.newState
- The new state of the audio stream publish.elapseSinceLastState
- The time elapsed (ms) from the old state to the new state.public void onVideoPublishStateChanged(Constants.VideoSourceType source, java.lang.String channel, int oldState, int newState, int elapseSinceLastState)
PUB_STATE_IDLE(0)
- PUB_STATE_NO_PUBLISHED(1)
- PUB_STATE_PUBLISHING(2)
- PUB_STATE_PUBLISHED(3)
onVideoPublishStateChanged
in interface IAgoraEventHandler
source
- source type of the originated video source.channel
- The channel name of user joined.oldState
- The old state of the video stream subscribe state.newState
- The new state of the video stream subscribe state.elapseSinceLastState
- The time elapsed (ms) from the old state to the new state.public void onAudioSubscribeStateChanged(java.lang.String channel, int uid, int oldState, int newState, int elapseSinceLastState)
SUB_STATE_IDLE(0)
- SUB_STATE_NO_SUBSCRIBED(1)
- SUB_STATE_SUBSCRIBING(2)
- SUB_STATE_SUBSCRIBED(3)
onAudioSubscribeStateChanged
in interface IAgoraEventHandler
channel
- The channel name of user joined.uid
- The remote user ID that is subscribed to.oldState
- The old state of the audio stream subscribe.newState
- The new state of the audio stream subscribe .elapseSinceLastState
- The time elapsed (ms) from the old state to the new state.public void onVideoSubscribeStateChanged(java.lang.String channel, int uid, int oldState, int newState, int elapseSinceLastState)
SUB_STATE_IDLE(0)
- SUB_STATE_NO_SUBSCRIBED(1)
- SUB_STATE_SUBSCRIBING(2)
- SUB_STATE_SUBSCRIBED(3)
onVideoSubscribeStateChanged
in interface IAgoraEventHandler
channel
- The channel name of user joined.uid
- The remote user ID that is subscribed to.oldState
- The old state of the video stream subscribe state.newState
- The new state of the video stream subscribe state.elapseSinceLastState
- The time elapsed (ms) from the old state to the new state.public void onRemoteVideoStateChanged(int uid, int state, int reason, int elapsed)
uid
- ID of the user whose video state has changed.state
- State 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).reason
- The reason of the remote video state change:
- REMOTE_VIDEO_STATE_REASON_INTERNAL(0)
:
Internal reasons.
- REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION(1)
: Network congestion.
- REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY(2)
: Network recovery.
- REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED(3)
: The local user stops receiving the remote video
stream or disables the video module.
- REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED(4)
: The local user resumes receiving the remote video
stream or enables the video module.
- REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED(5)
: The remote user stops sending the video stream or
disables the video module.
- REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED(6)
: The remote user resumes sending the video stream
or enables the video module.
- REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE(7)
: The remote user leaves the channel.
- REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK(8)
: The remote media stream falls back to the
audio-only stream due to poor network conditions.
- REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY(9)
: The remote media stream switches back to
the video stream after the network conditions improve.elapsed
- The time elapsed (ms) from the local user calling `joinChannel` until this
callback is triggered.public void onChannelMediaRelayStateChanged(int state, int code)
onChannelMediaRelayStateChanged
in interface IAgoraEventHandler
state
- The 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`.code
- The 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.public void onChannelMediaRelayEvent(int code)
onChannelMediaRelayEvent
in interface IAgoraEventHandler
code
- The 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.public void onLocalPublishFallbackToAudioOnly(boolean isFallbackOrRecover)
onLocalPublishFallbackToAudioOnly
in interface IAgoraEventHandler
public void onRemoteSubscribeFallbackToAudioOnly(int uid, boolean isFallbackOrRecover)
public void onAudioRouteChanged(int routing)
AUDIO_ROUTE_DEFAULT(-1)
: The default audio route.
- AUDIO_ROUTE_HEADSET(0)
: Headset.
- AUDIO_ROUTE_EARPIECE(1)
: Earpiece.
- AUDIO_ROUTE_HEADSETNOMIC(2)
: Headset with no
microphone.
- AUDIO_ROUTE_SPEAKERPHONE(3)
: Speakerphone.
- AUDIO_ROUTE_LOUDSPEAKER(4)
: Loudspeaker.
- AUDIO_ROUTE_HEADSETBLUETOOTH(5)
: Bluetooth
headset.onAudioRouteChanged
in interface IAgoraEventHandler
public void 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.
onCameraReady
in interface IAgoraEventHandler
public void onCameraFocusAreaChanged(Rect rect)
onCameraFocusAreaChanged
in interface IAgoraEventHandler
rect
- Rectangular area in the camera zoom that specifies the focus area.public void onCameraExposureAreaChanged(Rect rect)
onCameraExposureAreaChanged
in interface IAgoraEventHandler
rect
- Rectangular area in the camera zoom that specifies the focus area.public void onContentInspectResult(int result)
onContentInspectResult
in interface IAgoraEventHandler
public void onSnapshotTaken(int uid, java.lang.String filePath, int width, int height, int errCode)
onSnapshotTaken
in interface IAgoraEventHandler
channel
- channel nameuid
- user idfilePath
- image is saveed file pathwidth
- image widthheight
- image heighterrCode
- 0 is ok negative is errorpublic void onFacePositionChanged(int imageWidth, int imageHeight, IRtcEngineEventHandler.AgoraFacePositionInfo[] faceRectArr)
onFacePositionChanged
in interface IAgoraEventHandler
imageWidth
- width of output image.imageHeight
- height of output image.faceRectArr
- Rectangular area in the camera zoom that specifies the focus area.public void 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.
uid
- User ID of the speaker.quality
- Rating of the audio quality:delay
- Time delay (ms).lost
- Packet loss rate (%).public void onRtcStats(IRtcEngineEventHandler.RtcStats stats)
onRtcStats
in interface IAgoraEventHandler
stats
- The statistics on the current call: RtcStats
.public void onLastmileQuality(int quality)
onLastmileQuality
in interface IAgoraEventHandler
quality
- The 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.public void onLastmileProbeResult(IRtcEngineEventHandler.LastmileProbeResult result)
startLastmileProbeTest
method.onLastmileProbeResult
in interface IAgoraEventHandler
result
- The uplink and downlink lastmile network probe test result. For details, see
LastmileProbeResult
.public void onNetworkQuality(int uid, int txQuality, int rxQuality)
uid
- User ID. If `uid` is 0, the SDK reports the local network quality.txQuality
- The 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.rxQuality
- The 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.public void onLocalVideoStats(Constants.VideoSourceType source, IRtcEngineEventHandler.LocalVideoStats stats)
onLocalVideoStats
in interface IAgoraEventHandler
source
- source type of the originated video sourcestats
- The statistics of the local video stream. See LocalVideoStats
.public void onRemoteAudioStats(IRtcEngineEventHandler.RemoteAudioStats stats)
onRemoteAudioStats
in interface IAgoraEventHandler
stats
- The statistics of the received audio: RemoteAudioStats.public void onLocalAudioStats(IRtcEngineEventHandler.LocalAudioStats stats)
onLocalAudioStats
in interface IAgoraEventHandler
stats
- The statistics of the local audio stream.
See LocalAudioStats.public void onRemoteVideoStats(IRtcEngineEventHandler.RemoteVideoStats stats)
onRemoteVideoStats
in interface IAgoraEventHandler
stats
- The statistics of the remote video streams. See RemoteVideoStats
.public void onLocalVideoStat(int sentBitrate, int sentFrameRate)
onLocalVideoStat
in interface IAgoraEventHandler
sentBitrate
- Data sending bitrate (kbit/s) since last count.sentFrameRate
- Data sending frame rate (fps) since last count.public void onRemoteVideoStat(int uid, int delay, int receivedBitrate, int receivedFrameRate)
uid
- User ID of the user whose video streams are received.delay
- Time delay (ms).receivedBitrate
- Data receiving bitrate (kbit/s).receivedFrameRate
- Data receiving frame rate (fps).public void onRemoteAudioTransportStats(int uid, int delay, int lost, int rxKBitRate)
public void onRemoteVideoTransportStats(int uid, int delay, int lost, int rxKBitRate)
public void onAudioMixingStateChanged(int state, int reasonCode)
startAudioMixing
method and the state of
audio mixing file changes, the Agora SDK triggers this callback.
- 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
.onAudioMixingStateChanged
in interface IAgoraEventHandler
state
- The state code:
- AUDIO_MIXING_STATE_PLAYING(710)
: The audio
mixing file is playing.
- AUDIO_MIXING_STATE_PAUSED(711)
: The audio mixing
file pauses playing.
- AUDIO_MIXING_STATE_STOPPED(713)
: The audio
mixing file stops playing.
- AUDIO_MIXING_STATE_FAILED(714)
: An exception
occurs when playing the audio mixing file. See the errorCode for details.reasonCode
- The error code:
- AUDIO_MIXING_ERROR_OK(701)
: No error.
- AUDIO_MIXING_ERROR_CAN_NOT_OPEN(701)
: The
SDK cannot open the audio mixing file.
- AUDIO_MIXING_REASON_TOO_FREQUENT_CALL(702)
: The SDK opens the audio mixing file too
frequently.
- AUDIO_MIXING_ERROR_INTERRUPTED_EOF(703)
: The audio mixing file playback is interrupted.public void onAudioMixingPositionChanged(long position)
onAudioMixingPositionChanged
in interface IAgoraEventHandler
position
- Current AudioMixing progress (millisecond).public void onAudioMixingFinished()
The audio mixing file playback is finished after calling startAudioMixing
.
If you failed to execute the startAudioMixing
method, it returns the error code in
the onError
callback.
onAudioMixingFinished
in interface IAgoraEventHandler
public void onAudioEffectFinished(int soundId)
onAudioEffectFinished
in interface IAgoraEventHandler
soundId
- ID of the audio effect. Each audio effect has a unique ID.public void onRhythmPlayerStateChanged(int state, int errorCode)
state
- The state code. See #RHYTHM_PLAYER_STATE_TYPE.errorCode
- The error code. See #RHYTHM_PLAYER_ERROR_TYPE.public void onLocalAudioStateChanged(int state, int error)
state
- State of the local audio:
LOCAL_AUDIO_STREAM_STATE_STOPPED(0)
:
The local audio is in the initial state. LOCAL_AUDIO_STREAM_STATE_CAPTURING(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.
error
- The 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.
public void onLocalVideoStateChanged(Constants.VideoSourceType source, int state, int error)
source
- source type of the originated video source.state
- The local video state:
- LOCAL_VIDEO_STREAM_STATE_STOPPED(0)
: The
local video is in the initial state.
- LOCAL_VIDEO_STREAM_STATE_CAPTURING(1)
:
The local video capturer starts successfully.
- LOCAL_VIDEO_STREAM_STATE_ENCODING(2)
: The
first local video frame encodes successfully.
- LOCAL_VIDEO_STREAM_STATE_FAILED(3)
: The
local video fails to start.error
- The detailed error information of the local video:
- LOCAL_VIDEO_STREAM_ERROR_OK(0)
: The local video
is normal.
- LOCAL_VIDEO_STREAM_ERROR_FAILURE(1)
: No
specified reason for the local video failure.
- LOCAL_VIDEO_STREAM_ERROR_DEVICE_NO_PERMISSION(2)
: No permission to use the local video device.
- LOCAL_VIDEO_STREAM_ERROR_DEVICE_BUSY(3)
: The local video capturer is in use.
- LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE(4)
: The local video capture fails. Check whether the
capturer is working properly.
- If your app runs in the background on a device running Android 9 or later, you cannot
access the camera.
- If your app runs on a device running Android 6 or later, this error is reported if the
camera is occupied by a third-part app and not property released. Once the camera is released,
the SDK triggers this callback again, reporting state `CAPTURING(1)`, and error
`ERROR_OK(0)`.
- LOCAL_VIDEO_STREAM_ERROR_ENCODE_FAILURE(5)
: The local video encoding fails.public void onRtmpStreamingStateChanged(java.lang.String url, int state, int errCode)
onRtmpStreamingStateChanged
in interface IAgoraEventHandler
url
- The RTMP URL address.state
- The RTMP streaming state:
RTMP_STREAM_PUBLISH_STATE_IDLE(0)
: The
RTMP or RTMPS streaming has not started or has ended. This state is also triggered after you
remove an RTMP or RTMPS stream from the CDN by calling removePublishStreamUrl. RTMP_STREAM_PUBLISH_STATE_CONNECTING(1)
: The
SDK is connecting to Agora streaming server and the CDN server. This state is triggered after
you call the addPublishStreamUrl
method. RTMP_STREAM_PUBLISH_STATE_RUNNING(2)
: The RTMP or
RTMPS streaming publishes. The SDK successfully publishes the RTMP or RTMPS streaming and
returns this state. RTMP_STREAM_PUBLISH_STATE_RECOVERING(3)
: The RTMP or RTMPS streaming is recovering. When
exceptions occur to the CDN, or the streaming is interrupted, the SDK attempts to resume RTMP
or RTMPS streaming and returns this state. RTMP_STREAM_PUBLISH_STATE_RUNNING(2)
returns. RTMP_STREAM_PUBLISH_STATE_FAILURE(4)
returns. You can also reconnect to the server by calling
the removePublishStreamUrl
and addPublishStreamUrl
methods.
RTMP_STREAM_PUBLISH_STATE_FAILURE(4)
: The RTMP or RTMPS streaming fails. See the errCode
parameter for the detailed error information. You can also call the addPublishStreamUrl
method to publish the RTMP or RTMPS
streaming again. RTMP_STREAM_PUBLISH_STATE_DISCONNECTING(5)
: The SDK is disconnecting from the Agora streaming
server and CDN. When you call `remove` or `stop` to stop the streaming normally, the SDK
reports the streaming state as `DISCONNECTING`, `IDLE` in sequence.
errCode
- The detailed error information for streaming:
RTMP_STREAM_PUBLISH_ERROR_OK(0)
: The
RTMP or RTMPS streaming publishes successfully. RTMP_STREAM_PUBLISH_ERROR_INVALID_ARGUMEN(1)
: Invalid argument used. If, for example, you do
not call the setLiveTranscoding
method to configure the
LiveTranscoding parameters before calling the addPublishStreamUrl
method, the SDK returns this error. Check whether you set the parameters
in the setLiveTranscoding
method properly. RTMP_STREAM_PUBLISH_ERROR_ENCRYPTED_STREAM_NOT_ALLOWED(2)
: The RTMP or RTMPS streaming is
encrypted and cannot be published. RTMP_STREAM_PUBLISH_ERROR_CONNECTION_TIMEOUT(3)
: Timeout for the RTMP or RTMPS streaming. Call
the addPublishStreamUrl
method to publish the streaming
again. RTMP_STREAM_PUBLISH_ERROR_INTERNAL_SERVER_ERROR(4)
: An error occurs in Agora streaming server.
Call the addPublishStreamUrl
method to publish the
streaming again. RTMP_STREAM_PUBLISH_ERROR_RTMP_SERVER_ERROR(5)
: An error occurs in the CDN server. RTMP_STREAM_PUBLISH_ERROR_TOO_OFTEN(6)
:
Reserved. RTMP_STREAM_PUBLISH_ERROR_REACH_LIMIT(7)
: The host publishes more than 10 URLs. Delete the
unnecessary URLs before adding new ones. RTMP_STREAM_PUBLISH_ERROR_NOT_AUTHORIZED(8)
: The host manipulates other hosts' URLs. Check
your app logic. RTMP_STREAM_PUBLISH_ERROR_STREAM_NOT_FOUND(9)
: Agora server fails to find the RTMP or RTMPS
streaming. RTMP_STREAM_PUBLISH_ERROR_FORMAT_NOT_SUPPORTED(10)
: The format of the CDN streaming URL is
not supported. Check whether the URL format is correct. RTMP_STREAM_PUBLISH_ERROR_NOT_BROADCASTER(11)
: The user role is not host, so the user cannot
use the CDN live streaming function. Check your application code logic. RTMP_STREAM_PUBLISH_ERROR_TRANSCODING_NO_MIX_STREAM(13)
: The `updateRtmpTranscoding` or
`setLiveTranscoding` method is called to update the transcoding configuration in a scenario
where there is streaming without transcoding. Check your application code logic. RTMP_STREAM_PUBLISH_ERROR_NET_DOWN(14)
: Errors
occurred in the host's network. RTMP_STREAM_PUBLISH_ERROR_INVALID_APPID(15)
: Your App ID does not have permission to use the
CDN live streaming function. Refer to
[Prerequisites](https://docs.agora.io/en/Interactive%20Broadcast/cdn_streaming_windows?platform=Windows#prerequisites)
to enable the CDN live streaming permission. RTMP_STREAM_UNPUBLISH_ERROR_OK(100)
: The streaming
has been stopped normally.
public void onRtmpStreamingEvent(java.lang.String url, int event)
onRtmpStreamingEvent
in interface IAgoraEventHandler
url
- The CDN streaming URL.error
- The event code.
- RTMP_STREAMING_EVENT_FAILED_LOAD_IMAGE(1)
: An error occurs when you add a background image or
a watermark image to the RTMP or RTMPS stream.
- RTMP_STREAMING_EVENT_URL_ALREADY_IN_USE(2)
: The chosen URL address is already in use for CDN
live streaming.
- RTMP_STREAMING_EVENT_ADVANCED_FEATURE_NOT_SUPPORT(3)
:advanced feature not support.
- RTMP_STREAMING_EVENT_REQUEST_TOO_OFTEN(4)
: Client request too frequently.public void onTranscodingUpdated()
onTranscodingUpdated
in interface IAgoraEventHandler
public void onStreamInjectedStatus(java.lang.String url, int uid, int status)
url
- URL address added into the broadcast.uid
- User ID.status
- Status of the injected stream:INJECT_STREAM_STATUS_START_SUCCESS(0)
INJECT_STREAM_STATUS_START_ALREADY_EXIST(1)
INJECT_STREAM_STATUS_START_UNAUTHORIZED(2)
INJECT_STREAM_STATUS_START_TIMEDOUT(3)
INJECT_STREAM_STATUS_START_FAILED(4)
INJECT_STREAM_STATUS_STOP_SUCCESS(5)
INJECT_STREAM_STATUS_STOP_NOT_FOUND =
6
INJECT_STREAM_STATUS_STOP_UNAUTHORIZED(7)
INJECT_STREAM_STATUS_STOP_TIMEDOUT(8)
INJECT_STREAM_STATUS_STOP_FAILED(9)
INJECT_STREAM_STATUS_BROKEN(10)
public void onStreamMessage(int uid, int streamId, byte[] data)
sendStreamMessage
method within 5 seconds.uid
- User ID.streamId
- Stream ID.data
- Data received by the recipients.public void onStreamMessageError(int uid, int streamId, int error, int missed, int cached)
sendStreamMessage
method within 5
seconds.uid
- ID of the user who sends the data stream.streamId
- The ID of the stream data.error
- The error code. See Error code
.missed
- The number of lost messages.cached
- The number of incoming cached messages when the data stream is interrupted.public void onMediaEngineLoadSuccess()
onMediaEngineLoadSuccess
in interface IAgoraEventHandler
public void onMediaEngineStartCallSuccess()
onMediaEngineStartCallSuccess
in interface IAgoraEventHandler
public void onNetworkTypeChanged(int type)
onNetworkTypeChanged
in interface IAgoraEventHandler
type
- The network type.
NETWORK_TYPE_UNKNOWN(-1)
: unknown.
NETWORK_TYPE_DISCONNECTED(0)
: disconnected.
NETWORK_TYPE_LAN(1)
: LAN.
NETWORK_TYPE_WIFI(2)
: WIFI.
NETWORK_TYPE_MOBILE_2G(3)
: 2G.
NETWORK_TYPE_MOBILE_3G(4)
: 3G.
NETWORK_TYPE_MOBILE_4G(5)
: 4G.
public void onIntraRequestReceived()
onIntraRequestReceived
in interface IAgoraEventHandler
public void onUplinkNetworkInfoUpdated(IRtcEngineEventHandler.UplinkNetworkInfo info)
onUplinkNetworkInfoUpdated
in interface IAgoraEventHandler
info
- The uplink network info.public void onDownlinkNetworkInfoUpdated(IRtcEngineEventHandler.DownlinkNetworkInfo info)
onDownlinkNetworkInfoUpdated
in interface IAgoraEventHandler
info
- The network info.public void onEncryptionError(int errorType)
onEncryptionError
in interface IAgoraEventHandler
type
- See #ENCRYPTION_ERROR_TYPE.public void onPermissionError(int permission)
onPermissionError
in interface IAgoraEventHandler
permission
- of Constants.RECORD_AUDIO
, Constants.CAMERA
and Constants.SCREEN_CAPTURE
public void onUploadLogResult(java.lang.String requestId, boolean success, int reason)
onUploadLogResult
in interface IAgoraEventHandler
requestId
- RequestId of the uploadsuccess
- Is upload successreason
- Reason of the upload, 0: OK, 1 Network Error, 2 Server Error.public void onProxyConnected(java.lang.String channel, int uid, int proxyType, java.lang.String localProxyIp, int elapsed)
setLocalAccessPoint
or setCloudProxy
.
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
- The channel name.uid
- User ID.proxyType
- type of proxy agora sdk connected, proxyType will be PROXY_TYPE_NONE_PROXY if
not connected to proxy(fallback).localProxyIp
- local proxy ip, if not join local proxy, it will be ""elapsed
- Time elapsed (ms) from the user calling joinChannel
until this callback is triggered.