Overview

TRTCCloud @ TXLiteAVSDK

TRTC main API classes
Documentation:
Sample code: TRTC Electron Demo

Creating A TRTC object

const TRTCCloud = require('trtc-electron-sdk').default;
// import TRTCCloud from 'trtc-electron-sdk';
this.rtcCloud = new TRTCCloud();
Since v7.9.348, the TRTC Electron SDK has integrated trtc.d.ts for developers using TypeScript.
import TRTCCloud from 'trtc-electron-sdk';

const rtcCloud: TRTCCloud = new TRTCCloud();
// Get the SDK version number
rtcCloud.getSDKVersion();

Setting 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);
});
rtcCloud.on('onExitRoom', (reason) => {
console.info('onExitRoom: userenter reason:' + reason);
});
};


subscribeEvents(this.rtcCloud);

Creating and terminating a TRTCCloud singleton

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

Room APIs

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

CDN APIs

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

Video APIs

API
Description
Enables capturing and preview of the local camera.
Disables capturing and preview of the local camera.
Pauses/Resumes publishing the local video.
Starts playing the video of a remote user.
Stops playing and pulling the video of a remote user.
Stops playing and pulling the videos of all remote users.
Pauses/Resumes receiving the video of a specified remote user.
Pauses/Resumes receiving the videos of all remote users.
Sets video encoder parameters.
Sets video preference.
Sets rendering parameters for the local video (primary stream).
Sets the rendering mode of the local video (deprecated).
Sets rendering parameters for a remote video.
Sets the rendering mode of a remote video (deprecated).
Sets the clockwise rotation of the local video (deprecated).
Sets the clockwise rotation of a remote video (deprecated).
Sets the rotation of encoded video images, i.e., images shown to remote users and recorded by the server.
Sets the mirror mode of the local camera's preview image (deprecated).
Sets the mirror mode of encoded images.
Enables/Disables the dual-stream mode (low-quality and high-quality streams).
Sets whether to view the high-quality or low-quality video of a specified user (userId).
Sets video quality preference for the audience (deprecated).
Takes a video screenshot.

Audio APIs

API
Description
Enables local audio capturing and publishing.
Disables local audio capturing and publishing.
Mutes/Unmutes the local user.
Mutes a remote user and stops pulling the user’s audio.
Mutes all remote users and stops pulling their audios.
Sets the SDK capturing volume.
Gets the SDK capturing volume.
Sets the SDK playback volume.
Gets the SDK playback volume.
Enables/Disables the volume reminder.
Starts audio recording.
Stops audio recording.
Sets audio quality (deprecated).
Sets the playback volume of a remote user.

Camera APIs

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

Audio device APIs

API
Description
Gets the mic list.
Gets the mic currently in use.
Sets the mic to use.
Gets the current mic volume.
Sets the current mic volume.
Mutes/Unmutes the current mic.
Gets whether the current mic is muted.
Gets the speaker list.
Gets the speaker currently in use.
Sets the speaker to use.
Gets the current speaker volume.
Sets the current speaker volume.
Mutes/Unmutes the current speaker.
Gets whether the current speaker is muted.

Beauty filter APIs

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

Substream APIs

API
Description
Starts rendering the substream (screen sharing) video of a remote user (deprecated).
Stops rendering the substream (screen sharing) video of a remote user (deprecated).
Sets the rendering mode of the substream (screen sharing) video (deprecated).
Sets the clockwise rotation of the substream (screen sharing) video (deprecated).
Enumerates shareable sources.
Sets screen sharing parameters. This API can be called during screen sharing.
Starts screen sharing.
Pauses screen sharing.
Resumes screen sharing.
Stops screen sharing.
Sets encoder parameters for the substream (screen sharing) video.
Sets the audio mixing volume of the substream (screen sharing) video.
Adds a specified window to the exclusion list of screen sharing. Windows in the list will not be shared.
Removes a specified window from the exclusion list of screen sharing.
Removes all windows from the exclusion list of screen sharing.

Custom message sending APIs

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

Background music mixing APIs

API
Description
Starts background music (deprecated).
Stops background music (deprecated).
Pauses background music (deprecated).
Resumes background music (deprecated).
Gets the total length of the background music file, in milliseconds (deprecated).
Sets the playback progress of background music (deprecated).
Sets background music volume (deprecated).
Sets the local playback volume of background music (deprecated).
Sets the remote playback volume of background music (deprecated).
Enables system audio capturing.
Disables system audio capturing.
Sets system audio capturing volume.
Starts background music.
Stops background music.
Pauses background music.
Resumes background music.
Gets the total length of the background music file, in milliseconds.
Sets the playback progress of background music.
Sets background music volume. This API is used to control the audio mixing volume of background music.
Sets the local playback volume of background music.
Sets the remote playback volume of background music.

Audio effect APIs

API
Description
Plays an audio effect (deprecated).
Sets the volume of an audio effect (deprecated).
Stops an audio effect (deprecated).
Stops all audio effects (deprecated).
Sets the volume of all audio effects (deprecated).
Pauses an audio effect (deprecated).
Resumes an audio effect (deprecated).

Device and network testing APIs

API
Description
Starts network speed testing. This may compromise the quality of video calls and should be avoided during a video call.
Stops network speed testing.
Starts camera testing.
Stops camera testing.
Starts mic testing.
Stops mic testing.
Starts speaker testing.
Stops speaker testing.

Log APIs

API
Description
Gets the SDK version.
Sets the log output level.
Enables/Disables console log printing.
Enables/Disables local log compression.
Sets the path to save logs.
Sets the log callback.
Calls the experimental API.

Disused APIs

API
Description
This API has been deprecated since v6.9.

TRTCCallback @ TXLiteAVSDK

TRTC callback API classes

Error and warning event callback APIs

API
Description
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.
Warning callback. This alerts you to non-serious problems such as stutter or recoverable decoding failure.

Room event callback APIs

API
Description
Callback for room entry
Callback for room exit
Callback for role switching
Callback of the result of a cross-room communication request
Callback of the result of ending cross-room communication
Callback for room switching

Member event callback APIs

API
Description
Callback for the entry of a user
Callback for the exit of a user
Callback of whether a user has turned their camera on.
Callback of whether a user has started screen sharing
Callback of whether a user is sending audio data
Callback for rendering the first video frame of the local user or a remote user
Callback for playing the first audio frame of a remote user. No notifications are sent for local audio.
Callback for sending the first local video frame
Callback for sending the first local audio frame
Callback for the entry of an anchor (deprecated)
Callback for the exit of an anchor (deprecated)

Callback APIs for statistics on network quality and technical metrics

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

Server event callback APIs

API
Description
Callback for the disconnection of the SDK from the server
Callback for the SDK trying to reconnect to the server
Callback for the reconnection of the SDK to the server
onSpeedTest
Callback of server speed test results (deprecated). The SDK tests the speed of multiple server addresses, and the result of each test is returned through this callback.
Callback of network speed test results.

Hardware event callback APIs

API
Description
Callback for the camera being ready
Callback for the mic being ready
onUserVoiceVolume
Callback of volumes, including the volume of each user (userId) and the total remote volume. If userid is ``, it indicates the local user.
Callback for the connection/disconnection of a local device
Volume callback for mic testing
Volume callback for speaker testing
Callback for volume change of the current audio capturing device
Callback for volume change of the current audio playback device

Custom message receiving callback APIs

API
Description
Callback for receiving a custom message
Callback for losing a custom message
Callback for receiving an SEI message

Callback APIs for relay to CDN

API
Description
Callback for starting publishing to Tencent Cloud’s live streaming CDN. This callback is triggered by the startPublishing() API in TRTCCloud.
Callback for stopping publishing to Tencent Cloud’s live streaming CDN. This callback is triggered by the stopPublishing() API in TRTCCloud.
Callback for relaying to a CDN
Callback for stopping relaying to a CDN
Callback for setting On-Cloud MixTranscoding parameters. This callback is triggered by the setMixTranscodingConfig() API in TRTCCloud.

Callback APIs for system audio capturing

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

Audio effect callback APIs

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

Screen sharing callback APIs

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

Screenshot callback API

API
Description
Callback for taking a screenshot

Background music callback APIs

API
Description
Callback for starting background music (deprecated)
Callback of the playback progress of background music (deprecated)
Callback for the end of background music (deprecated)

Definitions of Key Types

Key types

Type
Description
Room entry parameters
Video encoding parameters
QoS control parameters
Video quality
Volume
Network speed testing result
Video layout for On-Cloud MixTranscoding
On-Cloud MixTranscoding configuration
Relay to CDN parameters
Audio recording parameters
Local audio/video statistics
Remote audio/video statistics
Statistics

Enumerated values

Enumerated Value
Description
Video resolution
Video resolution mode
Video stream type
Video quality
Video image fill mode
Beauty filter (skin smoothing) algorithm
Application scenario
Role, which applies only to live streaming scenarios (TRTCAppSceneLIVE)
QoS control mode
Video quality preference
Device operation
Device type
Watermark source type
Configuration mode for stream mixing parameters