IRtcEngineEventHandler

The IRtcEngineEventHandler interface class is used by the SDK to send event notifications to the App. The App receives the SDK's event notifications by inheriting methods of this interface class.

All methods in this interface class have default (empty) implementations. The App can choose to inherit only the events it cares about.

Note:
  • In callback methods, the App should not perform time-consuming operations or call APIs that might block (such as sendMessage), otherwise it may affect the SDK's operation.
  • The SDK no longer catches exceptions in the code logic implemented by the developer in the IRtcEngineEventHandler class callbacks. You need to handle such exceptions yourself; otherwise, they may cause the App to crash when they occur.

OnActiveSpeaker

Occurs when the most active remote speaker is detected.

public virtual void OnActiveSpeaker(RtcConnection connection, uint uid) { }
After successfully calling EnableAudioVolumeIndication, the SDK continuously monitors the remote user with the highest volume and counts the number of times the user is identified as the loudest. The remote user with the highest count during a given period is considered the most active speaker. When there are two or more users in the channel and there is an active remote speaker, the SDK triggers this callback and reports the uid of the most active remote speaker.
  • If the most active remote speaker remains the same, the SDK does not trigger the OnActiveSpeaker callback again.
  • If the most active remote speaker changes, the SDK triggers this callback again and reports the uid of the new most active remote speaker.

Parameters

connection
Connection information. See RtcConnection.
uid
The ID of the most active remote speaker.

OnAudioDeviceStateChanged

Callback for audio device state changes.

public virtual void OnAudioDeviceStateChanged(string deviceId, MEDIA_DEVICE_TYPE deviceType, MEDIA_DEVICE_STATE_TYPE deviceState) { }

Indicates that the system audio device state has changed, such as when a headset is unplugged.

Note: This method is only available on Windows and macOS.

Parameters

deviceId
Device ID.
deviceType
Device type definition. See MEDIA_DEVICE_TYPE.
deviceState
Device state. See MEDIA_DEVICE_STATE_TYPE.

OnAudioDeviceVolumeChanged

Callback when the volume of an audio device or the app changes.

public virtual void OnAudioDeviceVolumeChanged(MEDIA_DEVICE_TYPE deviceType, int volume, bool muted)

This callback is triggered when the volume of the audio playback device, capture device, or app changes.

Note: This callback applies to Windows and macOS only.

Parameters

deviceType
Device type definition. See MEDIA_DEVICE_TYPE.
volume
Volume. Range: [0,255].
muted
Whether the audio device is muted:
  • true: The audio device is muted.
  • false: The audio device is not muted.

OnAudioEffectFinished

Callback when the local audio effect file finishes playing.

public virtual void OnAudioEffectFinished(int soundId)

This callback is triggered when the audio effect finishes playing.

Parameters

soundId
The ID of the specified audio effect. Each audio effect has a unique ID.

OnAudioMixingPositionChanged

Callback for music file playback progress.

public virtual void OnAudioMixingPositionChanged(long position) { }

After calling the StartAudioMixing [2/2] method to play a music file, the SDK triggers this callback every second to report the current playback progress.

Parameters

position
The current playback progress of the music file, in ms.

Return Values

  • 0: Success.
  • < 0: Failure. See Error Codes for details and troubleshooting.

OnAudioMixingStateChanged

Callback when the playback state of the music file changes.

public virtual void OnAudioMixingStateChanged(AUDIO_MIXING_STATE_TYPE state, AUDIO_MIXING_REASON_TYPE reason) {}

This callback is triggered when the playback state of the music file changes and reports the current playback state and error code.

Parameters

state
The playback state of the music file. See AUDIO_MIXING_STATE_TYPE.
reason
Error code. See AUDIO_MIXING_REASON_TYPE.

OnAudioPublishStateChanged

Callback for audio publish state change.

public virtual void OnAudioPublishStateChanged(string channel, STREAM_PUBLISH_STATE oldState,
            STREAM_PUBLISH_STATE newState, int elapseSinceLastState)

Parameters

channel
Channel name.
oldState
Previous publish state. See STREAM_PUBLISH_STATE.
newState
Current publish state. See STREAM_PUBLISH_STATE.
elapseSinceLastState
Time interval between the two state changes (ms).

OnAudioQuality

Reports the audio quality of a remote user.

public virtual void OnAudioQuality(RtcConnection connection, uint remoteUid, int quality, UInt16 delay, UInt16 lost) {}
Deprecated
Deprecated: Use OnRemoteAudioStats instead.

This callback reports the audio quality of a remote user during a call. It is triggered every 2 seconds for each remote user/host. If there are multiple remote users/hosts, this callback is triggered multiple times every 2 seconds.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
The user ID of the sender of the audio stream.
quality
Audio quality. See QUALITY_TYPE.
delay
The delay (ms) from the sender to the receiver, including preprocessing, network transmission, and jitter buffer delay.
lost
The packet loss rate (%) from the sender to the receiver.

OnAudioRoutingChanged

Callback when the audio routing changes.

public virtual void OnAudioRoutingChanged(int routing) {}
Note: This callback is for Android, iOS, and macOS only.

Parameters

routing
The current audio route. See AudioRoute.

OnAudioSubscribeStateChanged

Callback for audio subscribe state change.

public virtual void OnAudioSubscribeStateChanged(string channel, uint uid, STREAM_SUBSCRIBE_STATE oldState,
            STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)

Parameters

channel
Channel name.
uid
ID of the remote user.
oldState
Previous subscribe state. See STREAM_SUBSCRIBE_STATE.
newState
Current subscribe state. See STREAM_SUBSCRIBE_STATE.
elapseSinceLastState
Time interval between the two state changes (ms).

OnAudioVolumeIndication

Reports the audio volume indication of users.

public virtual void OnAudioVolumeIndication(RtcConnection connection, AudioVolumeInfo[] speakers, uint speakerNumber, int totalVolume) {}

This callback is disabled by default. You can enable it by calling EnableAudioVolumeIndication. Once enabled, as long as there are users publishing streams in the channel, the SDK triggers the OnAudioVolumeIndication callback at the time interval set in EnableAudioVolumeIndication after joining the channel. Each time, two OnAudioVolumeIndication callbacks are triggered: one reports the volume information of the local user who is publishing, and the other reports the volume information of up to three remote users with the highest instantaneous volume.

Note: After enabling this feature, if a user mutes themselves (by calling MuteLocalAudioStream), the SDK continues to report the local user's volume indication callback. If a remote user with the highest instantaneous volume mutes themselves for 20 seconds, they will no longer be included in the remote volume indication callback. If all remote users mute themselves, the SDK stops reporting the remote volume indication callback after 20 seconds.

Parameters

connection
Connection information. See RtcConnection.
speakers
User volume information. See the AudioVolumeInfo array. If speakers is empty, it indicates that no remote user is publishing or there are no remote users.
speakerNumber
Number of users.
  • In the local user's callback, as long as the local user is publishing, speakerNumber is always 1.
  • In the remote users' callback, speakerNumber ranges from [0,3]. If there are more than 3 remote users publishing, speakerNumber is 3 in this callback.
totalVolume
Total mixed volume, ranging from [0,255].
  • In the local user's callback, totalVolume is the volume of the local user.
  • In the remote users' callback, totalVolume is the total mixed volume of up to three remote users with the highest instantaneous volume.

OnCameraExposureAreaChanged

Callback when the camera exposure area changes.

public virtual void OnCameraExposureAreaChanged(int x, int y, int width, int height)

Parameters

x
The x-coordinate of the changed exposure area.
y
The y-coordinate of the changed exposure area.
width
The width of the changed exposure area.
height
The height of the changed exposure area.

OnCameraFocusAreaChanged

Callback when the camera focus area changes.

public virtual void OnCameraFocusAreaChanged(int x, int y, int width, int height)

This callback is triggered when the local user calls the SetCameraFocusPositionInPreview method to change the focus position.

Note: This callback is applicable to Android and iOS only.

Parameters

x
The x-coordinate of the changed focus area.
y
The y-coordinate of the changed focus area.
width
The width of the changed focus area.
height
The height of the changed focus area.

OnCameraReady

Callback when the camera is ready.

public virtual void OnCameraReady()
Deprecated
Deprecated: Use OnLocalVideoStateChanged with LOCAL_VIDEO_STREAM_STATE_CAPTURING(1) instead.

This callback indicates that the camera has been successfully opened and video capture can begin.

OnChannelMediaRelayStateChanged

Callback when the state of channel media stream relay changes.

public virtual void OnChannelMediaRelayStateChanged(int state, int code) {}

When the state of channel media stream relay changes, the SDK triggers this callback and reports the current relay state and related error information.

Parameters

state
The state of channel media stream relay. See CHANNEL_MEDIA_RELAY_STATE.
code
The error code of channel media stream relay. See CHANNEL_MEDIA_RELAY_ERROR.

OnClientRoleChangeFailed

Callback when the user role switch fails.

public virtual void OnClientRoleChangeFailed(RtcConnection connection, CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole) { }

This callback informs you of the reason for the failure and the current user role when the user role switch fails.

Trigger Timing

This callback is triggered when the SDK fails to set the user role after the local user joins a channel and calls SetClientRole [1/2] or SetClientRole [2/2].

Parameters

reason
The reason for the user role switch failure. See CLIENT_ROLE_CHANGE_FAILED_REASON.
currentRole
The current user role. See CLIENT_ROLE_TYPE.
connection
Connection information. See RtcConnection.

OnClientRoleChanged

Callback when the user role or audience latency level is switched.

public virtual void OnClientRoleChanged(RtcConnection connection, CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole, ClientRoleOptions newRoleOptions) { }
Note: This callback is not triggered if you call SetClientRole [1/2] or SetClientRole [2/2] to set the user role to BROADCASTER before joining a channel.

Trigger Timing

This callback is triggered in the following situations:

Parameters

connection
Connection information. See RtcConnection.
oldRole
The role before the switch: CLIENT_ROLE_TYPE.
newRole
The role after the switch: CLIENT_ROLE_TYPE.
newRoleOptions
The options of the new role. See ClientRoleOptions.

OnConnectionBanned

Callback when the network connection is banned by the server.

public virtual void OnConnectionBanned(RtcConnection connection) {}
Deprecated
Deprecated: Use OnConnectionStateChanged instead.

Parameters

connection
Connection information. See RtcConnection.

OnConnectionInterrupted

Callback when the network connection is interrupted.

public virtual void OnConnectionInterrupted(RtcConnection connection) {}
Deprecated
Deprecated: Use the OnConnectionStateChanged callback instead.
The SDK triggers this callback when it loses network connection for more than 4 seconds after establishing a connection with the server. After this event is triggered, the SDK attempts to reconnect to the server, so this event can be used for UI prompts. The difference between this callback and OnConnectionLost is:
  • OnConnectionInterrupted is triggered only after successfully joining a channel and when the SDK loses connection with the server for more than 4 seconds.
  • OnConnectionLost is triggered regardless of whether the channel is joined, as long as the SDK fails to connect to the server within 10 seconds.
If the SDK fails to rejoin the channel within 20 minutes after disconnection, it stops trying to reconnect.

Parameters

connection
Connection information. See RtcConnection.

OnConnectionLost

Callback when the network connection is lost and the SDK fails to reconnect to the server within 10 seconds.

public virtual void OnConnectionLost(RtcConnection connection) {}

After calling JoinChannel [2/2], this callback is triggered if the SDK fails to connect to the server within 10 seconds, regardless of whether the channel was successfully joined. If the SDK fails to rejoin the channel within 20 minutes after disconnection, it stops trying to reconnect.

Parameters

connection
Connection information. See RtcConnection.

OnConnectionStateChanged

Callback when the network connection state changes.

public virtual void OnConnectionStateChanged(RtcConnection connection, CONNECTION_STATE_TYPE state, CONNECTION_CHANGED_REASON_TYPE reason) {}

This callback is triggered when the network connection state changes and informs you of the current state and the reason for the change.

Parameters

connection
Connection information. See RtcConnection.
state
Current network connection state. See CONNECTION_STATE_TYPE.
reason
Reason for the change in network connection state. See CONNECTION_CHANGED_REASON_TYPE.

OnEncryptionError

Callback when built-in encryption fails.

public virtual void OnEncryptionError(RtcConnection connection, ENCRYPTION_ERROR_TYPE errorType) {}

After calling EnableEncryption to enable encryption, if encryption or decryption fails on the sender or receiver side, the SDK triggers this callback.

Parameters

connection
Connection information. See RtcConnection.
errorType
Error type. See ENCRYPTION_ERROR_TYPE.

OnError

Callback when an error occurs.

public virtual void OnError(int err, string msg) { }

This callback indicates that a network or media-related error occurred during SDK runtime. In most cases, errors reported by the SDK mean that the SDK cannot recover automatically and requires app intervention or user notification.

Parameters

err
Error code. See ERROR_CODE_TYPE.
msg
Error description.

OnExtensionErrorWithContext

Callback for extension errors.

public virtual void OnExtensionErrorWithContext(ExtensionContext context, int error, string message){}

This callback is triggered when enabling the extension fails or the extension encounters a runtime error, reporting the error code and reason.

Parameters

context
Extension context information. See ExtensionContext.
error
Error code. See the plugin documentation provided by the extension provider.
message
Error reason. See the plugin documentation provided by the extension provider.

OnExtensionEventWithContext

Callback for extension events.

public virtual void OnExtensionEventWithContext(ExtensionContext context, string key, string value){}

To listen for extension events, you need to register this callback.

Parameters

context
Extension context information. See ExtensionContext.
key
The key of the extension property.
value
The value corresponding to the extension property key.

OnExtensionStartedWithContext

Callback when the extension is successfully enabled.

public virtual void OnExtensionEventWithContext(ExtensionContext context, string key, string value){ }

This callback is triggered after the extension is successfully enabled.

Parameters

context
Extension context information. See ExtensionContext.

OnExtensionStoppedWithContext

Callback when the extension is disabled.

public virtual void OnExtensionStoppedWithContext(ExtensionContext context){ }

This callback is triggered after the extension is successfully disabled.

Parameters

context
Extension context information. See ExtensionContext.

OnFacePositionChanged

Reports the result of local face detection.

public virtual void OnFacePositionChanged(int imageWidth, int imageHeight, Rectangle vecRectangle, int[] vecDistance, int numFaces) {}
After calling EnableFaceDetection(true) to enable local face detection, you can use this callback to get the following face detection information in real time:
  • The size of the image captured by the camera
  • The position of the face in the view
  • The distance between the face and the device screen
The distance between the face and the device screen is estimated by the SDK based on the size of the captured image and the position of the face in the view.
Note:
  • This callback is only applicable to Android and iOS platforms.
  • When the face in front of the camera disappears, this callback is triggered immediately; when no face is detected, the callback frequency is reduced to save device power.
  • When the face is too close to the device screen, the SDK does not trigger this callback.

Parameters

imageWidth
Width (px) of the image captured by the camera.
imageHeight
Height (px) of the image captured by the camera.
vecRectangle
Detected face information. See Rectangle.
vecDistance
Distance (cm) between the face and the device screen.
numFaces
Number of faces detected. If 0, no face is detected.

OnFirstLocalAudioFramePublished

Occurs when the first local audio frame is published.

public virtual void OnFirstLocalAudioFramePublished(RtcConnection connection, int elapsed) {}
The SDK triggers this callback in the following situations:
  • After successfully joining a channel by calling JoinChannel [2/2] with local audio enabled.
  • After calling MuteLocalAudioStream(true) and then MuteLocalAudioStream(false).
  • After calling DisableAudio and then EnableAudio.
  • After successfully pushing an audio frame to the SDK using PushAudioFrame.

Parameters

connection
Connection information. See RtcConnection.
elapsed
The time elapsed (ms) from calling JoinChannel [2/2] to the triggering of this callback.

OnFirstLocalVideoFrame

Callback when the first local video frame is rendered.

public virtual void OnFirstLocalVideoFrame(VIDEO_SOURCE_TYPE source, int width, int height, int elapsed) { }

The SDK triggers this callback when the first local video frame is rendered on the local view.

Parameters

source
The type of video source. See VIDEO_SOURCE_TYPE.
width
The width (px) of the locally rendered video.
height
The height (px) of the locally rendered video.
elapsed
Time elapsed (ms) from calling JoinChannel [1/2] or JoinChannel [2/2] to when this event occurs. If StartPreview [1/2]/StartPreview [2/2] was called before joining the channel, this parameter indicates the time elapsed from calling StartPreview [1/2] or StartPreview [2/2] to when this event occurs.

OnFirstLocalVideoFramePublished

Callback when the first local video frame is published.

public virtual void OnFirstLocalVideoFramePublished(RtcConnection connection, int elapsed) {}
The SDK triggers this callback under the following conditions:

Parameters

connection
Connection information. See RtcConnection.
elapsed
The time interval (ms) from calling JoinChannel [1/2] or JoinChannel [2/2] to when this callback is triggered.

OnFirstRemoteAudioDecoded

Occurs when the first remote audio frame is decoded.

public virtual void OnFirstRemoteAudioDecoded(RtcConnection connection, uint uid, int elapsed) { }
Deprecated
Deprecated: Use OnRemoteAudioStateChanged instead.
The SDK triggers this callback in the following situations:
  • When a remote user sends audio after joining the channel for the first time.
  • When a remote user goes offline and rejoins to send audio again. Offline means no audio packet is received within 15 seconds, which may be caused by:
    • The remote user leaves the channel
    • The remote user is disconnected
    • The remote user calls MuteLocalAudioStream to stop sending audio
    • The remote user calls DisableAudio to disable audio

Parameters

connection
Connection information. See RtcConnection.
uid
The ID of the remote user.
elapsed
The delay (ms) from the local user calling JoinChannel [2/2] to the triggering of this callback.

OnFirstRemoteAudioFrame

Occurs when the first remote audio frame is received.

public virtual void OnFirstRemoteAudioFrame(RtcConnection connection, uint userId, int elapsed) { }
Deprecated
Deprecated: Use OnRemoteAudioStateChanged instead.

Parameters

connection
Connection information. See RtcConnection.
userId
The user ID of the remote user who sends the audio frame.
elapsed
The delay (ms) from the local user calling JoinChannel [2/2] to the triggering of this callback.

OnFirstRemoteVideoDecoded

Callback when the first remote video frame is received and decoded.

public virtual void OnFirstRemoteVideoDecoded(RtcConnection connection, uint remoteUid, int width, int height, int elapsed) {}
The SDK triggers this callback under the following conditions:
  • A remote user sends video after joining the channel for the first time.
  • A remote user sends video after going offline and coming back online. Possible reasons for the interruption include:
    • The remote user leaves the channel.
    • The remote user gets disconnected.
    • The remote user calls DisableVideo to disable the video module.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
User ID indicating which user's video stream it is.
width
Width (px) of the video stream.
height
Height (px) of the video stream.
elapsed
Delay (ms) from when JoinChannel [1/2] or JoinChannel [2/2] is called locally to when this callback is triggered.

OnFirstRemoteVideoFrame

Callback when the renderer receives the first frame of remote video.

public virtual void OnFirstRemoteVideoFrame(RtcConnection connection, uint remoteUid, int width, int height, int elapsed) {}
Note: This callback is triggered only when the SDK handles rendering. If you use custom video rendering, this callback is not triggered. You need to implement it yourself outside the SDK.

Parameters

remoteUid
User ID that specifies whose video stream it is.
connection
Connection information. See RtcConnection.
width
Width of the video stream (px).
height
Height of the video stream (px).
elapsed
Time elapsed (ms) from the local call to JoinChannel [1/2] or JoinChannel [2/2] until this event occurs.

OnJoinChannelSuccess

Callback when successfully joined a channel.

public virtual void OnJoinChannelSuccess(RtcConnection connection, int elapsed) {}

This callback indicates that the client has successfully joined the specified channel.

Trigger Timing

This callback is triggered after you successfully join a channel by calling JoinChannel [1/2], JoinChannel [2/2], JoinChannelWithUserAccount [1/2], JoinChannelWithUserAccount [2/2], or JoinChannelEx.

Parameters

connection
Connection information. See RtcConnection.
elapsed
Time elapsed (ms) from the local call to JoinChannel [2/2] to the occurrence of this event.

OnLastmileProbeResult

Callback for the last mile network probe result before a call.

public virtual void OnLastmileProbeResult(LastmileProbeResult result)

After calling StartLastmileProbeTest, the SDK returns this callback within approximately 30 seconds.

Parameters

result
Last mile probe result for uplink and downlink. See LastmileProbeResult.

OnLastmileQuality

Callback for last mile network quality before joining a channel.

public virtual void OnLastmileQuality(int quality)

This callback reports the result of the last mile network probe before the local user joins a channel. The last mile refers to the network connection between the device and the Agora edge server. Before joining a channel, after calling StartLastmileProbeTest, the SDK triggers this callback to report the last mile network probe result for the local user.

Parameters

quality
Last mile network quality. See QUALITY_TYPE.

OnLeaveChannel

Callback when leaving a channel.

public virtual void OnLeaveChannel(RtcConnection connection, RtcStats stats) {}

You can use this callback to get information such as the total call duration and the amount of data sent and received by the SDK during the call.

Trigger Timing

This callback is triggered after you successfully leave a channel by calling LeaveChannel [1/2], LeaveChannel [2/2], LeaveChannelEx [1/2], or LeaveChannelEx [2/2].

Parameters

connection
Connection information. See RtcConnection.
stats
Call statistics. See RtcStats.

OnLocalAudioStateChanged

Callback when the local audio state changes.

public virtual void OnLocalAudioStateChanged(RtcConnection connection, LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_REASON reason)

When the state of the local audio (including microphone capture and audio encoding) changes, the SDK triggers this callback to report the current local audio state. When a local audio issue occurs, this callback helps you understand the current audio state and the reason for the issue, making it easier to troubleshoot.

Note: When the state is LOCAL_AUDIO_STREAM_STATE_FAILED (3), you can check the returned error information in the error parameter.

Parameters

connection
Connection information. See RtcConnection.
state
Current local audio state. See LOCAL_AUDIO_STREAM_STATE.
reason
Reason for the local audio state change. See LOCAL_AUDIO_STREAM_REASON.

OnLocalAudioStats

Callback for statistics of the local audio stream during a call.

public virtual void OnLocalAudioStats(RtcConnection connection, LocalAudioStats stats) {}

The SDK triggers this callback every 2 seconds.

Parameters

connection
Connection information. See RtcConnection.
stats
Local audio statistics. See LocalAudioStats.

OnLocalUserRegistered

Callback when the local user successfully registers a User Account.

public virtual void OnLocalUserRegistered(uint uid, string userAccount) {}

This callback is triggered after the local user successfully registers a User Account by calling RegisterLocalUserAccount, or joins a channel by calling JoinChannelWithUserAccount [2/2]. It informs you of the local user's UID and User Account.

Parameters

uid
The local user's ID.
userAccount
The local user's User Account.

OnLocalVideoEvent

Callback triggered when a local video event occurs.

public virtual void OnLocalVideoEvent(VideoSourceType source, LocalVideoEventType event)
Since
Available since v4.6.1.

You can use this callback to get the reason for the local video event.

Parameters

source
The video source type. See VIDEO_SOURCE_TYPE.
event
The local video event type. See LOCAL_VIDEO_EVENT_TYPE.

OnLocalVideoStateChanged

Callback when the local video state changes.

public virtual void OnLocalVideoStateChanged(VIDEO_SOURCE_TYPE source, LOCAL_VIDEO_STREAM_STATE state, LOCAL_VIDEO_STREAM_REASON reason)

This callback is triggered when the local video state changes. The SDK reports the current local video state and the reason for the change.

Note:
  • Frame duplication detection applies only to video frames with resolution greater than 200 × 200, frame rate ≥ 10 fps, and bitrate less than 20 Kbps.
  • If an exception occurs during video capture, normally you can troubleshoot via the reason parameter in this callback. However, on some devices, when capture issues occur (e.g., freeze), Android may not throw any error callback, so the SDK cannot report the reason for local video state changes. In this case, you can determine whether frames are being captured by checking if this callback reports state as LOCAL_VIDEO_STREAM_STATE_CAPTURING or LOCAL_VIDEO_STREAM_STATE_ENCODING, and the captureFrameRate in the OnLocalVideoStats callback is 0.

Trigger Timing

  • The SDK triggers this callback in the following cases with state as LOCAL_VIDEO_STREAM_STATE_FAILED and reason as LOCAL_VIDEO_STREAM_REASON_CAPTURE_FAILURE:
    • The app goes to the background and the system reclaims the camera.
    • On Android 9 and above, after the app stays in the background for a while, the system revokes camera permissions.
    • On Android 6 and above, if the camera is occupied by a third-party app for a while and then released, the SDK triggers this callback and reports OnLocalVideoStateChanged(LOCAL_VIDEO_STREAM_STATE_CAPTURING, LOCAL_VIDEO_STREAM_REASON_OK).
    • The camera starts normally but does not output captured video for 4 consecutive seconds.
  • When the camera outputs captured video frames, if the SDK detects 15 consecutive duplicate frames, it triggers this callback with state as LOCAL_VIDEO_STREAM_STATE_CAPTURING and reason as LOCAL_VIDEO_STREAM_REASON_CAPTURE_FAILURE.

Parameters

source
Type of video source. See VIDEO_SOURCE_TYPE.
state
Local video state. See LOCAL_VIDEO_STREAM_STATE.
reason
Reason for the local video state change. See LOCAL_VIDEO_STREAM_REASON.

OnLocalVideoStats

Callback for local video stream statistics.

public virtual void OnLocalVideoStats(RtcConnection connection, LocalVideoStats stats) {}

This callback reports statistics about the local device sending video streams. It is triggered every 2 seconds.

Parameters

connection
Connection information. See RtcConnection.
stats
Local video stream statistics. See LocalVideoStats.

OnMultipathStats

Callback for multipath transmission statistics.

public virtual void OnMultipathStats(RtcConnection connection, MultipathStats stats)
Since
Available since v4.6.2.

Trigger Timing

This callback is triggered after you set enableMultipath to true to enable multipath transmission.

Parameters

stats
Multipath transmission statistics. See MultipathStats.

OnNetworkQuality

Callback for uplink and downlink last mile network quality of each user during a call.

public virtual void OnNetworkQuality(RtcConnection connection, uint remoteUid, int txQuality, int rxQuality) {}

This callback reports the last mile network status of each user during a call. The last mile refers to the network connection between the device and the Agora edge server. This callback is triggered every 2 seconds. If there are multiple remote users, it is triggered multiple times every 2 seconds. The callback reports network quality via broadcast packets within the channel. Excessive broadcast packets may cause a broadcast storm. To prevent this, the callback supports reporting network quality for up to 4 remote hosts simultaneously by default.

Note: When the user is not sending streams, txQuality is UNKNOWN; when not receiving streams, rxQuality is UNKNOWN.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
User ID. Indicates the network quality report is for the user with this ID. If uid is 0, the report is for the local user.
txQuality
Uplink network quality of the user, calculated based on sending bitrate, uplink packet loss rate, average RTT, and network jitter. This value reflects the current uplink quality and helps determine if the current video encoding settings are supported. For example, with an uplink bitrate of 1000 Kbps, 640 × 480 resolution at 15 fps is supported in live broadcast scenarios, but 1280 × 720 resolution may not be. See QUALITY_TYPE.
rxQuality
Downlink network quality of the user, calculated based on downlink packet loss rate, average RTT, and network jitter. See QUALITY_TYPE.

OnNetworkTypeChanged

Callback when the local network type changes.

public virtual void OnNetworkTypeChanged(RtcConnection connection, NETWORK_TYPE type) {}

When the local network connection type changes, the SDK triggers this callback and specifies the current network type. You can use this callback to get the current network type. When the connection is interrupted, this callback helps determine whether the cause is a network switch or poor network conditions.

Parameters

connection
Connection information. See RtcConnection.
type
Local network connection type. See NETWORK_TYPE.

OnPermissionError

Callback when failing to obtain device permission.

public virtual void OnPermissionError(PERMISSION_TYPE permissionType) {}

When the SDK fails to obtain device permission, it triggers this callback to report which device permission could not be obtained.

Parameters

permissionType
Device permission type. See PERMISSION_TYPE.

OnPermissionGranted

Callback when a permission is granted.

public virtual void OnPermissionGranted(PermissionType permissionType)

Parameters

permissionType
Permission type. See PERMISSION_TYPE.

OnProxyConnected

Callback for proxy connection status.

public virtual void OnProxyConnected(string channel, uint uid, PROXY_TYPE proxyType, string localProxyIp, int elapsed)

You can use this callback to monitor the SDK's proxy connection status. For example, when a user calls SetCloudProxy to set a proxy and successfully joins a channel, the SDK triggers this callback to report the user ID, the type of proxy connected, and the time elapsed from calling JoinChannel [2/2] to this callback being triggered.

Parameters

channel
Channel name.
uid
User ID
proxyType
Type of proxy connected. See PROXY_TYPE.
localProxyIp
Reserved parameter, currently not supported.
elapsed
Time elapsed (ms) from calling JoinChannel [2/2] to the SDK triggering this callback.

OnRejoinChannelSuccess

Callback when successfully rejoined a channel.

public virtual void OnRejoinChannelSuccess(RtcConnection connection, int elapsed) {}

Trigger Timing

Due to network issues, the client may lose connection with the server. The SDK will attempt to reconnect automatically. This callback is triggered after a successful reconnection.

Parameters

connection
Connection information. See RtcConnection.
elapsed
Time interval (ms) from the call to JoinChannel [2/2] to the triggering of this callback.

OnRemoteAudioStateChanged

Callback when the remote audio stream state changes.

public virtual void OnRemoteAudioStateChanged(RtcConnection connection, uint remoteUid, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed) {}

When the audio state of a remote user (in a communication scenario) or host (in a live streaming scenario) changes, the SDK triggers this callback to report the current remote audio stream state to the local user.

Note: When there are more than 32 users (in a communication scenario) or hosts (in a live streaming scenario) in the channel, this callback may be inaccurate.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
ID of the remote user whose audio state changed.
state
Remote audio stream state. See REMOTE_AUDIO_STATE.
reason
Specific reason for the remote audio stream state change. See REMOTE_AUDIO_STATE_REASON.
elapsed
Time elapsed (in ms) from the local user calling JoinChannel [2/2] to the occurrence of this event.

OnRemoteAudioStats

Callback for statistics of the remote audio stream during a call.

public virtual void OnRemoteAudioStats(RtcConnection connection, RemoteAudioStats stats) {}

This callback is triggered every 2 seconds for each remote user/host sending an audio stream. If multiple remote users/hosts are sending audio streams, this callback is triggered multiple times every 2 seconds.

Parameters

connection
Connection information. See RtcConnection.
stats
Received remote audio statistics. See RemoteAudioStats.

OnRemoteAudioTransportStats

Callback for transport statistics of the remote audio stream during a call.

public virtual void OnRemoteAudioTransportStats(RtcConnection connection, uint remoteUid, UInt16 delay, UInt16 lost, UInt16 rxKBitRate) {}

Deprecated: Use OnRemoteAudioStats instead. This callback describes end-to-end network statistics for a remote user during a call, calculated based on audio packets. It uses objective data such as packet loss and network delay to reflect the current network status. During a call, when the user receives audio packets from a remote user/host, this callback is triggered every 2 seconds.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
User ID indicating which user/host the audio packet belongs to.
delay
Delay (ms) from the sender to the receiver for audio packets.
lost
Packet loss rate (%) from the sender to the receiver for audio packets.
rxKBitrate
Received bitrate (Kbps) of the remote audio packets.

OnRemoteSubscribeFallbackToAudioOnly

Callback when the subscribed stream falls back to audio-only or recovers to audio-video.

public virtual void OnRemoteSubscribeFallbackToAudioOnly(uint uid, bool isFallbackOrRecover)
After you call SetRemoteSubscribeFallbackOption and set option to STREAM_FALLBACK_OPTION_AUDIO_ONLY, this callback is triggered in the following cases:
  • The downlink network condition is poor, and the subscribed audio-video stream falls back to audio-only.
  • The downlink network condition improves, and the subscribed audio stream recovers to audio-video.
Note: When the subscribed stream falls back to a lower-quality video stream due to poor network conditions, you can monitor the switch between remote video streams via the OnRemoteVideoStats callback.

Parameters

uid
The user ID of the remote user.
isFallbackOrRecover
  • true: The subscribed stream has fallen back to audio-only due to poor network conditions.
  • false: The subscribed stream has recovered to audio-video due to improved network conditions.

OnRemoteVideoStateChanged

Callback when the remote video state changes.

public virtual void OnRemoteVideoStateChanged(RtcConnection connection, uint remoteUid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed) {}
Note: When the number of users (in communication scenario) or hosts (in live streaming scenario) in the channel exceeds 32, this callback may be inaccurate.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
Remote user ID whose video state has changed.
state
Remote video stream state. See REMOTE_VIDEO_STATE.
reason
Specific reason for the remote video stream state change. See REMOTE_VIDEO_STATE_REASON.
elapsed
Time elapsed (ms) from the local user calling JoinChannel [2/2] to when this event occurs.

OnRemoteVideoStats

Callback for remote video stream statistics during a call.

public virtual void OnRemoteVideoStats(RtcConnection connection, RemoteVideoStats stats) {}

This callback reports end-to-end video stream statistics of remote users during a call. It is triggered every 2 seconds for each remote user/host. If there are multiple remote users/hosts, this callback is triggered multiple times every 2 seconds.

Parameters

connection
Connection information. See RtcConnection.
stats
Remote video statistics. See RemoteVideoStats.

OnRemoteVideoTransportStats

Callback for transport statistics of remote video streams during a call.

public virtual void OnRemoteVideoTransportStats(RtcConnection connection, uint remoteUid, UInt16 delay, UInt16 lost, UInt16 rxKBitRate) {}
Deprecated
Deprecated: This callback is deprecated. Use OnRemoteVideoStats instead.

This callback reports end-to-end network statistics of remote users during a call, calculated based on video packets. It provides objective data such as packet loss and network delay to reflect the current network status. During a call, when a user receives video packets sent by a remote user/host, this callback is triggered every 2 seconds.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
User ID that specifies whose video packet it is (user/host).
delay
Delay (ms) from sender to receiver for the video packet.
lost
Packet loss rate (%) from sender to receiver for the video packet.
rxKBitRate
Receiving bitrate of the remote video packet (Kbps).

OnRenewTokenResult

Callback for the result of renewToken method call.

public virtual void OnRenewTokenResult(RtcConnection connection, string token, RENEW_TOKEN_ERROR_CODE code)
Since
Available since v4.6.2.

This callback is triggered after you call the renewToken method to update the token, to notify the result of the update.

Parameters

token
The updated token.
code
Error code. See RENEW_TOKEN_ERROR_CODE.

OnRequestToken

Callback when the token has expired.

public virtual void OnRequestToken(RtcConnection connection) {}
During audio and video interaction, if the token becomes invalid, the SDK triggers this callback to report that the token has expired. When you receive this callback, you need to generate a new token on your server and update the token using one of the following methods:

Parameters

connection
Connection information. See RtcConnection.

OnRhythmPlayerStateChanged

Callback when the virtual metronome state changes.

public virtual void OnRhythmPlayerStateChanged(RHYTHM_PLAYER_STATE_TYPE state, RHYTHM_PLAYER_REASON reason)
Deprecated
Deprecated since v4.6.2.

This callback is triggered when the virtual metronome state changes. If the virtual metronome encounters a failure, this callback helps you understand the current state and the reason for the failure, facilitating troubleshooting.

Note: (Android and iOS only)

Parameters

state
Current state of the virtual metronome. See RHYTHM_PLAYER_STATE_TYPE.
reason
Error code and message when an error occurs in the virtual metronome. See RHYTHM_PLAYER_REASON.

OnRtcStats

Callback for statistics related to the current call.

public virtual void OnRtcStats(RtcConnection connection, RtcStats stats) {}

Trigger Timing

The SDK periodically reports statistics of the current call to the app, triggered every two seconds.

Parameters

connection
Connection information. See RtcConnection.
stats
RTC engine statistics. See RtcStats.

OnRtmpStreamingEvent

Callback for RTMP streaming events.

public virtual void OnRtmpStreamingEvent(string url, RTMP_STREAMING_EVENT eventCode)

Parameters

url
The RTMP streaming URL.
eventCode
The RTMP streaming event code. See RTMP_STREAMING_EVENT.

OnRtmpStreamingStateChanged

Callback when the RTMP streaming state changes.

public virtual void OnRtmpStreamingStateChanged(string url, RTMP_STREAM_PUBLISH_STATE state, RTMP_STREAM_PUBLISH_REASON reason)

The SDK triggers this callback when the RTMP streaming state changes. The callback provides the URL whose state changed and the current streaming state. This helps users understand the current streaming status. If a streaming error occurs, you can use the returned error code to identify the cause and troubleshoot the issue.

Parameters

url
The URL whose streaming state has changed.
state
The current streaming state. See RTMP_STREAM_PUBLISH_STATE.
reason
The reason for the streaming state change. See RTMP_STREAM_PUBLISH_REASON.

OnSnapshotTaken

Callback for snapshot result.

public virtual void OnSnapshotTaken(RtcConnection connection, uint uid, string filePath, int width, int height, int errCode) { }

After successfully calling TakeSnapshot [1/2], the SDK triggers this callback to report whether the snapshot succeeded and provide snapshot details.

Parameters

uid
User ID. If uid is 0, it refers to the local user.
connection
Connection information. See RtcConnection.
filePath
Local path where the snapshot is saved.
width
Image width (px).
height
Image height (px).
errCode
Indicates success or failure of the snapshot.
  • 0: Snapshot succeeded.
  • < 0: Snapshot failed.
    • -1: Failed to write to file or JPEG encoding failed.
    • -2: No video frame received from the specified user within 1 second after calling TakeSnapshot [1/2]. Possible reasons: local capture stopped, remote user stopped publishing, or video data processing is blocked.
    • -3: TakeSnapshot [1/2] is called too frequently.

OnStreamMessage

Occurs when a stream message is received from a remote user.

public virtual void OnStreamMessage(RtcConnection connection, uint remoteUid, int streamId, byte[] data, ulong length, ulong sentTs) { }

This callback indicates that the local user has received a stream message sent by a remote user using the SendStreamMessage method.

Note: If you need a more comprehensive, low-latency, high-concurrency, and scalable real-time messaging and state synchronization solution, we recommend using Real-time Messaging.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
The user ID of the sender.
streamId
The stream ID of the received message.
data
The received data.
length
The length of the data in bytes.
sentTs
The timestamp when the data stream was sent.

OnStreamMessageError

Occurs when a stream message from a remote user fails to be received.

public virtual void OnStreamMessageError(RtcConnection connection, uint remoteUid, int streamId, int code, int missed, int cached) {}

This callback indicates that the local user failed to receive a stream message sent by a remote user using the SendStreamMessage method.

Note: If you need a more comprehensive, low-latency, high-concurrency, and scalable real-time messaging and state synchronization solution, we recommend using Real-time Messaging.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
The user ID of the sender.
streamId
The stream ID of the received message.
code
The error code. See Error Codes.
missed
The number of lost messages.
cached
The number of messages cached after the data stream was interrupted.

OnTokenPrivilegeWillExpire

Callback when the token will expire in 30 seconds.

public virtual void OnTokenPrivilegeWillExpire(RtcConnection connection, string token) {}
When you receive this callback, you need to generate a new token on your server and update the token using one of the following methods:

Trigger Timing

During audio and video interaction, the SDK triggers this callback 30 seconds before the token expires to remind the app to update the token.

Parameters

connection
Connection information. See RtcConnection.
token
The token that is about to expire.

OnTranscodedStreamLayoutInfo

Occurs when a mixed video stream with layout information is received.

public virtual void OnTranscodedStreamLayoutInfo(RtcConnection connection, uint uid, int width, int height, int layoutCount, VideoLayout[] layoutlist)

This callback is triggered when the local client receives a mixed video stream from the mixing server for the first time, or when the layout information of the mixed stream changes. The SDK reports the layout information of each sub-stream in the mixed video stream.

Note: This callback is only applicable to Android and iOS.

Parameters

connection
Connection information. See RtcConnection.
uid
User ID of the publisher of the mixed video stream.
width
Width (px) of the mixed video stream.
height
Height (px) of the mixed video stream.
layoutCount
Number of layout entries in the mixed video stream.
layoutlist
Detailed layout information of a mixed video stream. See VideoLayout.

OnUplinkNetworkInfoUpdated

Callback for uplink network information changes.

public virtual void OnUplinkNetworkInfoUpdated(UplinkNetworkInfo info) {}

The SDK triggers this callback only when the uplink network information changes.

Note: This callback only applies when pushing externally encoded video data in H.264 format to the SDK.

Parameters

info
Uplink network information. See UplinkNetworkInfo.

OnUserEnableLocalVideo

Callback when a remote user enables or disables local video capture.

public virtual void OnUserEnableLocalVideo(RtcConnection connection, uint remoteUid, bool enabled) {}
Deprecated
Deprecated: This callback is deprecated. Use the OnRemoteVideoStateChanged callback with the following enumerations:
  • REMOTE_VIDEO_STATE_STOPPED(0) and REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED(5).
  • REMOTE_VIDEO_STATE_DECODING (2) and REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED(6).

This callback is triggered when a remote user calls the EnableLocalVideo method to enable or disable video capture.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
User ID indicating which user's video stream it is.
enabled
Whether the remote user enables video capture:
  • true: The user has enabled the video feature. Other users can receive this user's video stream.
  • false: The user has disabled the video feature. The user can still receive other users' video streams, but others cannot receive this user's video stream.

OnUserEnableVideo

Callback when a remote user enables or disables the video module.

public virtual void OnUserEnableVideo(RtcConnection connection, uint remoteUid, bool enabled) {}

Disabling the video feature means the user can only make voice calls, cannot display or send their own video, nor receive or display others' video. This callback is triggered when a remote user calls the EnableVideo or DisableVideo method to enable or disable the video module.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
User ID indicating which user's video stream it is.
enabled
  • true: The user has enabled the video feature.
  • false: The user has disabled the video feature.

OnUserInfoUpdated

Callback when remote user information is updated.

public virtual void OnUserInfoUpdated(uint uid, UserInfo info)

After a remote user joins a channel, the SDK obtains the UID and User Account of the remote user, then caches a mapping table containing the remote user's UID and User Account, and triggers this callback locally.

Parameters

uid
Remote user ID.
info
The UserInfo object identifying user information, including UID and User Account. See the UserInfo class.

OnUserJoined

Callback when a remote user (in communication) or host (in live broadcast) joins the current channel.

public virtual void OnUserJoined(RtcConnection connection, uint remoteUid, int elapsed) {}
  • In communication scenarios, this callback indicates that a remote user has joined the channel. If other users are already in the channel before the new user joins, the new user also receives callbacks for those existing users.
  • In live broadcast scenarios, this callback indicates that a host has joined the channel. If other hosts are already in the channel before the new one joins, the new user also receives callbacks for those existing hosts. It is recommended to keep the number of co-hosts under 32 (including no more than 17 video co-hosts).

Trigger Timing

This callback is triggered in the following situations:
  • A remote user/host joins the channel.
  • A remote user changes their role to host after joining the channel.
  • A remote user/host rejoins the channel after a network interruption.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
ID of the remote user/host who joined the channel.
elapsed
Time elapsed (ms) from the local user calling JoinChannel [1/2] or JoinChannel [2/2] to the triggering of this callback.

OnUserMuteAudio

Callback when a remote user (in a communication scenario) or host (in a live streaming scenario) stops or resumes sending audio stream.

public virtual void OnUserMuteAudio(RtcConnection connection, uint remoteUid, bool muted) { }

This callback is triggered when the remote user calls the MuteLocalAudioStream method to disable or enable audio sending.

Note: When there are more than 32 users (in a communication scenario) or hosts (in a live streaming scenario) in the channel, this callback may be inaccurate.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
User ID.
muted
Whether the user is muted:
  • true: The user has muted the audio.
  • false: The user has unmuted the audio.

OnUserMuteVideo

Callback when a remote user stops or resumes publishing the video stream.

public virtual void OnUserMuteVideo(RtcConnection connection, uint remoteUid, bool muted) {}

When a remote user calls MuteLocalVideoStream to stop or resume publishing the video stream, the SDK triggers this callback to report the remote user's publishing status to the local user.

Note: When the number of users (in communication scenario) or hosts (in live streaming scenario) in the channel exceeds 32, this callback may be inaccurate.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
Remote user ID.
muted
Whether the remote user stops publishing the video stream:
  • true: Stops publishing the video stream.
  • false: Publishes the video stream.

OnUserOffline

Callback when a remote user (in communication) or host (in live broadcast) leaves the current channel.

public virtual void OnUserOffline(RtcConnection connection, uint remoteUid, USER_OFFLINE_REASON_TYPE reason) {}
Users generally leave the channel for the following reasons:
  • Normal departure: The remote user or host sends a 'goodbye' message and leaves the channel voluntarily.
  • Timeout disconnection: If no data packet is received from the other party within a certain period (20 seconds for communication, slightly longer for live broadcast), the user is considered disconnected. In poor network conditions, false positives may occur. It is recommended to use the RTM SDK for reliable disconnection detection.

Trigger Timing

During audio and video interaction, this callback is triggered when a remote user or host leaves the current channel.

Parameters

connection
Connection information. See RtcConnection.
remoteUid
ID of the remote user or host who went offline.
reason
Reason why the remote user (in communication) or host (in live broadcast) went offline. See USER_OFFLINE_REASON_TYPE.

OnVideoDeviceStateChanged

Callback for video device state changes.

public virtual void OnVideoDeviceStateChanged(string deviceId, int deviceType, int deviceState)

This callback notifies you when the system video device state changes, such as being unplugged or removed. If an external camera is used for capturing and it is unplugged, the video will be interrupted.

Note: (Windows and macOS only)

Parameters

deviceId
Device ID.
deviceType
Device type. See MEDIA_DEVICE_TYPE.
deviceState
Device state. See MEDIA_DEVICE_STATE_TYPE.

OnVideoPublishStateChanged

Callback when the video publishing state changes.

public virtual void OnVideoPublishStateChanged(VIDEO_SOURCE_TYPE source, string channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) { }

Parameters

channel
Channel name.
source
Type of video source. See VIDEO_SOURCE_TYPE.
oldState
Previous publishing state. See STREAM_PUBLISH_STATE.
newState
Current publishing state. See STREAM_PUBLISH_STATE.
elapseSinceLastState
Time interval (ms) between the two state changes.

OnVideoRenderingTracingResult

Reports video frame rendering events.

public virtual void OnVideoRenderingTracingResult(RtcConnection connection, uint uid, MEDIA_TRACE_EVENT currentEvent, VideoRenderingTracingInfo tracingInfo) { }

After calling the StartMediaRenderingTracing method or joining a channel, the SDK triggers this callback to report video frame rendering events and metrics during the rendering process. Developers can optimize based on these metrics to improve rendering efficiency.

Parameters

connection
Connection information. See RtcConnection.
uid
User ID.
currentEvent
Current video frame rendering event. See MEDIA_TRACE_EVENT.
tracingInfo
Metrics during the video frame rendering process. Developers should minimize these values to improve rendering efficiency. See VideoRenderingTracingInfo.

OnVideoSizeChanged

Callback when the size or rotation of local or remote video changes.

public virtual void OnVideoSizeChanged(RtcConnection connection, VIDEO_SOURCE_TYPE sourceType, uint uid, int width, int height, int rotation) { }

Parameters

connection
Connection information. See RtcConnection.
sourceType
Type of video source. See VIDEO_SOURCE_TYPE.
uid
User ID whose image size or rotation changes (the uid of the local user is 0, in which case the video is a local preview).
width
Width of the video stream (pixels).
height
Height of the video stream (pixels).
rotation
Rotation information, range [0,360).
Note: On iOS, this parameter is always 0.

OnVideoStopped

Callback when the video function is stopped.

public virtual void OnVideoStopped()
Deprecated
Deprecated: Use the OnLocalVideoStateChanged callback with LOCAL_VIDEO_STREAM_STATE_STOPPED(0) instead.

If the app needs to handle the view after stopping the video (such as displaying other content), it can do so in this callback.

OnVideoSubscribeStateChanged

Callback for video subscribe state change.

public virtual void OnVideoSubscribeStateChanged(string channel, uint uid, STREAM_SUBSCRIBE_STATE oldState,
            STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)

Parameters

channel
Channel name.
uid
ID of the remote user.
oldState
Previous subscribe state. See STREAM_SUBSCRIBE_STATE.
newState
Current subscribe state. See STREAM_SUBSCRIBE_STATE.
elapseSinceLastState
Time interval between the two state changes (ms).