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 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 onRemoteSubscribeFallbackToAudioOnly (RtcChannel rtcChannel, int uid, boolean isFallbackOrRecover)
 

Detailed Description

Member Function Documentation

◆ onActiveSpeaker()

void io.agora.rtc.IRtcChannelEventHandler.onActiveSpeaker ( RtcChannel  rtcChannel,
int  uid 
)

Reports which user is the loudest speaker.

This callback reports the speaker with the highest accumulative volume during a certain period. If the user enables the audio volume indication by calling enableAudioVolumeIndication, this callback returns the uid of the active speaker whose voice is detected by the audio volume detection module of the SDK.

Parameters
rtcChannelThe current RtcChannel instance.
uidUser ID of the active speaker. A uid of 0 represents the local user.
Note
  • To receive this callback, you need to call enableAudioVolumeIndication.
  • This callback reports the ID of the user with the highest voice volume during a period of time, instead of at the moment.

◆ onChannelError()

void io.agora.rtc.IRtcChannelEventHandler.onChannelError ( RtcChannel  rtcChannel,
int  err 
)

Reports the error code of the RtcChannel instance.

Parameters
rtcChannelThe current RtcChannel instance.
errThe error code: ErrorCode

◆ onChannelMediaRelayEvent()

void io.agora.rtc.IRtcChannelEventHandler.onChannelMediaRelayEvent ( RtcChannel  rtcChannel,
int  code 
)

Reports events during the media stream relay.

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

◆ onChannelMediaRelayStateChanged()

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.

Parameters
rtcChannelThe current RtcChannel instance.
stateThe state code:
  • RELAY_STATE_IDLE(0): The SDK is initializing.
  • RELAY_STATE_CONNECTING(1): The SDK tries to relay the media stream to the destination channel.
  • RELAY_STATE_RUNNING(2): The SDK successfully relays the media stream to the destination channel.
  • RELAY_STATE_FAILURE(3): A failure occurs. See the details in code.
codeThe error code:
  • RELAY_OK(0): The state is normal.
  • RELAY_ERROR_SERVER_ERROR_RESPONSE(1): An error occurs in the server response.
  • RELAY_ERROR_SERVER_NO_RESPONSE(2): No server response. You can call the leaveChannel method to leave the channel.
  • RELAY_ERROR_NO_RESOURCE_AVAILABLE(3): The SDK fails to access the service, probably due to limited resources of the server.
  • RELAY_ERROR_FAILED_JOIN_SRC(4): The server fails to join the source channel.
  • RELAY_ERROR_FAILED_JOIN_DEST(5): The server fails to join the destination channel.
  • RELAY_ERROR_FAILED_PACKET_RECEIVED_FROM_SRC(6): The server fails to receive the data from the source channel.
  • RELAY_ERROR_FAILED_PACKET_SENT_TO_DEST(7): The source channel fails to transmit data.
  • 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.

◆ onChannelWarning()

void io.agora.rtc.IRtcChannelEventHandler.onChannelWarning ( RtcChannel  rtcChannel,
int  warn 
)

Reports the warning code of the RtcChannel instance.

Parameters
rtcChannelThe current RtcChannel instance.
warnThe warning code: WarnCode.

◆ onClientRoleChanged()

void io.agora.rtc.IRtcChannelEventHandler.onClientRoleChanged ( RtcChannel  rtcChannel,
int  oldRole,
int  newRole 
)

Occurs when the user role switches in a Live-Broadcast channel. For example, from broadcaster 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.

Parameters
rtcChannelThe current RtcChannel instance.
oldRoleThe role that the user switches from.
  • CLIENT_ROLE_BROADCASTER(1): Broadcaster.
  • CLIENT_ROLE_AUDIENCE(2): Audience.
newRoleThe role that the user switches to.
  • CLIENT_ROLE_BROADCASTER(1): Broadcaster.
  • CLIENT_ROLE_AUDIENCE(2): Audience.

◆ onConnectionLost()

void io.agora.rtc.IRtcChannelEventHandler.onConnectionLost ( RtcChannel  rtcChannel)

Occurs when the SDK cannot reconnect to Agora's 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's edge server, the SDK stops rejoining the channel.

Parameters
rtcChannelThe current RtcChannel instance.

◆ onConnectionStateChanged()

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.

Parameters
rtcChannelThe current RtcChannel instance.
stateThe current network connection state:
reasonThe reason causing the change of the connection state:

◆ onJoinChannelSuccess()

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.

Parameters
rtcChannelThe current RtcChannel instance.
uidThe user ID.
elapsedTime elapsed (ms) from the local user calling joinChannel until this callback is triggered.

◆ onLeaveChannel()

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 retrieves the channel information, such as the call duration and statistics.

Parameters
rtcChannelThe current RtcChannel instance.
statsStatistics of the call: RtcStats.

◆ onNetworkQuality()

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's 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.

Parameters
rtcChannelThe current RtcChannel instance.
uidUser ID. The network quality of the user with this uid is reported. If uid is 0, the local network quality is reported.
txQualityUplink 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.
  • QUALITY_UNKNOWN(0): The quality is unknown.
  • QUALITY_EXCELLENT(1): The quality is excellent.
  • 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.
  • QUALITY_DETECTING(8): The SDK is detecting the network quality.
rxQualityDownlink network quality rating of the user in terms of packet loss rate, average RTT, and jitter of the downlink network.
  • QUALITY_UNKNOWN(0): The quality is unknown.
  • QUALITY_EXCELLENT(1): The quality is excellent.
  • 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.
  • QUALITY_DETECTING(8): The SDK is detecting the network quality.

◆ onRejoinChannelSuccess()

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.

Parameters
rtcChannelThe current RtcChannel instance.
uidThe user ID.
elapsedTime elapsed (ms) from the local user starting to reconnect until this callback is triggered.

◆ onRemoteAudioStateChanged()

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.

Parameters
rtcChannelThe current RtcChannel instance.
uidID of the user whose audio state changes.
stateState of the remote audio:
  • REMOTE_AUDIO_STATE_STOPPED(0): The remote audio is in the default state, probably due to REMOTE_AUDIO_REASON_LOCAL_MUTED(3), REMOTE_AUDIO_REASON_REMOTE_MUTED(5), or REMOTE_AUDIO_REASON_REMOTE_OFFLINE(7).
  • REMOTE_AUDIO_STATE_STARTING(1): The first remote audio packet is received.
  • REMOTE_AUDIO_STATE_DECODING(2): The remote audio stream is decoded and plays normally, probably due to REMOTE_AUDIO_REASON_NETWORK_RECOVERY(2), REMOTE_AUDIO_REASON_LOCAL_UNMUTED(4) or REMOTE_AUDIO_REASON_REMOTE_UNMUTED(6).
  • REMOTE_AUDIO_STATE_FROZEN(3): The remote audio is frozen, probably due to REMOTE_AUDIO_REASON_NETWORK_CONGESTION(1).
  • REMOTE_AUDIO_STATE_FAILED(4): The remote audio fails to start, probably due to REMOTE_AUDIO_REASON_INTERNAL(0).
reasonThe reason of the remote audio state change.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

◆ onRemoteAudioStats()

void io.agora.rtc.IRtcChannelEventHandler.onRemoteAudioStats ( RtcChannel  rtcChannel,
RemoteAudioStats  stats 
)

Reports the statistics of the audio stream from each remote user/broadcaster.

The SDK triggers this callback once every two seconds for each remote user/broadcaster. 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.

Parameters
rtcChannelThe current RtcChannel instance.
statsStatistics of the received remote audio streams: RemoteAudioStats.

◆ onRemoteSubscribeFallbackToAudioOnly()

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 uplink conditions, or when the remote media stream switches back to the video after the uplink network condition improves.

Note
Once the remote media stream is switched to the low stream due to poor network conditions, you can monitor the stream switch between a high and low stream in the onRemoteVideoStats callback.
Parameters
rtcChannelThe current RtcChannel instance.
uidID of the remote user sending the stream.
isFallbackOrRecoverWhether the remote media stream fell back to audio-only or switched back to the video:
  • true: The remote media stream fell back to audio-only due to poor network conditions.
  • false: The remote media stream switched back to the video stream after the network conditions improved.

◆ onRemoteVideoStateChanged()

void io.agora.rtc.IRtcChannelEventHandler.onRemoteVideoStateChanged ( RtcChannel  rtcChannel,
int  uid,
int  state,
int  reason,
int  elapsed 
)

Occurs when the remote video state changes.

Parameters
rtcChannelThe current RtcChannel instance.
uidID of the remote user whose video state changes.
stateState of the remote video:
  • REMOTE_VIDEO_STATE_STOPPED(0): The remote video is in the default state, probably due to REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED(3), REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED(5), or REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE(7).
  • REMOTE_VIDEO_STATE_STARTING(1): The first remote video packet is received.
  • REMOTE_VIDEO_STATE_DECODING(2): The remote video stream is decoded and plays normally, probably due to REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY (2), REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED(4), REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED(6), or REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY(9).
  • REMOTE_VIDEO_STATE_FROZEN(3): The remote video is frozen, probably due to REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION(1) or REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK(8).
  • REMOTE_VIDEO_STATE_FAILED(4): The remote video fails to start, probably due to REMOTE_VIDEO_STATE_REASON_INTERNAL(0).
reasonThe reason of the remote video state change:
  • 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.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

◆ onRemoteVideoStats()

void io.agora.rtc.IRtcChannelEventHandler.onRemoteVideoStats ( RtcChannel  rtcChannel,
RemoteVideoStats  stats 
)

Reports the statistics of the video stream from each remote user/broadcaster. The SDK triggers this callback once every two seconds for each remote user/broadcaster. If a channel includes multiple remote users, the SDK triggers this callback as many times.

Parameters
rtcChannelThe current RtcChannel instance.
statsStatistics of the received remote video streams: RemoteVideoStats.

◆ onRequestToken()

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. This callback notifies the app to generate a new token and call renewToken to renew the token.

Parameters
rtcChannelThe current RtcChannel instance.

◆ onRtcStats()

void io.agora.rtc.IRtcChannelEventHandler.onRtcStats ( RtcChannel  rtcChannel,
RtcStats  stats 
)

Reports the statistics of the RtcEngine once every two seconds.

Parameters
rtcChannelThe current RtcChannel instance.
statsStatistics of the RtcChannel instance: RtcStats.

◆ onRtmpStreamingStateChanged()

void io.agora.rtc.IRtcChannelEventHandler.onRtmpStreamingStateChanged ( RtcChannel  rtcChannel,
String  url,
int  state,
int  errCode 
)

Occurs when the state of the RTMP 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 streaming. When exceptions occur, you can troubleshoot issues by referring to the detailed error descriptions in the errCode parameter.

Parameters
rtcChannelThe current RtcChannel instance.
urlThe RTMP URL address.
stateThe RTMP streaming state:
  • RTMP_STREAM_PUBLISH_STATE_IDLE(0): The RTMP streaming has not started or has ended. This state is also triggered after you remove an RTMP address from the CDN by calling removePublishStreamUrl.
  • RTMP_STREAM_PUBLISH_STATE_CONNECTING(1): The SDK is connecting to Agora's streaming server and the RTMP server. This state is triggered after you call the addPublishStreamUrl method.
  • RTMP_STREAM_PUBLISH_STATE_RUNNING(2): The RTMP streaming publishes. The SDK successfully publishes the RTMP streaming and returns this state.
  • RTMP_STREAM_PUBLISH_STATE_RECOVERING(3): The RTMP streaming is recovering. When exceptions occur to the CDN, or the streaming is interrupted, the SDK attempts to resume RTMP streaming and returns this state.
    • If the SDK successfully resumes the streaming, RTMP_STREAM_PUBLISH_STATE_RUNNING(2) returns.
    • If the streaming does not resume within 60 seconds or server errors occur, 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 streaming fails. See the errCode parameter for the detailed error information. You can also call the addPublishStreamUrl method to publish the RTMP streaming again.
errCodeThe detailed error information for streaming:
  • RTMP_STREAM_PUBLISH_ERROR_OK(0): The RTMP streaming publishes successfully.
  • RTMP_STREAM_PUBLISH_ERROR_INVALID_ARGUMENT(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 streaming is encrypted and cannot be published.
  • RTMP_STREAM_PUBLISH_ERROR_CONNECTION_TIMEOUT(3): Timeout for the RTMP streaming. Call the addPublishStreamUrl method to publish the streaming again.
  • RTMP_STREAM_PUBLISH_ERROR_INTERNAL_SERVER_ERROR(4): An error occurs in Agora's streaming server. Call the addPublishStreamUrl method to publish the streaming again.
  • RTMP_STREAM_PUBLISH_ERROR_RTMP_SERVER_ERROR(5): An error occurs in the RTMP server.
  • RTMP_STREAM_PUBLISH_ERROR_TOO_OFTEN(6): The RTMP streaming publishes too frequently.
  • 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's server fails to find the RTMP streaming.
  • RTMP_STREAM_PUBLISH_ERROR_FORMAT_NOT_SUPPORTED(10): The format of the RTMP streaming URL is not supported. Check whether the URL format is correct.

◆ onStreamInjectedStatus()

void io.agora.rtc.IRtcChannelEventHandler.onStreamInjectedStatus ( RtcChannel  rtcChannel,
String  url,
int  uid,
int  status 
)

Reports the status of injecting the online media stream.

Parameters
rtcChannelThe current RtcChannel instance.
urlThe URL address of the externally injected stream.
uidUser ID.
statusState of the externally injected stream:
  • INJECT_STREAM_STATUS_START_SUCCESS(0): The external video stream imports successfully.
  • INJECT_STREAM_STATUS_START_ALREADY_EXIST(1): The external video stream already exists.
  • INJECT_STREAM_STATUS_START_UNAUTHORIZED(2)}: The external video stream import is unauthorized.
  • INJECT_STREAM_STATUS_START_TIMEDOUT(3): Timeout when importing the external video stream.
  • INJECT_STREAM_STATUS_START_FAILED(4): The external video stream fails to import.
  • INJECT_STREAM_STATUS_STOP_SUCCESS(5): The external video stream stops importing successfully.
  • INJECT_STREAM_STATUS_STOP_NOT_FOUND(6): No external video stream is found.
  • INJECT_STREAM_STATUS_STOP_UNAUTHORIZED(7): The external video stream stops from being unauthorized.
  • INJECT_STREAM_STATUS_STOP_TIMEDOUT(8): Timeout when stopping the import of the external video stream.
  • INJECT_STREAM_STATUS_STOP_FAILED(9): Fails to stop importing the external video stream.
  • INJECT_STREAM_STATUS_BROKEN(10): The external video stream import is interrupted.

◆ onStreamMessage()

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.

Parameters
rtcChannelThe current RtcChannel instance.
uidID of the remote user who sends the data stream.
streamIdStream ID.
dataData received by the local user.

◆ onStreamMessageError()

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.

Parameters
rtcChannelThe current RtcChannel instance.
uidID of the remote user who sends the data stream.
streamIdStream ID.
errorThe detailed error informationL ErrorCode.
missedThe number of lost messages.
cachedThe number of incoming cached messages when the data stream is interrupted.

◆ onTokenPrivilegeWillExpire()

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.

Parameters
rtcChannelThe current RtcChannel instance.
tokenThe token that will expire in 30 seconds.

◆ onTranscodingUpdated()

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.

Note
If you call the setLiveTranscoding method to set the LiveTranscoding class for the first time, the SDK does not trigger this callback.
Parameters
rtcChannelThe current RtcChannel instance.

◆ onUserJoined()

void io.agora.rtc.IRtcChannelEventHandler.onUserJoined ( RtcChannel  rtcChannel,
int  uid,
int  elapsed 
)

Occurs when a remote user (Communication) or a broadcaster (Live-Broadcast) 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-Broadcast 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.
Parameters
rtcChannelThe current RtcChannel instance.
uidID of the user or host who joins the channel.
elapsedTime delay (ms) from the local user calling joinChannel or setClientRole(BROADCASTER) until this callback is triggered.
Note
In the Live-Broadcast profile:
  • The host receives this callback when another host joins the channel.
  • The audience in the channel receives this callback when a new host joins the channel.
  • When a web app joins the channel, this callback is triggered as long as the web app publishes streams.

◆ onUserOffline()

void io.agora.rtc.IRtcChannelEventHandler.onUserOffline ( RtcChannel  rtcChannel,
int  uid,
int  reason 
)

Occurs when a remote user (Communication) or a broadcaster (Live Broadcast) leaves the channel.

There are two reasons for users to become offline:

  • Leave the channel: When the user/broadcaster leaves the channel, the user/broadcaster sends a goodbye message. When this message is received, the SDK determines that the user/host leaves the channel.
  • Go offline: When no data packet of the user or broadcaster is received for a certain period of time (around 20 seconds), the SDK assumes that the user/broadcaster drops offline. A poor network connection may lead to false detections, so we recommend using the Agora RTM SDK for reliable offline detection.
Parameters
rtcChannelThe current RtcChannel instance.
uidID of the user or broadcaster who leaves the channel or goes offline.
reasonThe reason why the user goes offline:
  • USER_OFFLINE_QUIT(0): The user leaves the current channel.
  • USER_OFFLINE_DROPPED(1): The SDK timed out and the user dropped offline because no data packet was received within a certain period of time. If a user quits the call and the message is not passed to the SDK (due to an unreliable channel), the SDK assumes the user dropped offline.
  • USER_OFFLINE_BECOME_AUDIENCE(2): (Live-Broadcast only.) The client role switched from broadcaster to audience.

◆ onVideoSizeChanged()

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.

Parameters
rtcChannelThe current RtcChannel instance.
uidUser ID of the remote user or local user (0) whose video size or rotation changes.
widthNew width (pixels) of the video.
heightNew height (pixels) of the video.
rotationNew rotation of the video [0 to 360].