Options
All
  • Public
  • Public/Protected
  • All
Menu

Listener type enumeration

Index

Enumeration members

onCameraDidReady = "onCameraDidReady"
  • Callback for the camera being ready
onConnectOtherRoom = "onConnectOtherRoom"
  • Callback for requesting a cross-room call (anchor competition)
  • Calling the connectOtherRoom() API in TRTCCloud will set up a video call between two anchors from different rooms. The caller will receive the onConnectOtherRoom() callback, which can be used to determine whether the cross-room call is successful. If it is successful, all users in both rooms will receive the onUserVideoAvailable() callback.
  • param:
  • userId: userId of the anchor to compete with
  • errCode: error code. ERR_NULL indicates a successful switch. For more information, please see Error Codes.
  • errMsg: error message
onConnectionLost = "onConnectionLost"
  • Callback for the disconnection of the SDK from the server
onConnectionRecovery = "onConnectionRecovery"
  • Callback for the reconnection of the SDK to the server
onDeviceChange = "onDeviceChange"
  • Callback for the connection/disconnection of a local device
  • Note: This callback only works on Windows and macOS.
  • Parameters
  • deviceId: device ID
  • type: device type
  • state: event type
onDisConnectOtherRoom = "onDisConnectOtherRoom"
  • Callback for ending a cross-room call (anchor competition)
onEnterRoom = "onEnterRoom"
  • Callback for room entry
  • After calling the enterRoom() API in TRTCCloud to enter a room, you will receive the onEnterRoom(result) callback from the SDK.
  • If room entry succeeded, result would be a positive number (result > 0), indicating the time in milliseconds (ms) room entry took.
  • If room entry failed, result would be a negative number (result < 0), which represents the error code.
  • param:
  • If result is greater than 0, it indicates the time (in ms) room entry takes; if result is less than 0, it represents the error code.
onError = "onError"
  • Callback for error. This callback indicates that the SDK encountered an unrecoverable error. Such errors must be listened for, and UI reminders should be sent to users if necessary.
  • param:
  • errCode: error code
  • errMsg: error message
  • extraInfo: extended field. Certain error codes may carry extra information for troubleshooting.
onExitRoom = "onExitRoom"
  • Callback for room exit
  • Calling the exitRoom() API in TRTCCloud will trigger the execution of room exit-related logic, including releasing resources such as audio/video devices and codecs. After all the resources are released, the SDK will notify you via the onExitRoom() callback.
  • If you need to call enterRoom() again or switch to another RTC SDK, please wait until you receive the onExitRoom() callback. Otherwise, you may encounter problems such as the camera or mic being occupied.
  • param:
  • reason: reason for room exit. 0: The user called exitRoom to exit the room; 1: The user was kicked out of the room by the server; 2: The room was closed.
onFirstAudioFrame = "onFirstAudioFrame"
  • Callback for playing the first audio frame of a remote user (no callback for playing the first local audio frame)
  • param:
  • userId: remote user ID
onFirstVideoFrame = "onFirstVideoFrame"
  • Callback for rendering the first video frame of the local user or a remote user
  • If userId is null, it indicates that the first video frame of the local user is rendered, in which case the callback is triggered by startLocalPreview. If userId is not null, it indicates that the first video frame of a remote user is rendered, in which case the callback is triggered by startRemoteView.
  • This callback is triggered only after startLocalPreview(), startRemoteView(), or startRemoteSubStreamView() is called.
  • param:
  • userId: ID of the local or remote user. userId == null indicates the local user, while userId != null indicates a remote user.
  • streamType: video stream type, which may be camera video or screen sharing images
  • width: image width
  • height: image height
onMicDidReady = "onMicDidReady"
  • Callback for the mic being ready
onMissCustomCmdMsg = "onMissCustomCmdMsg"
  • Callback for losing a custom message
  • TRTC uses UDP channels. Even if you enable reliable messaging, there is a small chance that you may lose a message. Reliable messaging can meet the requirements of common message sending scenarios. If the sender enables reliable messaging, the recipient will be notified via this callback of the number of custom messages lost during a past period of time (usually 5 seconds).
  • Notes:
  • The recipient will receive this callback only if the sender enables reliable messaging.
  • param:
  • userId: user ID
  • cmdID: data stream ID
  • errCode: error code, whose value is -1 in the current version
  • missed: number of lost messages
onMusicObserverComplete = "onMusicObserverComplete"
  • Callback for the completion of background music
onMusicObserverPlayProgress = "onMusicObserverPlayProgress"
  • Callback of the playback progress of background music
onMusicObserverStart = "onMusicObserverStart"
  • Callback for starting background music
onNetworkQuality = "onNetworkQuality"
  • Callback of statistics on upstream and downstream network quality (triggered every 2 seconds)
  • userId: If this parameter is the ID of the local user, the statistics indicate the video quality of the local user.
  • param:
  • localQuality: upstream network quality
  • remoteQuality: downstream network quality
onRecvCustomCmdMsg = "onRecvCustomCmdMsg"
  • Callback for receiving a custom message
  • When a user in a room uses sendCustomCmdMsg to send a custom message, other users in the room can receive the message through the onRecvCustomCmdMsg callback.
  • param:
  • userId: user ID
  • cmdID: command ID
  • seq: message sequence number
  • message: message data
onRecvSEIMsg = "onRecvSEIMsg"
  • Callback for receiving an SEI message
  • When a user in a room uses sendSEIMsg to send data, other users in the room can receive the data through the onRecvSEIMsg callback.
  • param:
  • userId: user ID
  • message: message data
onRemoteUserEnterRoom = "onRemoteUserEnterRoom"
  • Callback for the entry of a remote user
  • To ensure the performance of the SDK, this callback works differently under call and live streaming scenarios.
  • Call (TRTCCloudDef.TRTC_APP_SCENE_VIDEOCALL and TRTCCloudDef.TRTC_APP_SCENE_AUDIOCALL): The concept of roles does not apply, and the callback is triggered when any remote user enters the room.
  • Live streaming (TRTCCloudDef.TRTC_APP_SCENE_LIVE and TRTCCloudDef.TRTC_APP_SCENE_VOICE_CHATROOM): Given that there is no limit on audience size and frequent callbacks may affect the SDK’s performance, the callback is triggered only when an anchor enters the room.
  • param:
  • userId: user ID
onRemoteUserLeaveRoom = "onRemoteUserLeaveRoom"
  • Callback for the exit of a remote user
  • Like onRemoteUserEnterRoom, this callback works differently under call and live streaming scenarios.
  • Call (TRTCCloudDef.TRTC_APP_SCENE_VIDEOCALL and TRTCCloudDef.TRTC_APP_SCENE_AUDIOCALL): The concept of roles does not apply, and the callback is triggered when any remote user exits the room.
  • Live streaming (TRTCCloudDef.TRTC_APP_SCENE_LIVE and TRTCCloudDef.TRTC_APP_SCENE_VOICE_CHATROOM): The callback is triggered only when an anchor exits the room.
  • param:
  • userId: user ID
  • reason: reason for room exit. 0: The user exited the room voluntarily; 1: The user exited the room due to timeout; 2: The user was kicked out of the room.
onScreenCapturePaused = "onScreenCapturePaused"
  • Callback for pausing screen sharing

-Parameters

  • reason: reason. 0: The user paused screen sharing; 1: Screen sharing was paused because the shared window became invisible.
  • Note: The value returned is only valid for iOS.
onScreenCaptureResumed = "onScreenCaptureResumed"
  • Callback for resuming screen sharing

-Parameters

  • reason: reason. 0: The user resumed screen sharing; 1: Screen sharing was resumed automatically after the shared window became visible again.
  • Note: The value returned is only valid for iOS.
onScreenCaptureStarted = "onScreenCaptureStarted"
  • Callback for starting screen sharing
onScreenCaptureStoped = "onScreenCaptureStoped"
  • Callback for stopping screen sharing

-Parameters

-reason: reason. 0: The user stopped screen sharing; 1: Screen sharing stopped because the shared window was closed.

onSendFirstLocalAudioFrame = "onSendFirstLocalAudioFrame"
  • Callback for sending the first local audio frame
  • After enterRoom() and startLocalAudio() are called successfully, the SDK will capture audio from the mic and encode the audio captured. It will return this callback after sending the first audio frame to the cloud.
onSendFirstLocalVideoFrame = "onSendFirstLocalVideoFrame"
  • Callback for sending the first local video frame
  • After enterRoom() and startLocalPreview() are called successfully, the SDK will capture video from the camera and encode the video captured. It will return this callback after sending the first video frame to the cloud.
  • param:
  • streamType: video stream type, which may be the big-image stream, small-image stream, or substream (screen sharing)
onSetMixTranscodingConfig = "onSetMixTranscodingConfig"
  • Callback for setting On-Cloud MixTranscoding parameters (triggered by the setMixTranscodingConfig() API in TRTCCloud)
  • param:
  • errCode: 0: successful; other values: failed
  • errMsg: error message
onSnapshotComplete = "onSnapshotComplete"
  • Callback for taking a screenshot
  • Parameters
  • If errorCode is 0, the screenshot is taken successfully. Other values indicate failure to take the screenshot.
onSpeedTest = "onSpeedTest"
  • Callback of server speed testing results (The SDK tests the speed of multiple server addresses and returns the results via this callback)
  • param:
  • currentResult: result of the current test
  • finishedCount: number of servers that have been tested
  • totalCount: total number of servers to test
onStartPublishCDNStream = "onStartPublishCDNStream"
  • Callback for starting relaying to CDN
  • This callback is triggered by the startPublishCDNStream() API in TRTCCloud.
  • Note: If 0 (successful) is returned, it indicates that Tencent Cloud has been notified of the relaying request, but if an error occurs in the target CDN, relaying may still fail.
  • param:
  • errCode: 0: successful; other values: failed
  • errMsg: error message
onStartPublishing = "onStartPublishing"
  • Callback for starting publishing to Tencent Cloud’s live streaming CDN (triggered by the startPublishing() API in TRTCCloud)
  • param:
  • errCode: 0: successful; other values: failed
  • errMsg: error message
onStatistics = "onStatistics"
  • Callback of statistics on technical metrics
  • If you are familiar with the technical metrics of RTC, you can use this callback to get statistics on the SDK’s technical metrics. If you are building an RTC project for the first time, you can use the onNetworkQuality callback only.
  • Note: This callback is triggered once every 2 seconds
  • param:
  • statics: status data
onStopPublishCDNStream = "onStopPublishCDNStream"
  • Callback for stopping relaying to CDN
  • This callback is triggered by the stopPublishCDNStream() API in TRTCCloud.
  • param:
  • errCode: 0: successful; other values: failed
  • errMsg: error message
onStopPublishing = "onStopPublishing"
  • Callback for stopping publishing to Tencent Cloud’s live streaming CDN (triggered by the stopPublishing() API in TRTCCloud)
  • param:
  • errCode: 0: successful; other values: failed
  • errMsg: error message
onSwitchRole = "onSwitchRole"
  • Callback for role switching
  • You can call the switchRole() API in TRTCCloud to switch between the anchor and audience roles. This is accompanied by a line switching process. After the switch, the onSwitchRole() callback will be returned.
  • param:
  • errCode: error code. 0 indicates a successful switch.
  • errMsg: error message
onSwitchRoom = "onSwitchRoom"
  • Callback for switching rooms (switchRoom)
  • param:
  • errCode: error code
  • errMsg: error message
onTestMicVolume = "onTestMicVolume"
  • Callback of mic testing volume
  • This callback is triggered by the mic testing API startMicDeviceTest.
  • Note: This callback only works on Windows and macOS.
  • Parameters:
  • volume: value range: 0-100
onTestSpeakerVolume = "onTestSpeakerVolume"
  • Callback of speaker testing volume
  • This callback is triggered by the speaker testing API startSpeakerDeviceTest.
  • Note: This callback only works on Windows and macOS.
  • Parameters:
  • volume: value range: 0-100
onTryToReconnect = "onTryToReconnect"
  • Callback for the SDK reconnecting to the server
onUserAudioAvailable = "onUserAudioAvailable"
  • Callback of whether a remote user has playable audio
  • param:
  • userId: user ID
  • available: whether audio is enabled
onUserSubStreamAvailable = "onUserSubStreamAvailable"
  • Callback of whether a remote user has playable video in the substream (usually used for screen sharing)
  • param:
  • userId: user ID
  • available: whether screen sharing is enabled
onUserVideoAvailable = "onUserVideoAvailable"
  • Callback of whether a remote user has playable video in the primary stream (usually used for camera video)
  • The onUserVideoAvailable(userId, true) callback indicates that the user has playable video frames. You can call startRemoteView(userid) to load the user’s video, and will receive the onFirstVideoFrame(userid) callback, which indicates that the first video frame has been rendered.
  • The onUserVideoAvailable(userId, false) callback indicates that the remote user has disabled video. It may be because the user called muteLocalVideo() or stopLocalPreview().
  • param:
  • userId: user ID
  • available: whether video is enabled
onUserVoiceVolume = "onUserVoiceVolume"
  • Callback of volume (including the volume of each userId and total remote volume)
  • You can use the enableAudioVolumeEvaluation API in TRTCCloud to enable this callback or set its triggering interval. After enableAudioVolumeEvaluation is called to enable the volume callback, no matter whether there is a user speaking in the room, this callback will be triggered at the specified interval. If there is no one speaking, userVolumes will be empty, and totalVolume will be 0.
  • Note: If userId is the ID of the local user, volume indicates the local user’s volume. userVolumes includes only the volumes of speaking users, i.e., users whose volume is not 0.
  • param:
  • userVolumes: volumes of all speaking users in the room. Value range: 0-100
  • totalVolume: total volume of all remote users. Value range: 0-100
onWarning = "onWarning"
  • Callback for warning. This callback alerts you to non-serious problems such as stutter or recoverable decoding failure.
  • param:
  • warningCode: warning code
  • warningMsg: warning message
  • extraInfo: extended field. Certain warning codes may carry extra information for troubleshooting.

Generated using TypeDoc