Public Member Functions | |
void | onChannelWarning (RtcChannel rtcChannel, int warn) |
void | onChannelError (RtcChannel rtcChannel, int err) |
void | onJoinChannelSuccess (RtcChannel rtcChannel, int uid, int elapsed) |
void | onRejoinChannelSuccess (RtcChannel rtcChannel, int uid, int elapsed) |
void | onLeaveChannel (RtcChannel rtcChannel, RtcStats stats) |
void | onClientRoleChanged (RtcChannel rtcChannel, int oldRole, int newRole) |
void | onUserJoined (RtcChannel rtcChannel, int uid, int elapsed) |
void | onUserOffline (RtcChannel rtcChannel, int uid, int reason) |
void | onConnectionStateChanged (RtcChannel rtcChannel, int state, int reason) |
void | onConnectionLost (RtcChannel rtcChannel) |
void | onTokenPrivilegeWillExpire (RtcChannel rtcChannel, String token) |
void | onRequestToken (RtcChannel rtcChannel) |
void | onRtcStats (RtcChannel rtcChannel, RtcStats stats) |
void | onNetworkQuality (RtcChannel rtcChannel, int uid, int txQuality, int rxQuality) |
void | onRemoteVideoStats (RtcChannel rtcChannel, RemoteVideoStats stats) |
void | onRemoteAudioStats (RtcChannel rtcChannel, RemoteAudioStats stats) |
void | onRemoteAudioStateChanged (RtcChannel rtcChannel, int uid, int state, int reason, int elapsed) |
void | onAudioPublishStateChanged (RtcChannel rtcChannel, int oldState, int newState, int elapseSinceLastState) |
void | onVideoPublishStateChanged (RtcChannel rtcChannel, int oldState, int newState, int elapseSinceLastState) |
void | onAudioSubscribeStateChanged (RtcChannel rtcChannel, int uid, int oldState, int newState, int elapseSinceLastState) |
void | onVideoSubscribeStateChanged (RtcChannel rtcChannel, int uid, int oldState, int newState, int elapseSinceLastState) |
void | onActiveSpeaker (RtcChannel rtcChannel, int uid) |
void | onVideoSizeChanged (RtcChannel rtcChannel, int uid, int width, int height, int rotation) |
void | onRemoteVideoStateChanged (RtcChannel rtcChannel, int uid, int state, int reason, int elapsed) |
void | onStreamMessage (RtcChannel rtcChannel, int uid, int streamId, byte[] data) |
void | onStreamMessageError (RtcChannel rtcChannel, int uid, int streamId, int error, int missed, int cached) |
void | onChannelMediaRelayStateChanged (RtcChannel rtcChannel, int state, int code) |
void | onChannelMediaRelayEvent (RtcChannel rtcChannel, int code) |
void | onRtmpStreamingStateChanged (RtcChannel rtcChannel, String url, int state, int errCode) |
void | onTranscodingUpdated (RtcChannel rtcChannel) |
void | onStreamInjectedStatus (RtcChannel rtcChannel, String url, int uid, int status) |
void | onRtmpStreamingEvent (RtcChannel rtcChannel, String url, int errCode) |
void | onLocalPublishFallbackToAudioOnly (RtcChannel rtcChannel, boolean isFallbackOrRecover) |
void | onRemoteSubscribeFallbackToAudioOnly (RtcChannel rtcChannel, int uid, boolean isFallbackOrRecover) |
The IRtcChannelEventHandler class.
void io.agora.rtc.IRtcChannelEventHandler.onChannelWarning | ( | RtcChannel | rtcChannel, |
int | warn | ||
) |
Reports the warning code of the RtcChannel instance.
rtcChannel | The current RtcChannel instance. |
warn | The warning code: WarnCode. |
void io.agora.rtc.IRtcChannelEventHandler.onChannelError | ( | RtcChannel | rtcChannel, |
int | err | ||
) |
Reports the error code of the RtcChannel instance.
rtcChannel | The current RtcChannel instance. |
err | The error code: ErrorCode |
void io.agora.rtc.IRtcChannelEventHandler.onJoinChannelSuccess | ( | RtcChannel | rtcChannel, |
int | uid, | ||
int | elapsed | ||
) |
Occurs when the local user joins a specified channel.
If the uid
is not specified when calling joinChannel, the server automatically assigns a uid.
rtcChannel | The current RtcChannel instance. |
uid | The user ID. |
elapsed | Time elapsed (ms) from the local user calling joinChannel until this callback is triggered. |
void io.agora.rtc.IRtcChannelEventHandler.onRejoinChannelSuccess | ( | RtcChannel | rtcChannel, |
int | uid, | ||
int | elapsed | ||
) |
Occurs when a user rejoins the channel after being disconnected due to network problems.
When a user loses connection with the server because of network problems, the SDK automatically tries to reconnect and triggers this callback upon reconnection.
rtcChannel | The current RtcChannel instance. |
uid | The user ID. |
elapsed | Time elapsed (ms) from the local user starting to reconnect until this callback is triggered. |
void io.agora.rtc.IRtcChannelEventHandler.onLeaveChannel | ( | RtcChannel | rtcChannel, |
RtcStats | stats | ||
) |
Occurs when a user leaves the channel.
When a user leaves the channel by using the leaveChannel method, the SDK uses this callback to notify the app when the user leaves the channel.
With this callback, the app gets the channel information, such as the call duration and statistics.
rtcChannel | The current RtcChannel instance. |
stats | Statistics of the call: RtcStats. |
void io.agora.rtc.IRtcChannelEventHandler.onClientRoleChanged | ( | RtcChannel | rtcChannel, |
int | oldRole, | ||
int | newRole | ||
) |
Occurs when the user role switches in a LIVE_BROADCASTING
channel. For example, from host to audience or vice versa.
The SDK triggers this callback when the local user switches the user role by calling the setClientRole method after joining the channel.
rtcChannel | The current RtcChannel instance. |
oldRole | The role that the user switches from.
|
newRole | The role that the user switches to.
|
void io.agora.rtc.IRtcChannelEventHandler.onUserJoined | ( | RtcChannel | rtcChannel, |
int | uid, | ||
int | elapsed | ||
) |
Occurs when a remote user (COMMUNICATION
) or a host (LIVE_BROADCASTING
) joins the channel.
COMMUNICATION
profile: This callback notifies the app when another user joins the channel. If other users are already in the channel, the SDK also reports to the app on the existing users.LIVE_BROADCASTING
profile: This callback notifies the app when the host joins the channel. If other hosts are already in the channel, the SDK also reports to the app on the existing hosts. We recommend having at most 17 hosts in a channel.rtcChannel | The current RtcChannel instance. |
uid | ID of the user or host who joins the channel. |
elapsed | Time delay (ms) from the local user calling joinChannel or setClientRole(BROADCASTER) until this callback is triggered. |
LIVE_BROADCASTING
profile:void io.agora.rtc.IRtcChannelEventHandler.onUserOffline | ( | RtcChannel | rtcChannel, |
int | uid, | ||
int | reason | ||
) |
Occurs when a remote user (COMMUNICATION
) or a host (LIVE_BROADCASTING
) leaves the channel.
There are two reasons for users to become offline:
rtcChannel | The current RtcChannel instance. |
uid | ID of the user or host who leaves the channel or goes offline. |
reason | The reason why the user goes offline:
|
void io.agora.rtc.IRtcChannelEventHandler.onConnectionStateChanged | ( | RtcChannel | rtcChannel, |
int | state, | ||
int | reason | ||
) |
Occurs when the network connection state changes.
The Agora SDK triggers this callback to report on the current network connection state when it changes, and the reason to such change.
rtcChannel | The current RtcChannel instance. |
state | The current network connection state:
|
reason | The reason causing the change of the connection state:
|
void io.agora.rtc.IRtcChannelEventHandler.onConnectionLost | ( | RtcChannel | rtcChannel | ) |
Occurs when the SDK cannot reconnect to Agora edge server 10 seconds after its connection to the server is interrupted.
The SDK also triggers this callback when it cannot connect to the server 10 seconds after calling joinChannel, regardless of whether it is in the channel or not.
If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora edge server, the SDK stops rejoining the channel.
rtcChannel | The current RtcChannel instance. |
void io.agora.rtc.IRtcChannelEventHandler.onTokenPrivilegeWillExpire | ( | RtcChannel | rtcChannel, |
String | token | ||
) |
Occurs when the token expires in 30 seconds.
The user becomes offline if the token
used when joining the channel expires. This callback is triggered 30 seconds before the token expires, to remind the app to get a new token. Upon receiving this callback, you need to generate a new token on the server and call renewToken to pass the new token to the SDK.
rtcChannel | The current RtcChannel instance. |
token | The token that will expire in 30 seconds. |
void io.agora.rtc.IRtcChannelEventHandler.onRequestToken | ( | RtcChannel | rtcChannel | ) |
Occurs when the token has expired.
After a token is specified when joining the channel, the token expires after a certain period of time, and a new token is required to reconnect to the server.
Once you receive this callback, generate a new token on your app server, and call renewToken to pass the new token to the SDK.
rtcChannel | The current RtcChannel instance. |
void io.agora.rtc.IRtcChannelEventHandler.onRtcStats | ( | RtcChannel | rtcChannel, |
RtcStats | stats | ||
) |
Reports the statistics of the RtcEngine once every two seconds.
rtcChannel | The current RtcChannel instance. |
stats | Statistics of the RtcChannel instance: RtcStats. |
void io.agora.rtc.IRtcChannelEventHandler.onNetworkQuality | ( | RtcChannel | rtcChannel, |
int | uid, | ||
int | txQuality, | ||
int | rxQuality | ||
) |
Reports the last mile network quality of each user in the channel once every two seconds.
Last mile refers to the connection between the local device and Agora edge server. This callback reports once every two seconds the last mile network conditions of each user in the channel. If a channel includes multiple users, then this callback will be triggered as many times.
rtcChannel | The current RtcChannel instance. |
uid | User ID. The network quality of the user with this uid is reported. If uid is 0, the local network quality is reported. |
txQuality | Uplink transmission quality of the user in terms of the transmission bitrate, packet loss rate, average RTT (Round-Trip Time) and jitter of the uplink network. txQuality is a quality rating helping you understand how well the current uplink network conditions can support the selected VideoEncoderConfiguration. For example, a 1000 Kbps uplink network may be adequate for video frames with a resolution of 680 × 480 and a frame rate of 30 fps, but may be inadequate for resolutions higher than 1280 × 720.
|
rxQuality | Downlink network quality rating of the user in terms of packet loss rate, average RTT, and jitter of the downlink network.
|
void io.agora.rtc.IRtcChannelEventHandler.onRemoteVideoStats | ( | RtcChannel | rtcChannel, |
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.
rtcChannel | The current RtcChannel instance. |
stats | Statistics of the received remote video streams: RemoteVideoStats. |
void io.agora.rtc.IRtcChannelEventHandler.onRemoteAudioStats | ( | RtcChannel | rtcChannel, |
RemoteAudioStats | stats | ||
) |
Reports the statistics of the audio 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.
Schemes such as FEC (Forward Error Correction) or retransmission counter the frame loss rate. Hence, users may find the overall audio quality acceptable even when the packet loss rate is high.
rtcChannel | The current RtcChannel instance. |
stats | Statistics of the received remote audio streams: RemoteAudioStats. |
void io.agora.rtc.IRtcChannelEventHandler.onRemoteAudioStateChanged | ( | RtcChannel | rtcChannel, |
int | uid, | ||
int | state, | ||
int | reason, | ||
int | elapsed | ||
) |
Occurs when the remote audio state changes.
This callback indicates the state change of the remote audio stream.
rtcChannel | The current RtcChannel instance. |
uid | ID of the user whose audio state changes. |
state | State of the remote audio:
|
reason | The reason of the remote audio state change.
|
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
void io.agora.rtc.IRtcChannelEventHandler.onAudioPublishStateChanged | ( | RtcChannel | rtcChannel, |
int | oldState, | ||
int | newState, | ||
int | elapseSinceLastState | ||
) |
Occurs when the audio publishing state changes.
This callback indicates the publishing state change of the local audio stream.
The publishing states include:
rtcChannel | The current RtcChannel instance. |
oldState | The previous publishing state. |
newState | The current publishing state. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
void io.agora.rtc.IRtcChannelEventHandler.onVideoPublishStateChanged | ( | RtcChannel | rtcChannel, |
int | oldState, | ||
int | newState, | ||
int | elapseSinceLastState | ||
) |
Occurs when the local video publishing state changes.
This callback indicates the publishing state change of the local video stream.
The publishing states include:
rtcChannel | The current RtcChannel instance. |
oldState | The previous publishing state. |
newState | The current publishing state. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
void io.agora.rtc.IRtcChannelEventHandler.onAudioSubscribeStateChanged | ( | RtcChannel | rtcChannel, |
int | uid, | ||
int | oldState, | ||
int | newState, | ||
int | elapseSinceLastState | ||
) |
Occurs when the remote audio subscribing state changes.
This callback indicates the subscribing state change of the remote audio stream.
The subscribing states include:
rtcChannel | The current RtcChannel instance. |
uid | The ID of the remote user whose audio subscribing state changes. |
oldState | The previous subscribing state. |
newState | The current subscribing state. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
void io.agora.rtc.IRtcChannelEventHandler.onVideoSubscribeStateChanged | ( | RtcChannel | rtcChannel, |
int | uid, | ||
int | oldState, | ||
int | newState, | ||
int | elapseSinceLastState | ||
) |
Occurs when the remote video subscribe state changes.
This callback indicates the subscribe state change of the remote video stream.
The subscribing states include:
rtcChannel | The current RtcChannel instance. |
uid | The ID of the remote user whose video subscribe state changes. |
oldState | The previous subscribing state. |
newState | The current subscribing state. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
void io.agora.rtc.IRtcChannelEventHandler.onActiveSpeaker | ( | RtcChannel | rtcChannel, |
int | uid | ||
) |
Occurs when the most active remote speaker is detected.
After a successful call of enableAudioVolumeIndication, the SDK continuously detects which remote user has the loudest volume. During the current period, the remote user, who is detected as the loudest for the most times, is the most active user.
When the number of user is no less than two and an active speaker exists, the SDK triggers this callback and reports the uid
of the most active speaker.
uid
of the new active speaker.rtcChannel | The current RtcChannel instance. |
uid | The user ID of the most active remote speaker. |
void io.agora.rtc.IRtcChannelEventHandler.onVideoSizeChanged | ( | RtcChannel | rtcChannel, |
int | uid, | ||
int | width, | ||
int | height, | ||
int | rotation | ||
) |
Occurs when the video size or rotation information of a remote user changes.
rtcChannel | The current RtcChannel instance. |
uid | User ID of the remote user or local user (0) whose video size or rotation changes. |
width | New width (pixels) of the video. |
height | New height (pixels) of the video. |
rotation | New rotation of the video [0 to 360]. |
void io.agora.rtc.IRtcChannelEventHandler.onRemoteVideoStateChanged | ( | RtcChannel | rtcChannel, |
int | uid, | ||
int | state, | ||
int | reason, | ||
int | elapsed | ||
) |
Occurs when the remote video state changes.
rtcChannel | The current RtcChannel instance. |
uid | ID of the remote user whose video state changes. |
state | State of the remote video:
|
reason | The reason of the remote video state change:
|
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
void io.agora.rtc.IRtcChannelEventHandler.onStreamMessage | ( | RtcChannel | rtcChannel, |
int | uid, | ||
int | streamId, | ||
byte[] | data | ||
) |
Occurs when the local user receives a remote data stream.
The SDK triggers this callback when the local user receives the stream message that the remote user sends by calling the sendStreamMessage
method.
rtcChannel | The current RtcChannel instance. |
uid | ID of the remote user who sends the data stream. |
streamId | Stream ID. |
data | Data received by the local user. |
void io.agora.rtc.IRtcChannelEventHandler.onStreamMessageError | ( | RtcChannel | rtcChannel, |
int | uid, | ||
int | streamId, | ||
int | error, | ||
int | missed, | ||
int | cached | ||
) |
Occurs when the local user fails to receive a remote data stream.
The SDK triggers this callback when the local user fails to receive the stream message that the remote user sends by calling the sendStreamMessage
method.
rtcChannel | The current RtcChannel instance. |
uid | ID of the remote user who sends the data stream. |
streamId | Stream ID. |
error | The detailed error informationL ErrorCode. |
missed | The number of lost messages. |
cached | The number of incoming cached messages when the data stream is interrupted. |
void io.agora.rtc.IRtcChannelEventHandler.onChannelMediaRelayStateChanged | ( | RtcChannel | rtcChannel, |
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.
rtcChannel | The current RtcChannel instance. |
state | The state code:
|
code | The error code:
|
void io.agora.rtc.IRtcChannelEventHandler.onChannelMediaRelayEvent | ( | RtcChannel | rtcChannel, |
int | code | ||
) |
Reports events during the media stream relay.
rtcChannel | The current RtcChannel instance. |
code | The event code for media stream relay:
|
void io.agora.rtc.IRtcChannelEventHandler.onRtmpStreamingStateChanged | ( | RtcChannel | rtcChannel, |
String | url, | ||
int | state, | ||
int | errCode | ||
) |
Occurs when the state of the RTMP or RTMPS streaming changes.
The SDK triggers this callback to report the result of the local user calling the addPublishStreamUrl or removePublishStreamUrl method. This callback returns the URL and its current streaming state. When the streaming state is RTMP_STREAM_PUBLISH_STATE_FAILURE(4), see the errCode
parameter for details.
This callback indicates the state of the RTMP or RTMPS streaming. When exceptions occur, you can troubleshoot issues by referring to the detailed error descriptions in the errCode parameter.
rtcChannel | The current RtcChannel instance. |
url | The CDN streaming URL. |
state | The RTMP or RTMPS streaming state:
|
errCode | The detailed error information for streaming:
|
void io.agora.rtc.IRtcChannelEventHandler.onTranscodingUpdated | ( | RtcChannel | rtcChannel | ) |
Occurs when the publisher's transcoding settings are updated.
When the LiveTranscoding
class in the setLiveTranscoding method updates, the SDK triggers this callback to report the update information.
setLiveTranscoding
method to set the LiveTranscoding
class for the first time, the SDK does not trigger this callback.rtcChannel | The current RtcChannel instance. |
void io.agora.rtc.IRtcChannelEventHandler.onStreamInjectedStatus | ( | RtcChannel | rtcChannel, |
String | url, | ||
int | uid, | ||
int | status | ||
) |
Reports the status of injecting the online media stream.
rtcChannel | The current RtcChannel instance. |
url | The URL address of the externally injected stream. |
uid | User ID. |
status | State of the externally injected stream:
|
void io.agora.rtc.IRtcChannelEventHandler.onRtmpStreamingEvent | ( | RtcChannel | rtcChannel, |
String | url, | ||
int | errCode | ||
) |
Reports events during the RTMP or RTMPS streaming.
rtcChannel | The current RtcChannel instance. |
url | The CDN streaming URL. |
errCode | The event code.
|
void io.agora.rtc.IRtcChannelEventHandler.onLocalPublishFallbackToAudioOnly | ( | RtcChannel | rtcChannel, |
boolean | isFallbackOrRecover | ||
) |
Occurs when the published media stream falls back to an audio-only stream due to poor network conditions or switches back to video stream after the network conditions improve.
If you call setLocalPublishFallbackOption and set option as STREAM_FALLBACK_OPTION_AUDIO_ONLY(2), this callback is triggered when the local published stream falls back to audio-only mode due to poor uplink conditions, or when the audio stream switches back to the video after the uplink network condition improves. Once the published stream falls back to audio only, the remote app receives the onRemoteVideoStateChanged callback.
rtcChannel | The current RtcChannel instance. |
isFallbackOrRecover | Whether the published stream fell back to audio-only or switched back to the video:
|
void io.agora.rtc.IRtcChannelEventHandler.onRemoteSubscribeFallbackToAudioOnly | ( | RtcChannel | rtcChannel, |
int | uid, | ||
boolean | isFallbackOrRecover | ||
) |
Occurs when the remote media stream falls back to audio-only stream due to poor network conditions or switches back to video stream after the network conditions improve.
If you call setRemoteSubscribeFallbackOption and set option
as STREAM_FALLBACK_OPTION_AUDIO_ONLY(2), this callback is triggered when the remote media stream falls back to audio-only mode due to poor downlink conditions, or when the remote media stream switches back to the video after the downlink network condition improves.
rtcChannel | The current RtcChannel instance. |
uid | ID of the remote user sending the stream. |
isFallbackOrRecover | Whether the remote media stream fell back to audio-only or switched back to the video:
|