TRTCCloud @ TXLiteAVSDK

Tencent Cloud TRTC Core Function Interface.

Creating TRTC object

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

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
startPublishMediaStream Start publishing media stream
updatePublishMediaStream Update publishing stream
stopPublishMediaStream Stop publishing media stream

Video APIs

API Description
startLocalPreview Enables capturing and preview of the local camera.
stopLocalPreview Disables capturing and preview of the local camera.
updateLocalView Updates the HTML element for local camera preview.
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.
updateRemoteView Updates the HTML element for remote video rendering.
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).
setRemoteRenderParams Sets rendering parameters for a remote image.
setVideoEncoderRotation Sets the rotation of encoded video images, i.e., images presented to remote users and recorded by the server.
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.
startLocalRecording Start local media recording.
stopLocalRecording Stop local media recording.
setRemoteAudioParallelParams Sets the concurrent playback policy for remote audio streams.

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.

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
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 Capture and Rendering APIs

API Description
enableCustomAudioCapture Enables custom audio capturing mode.
sendCustomAudioData Sends custom captured audio data to the SDK.
enableMixExternalAudioFrame Enables/Disables custom audio track.
mixExternalAudioFrame Mixes custom audio track into the SDK.
setMixExternalAudioVolume Sets the publishing and playback volume of the mixed external audio.
generateCustomPTS Generates a PTS for custom capturing.
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
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.
setVoiceChangerType Setting voice change effects.
enableVoiceEarMonitor Turn on the ear monitor.
setVoiceEarMonitorVolume Setting ear monitor volume.
setVoiceCaptureVolume Setting voice volume.
setVoicePitch Setting voice pitch.

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.

Plugin APIs

API Description
setPluginParams Sets custom plugin options.
addPlugin Adds a plugin.
removePlugin Removes a plugin.
setPluginCallback Sets the plugin event callback.

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.

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
onSpeedTestResult Network speed test result callback.

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 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
onStartPublishMediaStream Callback for starting media stream publishing.
onUpdatePublishMediaStream Callback for updating media stream publishing.
onStopPublishMediaStream Callback for stopping media stream publishing.
onCdnStreamStateChanged Callback for RTMP/RTMPS push status change.

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

Local media recording event callback APIs

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

System audio event callback APIs

API Description
onSystemAudioLoopbackError Callback for system audio capturing failure. The SDK emits this event after an attempt to enable system audio capture fails.

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
TRTCSpeedTestParams Network speed testing parameters
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