Agora Java API Reference for Android
|
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 |
class | RemoteAudioStats |
class | RemoteVideoStats |
class | RtcStats |
enum | RTMP_STREAM_PUBLISH_ERROR |
enum | RTMP_STREAM_PUBLISH_STATE |
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 | onLocalUserRegistered (int uid, String userAccount) |
void | onUserInfoUpdated (int uid, UserInfo userInfo) |
void | onUserJoined (int uid, int elapsed) |
void | onUserOffline (int uid, int reason) |
void | onConnectionStateChanged (int state, int reason) |
void | onConnectionInterrupted () |
void | onConnectionLost () |
void | onConnectionBanned () |
void | onApiCallExecuted (int error, String api, String result) |
void | onTokenPrivilegeWillExpire (String token) |
void | onRequestToken () |
void | onAudioVolumeIndication (AudioVolumeInfo[] speakers, int totalVolume) |
void | onActiveSpeaker (int uid) |
void | onFirstLocalAudioFramePublished (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 | 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 errCode) |
void | onStreamPublished (String url, int error) |
void | onStreamUnpublished (String url) |
void | onTranscodingUpdated () |
void | onStreamInjectedStatus (String url, int uid, int status) |
void | onStreamMessage (int uid, int streamId, byte[] data) |
void | onStreamMessageError (int uid, int streamId, int error, int missed, int cached) |
void | onMediaEngineLoadSuccess () |
void | onMediaEngineStartCallSuccess () |
void | onNetworkTypeChanged (int type) |
void | onIntraRequestReceived () |
void | onUplinkNetworkInfoUpdated (UplinkNetworkInfo info) |
void | onDownlinkNetworkInfoUpdated (DownlinkNetworkInfo info) |
void | onRefreshRecordingServiceStatus (int status) |
void | onEncryptionError (ENCRYPTION_ERROR_TYPE errorType) |
void | onPermissionError (PERMISSION permission) |
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.
void io.agora.rtc2.IRtcEngineEventHandler.onWarning | ( | int | warn | ) |
A warning occurred during SDK runtime.
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.
void io.agora.rtc2.IRtcEngineEventHandler.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. 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.
err | Error code |
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onJoinChannelSuccess | ( | String | channel, |
int | uid, | ||
int | elapsed | ||
) |
Occurs when the local user successfully joins the specified channel.
channel | The channel name. |
uid | The user ID.
|
elapsed | The time elapsed (ms) from the local user calling joinChannel until this event occurs. |
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.
channel | The channel name. |
uid | The user ID. |
elapsed | Time elapsed (ms) from starting to reconnect until this callback is triggered |
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.
stats | The statistics on the call: RtcStats. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
oldRole | The old role of the user. |
newRole | The new role of the user |
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onLocalUserRegistered | ( | int | uid, |
String | userAccount | ||
) |
Occurs when the local user registers a user account.
This callback is triggered when the local user successfully registers a user account by calling the registerLocalUserAccount method, or joins a channel by calling the joinChannelWithUserAccount method. This callback reports the user ID and user account of the local user.
uid | The ID of the local user. |
userAccount | The user account of the local user. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
After a remote user joins the channel, the SDK gets the UID and user account of the remote user, caches them in a mapping table object (UserInfo), and triggers this callback on the local client.
uid | The ID of the remote user. |
userInfo | The UserInfo object that contains the user ID and user account of the remote user. |
Implements io.agora.rtc2.IAgoraEventHandler.
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:
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. |
void io.agora.rtc2.IRtcEngineEventHandler.onUserOffline | ( | int | uid, |
int | reason | ||
) |
Occurs when a remote user or broadcaster goes offline.
uid | ID of the remote user or broadcaster who leaves the channel or drops offline. |
reason | The reason why the remote user goes offline:
|
void io.agora.rtc2.IRtcEngineEventHandler.onConnectionStateChanged | ( | int | state, |
int | reason | ||
) |
Occurs when the network connection state changes.
The Agora SDK returns this callback to report on the current network connection state when it changes, and the reason to such change.
state | The current network connection state:
|
reason | The reason causing the change of the connection state:
|
Implements io.agora.rtc2.IAgoraEventHandler.
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.
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.
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.
void io.agora.rtc2.IRtcEngineEventHandler.onApiCallExecuted | ( | int | error, |
String | api, | ||
String | result | ||
) |
Occurs when an API method is executed.
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. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
token | The token that will expire in 30 seconds. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
Implements io.agora.rtc2.IAgoraEventHandler.
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.
muteLocalAudioStream
method, the SDK stops triggering the local user's callback.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.speakers | An array containing the user ID and volume information for each speaker: AudioVolumeInfo.
|
totalVolume | The total volume after audio mixing. The value ranges between 0 (the lowest volume) and 255 (the highest volume).
|
Implements io.agora.rtc2.IAgoraEventHandler.
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.
enableAudioVolumeIndication
to receive this callback.uid | The ID of the active speaker. A uid of 0 means the local user. |
void io.agora.rtc2.IRtcEngineEventHandler.onFirstLocalAudioFramePublished | ( | int | elapsed | ) |
Occurs when the first audio frame is published.
elapsed | The time elapsed (ms) from the local user calling joinChannel to the SDK triggers this callback. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
void io.agora.rtc2.IRtcEngineEventHandler.onFirstLocalVideoFrame | ( | int | width, |
int | height, | ||
int | elapsed | ||
) |
The first local video frame is displayed on the screen.
width | Width (pixels) of the video stream. |
height | Height (pixels) of the video stream. |
elapsed | Time 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.
void io.agora.rtc2.IRtcEngineEventHandler.onFirstLocalVideoFramePublished | ( | int | elapsed | ) |
Occurs when the first video frame is published.
elapsed | The time elapsed (ms) from the local user calling joinChannel to the SDK triggers this callback. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
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:
uid | User ID of the remote user sending the video streams. |
width | Width (pixels) of the video stream. |
height | Height (pixels) of the video stream. |
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until this callback is triggered. |
void io.agora.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.
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 token, java.lang.String channelName, java.lang.String optionalInfo, int optionalUid) joinChannel until this callback is triggered. |
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.
COMMUNICATION
profile) or hosts (in the LIVE_BROADCASTING
profile) in the channel exceeds 17.uid | ID of the remote user. |
muted | Whether the remote user's audio stream playback pauses/resumes:
|
void io.agora.rtc2.IRtcEngineEventHandler.onUserMuteVideo | ( | int | uid, |
boolean | muted | ||
) |
Occurs when a remote user stops/resumes sending the video stream.
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.
COMMUNICATION
profile) or hosts (in the LIVE_BROADCASTING
profile) in the channel exceeds 17.uid | ID of the remote user. |
muted | Whether the remote user's video stream playback pauses/resumes:
|
void io.agora.rtc2.IRtcEngineEventHandler.onUserEnableVideo | ( | int | uid, |
boolean | enabled | ||
) |
Occurs when a remote user enables/disables the video module.
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:
|
void io.agora.rtc2.IRtcEngineEventHandler.onUserEnableLocalVideo | ( | int | uid, |
boolean | enabled | ||
) |
Occurs when a remote user enables/disables the local video capture 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 resumes or stops capturing the video stream by calling the enableLocalVideo method.
This callback is only applicable to the scenario when the remote user only wants to watch the remote video without sending any video stream to the other user.
uid | User ID of the remote user. |
enabled | Whether the specific remote user enables/disables the local video capturing function:
|
void io.agora.rtc2.IRtcEngineEventHandler.onVideoSizeChanged | ( | int | uid, |
int | width, | ||
int | height, | ||
int | rotation | ||
) |
The local or remote video size or rotation changed.
uid | User ID of the user whose video size or rotation has changed. |
width | Width (pixels) of the video stream. |
height | Height (pixels) of the video stream. |
rotation | Rotation [0 to 360). |
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.
uid | ID of the user whose audio state changes. |
state | The state of the remote audio:
|
reason | The reason of the remote audio state change.
|
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
void io.agora.rtc2.IRtcEngineEventHandler.onAudioPublishStateChanged | ( | String | channel, |
STREAM_PUBLISH_STATE | oldState, | ||
STREAM_PUBLISH_STATE | newState, | ||
int | elapseSinceLastState | ||
) |
Occurs when the audio publish state changed.
channel | The channel name of user joined. |
oldState | The old state of the audio stream publish : #STREAM_PUBLISH_STATE. |
newState | The new state of the audio stream publish : #STREAM_PUBLISH_STATE. |
elapseSinceLastState | The time elapsed (ms) from the old state to the new state. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
channel | The channel name of user joined. |
oldState | The old state of the video stream subscribe state : #STREAM_PUBLISH_STATE. |
newState | The new state of the video stream subscribe state : #STREAM_PUBLISH_STATE. |
elapseSinceLastState | The time elapsed (ms) from the old state to the new state. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
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 : #STREAM_SUBSCRIBE_STATE. |
newState | The new state of the audio stream subscribe : #STREAM_SUBSCRIBE_STATE. |
elapseSinceLastState | The time elapsed (ms) from the old state to the new state. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
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 : #STREAM_SUBSCRIBE_STATE. |
newState | The new state of the video stream subscribe state : #STREAM_SUBSCRIBE_STATE. |
elapseSinceLastState | The time elapsed (ms) from the old state to the new state. |
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onRemoteVideoStateChanged | ( | int | uid, |
int | state, | ||
int | reason, | ||
int | elapsed | ||
) |
Occurs when the remote video state has changed.
COMMUNICATION
profile) or hosts (in the LIVE_BROADCASTING
profile) in the channel exceeds 17.uid | ID of the user whose video state has changed. |
state | State of the remote video:
|
reason | The reason of the remote video state change:
|
elapsed | The time elapsed (ms) from the local user calling joinChannel until this callback is triggered. |
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.
state | The state code:
|
code | The error code:
|
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onChannelMediaRelayEvent | ( | int | code | ) |
Reports events during the media stream relay.
code | The event code for media stream relay:
|
Implements io.agora.rtc2.IAgoraEventHandler.
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.
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.
void io.agora.rtc2.IRtcEngineEventHandler.onCameraFocusAreaChanged | ( | Rect | rect | ) |
Occurs when the camera focus area has changed.
rect | Rectangular area in the camera zoom that specifies the focus area. |
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onCameraExposureAreaChanged | ( | Rect | rect | ) |
Occurs when the camera exposure area has changed.
rect | Rectangular area in the camera zoom that specifies the focus area. |
Implements io.agora.rtc2.IAgoraEventHandler.
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
channel | channel name |
uid | user id |
filePath | image is saveed file path |
width | image width |
height | image height |
errCode | 0 is ok negative is error |
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onFacePositionChanged | ( | int | imageWidth, |
int | imageHeight, | ||
AgoraFacePositionInfo[] | faceRectArr | ||
) |
Occurs when the camera exposure area has changed.
imageWidth | width of output image. |
imageHeight | height of output image. |
faceRectArr | Rectangular area in the camera zoom that specifies the focus area. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
uid | User ID of the speaker. |
quality | Rating of the audio quality: |
delay | Time delay (ms). |
lost | Packet loss rate (%). |
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.
stats | The statistics on the current call: RtcStats. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
quality | The network quality:
|
Implements io.agora.rtc2.IAgoraEventHandler.
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.
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.
uid | User ID. If uid is 0, the SDK reports the local network quality. |
txQuality | The transmission quality of the user:
|
rxQuality | The receiving quality of the user:
|
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.
stats | The statistics of the local video stream. See LocalVideoStats. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
stats | The statistics of the received audio: RemoteAudioStats. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
stats | The statistics of the local audio stream. See LocalAudioStats. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
stats | The statistics of the remote video streams. See RemoteVideoStats. |
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onLocalVideoStat | ( | int | sentBitrate, |
int | sentFrameRate | ||
) |
sentBitrate | Data sending bitrate (kbit/s) since last count. |
sentFrameRate | Data sending frame rate (fps) since last count. |
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.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). |
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.
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.
void io.agora.rtc2.IRtcEngineEventHandler.onAudioEffectFinished | ( | int | soundId | ) |
The local audio effect playback has finished.
soundId | ID of the audio effect. Each audio effect has a unique ID. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
LOCAL_AUDIO_STREAM_STATE_FAILED(3)
, see the error
parameter for details.state | State of the local audio:
|
error | The error information of the local audio:
|
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.
state | The local video state:
|
error | The detailed error information of the local video:
|
void io.agora.rtc2.IRtcEngineEventHandler.onRtmpStreamingStateChanged | ( | String | url, |
RTMP_STREAM_PUBLISH_STATE | state, | ||
RTMP_STREAM_PUBLISH_ERROR | errCode | ||
) |
Occurs when the state of the RTMP streaming changes.
url | The RTMP URL address. |
state | The RTMP streaming state. See RTMP_STREAM_PUBLISH_STATE. |
errCode | The detailed error information for streaming. See {RTMP_STREAM_PUBLISH_ERROR}. |
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onStreamPublished | ( | String | url, |
int | error | ||
) |
A stream was published.
url | URL address to which the publisher publishes the stream. |
error | Error code |
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onStreamUnpublished | ( | String | url | ) |
A stream was unpublished.
url | URL address to which the publisher unpublishes the stream. |
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onTranscodingUpdated | ( | ) |
Transcoding was successfully updated.
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onStreamInjectedStatus | ( | String | url, |
int | uid, | ||
int | status | ||
) |
The status of the injected stream.
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.
uid | User ID. |
streamId | Stream ID. |
data | Data received by the recipients. |
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.
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. |
void io.agora.rtc2.IRtcEngineEventHandler.onMediaEngineLoadSuccess | ( | ) |
Occurs when the media engine is loaded.
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onMediaEngineStartCallSuccess | ( | ) |
Occurs when the media engine starts.
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onNetworkTypeChanged | ( | int | type | ) |
Occurs when the network type is changed.
type | The network type.
|
Implements io.agora.rtc2.IAgoraEventHandler.
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.
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.
info | The uplink network info. |
Implements io.agora.rtc2.IAgoraEventHandler.
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.
info | The network info. |
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onEncryptionError | ( | ENCRYPTION_ERROR_TYPE | errorType | ) |
Reports the error type of encryption.
type | See #ENCRYPTION_ERROR_TYPE. |
Implements io.agora.rtc2.IAgoraEventHandler.
void io.agora.rtc2.IRtcEngineEventHandler.onPermissionError | ( | PERMISSION | permission | ) |
Reports the permission error.
permission | PERMISSION |
Implements io.agora.rtc2.IAgoraEventHandler.