AgoraRtcEventHandlers class
Constructors
-
AgoraRtcEventHandlers({void onJoinChannelSuccess(RtcConnection connection, int elapsed)?, void onRejoinChannelSuccess(RtcConnection connection, int elapsed)?, void onProxyConnected(String channel, int uid, ProxyType proxyType, String localProxyIp, int elapsed)?, void onError(ErrorCodeType err, String msg)?, void onAudioQuality(RtcConnection connection, int remoteUid, QualityType quality, int delay, int lost)?, void onLastmileProbeResult(LastmileProbeResult result)?, void onAudioVolumeIndication(RtcConnection connection, List<AudioVolumeInfo> speakers, int speakerNumber, int totalVolume)?, void onLeaveChannel(RtcConnection connection, RtcStats stats)?, void onRtcStats(RtcConnection connection, RtcStats stats)?, void onAudioDeviceStateChanged(String deviceId, MediaDeviceType deviceType, MediaDeviceStateType deviceState)?, void onAudioMixingFinished()?, void onAudioEffectFinished(int soundId)?, void onVideoDeviceStateChanged(String deviceId, MediaDeviceType deviceType, MediaDeviceStateType deviceState)?, void onNetworkQuality(RtcConnection connection, int remoteUid, QualityType txQuality, QualityType rxQuality)?, void onIntraRequestReceived(RtcConnection connection)?, void onUplinkNetworkInfoUpdated(UplinkNetworkInfo info)?, void onDownlinkNetworkInfoUpdated(DownlinkNetworkInfo info)?, void onLastmileQuality(QualityType quality)?, void onFirstLocalVideoFrame(VideoSourceType source, int width, int height, int elapsed)?, void onFirstLocalVideoFramePublished(VideoSourceType source, int elapsed)?, void onFirstRemoteVideoDecoded(RtcConnection connection, int remoteUid, int width, int height, int elapsed)?, void onVideoSizeChanged(RtcConnection connection, VideoSourceType sourceType, int uid, int width, int height, int rotation)?, void onLocalVideoStateChanged(VideoSourceType source, LocalVideoStreamState state, LocalVideoStreamReason error)?, void onRemoteVideoStateChanged(RtcConnection connection, int remoteUid, RemoteVideoState state, RemoteVideoStateReason reason, int elapsed)?, void onFirstRemoteVideoFrame(RtcConnection connection, int remoteUid, int width, int height, int elapsed)?, void onUserJoined(RtcConnection connection, int remoteUid, int elapsed)?, void onUserOffline(RtcConnection connection, int remoteUid, UserOfflineReasonType reason)?, void onUserMuteAudio(RtcConnection connection, int remoteUid, bool muted)?, void onUserMuteVideo(RtcConnection connection, int remoteUid, bool muted)?, void onUserEnableVideo(RtcConnection connection, int remoteUid, bool enabled)?, void onUserStateChanged(RtcConnection connection, int remoteUid, int state)?, void onUserEnableLocalVideo(RtcConnection connection, int remoteUid, bool enabled)?, void onLocalAudioStats(RtcConnection connection, LocalAudioStats stats)?, void onRemoteAudioStats(RtcConnection connection, RemoteAudioStats stats)?, void onLocalVideoStats(VideoSourceType source, LocalVideoStats stats)?, void onRemoteVideoStats(RtcConnection connection, RemoteVideoStats stats)?, void onCameraReady()?, void onCameraFocusAreaChanged(int x, int y, int width, int height)?, void onCameraExposureAreaChanged(int x, int y, int width, int height)?, void onFacePositionChanged(int imageWidth, int imageHeight, List<Rectangle> vecRectangle, List<int> vecDistance, int numFaces)?, void onVideoStopped()?, void onAudioMixingStateChanged(AudioMixingStateType state, AudioMixingReasonType reason)?, void onRhythmPlayerStateChanged(RhythmPlayerStateType state, RhythmPlayerReason errorCode)?, void onConnectionLost(RtcConnection connection)?, void onConnectionInterrupted(RtcConnection connection)?, void onConnectionBanned(RtcConnection connection)?, void onStreamMessage(RtcConnection connection, int remoteUid, int streamId, Uint8List data, int length, int sentTs)?, void onStreamMessageError(RtcConnection connection, int remoteUid, int streamId, ErrorCodeType code, int missed, int cached)?, void onRequestToken(RtcConnection connection)?, void onTokenPrivilegeWillExpire(RtcConnection connection, String token)?, void onFirstLocalAudioFramePublished(RtcConnection connection, int elapsed)?, void onFirstRemoteAudioFrame(RtcConnection connection, int userId, int elapsed)?, void onFirstRemoteAudioDecoded(RtcConnection connection, int uid, int elapsed)?, void onLocalAudioStateChanged(RtcConnection connection, LocalAudioStreamState state, LocalAudioStreamReason error)?, void onRemoteAudioStateChanged(RtcConnection connection, int remoteUid, RemoteAudioState state, RemoteAudioStateReason reason, int elapsed)?, void onActiveSpeaker(RtcConnection connection, int uid)?, void onContentInspectResult(ContentInspectResult result)?, void onSnapshotTaken(RtcConnection connection, int uid, String filePath, int width, int height, int errCode)?, void onClientRoleChanged(RtcConnection connection, ClientRoleType oldRole, ClientRoleType newRole, ClientRoleOptions newRoleOptions)?, void onClientRoleChangeFailed(RtcConnection connection, ClientRoleChangeFailedReason reason, ClientRoleType currentRole)?, void onAudioDeviceVolumeChanged(MediaDeviceType deviceType, int volume, bool muted)?, void onRtmpStreamingStateChanged(String url, RtmpStreamPublishState state, RtmpStreamPublishReason errCode)?, void onRtmpStreamingEvent(String url, RtmpStreamingEvent eventCode)?, void onTranscodingUpdated()?, void onAudioRoutingChanged(int routing)?, void onChannelMediaRelayStateChanged(ChannelMediaRelayState state, ChannelMediaRelayError code)?, void onLocalPublishFallbackToAudioOnly(bool isFallbackOrRecover)?, void onRemoteSubscribeFallbackToAudioOnly(int uid, bool isFallbackOrRecover)?, void onRemoteAudioTransportStats(RtcConnection connection, int remoteUid, int delay, int lost, int rxKBitRate)?, void onRemoteVideoTransportStats(RtcConnection connection, int remoteUid, int delay, int lost, int rxKBitRate)?, void onConnectionStateChanged(RtcConnection connection, ConnectionStateType state, ConnectionChangedReasonType reason)?, void onWlAccMessage(RtcConnection connection, WlaccMessageReason reason, WlaccSuggestAction action, String wlAccMsg)?, void onWlAccStats(RtcConnection connection, WlAccStats currentStats, WlAccStats averageStats)?, void onNetworkTypeChanged(RtcConnection connection, NetworkType type)?, void onEncryptionError(RtcConnection connection, EncryptionErrorType errorType)?, void onPermissionError(PermissionType permissionType)?, void onLocalUserRegistered(int uid, String userAccount)?, void onUserInfoUpdated(int uid, UserInfo info)?, void onUploadLogResult(RtcConnection connection, String requestId, bool success, UploadErrorReason reason)?, void onAudioSubscribeStateChanged(String channel, int uid, StreamSubscribeState oldState, StreamSubscribeState newState, int elapseSinceLastState)?, void onVideoSubscribeStateChanged(String channel, int uid, StreamSubscribeState oldState, StreamSubscribeState newState, int elapseSinceLastState)?, void onAudioPublishStateChanged(String channel, StreamPublishState oldState, StreamPublishState newState, int elapseSinceLastState)?, void onVideoPublishStateChanged(VideoSourceType source, String channel, StreamPublishState oldState, StreamPublishState newState, int elapseSinceLastState)?, void onExtensionEvent(String provider, String extension, String key, String value)?, void onExtensionStarted(String provider, String extension)?, void onExtensionStopped(String provider, String extension)?, void onExtensionError(String provider, String extension, int error, String message)?, void onUserAccountUpdated(RtcConnection connection, int remoteUid, String userAccount)?})
-
const
Properties
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
onActiveSpeaker
→ void Function(RtcConnection connection, int uid)?
-
Occurs when the most active remote speaker is detected.
After a successful call of enableAudioVolumeIndication , the SDK continuously detects which remote user has the loudest volume. During the current period, the remote user, who is detected as the loudest for the most times, is the most active user.When the number of users is no less than two and an active remote speaker exists, the SDK triggers this callback and reports the uid of the most active remote speaker.If the most active remote speaker is always the same user, the SDK triggers the onActiveSpeaker callback only once.If the most active remote speaker changes to another user, the SDK triggers this callback again and reports the uid of the new active remote speaker.
final
-
onAudioDeviceStateChanged
→ void Function(String deviceId, MediaDeviceType deviceType, MediaDeviceStateType deviceState)?
-
Occurs when the audio device state changes.
This callback notifies the application that the system's audio device state is changed. For example, a headset is unplugged from the device.This method is for Windows and macOS only.
final
-
onAudioEffectFinished
→ void Function(int soundId)?
-
Occurs when the playback of the local music file finishes.
This callback occurs when the local audio effect file finishes playing.
final
-
onAudioMixingFinished
→ void Function()?
-
Occurs when the playback of the local music file finishes.
Deprecated:Please use onAudioMixingStateChanged instead.After you call startAudioMixing to play a local music file, this callback occurs when the playback finishes. If the call startAudioMixing fails, the error code WARN_AUDIO_MIXING_OPEN_ERROR is returned.
final
-
onAudioMixingStateChanged
→ void Function(AudioMixingStateType state, AudioMixingReasonType reason)?
-
Occurs when the playback state of the music file changes.
This callback occurs when the playback state of the music file changes, and reports the current state and error code.
final
-
onAudioPublishStateChanged
→ void Function(String channel, StreamPublishState oldState, StreamPublishState newState, int elapseSinceLastState)?
-
Occurs when the audio publishing state changes.
final
-
onAudioQuality
→ void Function(RtcConnection connection, int remoteUid, QualityType quality, int delay, int lost)?
-
Reports the statistics of the audio stream from each remote user.
Deprecated:Please use onRemoteAudioStats instead.The SDK triggers this callback once every two seconds to report the audio quality of each remote user/host sending an audio stream. If a channel has multiple users/hosts sending audio streams, the SDK triggers this callback as many times.
final
-
onAudioRoutingChanged
→ void Function(int routing)?
-
Occurs when the local audio route changes.
This method is for Android, iOS and macOS only.
final
-
onAudioSubscribeStateChanged
→ void Function(String channel, int uid, StreamSubscribeState oldState, StreamSubscribeState newState, int elapseSinceLastState)?
-
Occurs when the audio subscribing state changes.
final
-
onAudioVolumeIndication
→ void Function(RtcConnection connection, List<AudioVolumeInfo> speakers, int speakerNumber, int totalVolume)?
-
Reports the volume information of users.
By default, this callback is disabled. You can enable it by calling enableAudioVolumeIndication . Once this callback is enabled and users send streams in the channel, the SDK triggers the onAudioVolumeIndication callback according to the time interval set in enableAudioVolumeIndication. The SDK triggers two independent onAudioVolumeIndication callbacks simultaneously, which separately report the volume information of the local user who sends a stream and the remote users (up to three) whose instantaneous volume is the highest.Once this callback is enabled, if the local user calls the muteLocalAudioStream method for mute, the SDK continues to report the volume indication of the local user.20 seconds after a remote user whose volume is one of the three highest in the channel stops publishing the audio stream, the callback excludes this user's information; 20 seconds after all remote users stop publishing audio streams, the SDK stops triggering the callback for remote users.
final
-
onCameraExposureAreaChanged
→ void Function(int x, int y, int width, int height)?
-
Occurs when the camera exposure area changes.
final
-
onCameraFocusAreaChanged
→ void Function(int x, int y, int width, int height)?
-
Occurs when the camera focus area changes.
final
-
onCameraReady
→ void Function()?
-
Occurs when the camera turns on and is ready to capture the video.
Deprecated:Please use localVideoStreamStateCapturing(1) in onLocalVideoStateChanged instead.This callback indicates that the camera has been successfully turned on and you can start to capture video.
final
-
onChannelMediaRelayStateChanged
→ void Function(ChannelMediaRelayState state, ChannelMediaRelayError code)?
-
Occurs when the state of the media stream relay changes.
The SDK returns the state of the current media relay with any error message.
final
-
onClientRoleChanged
→ void Function(RtcConnection connection, ClientRoleType oldRole, ClientRoleType newRole, ClientRoleOptions newRoleOptions)?
-
Occurs when the user role switches in the interactive live streaming.
The SDK triggers this callback when the local user switches the user role by calling setClientRole after joining the channel.
final
-
onClientRoleChangeFailed
→ void Function(RtcConnection connection, ClientRoleChangeFailedReason reason, ClientRoleType currentRole)?
-
Occurs when the user role switch fails in the interactive live streaming.
In the live broadcasting channel profile, when the local user calls setClientRole
1/2
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.
final
-
onConnectionBanned
→ void Function(RtcConnection connection)?
-
Occurs when the connection is banned by the Agora server.
Deprecated:Please use onConnectionStateChanged instead.
final
-
onConnectionInterrupted
→ void Function(RtcConnection connection)?
-
Occurs when the connection between the SDK and the server is interrupted.
Deprecated:Use onConnectionStateChanged instead.The SDK triggers this callback when it loses connection with the server for more than four seconds after the connection is established. After triggering this callback, the SDK tries to reconnect to the server. You can use this callback to implement pop-up reminders. The difference between this callback and onConnectionLost is: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.
final
-
onConnectionLost
→ void Function(RtcConnection connection)?
-
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
2/2
method, regardless of whether it is in the channel. If the SDK fails to rejoin the channel within 20 minutes after disconnecting, the SDK will stop trying to reconnect.
final
-
onConnectionStateChanged
→ void Function(RtcConnection connection, ConnectionStateType state, ConnectionChangedReasonType reason)?
-
Occurs when the network connection state changes.
When the network connection state changes, the SDK triggers this callback and reports the current connection state and the reason for the change.
final
-
onContentInspectResult
→ void Function(ContentInspectResult result)?
-
Reports the result of video content moderation.
After calling enableContentInspect to enable the video content moderation, and setting the type parameter in ContentInspectConfig tocontentInspectModeration, the SDK triggers the onContentInspectResult callback and reports the result of video content moderation.
final
-
onEncryptionError
→ void Function(RtcConnection connection, EncryptionErrorType errorType)?
-
Reports the built-in encryption errors.
When encryption is enabled by calling enableEncryption , the SDK triggers this callback if an error occurs in encryption or decryption on the sender or the receiver side.
final
-
onError
→ void Function(ErrorCodeType err, String msg)?
-
Reports an error during SDK runtime.
This callback indicates that an error (concerning network or media) occurs during SDK runtime. In most cases, the SDK cannot fix the issue and resume running. The SDK requires the application to take action or informs the user about the issue.
final
-
onExtensionError
→ void Function(String provider, String extension, int error, String message)?
-
Occurs when the extension runs incorrectly.
When calling enableExtension (true) fails or the extension runs in error, the extension triggers this callback and reports the error code and reason.
final
-
onExtensionEvent
→ void Function(String provider, String extension, String key, String value)?
-
The event callback of the extension.
To listen for events while the extension is running, you need to register this callback.
final
-
onExtensionStarted
→ void Function(String provider, String extension)?
-
Occurs when the extension is enabled.
After a successful call of enableExtension (true), the extension triggers this callback.
final
-
onExtensionStopped
→ void Function(String provider, String extension)?
-
Occurs when the extension is disabled.
After a successful call of enableExtension (false), this callback is triggered.
final
-
onFacePositionChanged
→ void Function(int imageWidth, int imageHeight, List<Rectangle> vecRectangle, List<int> vecDistance, int numFaces)?
-
Reports the face detection result of the local user.
Once you enable face detection by calling enableFaceDetection (true), you can get the following information on the local user in real-time:The width and height of the local video.The position of the human face in the local view.The distance between the human face and the screen.This value is based on the fitting calculation of the local video size and the position of the human face.This callback is for Android and iOS only.When it is detected that the face in front of the camera disappears, the callback will be triggered immediately. When no human face is detected, the frequency of this callback to be rtriggered wil be decreased to reduce power consumption on the local device.The SDK stops triggering this callback when a human face is in close proximity to the screen.On Android, the value of distance reported in this callback may be slightly different from the actual distance. Therefore, Agora does not recommend using it for accurate calculation.
final
-
onFirstLocalAudioFramePublished
→ void Function(RtcConnection connection, int elapsed)?
-
Occurs when the first audio frame is published.
The SDK triggers this callback under one of the following circumstances:The local client enables the audio module and calls joinChannel
2/2
successfully.The local client calls muteLocalAudioStream (true) and muteLocalAudioStream(false) in sequence.The local client calls disableAudio and enableAudio in sequence.
final
-
onFirstLocalVideoFrame
→ void Function(VideoSourceType source, int width, int height, int elapsed)?
-
Occurs when the first local video frame is displayed on the local video view.
The SDK triggers this callback when the first local video frame is displayed on the local video view.
final
-
onFirstLocalVideoFramePublished
→ void Function(VideoSourceType source, int elapsed)?
-
Occurs when the first video frame is published.
The SDK triggers this callback under one of the following circumstances: The local client enables the video module and calls joinChannel successfully. The local client calls muteLocalVideoStream (true) and muteLocalVideoStream (false) in sequence. The local client calls disableVideo and enableVideo in sequence.
final
-
onFirstRemoteAudioDecoded
→ void Function(RtcConnection connection, int uid, int elapsed)?
-
Occurs when the SDK decodes the first remote audio frame for playback.
Deprecated:Use onRemoteAudioStateChanged instead.The SDK triggers this callback under one of the following circumstances:The remote user joins the channel and sends the audio stream.The remote user stops sending the audio stream and re-sends it after 15 seconds, and the possible reasons include:The remote user leaves the channel.The remote user is offline.The remote user calls muteLocalAudioStream to stop sending the video stream.The remote user calls disableAudio to disable video.
final
-
onFirstRemoteAudioFrame
→ void Function(RtcConnection connection, int userId, int elapsed)?
-
Occurs when the first audio frame sent by a specified remote user is received.
Deprecated:Use onRemoteAudioStateChanged instead.
final
-
onFirstRemoteVideoDecoded
→ void Function(RtcConnection connection, int remoteUid, int width, int height, int elapsed)?
-
Occurs when the first remote video frame is received and decoded.
The SDK triggers this callback under one of the following circumstances:The remote user joins the channel and sends the video stream.The remote user stops sending the video stream and re-sends it after 15 seconds. Reasons for such an interruption include:The remote user leaves the channel.The remote user drops offline.The remote user calls muteLocalVideoStream to stop sending the video stream.The remote user calls disableVideo to disable video.
final
-
onFirstRemoteVideoFrame
→ void Function(RtcConnection connection, int remoteUid, int width, int height, int elapsed)?
-
Occurs when the renderer receives the first frame of the remote video.
final
-
onJoinChannelSuccess
→ void Function(RtcConnection connection, int elapsed)?
-
Occurs when a user joins a channel.
This callback notifies the application that a user joins a specified channel.
final
-
onLastmileProbeResult
→ void Function(LastmileProbeResult result)?
-
Reports the last mile network probe result.
The SDK triggers this callback within 30 seconds after the app calls startLastmileProbeTest .
final
-
onLastmileQuality
→ void Function(QualityType quality)?
-
Reports the last-mile network quality of the local user.
This callback reports the last-mile network conditions of the local user before the user joins the channel. Last mile refers to the connection between the local device and Agora's edge server.Before the user joins the channel, this callback is triggered by the SDK once startLastmileProbeTest is called and reports the last-mile network conditions of the local user.
final
-
onLeaveChannel
→ void Function(RtcConnection connection, RtcStats stats)?
-
Occurs when a user leaves a channel.
This callback notifies the app that the user leaves the channel by calling leaveChannel . From this callback, the app can get information such as the call duration and quality statistics.
final
-
onLocalAudioStateChanged
→ void Function(RtcConnection connection, LocalAudioStreamState state, LocalAudioStreamReason error)?
-
Occurs when the local audio stream state changes.
When the state of the local audio stream changes (including the state of the audio capture and encoding), the SDK triggers this callback to report the current state. This callback indicates the state of the local audio stream, and allows you to troubleshoot issues when audio exceptions occur.When the state is localAudioStreamStateFailed (3), you can view the error information in the error parameter.
final
-
onLocalAudioStats
→ void Function(RtcConnection connection, LocalAudioStats stats)?
-
Reports the statistics of the local audio stream.
The SDK triggers this callback once every two seconds.
final
-
onLocalUserRegistered
→ void Function(int uid, String userAccount)?
-
Occurs when the local user registers a user account.
After the local user successfully calls registerLocalUserAccount to register the user account or calls joinChannelWithUserAccount to join a channel, the SDK triggers the callback and informs the local user's UID and User Account.
final
-
onLocalVideoStateChanged
→ void Function(VideoSourceType source, LocalVideoStreamState state, LocalVideoStreamReason error)?
-
Occurs when the local video stream state changes.
When the state of the local video stream changes (including the state of the video capture and encoding), the SDK triggers this callback to report the current state. This callback indicates the state of the local video stream, including camera capturing and video encoding, and allows you to troubleshoot issues when exceptions occur.The SDK triggers the onLocalVideoStateChanged callback with the state code of localVideoStreamStateFailed and error code of localVideoStreamErrorCaptureFailure in the following situations:The app switches to the background, and the system gets the camera resource.The camera starts normally, but does not output video frames for four consecutive seconds.When the camera outputs the captured video frames, if the video frames are the same for 15 consecutive frames, the SDK triggers the onLocalVideoStateChanged callback with the state code of localVideoStreamStateCapturing and error code of localVideoStreamErrorCaptureFailure. Note that the video frame duplication detection is only available for video frames with a resolution greater than 200 × 200, a frame rate greater than or equal to 10 fps, and a bitrate less than 20 Kbps.For some device models, the SDK does not trigger this callback when the state of the local video changes while the local video capturing device is in use, so you have to make your own timeout judgment.
final
-
onLocalVideoStats
→ void Function(VideoSourceType source, LocalVideoStats stats)?
-
Reports the statistics of the local video stream.
The SDK triggers this callback once every two seconds to report the statistics of the local video stream.
final
-
onNetworkQuality
→ void Function(RtcConnection connection, int remoteUid, QualityType txQuality, QualityType rxQuality)?
-
Reports the last mile network quality of each user in the channel.
This callback reports the last mile network conditions of each user in the channel. Last mile refers to the connection between the local device and Agora's edge server.The SDK triggers this callback once every two seconds. If a channel includes multiple users, the SDK triggers this callback as many times.txQuality is rxQuality is
final
-
onNetworkTypeChanged
→ void Function(RtcConnection connection, NetworkType type)?
-
Occurs when the local network type changes.
This callback occurs when the connection state of the local user changes. You can get the connection state and reason for the state change in this callback. When the network connection is interrupted, this callback indicates whether the interruption is caused by a network type change or poor network conditions.
final
-
onPermissionError
→ void Function(PermissionType permissionType)?
-
Occurs when the SDK cannot get the device permission.
When the SDK fails to get the device permission, the SDK triggers this callback to report which device permission cannot be got.This method is for Android and iOS only.
final
-
onProxyConnected
→ void Function(String channel, int uid, ProxyType proxyType, String localProxyIp, int elapsed)?
-
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 fromthe user calling joinChannel
1/2
until this callback is triggered.
final
-
onRejoinChannelSuccess
→ void Function(RtcConnection connection, int elapsed)?
-
Occurs when a user rejoins the channel.
When a user loses connection with the server because of network problems, the SDK automatically tries to reconnect and triggers this callback upon reconnection.
final
-
onRemoteAudioStateChanged
→ void Function(RtcConnection connection, int remoteUid, RemoteAudioState state, RemoteAudioStateReason reason, int elapsed)?
-
Occurs when the remote audio state changes.
When the audio state of a remote user (in a voice/video call channel) or host (in a live streaming channel) changes, the SDK triggers this callback to report the current state of the remote audio stream.This callback does not work properly when the number of users (in the communication profile) or hosts (in the live streaming channel) in a channel exceeds 17.
final
-
onRemoteAudioStats
→ void Function(RtcConnection connection, RemoteAudioStats stats)?
-
Reports the statistics of the audio stream sent by each remote users.
The SDK triggers this callback once every two seconds. If a channel includes multiple users, the SDK triggers this callback as many times.
final
-
onRemoteAudioTransportStats
→ void Function(RtcConnection connection, int remoteUid, int delay, int lost, int rxKBitRate)?
-
Reports the transport-layer statistics of each remote audio stream.
Deprecated:Please use onRemoteAudioStats instead.This callback reports the transport-layer statistics, such as the packet loss rate and network time delay, once every two seconds after the local user receives an audio packet from a remote user. During a call, when the user receives the video packet sent by the remote user/host, the callback is triggered every 2 seconds.
final
-
onRemoteVideoStateChanged
→ void Function(RtcConnection connection, int remoteUid, RemoteVideoState state, RemoteVideoStateReason reason, int elapsed)?
-
Occurs when the remote video stream state changes.
This callback does not work properly when the number of users (in the communication profile) or hosts (in the live streaming channel) in a channel exceeds 17.
final
-
onRemoteVideoStats
→ void Function(RtcConnection connection, RemoteVideoStats stats)?
-
Reports the statistics of the video stream sent by each remote users.
Reports the statistics of the video stream from the remote users. The SDK triggers this callback once every two seconds for each remote user. If a channel has multiple users/hosts sending video streams, the SDK triggers this callback as many times.
final
-
onRemoteVideoTransportStats
→ void Function(RtcConnection connection, int remoteUid, int delay, int lost, int rxKBitRate)?
-
Reports the transport-layer statistics of each remote video stream.
Deprecated:This callback is deprecated; use onRemoteVideoStats instead.This callback reports the transport-layer statistics, such as the packet loss rate and network time delay, once every two seconds after the local user receives a video packet from a remote user.During a call, when the user receives the video packet sent by the remote user/host, the callback is triggered every 2 seconds.
final
-
onRequestToken
→ void Function(RtcConnection connection)?
-
Occurs when the token expires.
When the token expires during a call, the SDK triggers this callback to remind the app to renew the token.Once you receive this callback, generate a new token on your app server, and call joinChannel
2/2
to rejoin the channel.
final
-
onRtcStats
→ void Function(RtcConnection connection, RtcStats stats)?
-
Reports the statistics of the current call.
The SDK triggers this callback once every two seconds after the user joins the channel.
final
-
onRtmpStreamingEvent
→ void Function(String url, RtmpStreamingEvent eventCode)?
-
Reports events during the media push.
final
-
onRtmpStreamingStateChanged
→ void Function(String url, RtmpStreamPublishState state, RtmpStreamPublishReason errCode)?
-
Occurs when the media push state changes.
When the media push state changes, the SDK triggers this callback and reports the URL address and the current state of the media push. This callback indicates the state of the media push. When exceptions occur, you can troubleshoot issues by referring to the detailed error descriptions in the error code parameter.
final
-
onSnapshotTaken
→ void Function(RtcConnection connection, int uid, String filePath, int width, int height, int errCode)?
-
Reports the result of taking a video snapshot.
After a successful takeSnapshot method call, the SDK triggers this callback to report whether the snapshot is successfully taken, as well as the details for that snapshot.
final
-
onStreamMessage
→ void Function(RtcConnection connection, int remoteUid, int streamId, Uint8List data, int length, int sentTs)?
-
Occurs when the local user receives the data stream from the remote user.
The SDK triggers this callback when the local user receives the stream message that the remote user sends by calling the sendStreamMessage method.
final
-
onStreamMessageError
→ void Function(RtcConnection connection, int remoteUid, int streamId, ErrorCodeType code, int missed, int cached)?
-
Occurs when the local user does not receive the data stream from the remote user.
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.
final
-
onTokenPrivilegeWillExpire
→ void Function(RtcConnection connection, String token)?
-
Occurs when the token expires in 30 seconds.
When the token is about to expire in 30 seconds, the SDK triggers this callback to remind the app to renew the token.Upon receiving this callback, generate a new token on your server, and call renewToken to pass the new token to the SDK.
final
-
onTranscodingUpdated
→ void Function()?
-
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.If you call the setLiveTranscoding method to set the LiveTranscoding class for the first time, the SDK does not trigger this callback.
final
-
onUplinkNetworkInfoUpdated
→ void Function(UplinkNetworkInfo info)?
-
Occurs when the uplink network information changes.
The SDK triggers this callback when the uplink network information changes.This callback only applies to scenarios where you push externally encoded video data in H.264 format to the SDK.
final
-
onUserEnableLocalVideo
→ void Function(RtcConnection connection, int remoteUid, bool enabled)?
-
Occurs when a specific remote user enables/disables the local video capturing function.
The SDK triggers this callback when the remote user resumes or stops capturing the video stream by calling the enableLocalVideo method.
final
-
onUserEnableVideo
→ void Function(RtcConnection connection, int remoteUid, bool enabled)?
-
Occurs when a remote user enables/disables the video module.
Once the video module is disabled, the user can only use a voice call. The user cannot send or receive any video.The SDK triggers this callback when a remote user enables or disables the video module by calling the enableVideo or disableVideo method.
final
-
onUserInfoUpdated
→ void Function(int uid, UserInfo info)?
-
Occurs when the SDK gets the user ID and user account of the remote user.
After a remote user joins the channel, the SDK gets the UID and user account of the remote user, caches them in a mapping table object, and triggers this callback on the local client.
final
-
onUserJoined
→ void Function(RtcConnection connection, int remoteUid, int elapsed)?
-
Occurs when a remote user (COMMUNICATION)/ host (LIVE_BROADCASTING) joins the channel.
In a communication channel, this callback indicates that a remote user joins the channel. The SDK also triggers this callback to report the existing users in the channel when a user joins the channel.In a live-broadcast channel, this callback indicates that a host joins the channel. The SDK also triggers this callback to report the existing hosts in the channel when a host joins the channel. Agora recommends 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
2/2
method.A remote user switches the user role to the host after joining the channel.A remote user/host rejoins the channel after a network interruption.
final
-
onUserMuteAudio
→ void Function(RtcConnection connection, int remoteUid, bool muted)?
-
Occurs when a remote user (in the communication profile) or a host (in the live streaming profile) stops/resumes sending the audio stream.
The SDK triggers this callback when the remote user stops or resumes sending the audio stream by calling the muteLocalAudioStream method.This callback does not work properly when the number of users (in the communication profile) or hosts (in the live streaming channel) in a channel exceeds 17.
final
-
onUserMuteVideo
→ void Function(RtcConnection connection, int remoteUid, bool muted)?
-
Occurs when a remote user stops/resumes publishing the video stream.
When a remote user calls muteLocalVideoStream to stop or resume publishing the video stream, the SDK triggers this callback to report the state of the remote user's publishing stream to the local user.This callback can be inaccurate when the number of users (in the communication profile) or hosts (in the live streaming profile) in a channel exceeds 17.
final
-
onUserOffline
→ void Function(RtcConnection connection, int remoteUid, UserOfflineReasonType reason)?
-
Occurs when a remote user (in the communication profile)/ host (in the live streaming profile) leaves the channel.
There are two reasons for users to become offline:Leave the channel: When a user/host leaves the channel, the user/host sends a goodbye message. When this message is received, the SDK determines 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 (20 seconds for the communication profile, and more for the live broadcast profile), the SDK assumes that the user/host drops offline. A poor network connection may lead to false detections. It's recommended to use the Agora RTM SDK for reliable offline detection.
final
-
onVideoPublishStateChanged
→ void Function(VideoSourceType source, String channel, StreamPublishState oldState, StreamPublishState newState, int elapseSinceLastState)?
-
Occurs when the video publishing state changes.
final
-
onVideoSizeChanged
→ void Function(RtcConnection connection, VideoSourceType sourceType, int uid, int width, int height, int rotation)?
-
Occurs when the video size or rotation of a specified user changes.
final
-
onVideoStopped
→ void Function()?
-
Occurs when the video stops playing.
Deprecated:Use localVideoStreamStateStopped(0) in the onLocalVideoStateChanged callback instead.The application can use this callback to change the configuration of the view (for example, displaying other pictures in the view) after the video stops playing.
final
-
onVideoSubscribeStateChanged
→ void Function(String channel, int uid, StreamSubscribeState oldState, StreamSubscribeState newState, int elapseSinceLastState)?
-
Occurs when the video subscribing state changes.
final
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
toString()
→ String
-
A string representation of this object.
inherited