/** * event callback APIs for TRTC’s video call feature */ export enum TRTCCloudListener { /** - Error event callback. - Error event, which indicates that the SDK threw an irrecoverable error such as room entry failure or failure to start device. - Param: - errCode: Error code - errMsg: Error message - extraInfo: Extended field. Certain error codes may carry extra information for troubleshooting. */ onError = 'onError', /** - Warning event callback - Warning event, which indicates that the SDK threw an error requiring attention, such as video lag or high CPU usage. - Param: - warningCode: Warning code - warningMsg: Warning message - extraInfo: Extended field. Certain warning codes may carry extra information for troubleshooting. */ onWarning = 'onWarning', /** - The callback of the room has been added - After calling the enterRoom() API in TRTCCloud to enter a room, you will receive the onEnterRoom(result) callback from TRTCCloudDelegate . - If room entry succeeded, `result` will be a positive number ( result > 0), indicating the time in milliseconds (ms) the room entry takes. - If room entry failed, `result` will be a negative number (result < 0), indicating the error code for the failure. - Param: - If `result` is greater than 0, it indicates the time (in ms) the room entry takes; if `result` is less than 0, it represents the error code for room entry. */ onEnterRoom = 'onEnterRoom', /** - The incident of leaving the room recovers - Calling the exitRoom() API in TRTCCloud will trigger the execution of room exit-related logic, such as releasing resources of audio/video devices and codecs. - After all resources occupied by the SDK are released, the SDK will return the onExitRoom() callback. - If you need to call enterRoom() again or switch to another audio/video SDK, please wait until you receive the onExitRoom() callback. - Param: - Reason for room exit. 0 : the user called exitRoom to exit the room; 1 : the user was removed from the room by the server; 2 : the room was dismissed. */ onExitRoom = 'onExitRoom', /** - Switching the event event recovery - 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 switching, the SDK will return the onSwitchRole() event callback. - Param: - errCode Error code, 0 means that the switch is successful - errMsg error message. */ onSwitchRole = 'onSwitchRole', /** - A user entered the room - Due to performance concerns, this callback works differently in different scenarios (i.e., AppScene , which you can specify by setting the second parameter when calling enterRoom ). - Live streaming scenarios ( TRTC_APP_SCENE_LIVE or TRTC_APP_SCENE_VOICE_CHATROOM ): in live streaming scenarios, a user is either in the role of an anchor or audience. The callback is returned only when an anchor enters the room. - Call scenarios ( TRTC_APP_SCENE_VIDEOCALL or TRTC_APP_SCENE_AUDIOCALL ): in call scenarios, the concept of roles does not apply (all users can be considered as anchors), and the callback is returned when any user enters the room. - Param: - userId: User ID of the remote user */ onRemoteUserEnterRoom = 'onRemoteUserEnterRoom', /** - A user exited the room - Due to performance concerns, this callback works differently in different scenarios - Live streaming scenarios ( TRTC_APP_SCENE_LIVE or TRTC_APP_SCENE_VOICE_CHATROOM ): the callback is triggered only when an anchor exits the room. - Call scenarios ( TRTC_APP_SCENE_VIDEOCALL or TRTC_APP_SCENE_AUDIOCALL ): in call scenarios, the concept of roles does not apply, and the callback is returned when any user exits the room. - Param: - userId User ID of the remote user - 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 removed from the room; 3 : the anchor user exited the room due to switch to audience. */ onRemoteUserLeaveRoom = 'onRemoteUserLeaveRoom', /** - Result of requesting cross-room call - You can call the connectOtherRoom() API in TRTCCloud to establish a video call with the anchor of another room. This is the “anchor competition” feature. - 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 either room will receive the onUserVideoAvailable() callback from the anchor of the other room. - Param: - userId The user ID of the anchor (in another room) to be called - errCode Error code, 0 : success - errMsg Error message */ onConnectOtherRoom = 'onConnectOtherRoom', /** - Result of ending cross-room call - Param: - errCode Error code, 0 represents the successful switch - errMsg Error message */ onDisConnectOtherRoom = 'onDisConnectOtherRoom', /** - Result of room switching - Param: - errCode Error code, 0 represents the successful switch - errMsg Error message */ onSwitchRoom = 'onSwitchRoom', /** - A remote user published/unpublished primary stream videoThe primary stream is usually used for camera images. If you receive the onUserVideoAvailable(userId, true) callback, it indicates that the user has available primary stream video. - You can then call startRemoteView to subscribe to the remote user’s video. If the subscription is successful, you will receive the onFirstVideoFrame(userid) callback, which indicates that the first video frame of the user is rendered. - Param: - userId User ID of the remote user - available Whether the user published (or unpublished) primary stream video. true : published; false : unpublished */ onUserVideoAvailable = 'onUserVideoAvailable', /** - A remote user published/unpublished substream video - Param: - userId User ID of the remote user - available Whether the user published (or unpublished) substream video. true : published; false : unpublished */ onUserSubStreamAvailable = 'onUserSubStreamAvailable', /** - A remote user published/unpublished audio - Param: - userId User ID of the remote user - available Whether the user published (or unpublished) audio. true : published; false : unpublished */ onUserAudioAvailable = 'onUserAudioAvailable', /** - Change of remote video size - If you receive the onUserVideoSizeChanged(userId, streamtype, newWidth, newHeight) callback, it indicates that the user changed the video size. It may be triggered by setVideoEncoderParam or setSubStreamEncoderParam . - Param: - userId User ID - streamType Video stream type. The primary stream ( Main ) is usually used for camera images, and the substream ( Sub ) for screen sharing images. - newWidth Video width - newHeight Video height */ onUserVideoSizeChanged = 'onUserVideoSizeChanged', /** - The SDK started rendering the first video frame of the local or a remote user - The SDK returns this event callback when it starts rendering your first video frame or that of a remote user. The userId in the callback can help you determine whether the frame is yours or a remote user’s. - If userId is empty, it indicates that the SDK has started rendering your first video frame. The precondition is that you have called startLocalPreview or startScreenCapture. - If userId is not empty, it indicates that the SDK has started rendering the first video frame of a remote user. The precondition is that you have called startRemoteView to subscribe to the user’s video. - Param: - userId The user ID of the local or a remote user. If it is empty, it indicates that the first local video frame is available; if it is not empty, it indicates that the first video frame of a remote user is available. - streamType Video stream type. The primary stream ( Main ) is usually used for camera images, and the substream ( Sub ) for screen sharing images. - width Video width - height Video height */ onFirstVideoFrame = 'onFirstVideoFrame', /** - The SDK started playing the first audio frame of a remote user - Param: - userId User ID of the remote user */ onFirstAudioFrame = 'onFirstAudioFrame', /** - The first local video frame was published - After you enter a room and call startLocalPreview or startScreenCapture to enable local video capturing (whichever happens first), the SDK will start video encoding and publish the local video data via its network module to the cloud. - Param: - streamType Video stream type. The primary stream ( Main ) is usually used for camera images, and the substream ( Sub ) for screen sharing images. */ onSendFirstLocalVideoFrame = 'onSendFirstLocalVideoFrame', /** - The first local audio frame was published - After you enter a room and call startLocalAudio to enable audio capturing (whichever happens first), the SDK will start audio encoding and publish the local audio data via its network module to the cloud. */ onSendFirstLocalAudioFrame = 'onSendFirstLocalAudioFrame', /** - Real-time network quality statistics - Param: - localQuality Upstream network quality - remoteQuality Downstream network quality, it refers to the data quality finally measured on the local side after the data flow passes through a complete transmission link of "remote ->cloud ->local". Therefore, the downlink network quality here represents the joint impact of the remote uplink and the local downlink. */ onNetworkQuality = 'onNetworkQuality', /** - Real-time statistics on technical metrics - If you are familiar with related terms in the field of audio and video, you can obtain all technical indicators of SDK through this callback. If you are the first time you have developed sound and video -related projects, you can only pay attention to Onnetworkquality. - Note: Retain once every 2 seconds - Param: - statics Statistics, including local statistics and the statistics of remote users. */ onStatistics = 'onStatistics', /** - The SDK was disconnected from the cloud */ onConnectionLost = 'onConnectionLost', /** - The SDK is reconnecting to the cloud */ onTryToReconnect = 'onTryToReconnect', /** - The SDK is reconnected to the cloud */ onConnectionRecovery = 'onConnectionRecovery', /** - The camera is ready */ onCameraDidReady = 'onCameraDidReady', /** - The mic is ready */ onMicDidReady = 'onMicDidReady', /** - It is used to remind the volume callback, including the volume of each userID and the long -term total volume. - The SDK can assess the volume of each channel and return this callback on a regular basis. You can display, for example, a waveform or volume bar on the UI based on the statistics returned. - You need to first call enableAudioVolumeEvaluation to enable the feature and set the interval for the callback. - Note that the SDK returns this callback at the specified interval regardless of whether someone is speaking in the room. - Param: - userVolumes An array that represents the volume of all users who are speaking in the room. Value range: 0-100 - totalVolume The total volume of all remote users. Value range: 0-100 */ onUserVoiceVolume = 'onUserVoiceVolume', /** - Receipt of 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 serial number - message Message data */ onRecvCustomCmdMsg = 'onRecvCustomCmdMsg', /** - Loss of custom message - When you use sendCustomCmdMsg to send a custom UDP message, even if you enable reliable transfer (by setting reliable to true ), there is still a chance of message loss. Reliable transfer only helps maintain a low probability of message loss, which meets the reliability requirements in most cases. - If the sender sets reliable to true , the SDK will use this callback to notify the recipient of the number of custom messages lost during a specified time period (usually 5s) in the past. - Param: - userId User ID - cmdID Command ID - errCode Error code - missed Number of lost messages */ onMissCustomCmdMsg = 'onMissCustomCmdMsg', /** - Receipt of SEI message - If a user in the room uses sendSEIMsg to send an SEI message via video frames, other users in the room can receive the message through the onRecvSEIMsg callback. - Param: - userId User ID - message Data */ onRecvSEIMsg = 'onRecvSEIMsg', /** - Started publishing to Tencent Cloud CSS CDN - Param: - errCode 0 : successful; other values: failed - errMsg Error message */ onStartPublishing = 'onStartPublishing', /** - Stopped publishing to Tencent Cloud CSS CDN - Param: - errCode 0 : successful; other values: failed - errMsg Error message */ onStopPublishing = 'onStopPublishing', /** - Started publishing to non-Tencent Cloud’s live streaming CDN - When you call startPublishCDNStream to start publishing streams to a non-Tencent Cloud’s live streaming CDN, the SDK will sync the command to the CVM immediately. - Param: - errCode 0 : successful; other values: failed - errMsg Error message */ onStartPublishCDNStream = 'onStartPublishCDNStream', /** - Stopped publishing to non-Tencent Cloud’s live streaming CDN - When you call stopPublishCDNStream to stop publishing to a non-Tencent Cloud’s live streaming CDN, the SDK will sync the command to the CVM immediately. - Param: - errCode 0 : successful; other values: failed - errMsg Error message */ onStopPublishCDNStream = 'onStopPublishCDNStream', /** - Set the layout and transcoding parameters for On-Cloud MixTranscoding - Param: - errCode 0 : successful; other values: failed - errMsg Error message */ onSetMixTranscodingConfig = 'onSetMixTranscodingConfig', /** - Background music starts to play */ onMusicObserverStart = 'onMusicObserverStart', /** - Background music playback progress */ onMusicObserverPlayProgress = 'onMusicObserverPlayProgress', /** - Background music has been played */ onMusicObserverComplete = 'onMusicObserverComplete', /** - Finished taking a local screenshot - Param: - errorCode: 0 indicates that the screenshot is successful, and other values ​​indicate failure */ onSnapshotComplete = 'onSnapshotComplete', /** - Screen sharing started */ onScreenCaptureStarted = 'onScreenCaptureStarted', /** - Screen sharing was paused */ onScreenCapturePaused = 'onScreenCapturePaused', /** - Screen sharing was resumed */ onScreenCaptureResumed = 'onScreenCaptureResumed', /** - Screen sharing stopped - Param: - reason Reason. 0 : the user stopped screen sharing; 1 : screen sharing stopped because the shared window was closed. */ onScreenCaptureStoped = 'onScreenCaptureStoped', /** - Speed test result - Network speed test results, including packet loss, round-trip latency, and upstream and downstream bandwidth rates - Param: - availableDownBandwidth Downlink bandwidth - availableUpBandwidth Uplink bandwidth - downJitter Downlink data packet jitter (ms) - downLostRate Downlink packet loss rate - errMsg Test error message - ip Server IP address - quality Network quality measured by internal evaluation algorithms - rtt Latency (ms) - success Test success - upJitter Uplink data packet jitter (ms) - upLostRate Uplink packet loss rate */ onSpeedTestResult = 'onSpeedTestResult', }