Agora C++ API Reference for All Platforms
agora::rtc::IChannelEventHandler Class Reference

#include <IAgoraRtcChannel.h>

Public Member Functions

virtual ~IChannelEventHandler ()
 
virtual void onChannelWarning (IChannel *rtcChannel, int warn, const char *msg)
 
virtual void onChannelError (IChannel *rtcChannel, int err, const char *msg)
 
virtual void onJoinChannelSuccess (IChannel *rtcChannel, uid_t uid, int elapsed)
 
virtual void onRejoinChannelSuccess (IChannel *rtcChannel, uid_t uid, int elapsed)
 
virtual void onLeaveChannel (IChannel *rtcChannel, const RtcStats &stats)
 
virtual void onClientRoleChanged (IChannel *rtcChannel, CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole)
 
virtual void onClientRoleChangeFailed (IChannel *rtcChannel, CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole)
 
virtual void onUserJoined (IChannel *rtcChannel, uid_t uid, int elapsed)
 
virtual void onUserOffline (IChannel *rtcChannel, uid_t uid, USER_OFFLINE_REASON_TYPE reason)
 
virtual void onConnectionLost (IChannel *rtcChannel)
 
virtual void onRequestToken (IChannel *rtcChannel)
 
virtual void onTokenPrivilegeWillExpire (IChannel *rtcChannel, const char *token)
 
virtual void onRtcStats (IChannel *rtcChannel, const RtcStats &stats)
 
virtual void onNetworkQuality (IChannel *rtcChannel, uid_t uid, int txQuality, int rxQuality)
 
virtual void onRemoteVideoStats (IChannel *rtcChannel, const RemoteVideoStats &stats)
 
virtual void onRemoteAudioStats (IChannel *rtcChannel, const RemoteAudioStats &stats)
 
virtual void onRemoteAudioStateChanged (IChannel *rtcChannel, uid_t uid, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed)
 
virtual void onAudioPublishStateChanged (IChannel *rtcChannel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState)
 
virtual void onVideoPublishStateChanged (IChannel *rtcChannel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState)
 
virtual void onAudioSubscribeStateChanged (IChannel *rtcChannel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)
 
virtual void onVideoSubscribeStateChanged (IChannel *rtcChannel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)
 
virtual void onUserSuperResolutionEnabled (IChannel *rtcChannel, uid_t uid, bool enabled, SUPER_RESOLUTION_STATE_REASON reason)
 
virtual void onActiveSpeaker (IChannel *rtcChannel, uid_t uid)
 
virtual void onFirstRemoteVideoFrame (IChannel *rtcChannel, uid_t uid, int width, int height, int elapsed)
 
virtual void onVideoSizeChanged (IChannel *rtcChannel, uid_t uid, int width, int height, int rotation)
 
virtual void onRemoteVideoStateChanged (IChannel *rtcChannel, uid_t uid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed)
 
virtual void onStreamMessage (IChannel *rtcChannel, uid_t uid, int streamId, const char *data, size_t length)
 
virtual void onStreamMessageError (IChannel *rtcChannel, uid_t uid, int streamId, int code, int missed, int cached)
 
virtual void onChannelMediaRelayStateChanged (IChannel *rtcChannel, CHANNEL_MEDIA_RELAY_STATE state, CHANNEL_MEDIA_RELAY_ERROR code)
 
virtual void onChannelMediaRelayEvent (IChannel *rtcChannel, CHANNEL_MEDIA_RELAY_EVENT code)
 
virtual void onRtmpStreamingStateChanged (IChannel *rtcChannel, const char *url, RTMP_STREAM_PUBLISH_STATE state, RTMP_STREAM_PUBLISH_ERROR_TYPE errCode)
 
virtual void onRtmpStreamingEvent (IChannel *rtcChannel, const char *url, RTMP_STREAMING_EVENT eventCode)
 
virtual void onTranscodingUpdated (IChannel *rtcChannel)
 
virtual void onLocalPublishFallbackToAudioOnly (IChannel *rtcChannel, bool isFallbackOrRecover)
 
virtual void onRemoteSubscribeFallbackToAudioOnly (IChannel *rtcChannel, uid_t uid, bool isFallbackOrRecover)
 
virtual void onConnectionStateChanged (IChannel *rtcChannel, CONNECTION_STATE_TYPE state, CONNECTION_CHANGED_REASON_TYPE reason)
 
virtual void onProxyConnected (IChannel *rtcChannel, uid_t uid, PROXY_TYPE proxyType, const char *localProxyIp, int elapsed)
 

Detailed Description

Constructor & Destructor Documentation

◆ ~IChannelEventHandler()

virtual agora::rtc::IChannelEventHandler::~IChannelEventHandler ( )
inlinevirtual

Member Function Documentation

◆ onChannelWarning()

virtual void agora::rtc::IChannelEventHandler::onChannelWarning ( IChannel rtcChannel,
int  warn,
const char *  msg 
)
inlinevirtual

Reports the warning code of IChannel.

Parameters
rtcChannelIChannel
warnThe warning code: WARN_CODE_TYPE
msgThe warning message.

◆ onChannelError()

virtual void agora::rtc::IChannelEventHandler::onChannelError ( IChannel rtcChannel,
int  err,
const char *  msg 
)
inlinevirtual

Reports the error code of IChannel.

Parameters
rtcChannelIChannel
errThe error code: ERROR_CODE_TYPE
msgThe error message.

◆ onJoinChannelSuccess()

virtual void agora::rtc::IChannelEventHandler::onJoinChannelSuccess ( IChannel rtcChannel,
uid_t  uid,
int  elapsed 
)
inlinevirtual

Occurs when a user joins a channel.

This callback notifies the application that a user joins a specified channel.

Parameters
rtcChannelIChannel
uidThe user ID. If the uid is not specified in the joinChannel method, the server automatically assigns a uid.
elapsedTime elapsed (ms) from the local user calling joinChannel until this callback is triggered.

◆ onRejoinChannelSuccess()

virtual void agora::rtc::IChannelEventHandler::onRejoinChannelSuccess ( IChannel rtcChannel,
uid_t  uid,
int  elapsed 
)
inlinevirtual

Occurs when a user rejoins the channel after being disconnected due to network problems.

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

◆ onLeaveChannel()

virtual void agora::rtc::IChannelEventHandler::onLeaveChannel ( IChannel rtcChannel,
const RtcStats stats 
)
inlinevirtual

Occurs when a user leaves the channel.

This callback notifies the application that a user leaves the channel when the application calls the leaveChannel method.

The application gets information, such as the call duration and statistics.

Parameters
rtcChannelIChannel
statsThe call statistics: RtcStats.

◆ onClientRoleChanged()

virtual void agora::rtc::IChannelEventHandler::onClientRoleChanged ( IChannel rtcChannel,
CLIENT_ROLE_TYPE  oldRole,
CLIENT_ROLE_TYPE  newRole 
)
inlinevirtual

Occurs when the user role switches successfully in the interactive live streaming.

In the LIVE_BROADCASTING channel profile, when the local user successfully calls setClientRole to switch their user role after joining the channel, for example, from a host to an audience member or vice versa, the SDK triggers this callback to report the user role before and after the switch.

Parameters
rtcChannelIChannel
oldRoleRole that the user switches from: CLIENT_ROLE_TYPE.
newRoleRole that the user switches to: CLIENT_ROLE_TYPE.

◆ onClientRoleChangeFailed()

virtual void agora::rtc::IChannelEventHandler::onClientRoleChangeFailed ( IChannel rtcChannel,
CLIENT_ROLE_CHANGE_FAILED_REASON  reason,
CLIENT_ROLE_TYPE  currentRole 
)
inlinevirtual

Occurs when the user role switch fails in the interactive live streaming.

Since
v3.7.0

In the LIVE_BROADCASTING channel profile, when the local user calls setClientRole to switch their user role after joining the channel but the switch fails, the SDK triggers this callback to report the reason for the failure and the current user role.

Parameters
rtcChannelIChannel
reasonThe reason for the user role switch failure. See CLIENT_ROLE_CHANGE_FAILED_REASON.
currentRoleThe current user role. See CLIENT_ROLE_TYPE.

◆ onUserJoined()

virtual void agora::rtc::IChannelEventHandler::onUserJoined ( IChannel rtcChannel,
uid_t  uid,
int  elapsed 
)
inlinevirtual

Occurs when a remote user (COMMUNICATION)/ host (LIVE_BROADCASTING) joins the channel.

  • COMMUNICATION profile: This callback notifies the application that another user joins the channel. If other users are already in the channel, the SDK also reports to the application on the existing users.
  • LIVE_BROADCASTING profile: This callback notifies the application that the host joins the channel. If other hosts are already in the channel, the SDK also reports to the application on the existing hosts. We recommend limiting the number of hosts to 17.

The SDK triggers this callback under one of the following circumstances:

  • A remote user/host joins the channel by calling the joinChannel method.
  • A remote user switches the user role to the host by calling the setClientRole method after joining the channel.
  • A remote user/host rejoins the channel after a network interruption.
Note
In the LIVE_BROADCASTING 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 application joins the channel, the SDK triggers this callback as long as the web application publishes streams.
Parameters
rtcChannelIChannel
uidUser ID of the user or host joining the channel.
elapsedTime delay (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

◆ onUserOffline()

virtual void agora::rtc::IChannelEventHandler::onUserOffline ( IChannel rtcChannel,
uid_t  uid,
USER_OFFLINE_REASON_TYPE  reason 
)
inlinevirtual

Occurs when a remote user ( COMMUNICATION)/host (LIVE_BROADCASTING) leaves the channel.

Reasons why the user is offline:

  • Leave the channel: When the user/host leaves the channel, the user/host sends a goodbye message. When the message is received, the SDK assumes that the user/host leaves the channel.
  • Drop offline: When no data packet of the user or host is received for a certain period of time, the SDK assumes that the user/host drops offline. Unreliable network connections may lead to false detections, so we recommend using the Agora RTM SDK for more reliable offline detection.
Parameters
rtcChannelIChannel
uidUser ID of the user leaving the channel or going offline.
reasonReason why the user is offline: USER_OFFLINE_REASON_TYPE.

◆ onConnectionLost()

virtual void agora::rtc::IChannelEventHandler::onConnectionLost ( IChannel rtcChannel)
inlinevirtual

Occurs when the SDK cannot reconnect to Agora's edge 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 the joinChannel method, whether or not it is in the channel.

This callback is different from onConnectionInterrupted:

  • The SDK triggers the onConnectionInterrupted callback when it loses connection with the server for more than four seconds after it successfully joins the channel.
  • The SDK triggers the onConnectionLost callback when it loses connection with the server for more than 10 seconds, whether or not it joins the channel.

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
rtcChannelIChannel

◆ onRequestToken()

virtual void agora::rtc::IChannelEventHandler::onRequestToken ( IChannel rtcChannel)
inlinevirtual

Occurs when the token expires.

After a token is specified by calling the joinChannel method, if the SDK losses connection with the Agora server due to network issues, the token may expire after a certain period of time and a new token may be 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.

Parameters
rtcChannelIChannel

◆ onTokenPrivilegeWillExpire()

virtual void agora::rtc::IChannelEventHandler::onTokenPrivilegeWillExpire ( IChannel rtcChannel,
const char *  token 
)
inlinevirtual

Occurs when the token expires in 30 seconds.

The user becomes offline if the token used in the joinChannel method expires. The SDK triggers this callback 30 seconds before the token expires to remind the application to get a new token. Upon receiving this callback, generate a new token on the server and call the renewToken method to pass the new token to the SDK.

Parameters
rtcChannelIChannel
tokenToken that expires in 30 seconds.

◆ onRtcStats()

virtual void agora::rtc::IChannelEventHandler::onRtcStats ( IChannel rtcChannel,
const RtcStats stats 
)
inlinevirtual

Reports the statistics of the current call.

The SDK triggers this callback once every two seconds after the user joins the channel.

Parameters
rtcChannelIChannel
statsStatistics of the RtcEngine: RtcStats.

◆ onNetworkQuality()

virtual void agora::rtc::IChannelEventHandler::onNetworkQuality ( IChannel rtcChannel,
uid_t  uid,
int  txQuality,
int  rxQuality 
)
inlinevirtual

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, the SDK triggers this callback as many times.

Note
txQuality is UNKNOWN when the user is not sending a stream; rxQuality is UNKNOWN when the user is not receiving a stream.
Parameters
rtcChannelIChannel
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 rating 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 640 * 480 and a frame rate of 15 fps in the LIVE_BROADCASTING profile, but may be inadequate for resolutions higher than 1280 * 720. See QUALITY_TYPE.
rxQualityDownlink network quality rating of the user in terms of the packet loss rate, average RTT, and jitter of the downlink network. See QUALITY_TYPE.

◆ onRemoteVideoStats()

virtual void agora::rtc::IChannelEventHandler::onRemoteVideoStats ( IChannel rtcChannel,
const RemoteVideoStats stats 
)
inlinevirtual

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.

Parameters
rtcChannelIChannel
statsStatistics of the remote video stream. See RemoteVideoStats.

◆ onRemoteAudioStats()

virtual void agora::rtc::IChannelEventHandler::onRemoteAudioStats ( IChannel rtcChannel,
const RemoteAudioStats stats 
)
inlinevirtual

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

This callback replaces the onAudioQuality callback.

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.

Parameters
rtcChannelIChannel
statsThe statistics of the received remote audio streams. See RemoteAudioStats.

◆ onRemoteAudioStateChanged()

virtual void agora::rtc::IChannelEventHandler::onRemoteAudioStateChanged ( IChannel rtcChannel,
uid_t  uid,
REMOTE_AUDIO_STATE  state,
REMOTE_AUDIO_STATE_REASON  reason,
int  elapsed 
)
inlinevirtual

Occurs when the remote audio state changes.

This callback indicates the state change of the remote audio stream.

Note
This callback can be inaccurate when the number of users (in the COMMUNICATION profile) or hosts (in the LIVE_BROADCASTING profile) in a channel exceeds 17.
Parameters
rtcChannelIChannel
uidID of the remote user whose audio state changes.
stateState of the remote audio. See REMOTE_AUDIO_STATE.
reasonThe reason of the remote audio state change. See REMOTE_AUDIO_STATE_REASON.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

◆ onAudioPublishStateChanged()

virtual void agora::rtc::IChannelEventHandler::onAudioPublishStateChanged ( IChannel rtcChannel,
STREAM_PUBLISH_STATE  oldState,
STREAM_PUBLISH_STATE  newState,
int  elapseSinceLastState 
)
inlinevirtual

Occurs when the audio publishing state changes.

Since
v3.1.0

This callback indicates the publishing state change of the local audio stream.

Parameters
rtcChannelIChannel
oldStateThe previous publishing state. For details, see STREAM_PUBLISH_STATE.
newStateThe current publishing state. For details, see STREAM_PUBLISH_STATE.
elapseSinceLastStateThe time elapsed (ms) from the previous state to the current state.

◆ onVideoPublishStateChanged()

virtual void agora::rtc::IChannelEventHandler::onVideoPublishStateChanged ( IChannel rtcChannel,
STREAM_PUBLISH_STATE  oldState,
STREAM_PUBLISH_STATE  newState,
int  elapseSinceLastState 
)
inlinevirtual

Occurs when the video publishing state changes.

Since
v3.1.0

This callback indicates the publishing state change of the local video stream.

Parameters
rtcChannelIChannel
oldStateThe previous publishing state. For details, see STREAM_PUBLISH_STATE.
newStateThe current publishing state. For details, see STREAM_PUBLISH_STATE.
elapseSinceLastStateThe time elapsed (ms) from the previous state to the current state.

◆ onAudioSubscribeStateChanged()

virtual void agora::rtc::IChannelEventHandler::onAudioSubscribeStateChanged ( IChannel rtcChannel,
uid_t  uid,
STREAM_SUBSCRIBE_STATE  oldState,
STREAM_SUBSCRIBE_STATE  newState,
int  elapseSinceLastState 
)
inlinevirtual

Occurs when the audio subscribing state changes.

Since
v3.1.0

This callback indicates the subscribing state change of a remote audio stream.

Parameters
rtcChannelIChannel
uidThe ID of the remote user.
oldStateThe previous subscribing state. For details, see STREAM_SUBSCRIBE_STATE.
newStateThe current subscribing state. For details, see STREAM_SUBSCRIBE_STATE.
elapseSinceLastStateThe time elapsed (ms) from the previous state to the current state.

◆ onVideoSubscribeStateChanged()

virtual void agora::rtc::IChannelEventHandler::onVideoSubscribeStateChanged ( IChannel rtcChannel,
uid_t  uid,
STREAM_SUBSCRIBE_STATE  oldState,
STREAM_SUBSCRIBE_STATE  newState,
int  elapseSinceLastState 
)
inlinevirtual

Occurs when the audio subscribing state changes.

Since
v3.1.0

This callback indicates the subscribing state change of a remote video stream.

Parameters
rtcChannelIChannel
uidThe ID of the remote user.
oldStateThe previous subscribing state. For details, see STREAM_SUBSCRIBE_STATE.
newStateThe current subscribing state. For details, see STREAM_SUBSCRIBE_STATE.
elapseSinceLastStateThe time elapsed (ms) from the previous state to the current state.

◆ onUserSuperResolutionEnabled()

virtual void agora::rtc::IChannelEventHandler::onUserSuperResolutionEnabled ( IChannel rtcChannel,
uid_t  uid,
bool  enabled,
SUPER_RESOLUTION_STATE_REASON  reason 
)
inlinevirtual

Reports whether the super resolution feature is successfully enabled. (beta feature)

Since
v3.5.1

After calling enableRemoteSuperResolution, the SDK triggers this callback to report whether super resolution is successfully enabled. If it is not successfully enabled, use reason for troubleshooting.

Parameters
rtcChannelIChannel
uidThe user ID of the remote user.
enabledWhether super resolution is successfully enabled:
  • true: Super resolution is successfully enabled.
  • false: Super resolution is not successfully enabled.
reasonThe reason why super resolution is not successfully enabled or the message that confirms success. See SUPER_RESOLUTION_STATE_REASON.

◆ onActiveSpeaker()

virtual void agora::rtc::IChannelEventHandler::onActiveSpeaker ( IChannel rtcChannel,
uid_t  uid 
)
inlinevirtual

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.

  • If the most active speaker is always the same user, the SDK triggers this callback only once.
  • If the most active speaker changes to another user, the SDK triggers this callback again and reports the uid of the new active speaker.
Parameters
rtcChannelIChannel
uidThe user ID of the most active remote speaker.

◆ onFirstRemoteVideoFrame()

virtual void agora::rtc::IChannelEventHandler::onFirstRemoteVideoFrame ( IChannel rtcChannel,
uid_t  uid,
int  width,
int  height,
int  elapsed 
)
inlinevirtual

Occurs when the first remote video frame is rendered.

Since
v3.7.0

The SDK triggers this callback when the first frame of the remote video is displayed in the user's video window. The application can get the time elapsed from a user joining the channel until the first video frame is displayed.

Parameters
rtcChannelIChannel
uidUser ID of the remote user sending the video stream.
widthWidth (px) of the video frame.
heightHeight (px) of the video stream.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

◆ onVideoSizeChanged()

virtual void agora::rtc::IChannelEventHandler::onVideoSizeChanged ( IChannel rtcChannel,
uid_t  uid,
int  width,
int  height,
int  rotation 
)
inlinevirtual

Occurs when the video size or rotation of a specified user changes.

Parameters
rtcChannelIChannel
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).

◆ onRemoteVideoStateChanged()

virtual void agora::rtc::IChannelEventHandler::onRemoteVideoStateChanged ( IChannel rtcChannel,
uid_t  uid,
REMOTE_VIDEO_STATE  state,
REMOTE_VIDEO_STATE_REASON  reason,
int  elapsed 
)
inlinevirtual

Occurs when the remote video state changes.

Note
This callback can be inaccurate when the number of users (in the COMMUNICATION profile) or hosts (in the LIVE_BROADCASTING profile) in a channel exceeds 17.
Parameters
rtcChannelIChannel
uidID of the remote user whose video state changes.
stateState of the remote video. See REMOTE_VIDEO_STATE.
reasonThe reason of the remote video state change. See REMOTE_VIDEO_STATE_REASON.
elapsedTime elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

◆ onStreamMessage()

virtual void agora::rtc::IChannelEventHandler::onStreamMessage ( IChannel rtcChannel,
uid_t  uid,
int  streamId,
const char *  data,
size_t  length 
)
inlinevirtual

Occurs when the local user receives the data stream from the remote user within five seconds.

The SDK triggers this callback when the local user receives the stream message that the remote user sends by calling the sendStreamMessage method.

Parameters
rtcChannelIChannel
uidUser ID of the remote user sending the message.
streamIdStream ID.
dataThe data received by the local user.
lengthLength of the data in bytes.

◆ onStreamMessageError()

virtual void agora::rtc::IChannelEventHandler::onStreamMessageError ( IChannel rtcChannel,
uid_t  uid,
int  streamId,
int  code,
int  missed,
int  cached 
)
inlinevirtual

Occurs when the local user does not receive the data stream from the remote user within five seconds.

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
rtcChannelIChannel
uidUser ID of the remote user sending the message.
streamIdStream ID.
codeError code: ERROR_CODE_TYPE.
missedNumber of lost messages.
cachedNumber of incoming cached messages when the data stream is interrupted.

◆ onChannelMediaRelayStateChanged()

virtual void agora::rtc::IChannelEventHandler::onChannelMediaRelayStateChanged ( IChannel rtcChannel,
CHANNEL_MEDIA_RELAY_STATE  state,
CHANNEL_MEDIA_RELAY_ERROR  code 
)
inlinevirtual

Occurs when the state of the media stream relay changes.

The SDK returns the state of the current media relay with any error message.

Parameters
rtcChannelIChannel
stateThe state code in CHANNEL_MEDIA_RELAY_STATE.
codeThe error code in CHANNEL_MEDIA_RELAY_ERROR.

◆ onChannelMediaRelayEvent()

virtual void agora::rtc::IChannelEventHandler::onChannelMediaRelayEvent ( IChannel rtcChannel,
CHANNEL_MEDIA_RELAY_EVENT  code 
)
inlinevirtual

Reports events during the media stream relay.

Parameters
rtcChannelIChannel
codeThe event code in CHANNEL_MEDIA_RELAY_EVENT.

◆ onRtmpStreamingStateChanged()

virtual void agora::rtc::IChannelEventHandler::onRtmpStreamingStateChanged ( IChannel rtcChannel,
const char *  url,
RTMP_STREAM_PUBLISH_STATE  state,
RTMP_STREAM_PUBLISH_ERROR_TYPE  errCode 
)
inlinevirtual

Occurs when the state of the RTMP or RTMPS streaming changes.

When the CDN live streaming state changes, the SDK triggers this callback to report the current state and the reason why the state has changed.

When exceptions occur, you can troubleshoot issues by referring to the detailed error descriptions in the errCode parameter.

Parameters
rtcChannelIChannel
urlThe CDN streaming URL.
stateThe RTMP or RTMPS streaming state. See: RTMP_STREAM_PUBLISH_STATE.
errCodeThe detailed error information for streaming. See: RTMP_STREAM_PUBLISH_ERROR_TYPE.

◆ onRtmpStreamingEvent()

virtual void agora::rtc::IChannelEventHandler::onRtmpStreamingEvent ( IChannel rtcChannel,
const char *  url,
RTMP_STREAMING_EVENT  eventCode 
)
inlinevirtual

Reports events during the RTMP or RTMPS streaming.

Since
v3.1.0
Parameters
rtcChannelIChannel
urlThe RTMP or RTMPS streaming URL.
eventCodeThe event code. See RTMP_STREAMING_EVENT

◆ onTranscodingUpdated()

virtual void agora::rtc::IChannelEventHandler::onTranscodingUpdated ( IChannel rtcChannel)
inlinevirtual

Occurs when the publisher's transcoding is updated.

When the LiveTranscoding class in the setLiveTranscoding method updates, the SDK triggers the onTranscodingUpdated callback to report the update information to the local host.

Note
If you call the setLiveTranscoding method to set the LiveTranscoding class for the first time, the SDK does not trigger the onTranscodingUpdated callback.
Parameters
rtcChannelIChannel

◆ onLocalPublishFallbackToAudioOnly()

virtual void agora::rtc::IChannelEventHandler::onLocalPublishFallbackToAudioOnly ( IChannel rtcChannel,
bool  isFallbackOrRecover 
)
inlinevirtual

Occurs when the published media stream falls back to an audio-only stream due to poor network conditions or switches back to the video after the network conditions improve.

If you call setLocalPublishFallbackOption and set option as STREAM_FALLBACK_OPTION_AUDIO_ONLY, the SDK triggers this callback when the 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.

Parameters
rtcChannelIChannel
isFallbackOrRecoverWhether the published stream falls back to audio-only or switches back to the video:
  • true: The published stream falls back to audio-only due to poor network conditions.
  • false: The published stream switches back to the video after the network conditions improve.

◆ onRemoteSubscribeFallbackToAudioOnly()

virtual void agora::rtc::IChannelEventHandler::onRemoteSubscribeFallbackToAudioOnly ( IChannel rtcChannel,
uid_t  uid,
bool  isFallbackOrRecover 
)
inlinevirtual

Occurs when the remote media stream falls back to audio-only stream due to poor network conditions or switches back to the video stream after the network conditions improve.

If you call setRemoteSubscribeFallbackOption and set option as STREAM_FALLBACK_OPTION_AUDIO_ONLY, the SDK triggers this callback 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.

Note
Once the remote media stream switches to the low stream due to poor network conditions, you can monitor the stream switch between a high and low stream in the RemoteVideoStats callback.
Parameters
rtcChannelIChannel
uidID of the remote user sending the stream.
isFallbackOrRecoverWhether the remotely subscribed media stream falls back to audio-only or switches back to the video:
  • true: The remotely subscribed media stream falls back to audio-only due to poor network conditions.
  • false: The remotely subscribed media stream switches back to the video stream after the network conditions improved.

◆ onConnectionStateChanged()

virtual void agora::rtc::IChannelEventHandler::onConnectionStateChanged ( IChannel rtcChannel,
CONNECTION_STATE_TYPE  state,
CONNECTION_CHANGED_REASON_TYPE  reason 
)
inlinevirtual

Occurs when the connection state between the SDK and the server changes.

Parameters
rtcChannelIChannel
stateSee CONNECTION_STATE_TYPE.
reasonSee CONNECTION_CHANGED_REASON_TYPE.

◆ onProxyConnected()

virtual void agora::rtc::IChannelEventHandler::onProxyConnected ( IChannel rtcChannel,
uid_t  uid,
PROXY_TYPE  proxyType,
const char *  localProxyIp,
int  elapsed 
)
inlinevirtual

Reports the proxy connection state.

Since
v3.6.2

You can use this callback to listen for the state of the SDK connecting to a proxy. For example, when a user calls setCloudProxy and joins a channel successfully, the SDK triggers this callback to report the user ID, the proxy type connected, and the time elapsed from the user calling joinChannel until this callback is triggered.

Parameters
rtcChannelIChannel
uidThe user ID.
proxyTypeThe proxy type connected. See PROXY_TYPE.
localProxyIpReserved for future use.
elapsedThe time elapsed (ms) from the user calling joinChannel until this callback is triggered.