TRTCCloud @ TXLiteAVSDK

Tencent Cloud TRTC Core Function Interface.

Creating TRTC object

import TRTCCloud from 'trtc-electron-sdk';
const rtcCloud = new TRTCCloud();

Setting event callbacks

subscribeEvents = (rtcCloud) => {
    rtcCloud.on('onError', (errcode, errmsg) => {
        console.info('trtc_demo: onError :' + errcode + " msg" + errmsg);
    }); 
    rtcCloud.on('onEnterRoom', (elapsed) => {
        console.info('trtc_demo: onEnterRoom elapsed: elapsed:' + elapsed);
    });
    rtcCloud.on('onExitRoom', (reason) => {
        console.info('trtc_demo: onExitRoom reason:' + reason);
    });
};

subscribeEvents(rtcCloud);

TRTCCloud singleton creation and termination APIs

API Description
getTRTCShareInstance Creates a TRTCCloud singleton object during dynamic DLL loading.
destroyTRTCShareInstance Releases a TRTCCloud singleton object and frees up resources.

Room APIs

API Description
enterRoom Enters a room. If the room does not exist, the system will create one automatically.
exitRoom Leaves a room.
switchRoom Switches rooms.
switchRole Switches roles. This API applies only to the live streaming modes (TRTCAppSceneLIVE and TRTCAppSceneVoiceChatRoom).
connectOtherRoom Requests a cross-room call (anchor competition).
disconnectOtherRoom Ends a cross-room call (anchor competition).
setDefaultStreamRecvMode Sets the audio/video receiving mode (must be called before room entry to take effect).

CDN & Mix Stream APIs

API Description
startPublishing Starts publishing to Tencent Cloud’s live streaming CDN.
stopPublishing Stops publishing to Tencent Cloud’s live streaming CDN.
startPublishCDNStream Starts relaying to the live streaming CDN of a non-Tencent Cloud vendor.
stopPublishCDNStream Stops relaying to the live streaming CDN of a non-Tencent Cloud vendor.
setMixTranscodingConfig Sets On-Cloud MixTranscoding parameters.

Video APIs

API Description
startLocalPreview Enables capturing and preview of the local camera.
stopLocalPreview Disables capturing and preview of the local camera.
muteLocalVideo Blocks/Unblocks local video.
startRemoteView Starts playing the video of a remote user.
stopRemoteView Stops playing and pulling the video of a remote user.
stopAllRemoteView Stops playing and pulling the videos of all remote users.
muteRemoteVideoStream Pauses/Resumes receiving the video of a specified remote user.
muteAllRemoteVideoStreams Pauses/Resumes receiving the videos of all remote users.
setVideoEncoderParam Sets video encoder parameters.
setNetworkQosParam Set network quality control parameters.
setLocalRenderParams Sets rendering parameters for the local image (primary stream).
setLocalViewFillMode Sets the rendering mode of the local image (disused).
setRemoteRenderParams Sets rendering parameters for a remote image.
setRemoteViewFillMode Sets the rendering mode of a remote image (disused).
setLocalViewRotation Sets the clockwise rotation of the local image (disused).
setRemoteViewRotation Sets the clockwise rotation of a remote image (disused).
setVideoEncoderRotation Sets the rotation of encoded video images, i.e., images presented to remote users and recorded by the server.
setLocalViewMirror Sets the mirror mode of the local camera's preview image (disused).
setVideoEncoderMirror Sets the mirror mode of encoded images.
enableSmallVideoStream Enables/Disables the dual-channel (big and small images) encoding mode.
setRemoteVideoStreamType Sets whether to view the big or small image of a specified user (userId).
snapshotVideo Takes a video screenshot.
setPriorRemoteVideoStreamType Sets video quality preference for audience (disused).
startLocalRecording Start local media recording.
stopLocalRecording Stop local media recording.

Audio APIs

API Description
startLocalAudio Enables local audio capturing and publishing.
stopLocalAudio Disables local audio capturing and publishing.
muteLocalAudio Mutes/Unmutes the local user.
muteRemoteAudio Mutes a remote user and stops pulling the user’s audio.
muteAllRemoteAudio Mutes all remote users and stops pulling their audio.
setRemoteAudioVolume Sets the playback volume of a remote user.
setAudioCaptureVolume Sets the SDK capturing volume.
getAudioCaptureVolume Gets the SDK capturing volume.
setAudioPlayoutVolume Sets the SDK playback volume.
getAudioPlayoutVolume Gets the SDK playback volume.
enableAudioVolumeEvaluation Enables/Disables the volume reminder.
startAudioRecording Starts audio recording.
stopAudioRecording Stops audio recording.
setAudioQuality Sets audio quality (disused).

Camera Device APIs

API Description
getCameraDevicesList Gets the camera list.
setCurrentCameraDevice Sets the camera to use.
getCurrentCameraDevice Gets the camera currently in use.

Audio Device APIs

API Description
getMicDevicesList Gets the mic list.
getCurrentMicDevice Gets the mic currently in use.
setCurrentMicDevice Sets the mic to use.
getCurrentMicDeviceVolume Gets the current mic volume.
setCurrentMicDeviceVolume Sets the current mic volume.
setCurrentMicDeviceMute Mutes/Unmutes the current mic.
getCurrentMicDeviceMute Gets whether the current mic is muted.
getSpeakerDevicesList Gets the speaker list.
getCurrentSpeakerDevice Gets the speaker currently in use.
setCurrentSpeakerDevice Sets the speaker to use.
getCurrentSpeakerVolume Gets the current speaker volume.
setCurrentSpeakerVolume Sets the current speaker volume.
setCurrentSpeakerDeviceMute Mutes/Unmutes the current speaker.
getCurrentSpeakerDeviceMute Gets whether the current speaker is muted.
enableFollowingDefaultAudioDevice Set the audio device used by SDK to follow the system default device.

Beauty & Watermark APIs

API Description
setBeautyStyle Sets the strength of the beauty, skin brightening, and rosy skin filters.
setWaterMark Sets the watermark.

Substream(Screen Share) APIs

API Description
startRemoteSubStreamView Starts rendering the substream (screen sharing) image of a remote user (disused).
stopRemoteSubStreamView Stops rendering the substream (screen sharing) image of a remote user (disused).
setRemoteSubStreamViewFillMode Sets the rendering mode of substream (screen sharing) images (disused).
setRemoteSubStreamViewRotation Sets the clockwise rotation of substream (screen sharing) images (disused).
getScreenCaptureSources Enumerates shareable sources.
selectScreenCaptureTarget Sets screen sharing parameters. This API can be called during screen sharing.
startScreenCapture Starts screen sharing.
pauseScreenCapture Pauses screen sharing.
resumeScreenCapture Resumes screen sharing.
stopScreenCapture Stops screen sharing.
setSubStreamEncoderParam Sets encoder parameters for substream (screen sharing) images.
setSubStreamMixVolume Sets the audio mixing volume of substream (screen sharing) video.
addExcludedShareWindow Adds a specified window to the exclusion list of screen sharing. Windows in the list will not be shared.
removeExcludedShareWindow Removes a specified window from the exclusion list of screen sharing.
removeAllExcludedShareWindow Removes all windows from the exclusion list of screen sharing.

Custom Rendering APIs

API Description
setLocalVideoRenderCallback Set the callback of custom rendering for local video
setRemoteVideoRenderCallback Set the callback of custom rendering for remote video

Custom Message APIs

API Description
sendCustomCmdMsg Sends a custom message to all users in a room.
sendSEIMsg Embeds small-volume custom data into video frames.

Background Music APIs

API Description
playBGM Starts background music (disused).
stopBGM Stops background music (disused).
pauseBGM Pauses background music (disused).
resumeBGM Resumes background music (disused).
getBGMDuration Gets the total length of the background music file, in milliseconds (disused).
setBGMPosition Sets the playback progress of background music (disused).
setBGMVolume Sets background music volume (disused).
setBGMPlayoutVolume Sets the local playback volume of background music (disused).
setBGMPublishVolume Sets the remote playback volume of background music (disused).
startSystemAudioLoopback Enables system audio capturing.
stopSystemAudioLoopback Disables system audio capturing.
setSystemAudioLoopbackVolume Sets system audio capturing volume.
startPlayMusic Starts background music.
stopPlayMusic Stops background music.
pausePlayMusic Pauses background music.
resumePlayMusic Resumes background music.
getMusicDurationInMS Gets the total length of the background music file, in milliseconds.
seekMusicToPosInTime Sets the playback progress of background music.
setAllMusicVolume Sets background music volume. This API is used to control the audio mixing volume of background music.
setMusicPlayoutVolume Sets the local playback volume of background music.
setMusicPublishVolume Sets the remote playback volume of background music.
setVoiceReverbType Setting voice reverb effects.

Audio Effect APIs

API Description
playAudioEffect Plays an audio effect (disused).
setAudioEffectVolume Sets the volume of an audio effect (disused).
stopAudioEffect Stops an audio effect (disused).
stopAllAudioEffects Stops all audio effects (disused).
setAllAudioEffectsVolume Sets the volume of all audio effects (disused).
pauseAudioEffect Pauses an audio effect (disused).
resumeAudioEffect Resumes an audio effect (disused).

Device and Network Testing APIs

API Description
startSpeedTest Starts network speed testing. This may compromise the quality of video calls and should be avoided during a video call.
stopSpeedTest Stops network speed testing.
startCameraDeviceTest Starts camera test.
stopCameraDeviceTest Stops camera test.
startMicDeviceTest Starts mic testing.
stopMicDeviceTest Stops mic test.
startSpeakerDeviceTest Starts speaker testing.
stopSpeakerDeviceTest Stops speaker test.

Log APIs

API Description
getSDKVersion Gets the SDK version.
setLogLevel Sets the log output level.
setConsoleEnabled Enables/Disables console log printing.
setLogCompressEnabled Enables/Disables local log compression.
setLogDirPath Sets the path to save logs.
setLogCallback Sets the log callback.
callExperimentalAPI Calls the experimental API.

Disused APIs

API Description
setMicVolumeOnMixing This API has been disused since v6.9.

TRTCCallback @ TXLiteAVSDK

Tencent Cloud TRTC Event Notification Interface.

Error and warning event callback APIs

API Description
onError Error callback. This indicates that the SDK encountered an unrecoverable error. Such errors must be listened for, and UI messages should be sent to users if necessary.
onWarning Warning callback. This alerts you to non-serious problems such as stutter or recoverable decoding failure.

Room event callback APIs

API Description
onEnterRoom Callback for room entry
onExitRoom Callback for room exit
onSwitchRole Callback for role switching
onConnectOtherRoom Callback of the result of requesting a cross-room call (anchor competition)
onDisconnectOtherRoom Callback of the result of ending a cross-room call (anchor competition)
onSwitchRoom Callback for room switching

User event callback APIs

API Description
onRemoteUserEnterRoom Callback for the entry of a user
onRemoteUserLeaveRoom Callback for the exit of a user
onUserVideoAvailable Whether camera is enabled for video.
onUserSubStreamAvailable Callback of whether a user has started screen sharing
onUserAudioAvailable Callback of whether a user is sending audio data
onFirstVideoFrame Callback for rendering the first video frame of the local user or a remote user
onFirstAudioFrame Callback for playing the first audio frame of a remote user. No notifications are sent for local audio.
onSendFirstLocalVideoFrame Callback for sending the first local video frame.
onSendFirstLocalAudioFrame Callback for sending the first local audio frame.
onUserEnter Callback for the entry of an anchor (disused)
onUserExit Callback for the exit of an anchor (disused)

Event callback APIs for statistics on network quality and technical metrics

API Description
onNetworkQuality Network quality. This callback is triggered every 2 seconds to collect statistics on the quality of current upstream and downstream data transfer.
onStatistics Callback of statistics on technical metrics.

Server event callback APIs

API Description
onConnectionLost Callback for the disconnection of the SDK from the server
onTryToReconnect Callback for the SDK trying to reconnect to the server
onConnectionRecovery Callback for the reconnection of the SDK to the server
onSpeedTest Disused API: callback of server speed test results. The SDK tests the speed of multiple server addresses, and the result of each test is returned through this callback.
onSpeedTestResult Network speed test result.

Hardware event callback APIs

API Description
onCameraDidReady Callback for the camera being ready
onMicDidReady Callback for the mic being ready
onUserVoiceVolume Callback of volume, including the volume of each user (userId) and the total remote volume
onDeviceChange Callback for the connection/disconnection of a local device
onTestMicVolume Volume callback for mic testing
onTestSpeakerVolume Volume callback for speaker testing
onAudioDeviceCaptureVolumeChanged Callback for volume change of the current audio capturing device
[onAudioDevicePlayoutVolumeChanged]TRTCCallback.html#event:onAudioDevicePlayoutVolumeChanged) Callback for volume change of the current audio playback device

Custom message receiving callback APIs

API Description
onRecvCustomCmdMsg Callback for receiving a custom message
onMissCustomCmdMsg Callback for losing a custom message
onRecvSEIMsg Callback for receiving an SEI message

CDN event callback APIs

API Description
onStartPublishing Callback for starting publishing to Tencent Cloud’s live streaming CDN. This callback is triggered by the startPublishing() API in TRTCCloud.
onStopPublishing Callback for stopping publishing to Tencent Cloud’s live streaming CDN. This callback is triggered by the stopPublishing() API in TRTCCloud.
onStartPublishCDNStream Callback for starting relayed push to CDNs
onStopPublishCDNStream Callback for stopping relayed push to CDNs
onSetMixTranscodingConfig Callback for setting On-Cloud MixTranscoding parameters. This callback is triggered by the setMixTranscodingConfig() API in TRTCCloud.

System audio event callback APIs

API Description
onSystemAudioLoopbackError Callback of the system audio capturing result (only for macOS)

Audio effect callback APIs

API Description
onAudioEffectFinished Callback for the end of an audio effect (disused)

Screen sharing event callback APIs

API Description
onScreenCaptureCovered Callback for the screen sharing window being covered. You can prompt users to move the window in this callback.
onScreenCaptureStarted Callback for starting screen sharing
onScreenCapturePaused Callback for pausing screen sharing
onScreenCaptureResumed Callback for resuming screen sharing
onScreenCaptureStopped Callback for stopping screen sharing

Screenshot event callback API

API Description
onSnapshotComplete Callback for completing a screenshot

Background music event callback APIs

API Description
onPlayBGMBegin Callback for starting background music (disused)
onPlayBGMProgress Callback of the playback progress of background music (disused)
onPlayBGMComplete Callback for the end of background music (disused)

Local media recording event callback APIs

API Description
onLocalRecordBegin Local recording started
onLocalRecording Local media is being recording
onLocalRecordComplete Local recording completed

Definitions of Key Data Types

API Description
TRTCParams Room entry parameters
TRTCVideoEncParam Video encoding parameters
TRTCNetworkQosParam Network quality control parameters
TRTCQualityInfo Video quality
TRTCVolumeInfo Volume
TRTCSpeedTestResult Network speed testing result
TRTCMixUser Position of the image of each channel in On-Cloud MixTranscoding
TRTCTranscodingConfig On-Cloud MixTranscoding configuration
TRTCPublishCDNParam CDN relayed push parameters
TRTCAudioRecordingParams Audio recording parameters
TRTCLocalStatistics Local audio/video statistics
TRTCRemoteStatistics Remote audio/video statistics
TRTCStatistics Statistics

Enumerated values

API Description
TRTCVideoResolution Video resolution
TRTCVideoResolutionMode Video resolution mode
TRTCVideoStreamType Video stream type
TRTCQuality Video quality
TRTCVideoFillMode Video image fill mode
TRTCBeautyStyle Beauty filter (skin smoothing) algorithm
TRTCAppScene Application scenario
TRTCRoleType Role, which applies only to live streaming scenarios (TRTCAppSceneLIVE)
TRTCQosControlMode QoS control mode
TRTCVideoQosPreference Video quality preference
TRTCDeviceState Device state type
TRTCDeviceType Device type
TRTCWaterMarkSrcType Watermark source type
TRTCTranscodingConfigMode Configuration mode for stream mixing parameters