Interface IRtcEngineEventHandler

IRtcEngineEventHandlerThe SDK uses the interface to send event notifications to your app. Your app can get those notifications through methods that inherit this interface.

Hierarchy

  • IRtcEngineEventHandler

Methods

onActiveSpeaker? onAudioDeviceVolumeChanged? onAudioEffectFinished? onAudioMixingFinished? onAudioMixingPositionChanged? onAudioMixingStateChanged? onAudioPublishStateChanged? onAudioQuality? onAudioRoutingChanged? onAudioSubscribeStateChanged? onAudioVolumeIndication? onCameraExposureAreaChanged? onCameraFocusAreaChanged? onCameraReady? onChannelMediaRelayEvent? onChannelMediaRelayStateChanged? onClientRoleChangeFailed? onClientRoleChanged? onConnectionBanned? onConnectionInterrupted? onConnectionLost? onConnectionStateChanged? onEncryptionError? onError? onExtensionError? onExtensionEvent? onExtensionStarted? onExtensionStopped? onFacePositionChanged? onFirstLocalAudioFramePublished? onFirstLocalVideoFrame? onFirstLocalVideoFramePublished? onFirstRemoteAudioDecoded? onFirstRemoteAudioFrame? onFirstRemoteVideoDecoded? onFirstRemoteVideoFrame? onJoinChannelSuccess? onLastmileProbeResult? onLastmileQuality? onLeaveChannel? onLocalAudioStateChanged? onLocalAudioStats? onLocalUserRegistered? onLocalVideoStateChanged? onLocalVideoStats? onLocalVideoTranscoderError? onNetworkQuality? onNetworkTypeChanged? onPermissionError? onProxyConnected? onRejoinChannelSuccess? onRemoteAudioStateChanged? onRemoteAudioStats? onRemoteAudioTransportStats? onRemoteVideoStateChanged? onRemoteVideoStats? onRemoteVideoTransportStats? onRequestToken? onRhythmPlayerStateChanged? onRtcStats? onRtmpStreamingEvent? onRtmpStreamingStateChanged? onSnapshotTaken? onStreamMessage? onStreamMessageError? onTokenPrivilegeWillExpire? onTranscodingUpdated? onUplinkNetworkInfoUpdated? onUserEnableLocalVideo? onUserEnableVideo? onUserInfoUpdated? onUserJoined? onUserMuteAudio? onUserMuteVideo? onUserOffline? onVideoPublishStateChanged? onVideoRenderingTracingResult? onVideoSizeChanged? onVideoStopped? onVideoSubscribeStateChanged?

Methods

  • 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 whose volume 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • uid: number

      The user ID of the most active speaker.

    Returns void

  • Reports the volume change of the audio device or app. Occurs when the volume on the playback device, audio capture device, or the volume in the application changes.

    Parameters

    • deviceType: MediaDeviceType

      The device type. See MediaDeviceType .

    • volume: number

      The volume value. The range is [0, 255].

    • muted: boolean

      Whether the audio device is muted:true: The audio device is muted.false: The audio device is not muted.

    Returns void

  • Occurs when the playback of the local music file finishes. This callback occurs when the local audio effect file finishes playing.

    Parameters

    • soundId: number

      The audio effect ID. The ID of each audio effect file is unique.

    Returns void

  • 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.

    Returns void

  • Reports the playback progress of a music file. After you called the startAudioMixing method to play a music file, the SDK triggers this callback every two seconds to report the playback progress.

    Returns

    0: Success.< 0: Failure.

    Parameters

    • position: number

      The playback progress (ms).

    Returns void

  • 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.

    Parameters

    Returns void

  • Occurs when the audio publishing state changes.

    Parameters

    • channel: string

      The channel name.

    • oldState: StreamPublishState

      The previous publishing state. See StreamPublishState .

    • newState: StreamPublishState

      The current publishing stat. See StreamPublishState.

    • elapseSinceLastState: number

      The time elapsed (ms) from the previous state to the current state.

    Returns void

  • Reports the statistics of the audio stream sent by each remote user. Deprecated:Use onRemoteAudioStats instead.The SDK triggers this callback once every two seconds to report the audio quality of each remote user who is sending an audio stream. If a channel has multiple users sending audio streams, the SDK triggers this callback as many times.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The user ID of the remote user sending the audio stream.

    • quality: QualityType

      Audio quality of the user. See QualityType .

    • delay: number

      The network delay (ms) from the sender to the receiver, including the delay caused by audio sampling pre-processing, network transmission, and network jitter buffering.

    • lost: number

      The packet loss rate (%) of the audio packet sent from the remote user to the receiver.

    Returns void

  • Occurs when the local audio route changes.

    Parameters

    • routing: number

      The current audio routing.-1: The default audio route.0: The audio route is a headset with a microphone.1: The audio route is an earpiece.2: The audio route is a headset without a microphone.3: The audio route is the speaker that comes with the device.4: The audio route is an external speaker. (For iOS and macOS only)(5): The audio route is a Bluetooth headset.

    Returns void

  • Occurs when the audio subscribing state changes.

    Parameters

    • channel: string

      The channel name.

    • uid: number

      The user ID of the remote user.

    • oldState: StreamSubscribeState

      The previous subscribing status. See StreamSubscribeState .

    • newState: StreamSubscribeState

      The current subscribing status. See StreamSubscribeState.

    • elapseSinceLastState: number

      The time elapsed (ms) from the previous state to the current state.

    Returns void

  • 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 to mute, the SDK continues to report the volume indication of the local user.If a remote user whose volume is one of the three highest in the channel stops publishing the audio stream for 20 seconds, the callback excludes this user's information; if all remote users stop publishing audio streams for 20 seconds, the SDK stops triggering the callback for remote users.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • speakers: AudioVolumeInfo[]

      The volume information of the users. See AudioVolumeInfo . An empty speakers array in the callback indicates that no remote user is in the channel or is sending a stream.

    • speakerNumber: number

      The total number of users.In the callback for the local user, if the local user is sending streams, the value of speakerNumber is 1.In the callback for remote users, the value range of speakerNumber is [0,3]. If the number of remote users who send streams is greater than or equal to three, the value of speakerNumber is 3.

    • totalVolume: number

      The volume of the speaker. The value range is [0,255].In the callback for the local user, totalVolume is the volume of the local user who sends a stream.In the callback for remote users, totalVolume is the sum of the volume of all remote users (up to three) whose instantaneous volume is the highest.

    Returns void

  • Occurs when the camera exposure area changes. The SDK triggers this callback when the local user changes the camera exposure position by calling setCameraExposurePosition .This callback is for Android and iOS only.

    Parameters

    • x: number

      The x coordinate of the changed camera exposure area.

    • y: number

      The y coordinate of the changed camera exposure area.

    • width: number

      The width of the changed camera exposure area.

    • height: number

      The height of the changed exposure area.

    Returns void

  • Occurs when the camera focus area changes. The SDK triggers this callback when the local user changes the camera focus position by calling setCameraFocusPositionInPreview .This callback is for Android and iOS only.

    Parameters

    • x: number

      The x-coordinate of the changed camera focus area.

    • y: number

      The y-coordinate of the changed camera focus area.

    • width: number

      The width of the changed camera focus area.

    • height: number

      The height of the changed camera focus area.

    Returns void

  • 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.

    Returns void

  • Reports events during the media stream relay. Deprecated:This callback is deprecated.

    Parameters

    Returns void

  • Occurs when the state of the media stream relay changes. The SDK returns the state of the current media relay with any error message.

    Parameters

    Returns void

  • Occurs when the user role switching fails in the interactive live streaming. In the live broadcasting channel profile, when the local user calls to switch the user role after joining the channel but the switch fails, the SDK triggers this callback to report the reason for the failure and the current user role.

    Parameters

    Returns void

  • Occurs when the user role switches during the interactive live streaming. The SDK triggers this callback when the local user switches their user role by calling setClientRole after joining the channel.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • oldRole: ClientRoleType

      Role that the user switches from: ClientRoleType .

    • newRole: ClientRoleType

      Role that the user switches to: ClientRoleType .

    • newRoleOptions: ClientRoleOptions

      Properties of the role that the user switches to. See ClientRoleOptions .

    Returns void

  • Occurs when the connection is banned by the Agora server. Deprecated:Use onConnectionStateChanged instead.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    Returns void

  • 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 differences between this callback and onConnectionLost are as follow:The SDK triggers the onConnectionInterrupted callback when it loses connection with the server for more than four seconds after it successfully joins the channel.The SDK triggers the onConnectionLost callback when it loses connection with the server for more than 10 seconds, whether or not it joins the channel.If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora's edge server, the SDK stops rejoining the channel.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    Returns void

  • Occurs when the SDK cannot reconnect to Agora's edge server 10 seconds after its connection to the server is interrupted. The SDK triggers this callback when it cannot connect to the server 10 seconds after calling the joinChannel method, regardless of whether it is in the channel. If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora's edge server, the SDK stops rejoining the channel.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    Returns void

  • 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.

    Parameters

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • errorType: EncryptionErrorType

      Details about the error type. See EncryptionErrorType .

    Returns void

  • 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.

    Parameters

    • err: ErrorCodeType

      Error code. See ErrorCodeType .

    • msg: string

      The error message.

    Returns void

  • 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.

    Parameters

    • provider: string

      The name of the extension provider.

    • extension: string

      The name of the extension.

    • error: number

      Error code. For details, see the extension documentation provided by the extension provider.

    • message: string

      Reason. For details, see the extension documentation provided by the extension provider.

    Returns void

  • The event callback of the extension. To listen for events while the extension is running, you need to register this callback.

    Parameters

    • provider: string

      The name of the extension provider.

    • extension: string

      The name of the extension.

    • key: string

      The key of the extension.

    • value: string

      The value of the extension key.

    Returns void

  • Occurs when the extension is enabled. After a successful call of enableExtension (true), the extension triggers this callback.

    Parameters

    • provider: string

      The name of the extension provider.

    • extension: string

      The name of the extension.

    Returns void

  • Occurs when the extension is disabled. After a successful call of enableExtension (false), this callback is triggered.

    Parameters

    • provider: string

      The name of the extension provider.

    • extension: string

      The name of the extension.

    Returns void

  • 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.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.

    Parameters

    • imageWidth: number

      The width (px) of the video image captured by the local camera.

    • imageHeight: number

      The height (px) of the video image captured by the local camera.

    • vecRectangle: Rectangle[]

      The information of the detected human face. See Rectangle .

    • vecDistance: number[]

      The distance between the human face and the device screen (cm).

    • numFaces: number

      The number of faces detected. If the value is 0, it means that no human face is detected.

    Returns void

  • 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 successfully.The local client calls muteLocalAudioStream (true) and muteLocalAudioStream(false) in sequence.The local client calls disableAudio and enableAudio in sequence.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • elapsed: number

      Time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

    Returns void

  • 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.

    Parameters

    • source: VideoSourceType

      The type of the video source. See VideoSourceType .

    • width: number

      The width (px) of the first local video frame.

    • height: number

      The height (px) of the first local video frame.

    • elapsed: number

      Time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback. If you call startPreview before calling joinChannel, then this parameter is the time elapsed from calling the startPreview method until the SDK triggers this callback.

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • elapsed: number

      Time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

    Returns void

  • 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 for the first time.The remote user's audio is offline and then goes online to re-send audio. It means the local user cannot receive audio in 15 seconds. Reasons for such an interruption include:The remote user leaves channel.The remote user drops offline.The remote user calls muteLocalAudioStream to stop sending the audio stream.The remote user calls disableAudio to disable audio.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • uid: number

      The user ID of the remote user.

    • elapsed: number

      The time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

    Returns void

  • Occurs when the SDK receives the first audio frame from a specific remote user. Deprecated:Use onRemoteAudioStateChanged instead.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • userId: number

      The user ID of the remote user.

    • elapsed: number

      The time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The user ID of the remote user sending the video stream.

    • width: number

      The width (px) of the video stream.

    • height: number

      The height (px) of the video stream.

    • elapsed: number

      The time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

    Returns void

  • Occurs when the renderer receives the first frame of the remote video.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The user ID of the remote user sending the video stream.

    • width: number

      The width (px) of the video stream.

    • height: number

      The height (px) of the video stream.

    • elapsed: number

      The time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

    Returns void

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

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • elapsed: number

      The time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

    Returns void

  • Reports the last mile network probe result. The SDK triggers this callback within 30 seconds after the app calls startLastmileProbeTest .

    Parameters

    • result: LastmileProbeResult

      The uplink and downlink last-mile network probe test result. See LastmileProbeResult .

    Returns void

  • 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.

    Parameters

    • quality: QualityType

      The last-mile network quality. QualityUnknown(0): The quality is unknown.QualityExcellent(1): The quality is excellent.QualityGood(2): The network quality seems excellent, but the bitrate can be slightly lower than excellent.QualityPoor(3): Users can feel the communication is slightly impaired.QualityBad(4): Users cannot communicate smoothly.QualityVbad(5): The quality is so bad that users can barely communicate.QualityDown(6): The network is down, and users cannot communicate at all.See QualityType .

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • stats: RtcStats

      The statistics of the call. See RtcStats .

    Returns void

  • 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.

    Parameters

    Returns void

  • Reports the statistics of the local audio stream. The SDK triggers this callback once every two seconds.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • stats: LocalAudioStats

      Local audio statistics. See LocalAudioStats .

    Returns void

  • 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.

    Parameters

    • uid: number

      The ID of the local user.

    • userAccount: string

      The user account of the local user.

    Returns void

  • 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.If your app runs in the background on a device running Android 9 or later, you cannot access the camera.If your app runs in the background on a device running Android 6 or later, the camera is occupied by a third-party app. Once the camera is released, the SDK triggers the onLocalVideoStateChanged(LocalVideoStreamStateCapturing,LocalVideoStreamErrorOk) callback.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.

    Parameters

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • stats: LocalVideoStats

      The statistics of the local video stream. See LocalVideoStats .

    Returns void

  • Occurs when there's an error during the local video mixing. When you fail to call startLocalVideoTranscoder or updateLocalTranscoderConfiguration , the SDK triggers this callback to report the reason.

    Parameters

    • stream: TranscodingVideoStream

      The video streams that cannot be mixed during video mixing. See TranscodingVideoStream .

    • error: VideoTranscoderError

      The reason for local video mixing error. See VideoTranscoderError .

    Returns void

  • 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 Unknown when the user is not sending a stream; rxQuality is Unknown when the user is not receiving a stream.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The user ID. The network quality of the user with this user ID is reported. If the uid is 0, the local network quality is reported.

    • txQuality: QualityType

      Uplink network quality rating of the user in terms of the transmission bit rate, packet loss rate, average RTT (Round-Trip Time) and jitter of the uplink network. This parameter is a quality rating helping you understand how well the current uplink network conditions can support the selected video encoder configuration. For example, a 1000 Kbps uplink network may be adequate for video frames with a resolution of 640 × 480 and a frame rate of 15 fps in the LIVE_BROADCASTING profile, but might be inadequate for resolutions higher than 1280 × 720. QualityUnknown(0): The quality is unknown. QualityExcellent(1): The quality is excellent. QualityGood(2): The network quality seems excellent, but the bitrate can be slightly lower than excellent. QualityPoor(3): Users can feel the communication is slightly impaired. QualityBad(4): Users cannot communicate smoothly. QualityVbad(5): The quality is so bad that users can barely communicate. QualityDown(6): The network is down, and users cannot communicate at all.

    • rxQuality: QualityType

      Downlink network quality rating of the user in terms of packet loss rate, average RTT, and jitter of the downlink network. QualityUnknown(0): The quality is unknown. QualityExcellent(1): The quality is excellent. QualityGood(2): The network quality seems excellent, but the bitrate can be slightly lower than excellent. QualityPoor(3): Users can feel the communication is slightly impaired. QualityBad(4): Users cannot communicate smoothly. QualityVbad(5): The quality is so bad that users can barely communicate. QualityDown(6): The network is down, and users cannot communicate at all.

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • type: NetworkType

      The type of the local network connection. See NetworkType .

    Returns void

  • 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.

    Parameters

    • permissionType: PermissionType

      The type of the device permission. See PermissionType .

    Returns void

  • 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 until this callback is triggered.

    Parameters

    • channel: string

      The channel name.

    • uid: number

      The user ID.

    • proxyType: ProxyType

      The proxy type connected. See CloudProxyType .

    • localProxyIp: string

      Reserved for future use.

    • elapsed: number

      The time elapsed (ms) from the user calling joinChannel until this callback is triggered.

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • elapsed: number

      Time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback.

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The ID of the remote user whose audio state changes.

    • state: RemoteAudioState

      The state of the remote audio. See RemoteAudioState .

    • reason: RemoteAudioStateReason

      The reason of the remote audio state change. See RemoteAudioStateReason .

    • elapsed: number

      Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

    Returns void

  • Reports the transport-layer statistics of each remote audio stream. The SDK triggers this callback once every two seconds for each remote user who is sending audio streams. If a channel includes multiple remote users, the SDK triggers this callback as many times.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • stats: RemoteAudioStats

      The statistics of the received remote audio streams. See RemoteAudioStats .

    Returns void

  • Reports the transport-layer statistics of each remote audio stream. Deprecated:Use onRemoteAudioStats instead.This callback reports the transport-layer statistics, such as the packet loss rate and network time delay after the local user receives an audio packet from a remote user. During a call, when the user receives the audio packet sent by the remote user, the callback is triggered every 2 seconds.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The ID of the remote user sending the audio streams.

    • delay: number

      The network delay (ms) from the remote user to the receiver.

    • lost: number

      The packet loss rate (%) of the audio packet sent from the remote user to the receiver.

    • rxKBitRate: number

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The ID of the remote user whose video state changes.

    • state: RemoteVideoState

      The state of the remote video. See RemoteVideoState .

    • reason: RemoteVideoStateReason

      The reason for the remote video state change. See RemoteVideoStateReason .

    • elapsed: number

      Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • stats: RemoteVideoStats

      Statistics of the remote video stream. See RemoteVideoStats .

    Returns void

  • 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 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The ID of the remote user sending the video packets.

    • delay: number

      The network delay (ms) from the sender to the receiver.

    • lost: number

      The packet loss rate (%) of the video packet sent from the remote user.

    • rxKBitRate: number

      The bitrate of the received video (Kbps).

    Returns void

  • 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, you need to generate a new token on your app server, and call joinChannel to rejoin the channel.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    Returns void

  • Occurs when the state of virtual metronome changes. When the state of the virtual metronome changes, the SDK triggers this callback to report the current state of the virtual metronome. This callback indicates the state of the local audio stream and enables you to troubleshoot issues when audio exceptions occur.

    Parameters

    • state: RhythmPlayerStateType

      For the current virtual metronome status, see RhythmPlayerStateType .

    • errorCode: RhythmPlayerErrorType

      For the error codes and error messages related to virtual metronome errors, see RhythmPlayerErrorType .

    Returns void

  • Reports the statistics of the current call. The SDK triggers this callback once every two seconds after the user joins the channel.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • stats: RtcStats

      Statistics of the RTC engine. See RtcStats .

    Returns void

  • Reports events during the Media Push.

    Parameters

    • url: string

      The URL for Media Push.

    • eventCode: RtmpStreamingEvent

      The event code of Media Push. See RtmpStreamingEvent .

    Returns void

  • Occurs when the state of Media Push changes. When the state of Media Push 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.

    Parameters

    • url: string

      The URL address where the state of the Media Push changes.

    • state: RtmpStreamPublishState

      The current state of the Media Push. See RtmpStreamPublishState .

    • errCode: RtmpStreamPublishErrorType

      The detailed error information for the Media Push. See RtmpStreamPublishErrorType .

    Returns void

  • 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 the snapshot taken.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • uid: number

      The user ID. One uid of 0 indicates the local user.

    • filePath: string

      The local path of the snapshot.

    • width: number

      The width (px) of the snapshot.

    • height: number

      The height (px) of the snapshot.

    • errCode: number

      The message that confirms success or gives the reason why the snapshot is not successfully taken:0: Success.< 0: Failure:-1: The SDK fails to write data to a file or encode a JPEG image.-2: The SDK does not find the video stream of the specified user within one second after the takeSnapshot method call succeeds. The possible reasons are: local capture stops, remote end stops publishing, or video data processing is blocked.-3: Calling the takeSnapshot method too frequently.

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The ID of the remote user sending the message.

    • streamId: number

      The stream ID of the received message.

    • data: Uint8Array

      The data received.

    • length: number

      The data length (byte).

    • sentTs: number

      The time when the data stream is sent.

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The ID of the remote user sending the message.

    • streamId: number

      The stream ID of the received message.

    • code: ErrorCodeType

      The error code.

    • missed: number

      The number of lost messages.

    • cached: number

      Number of incoming cached messages when the data stream is interrupted.

    Returns void

  • 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, you need to generate a new token on your server, and call renewToken to pass the new token to the SDK.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • token: string

      The token that expires in 30 seconds.

    Returns void

  • Occurs when the publisher's transcoding is updated. When the LiveTranscoding class in the method updates, the SDK triggers the onTranscodingUpdated callback to report the update information.If you call the method to set the LiveTranscoding class for the first time, the SDK does not trigger this callback.

    Returns void

  • 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.

    Parameters

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The user ID of the remote user.

    • enabled: boolean

      Whether the specified remote user enables/disables the local video capturing function:true: The video module is enabled. Other users in the channel can see the video of this remote user.false: The video module is disabled. Other users in the channel can no longer receive the video stream from this remote user, while this remote user can still receive the video streams from other users.

    Returns void

  • Occurs when a remote user enables or 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The user ID of the remote user.

    • enabled: boolean

      true: The video module is enabled.false: The video module is disabled.

    Returns void

  • 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.

    Parameters

    • uid: number

      The user ID of the remote user.

    • info: UserInfo

      The UserInfo object that contains the user ID and user account of the remote user. See UserInfo for details.

    Returns void

  • Occurs when a remote user (in the communication profile)/ host (in the live streaming profile) leaves 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.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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The ID of the user or host who joins the channel.

    • elapsed: number

      Time delay (ms) from the local user calling joinChannel until this callback is triggered.

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The user ID.

    • muted: boolean

      Whether the remote user's audio stream is muted:true: User's audio stream is muted.false: User's audio stream is unmuted.

    Returns void

  • Occurs when a remote user stops or 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 to the local user the state of the streams published by the remote 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The user ID of the remote user.

    • muted: boolean

      Whether the remote user stops publishing the video stream:true: The remote user stops publishing the video stream.false: The remote user resumes publishing the video stream.

    Returns void

  • 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.

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • remoteUid: number

      The ID of the user who leaves the channel or goes offline.

    • reason: UserOfflineReasonType

      Reasons why the user goes offline: UserOfflineReasonType .

    Returns void

  • Occurs when the video publishing state changes.

    Parameters

    • source: VideoSourceType

      The type of the video source. See VideoSourceType .

    • channel: string

      The channel name.

    • oldState: StreamPublishState

      The previous publishing state. See StreamPublishState .

    • newState: StreamPublishState

      The current publishing stat. See StreamPublishState.

    • elapseSinceLastState: number

      The time elapsed (ms) from the previous state to the current state.

    Returns void

  • Video frame rendering event callback. After calling the startMediaRenderingTracing method or joining the channel, the SDK triggers this callback to report the events of video frame rendering and the indicators during the rendering process. Developers can optimize the indicators to improve the efficiency of the first video frame rendering.

    Parameters

    • connection: RtcConnection
    • uid: number

      The user ID.

    • currentEvent: MediaTraceEvent

      The current video frame rendering event. See MediaTraceEvent .

    • tracingInfo: VideoRenderingTracingInfo

      The indicators during the video frame rendering process. Developers need to reduce the value of indicators as much as possible in order to improve the efficiency of the first video frame rendering. See VideoRenderingTracingInfo .

    Returns void

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

    Parameters

    • connection: RtcConnection

      The connection information. See RtcConnection .

    • sourceType: VideoSourceType

      The type of the video source. See VideoSourceType .

    • uid: number

      The ID of the user whose video size or rotation changes. (The uid for the local user is 0. The video is the local user's video preview).

    • width: number

      The width (pixels) of the video stream.

    • height: number

      The height (pixels) of the video stream.

    • rotation: number

      The rotation information. The value range is [0,360).

    Returns void

  • 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.

    Returns void

  • Occurs when the video subscribing state changes.

    Parameters

    • channel: string

      The channel name.

    • uid: number

      The ID of the remote user.

    • oldState: StreamSubscribeState

      The previous subscribing status, see StreamSubscribeState for details.

    • newState: StreamSubscribeState

      The current subscribing status, see StreamSubscribeState for details.

    • elapseSinceLastState: number

      The time elapsed (ms) from the previous state to the current state.

    Returns void

Generated using TypeDoc