Video SDK v3.7.1 API Reference for All Platforms (C++)
|
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 | onStreamInjectedStatus (IChannel *rtcChannel, const char *url, uid_t uid, int status) |
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) |
The IChannelEventHandler class.
|
inlinevirtual |
|
inlinevirtual |
Reports the warning code of IChannel
.
rtcChannel | IChannel |
warn | The warning code: WARN_CODE_TYPE |
msg | The warning message. |
|
inlinevirtual |
Reports the error code of IChannel
.
rtcChannel | IChannel |
err | The error code: ERROR_CODE_TYPE |
msg | The error message. |
|
inlinevirtual |
Occurs when a user joins a channel.
This callback notifies the application that a user joins a specified channel.
rtcChannel | IChannel |
uid | The user ID. If the uid is not specified in the joinChannel method, the server automatically assigns a uid . |
elapsed | Time elapsed (ms) from the local user calling joinChannel until this callback is triggered. |
|
inlinevirtual |
Occurs when a user rejoins the channel after being disconnected due to network problems.
rtcChannel | IChannel |
uid | The user ID. |
elapsed | Time elapsed (ms) from the local user starting to reconnect until this callback is triggered. |
|
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.
|
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.
rtcChannel | IChannel |
oldRole | Role that the user switches from: CLIENT_ROLE_TYPE. |
newRole | Role that the user switches to: CLIENT_ROLE_TYPE. |
|
inlinevirtual |
Occurs when the user role switch fails in the interactive live streaming.
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.
rtcChannel | IChannel |
reason | The reason for the user role switch failure. See CLIENT_ROLE_CHANGE_FAILED_REASON. |
currentRole | The current user role. See CLIENT_ROLE_TYPE. |
|
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:
LIVE_BROADCASTING
profile:rtcChannel | IChannel |
uid | User ID of the user or host joining the channel. |
elapsed | Time delay (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when a remote user ( COMMUNICATION
)/host (LIVE_BROADCASTING
) leaves the channel.
Reasons why the user is offline:
rtcChannel | IChannel |
uid | User ID of the user leaving the channel or going offline. |
reason | Reason why the user is offline: USER_OFFLINE_REASON_TYPE. |
|
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:
onConnectionInterrupted
callback when it loses connection with the server for more than four seconds after it successfully joins the channel.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.
rtcChannel | IChannel |
|
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.
rtcChannel | IChannel |
|
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.
rtcChannel | IChannel |
token | Token that expires in 30 seconds. |
|
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.
txQuality
is UNKNOWN
when the user is not sending a stream; rxQuality
is UNKNOWN
when the user is not receiving a stream.rtcChannel | IChannel |
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 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. |
rxQuality | Downlink network quality rating of the user in terms of the packet loss rate, average RTT, and jitter of the downlink network. See QUALITY_TYPE. |
|
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.
rtcChannel | IChannel |
stats | Statistics of the remote video stream. See RemoteVideoStats. |
|
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.
rtcChannel | IChannel |
stats | The statistics of the received remote audio streams. See RemoteAudioStats. |
|
inlinevirtual |
Occurs when the remote audio state changes.
This callback indicates the state change of the remote audio stream.
COMMUNICATION
profile) or hosts (in the LIVE_BROADCASTING
profile) in a channel exceeds 17.rtcChannel | IChannel |
uid | ID of the remote user whose audio state changes. |
state | State of the remote audio. See REMOTE_AUDIO_STATE. |
reason | The reason of the remote audio state change. See REMOTE_AUDIO_STATE_REASON. |
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when the audio publishing state changes.
This callback indicates the publishing state change of the local audio stream.
rtcChannel | IChannel |
oldState | The previous publishing state. For details, see STREAM_PUBLISH_STATE. |
newState | The current publishing state. For details, see STREAM_PUBLISH_STATE. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
|
inlinevirtual |
Occurs when the video publishing state changes.
This callback indicates the publishing state change of the local video stream.
rtcChannel | IChannel |
oldState | The previous publishing state. For details, see STREAM_PUBLISH_STATE. |
newState | The current publishing state. For details, see STREAM_PUBLISH_STATE. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
|
inlinevirtual |
Occurs when the audio subscribing state changes.
This callback indicates the subscribing state change of a remote audio stream.
rtcChannel | IChannel |
uid | The ID of the remote user. |
oldState | The previous subscribing state. For details, see STREAM_SUBSCRIBE_STATE. |
newState | The current subscribing state. For details, see STREAM_SUBSCRIBE_STATE. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
|
inlinevirtual |
Occurs when the audio subscribing state changes.
This callback indicates the subscribing state change of a remote video stream.
rtcChannel | IChannel |
uid | The ID of the remote user. |
oldState | The previous subscribing state. For details, see STREAM_SUBSCRIBE_STATE. |
newState | The current subscribing state. For details, see STREAM_SUBSCRIBE_STATE. |
elapseSinceLastState | The time elapsed (ms) from the previous state to the current state. |
|
inlinevirtual |
Reports whether the super resolution feature is successfully enabled. (beta feature)
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.
rtcChannel | IChannel |
uid | The user ID of the remote user. |
enabled | Whether super resolution is successfully enabled:
|
reason | The reason why super resolution is not successfully enabled or the message that confirms success. See SUPER_RESOLUTION_STATE_REASON. |
|
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.
uid
of the new active speaker.rtcChannel | IChannel |
uid | The user ID of the most active remote speaker. |
|
inlinevirtual |
Occurs when the first remote video frame is rendered.
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.
rtcChannel | IChannel |
uid | User ID of the remote user sending the video stream. |
width | Width (px) of the video frame. |
height | Height (px) of the video stream. |
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
|
inlinevirtual |
Occurs when the video size or rotation of a specified user changes.
rtcChannel | IChannel |
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). |
|
inlinevirtual |
Occurs when the remote video state changes.
COMMUNICATION
profile) or hosts (in the LIVE_BROADCASTING
profile) in a channel exceeds 17.rtcChannel | IChannel |
uid | ID of the remote user whose video state changes. |
state | State of the remote video. See REMOTE_VIDEO_STATE. |
reason | The reason of the remote video state change. See REMOTE_VIDEO_STATE_REASON. |
elapsed | Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. |
|
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.
rtcChannel | IChannel |
uid | User ID of the remote user sending the message. |
streamId | Stream ID. |
data | The data received by the local user. |
length | Length of the data in bytes. |
|
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.
rtcChannel | IChannel |
uid | User ID of the remote user sending the message. |
streamId | Stream ID. |
code | Error code: ERROR_CODE_TYPE. |
missed | Number of lost messages. |
cached | Number of incoming cached messages when the data stream is interrupted. |
|
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.
rtcChannel | IChannel |
state | The state code in CHANNEL_MEDIA_RELAY_STATE. |
code | The error code in CHANNEL_MEDIA_RELAY_ERROR. |
|
inlinevirtual |
Reports events during the media stream relay.
rtcChannel | IChannel |
code | The event code in CHANNEL_MEDIA_RELAY_EVENT. |
|
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.
rtcChannel | IChannel |
url | The CDN streaming URL. |
state | The RTMP or RTMPS streaming state. See: RTMP_STREAM_PUBLISH_STATE. |
errCode | The detailed error information for streaming. See: RTMP_STREAM_PUBLISH_ERROR_TYPE. |
|
inlinevirtual |
Reports events during the RTMP or RTMPS streaming.
rtcChannel | IChannel |
url | The RTMP or RTMPS streaming URL. |
eventCode | The event code. See RTMP_STREAMING_EVENT |
|
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.
setLiveTranscoding
method to set the LiveTranscoding class for the first time, the SDK does not trigger the onTranscodingUpdated
callback.rtcChannel | IChannel |
|
inlinevirtual |
Occurs when a voice or video stream URL address is added to the interactive live streaming.
rtcChannel | IChannel |
url | The URL address of the externally injected stream. |
uid | User ID. |
status | State of the externally injected stream: INJECT_STREAM_STATUS. |
|
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.
rtcChannel | IChannel |
isFallbackOrRecover | Whether the published stream falls back to audio-only or switches back to the video:
|
|
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.
rtcChannel | IChannel |
uid | ID of the remote user sending the stream. |
isFallbackOrRecover | Whether the remotely subscribed media stream falls back to audio-only or switches back to the video:
|
|
inlinevirtual |
Occurs when the connection state between the SDK and the server changes.
rtcChannel | IChannel |
state | See CONNECTION_STATE_TYPE. |
reason | See CONNECTION_CHANGED_REASON_TYPE. |
|
inlinevirtual |
Reports the proxy connection state.
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.
rtcChannel | IChannel |
uid | The user ID. |
proxyType | The proxy type connected. See PROXY_TYPE. |
localProxyIp | Reserved for future use. |
elapsed | The time elapsed (ms) from the user calling joinChannel until this callback is triggered. |