FuncList | DESC |
Create TRTCCloud instance (singleton mode). | |
Terminate TRTCCloud instance (singleton mode). | |
Add TRTC event callback. | |
Remove TRTC event callback. | |
Enter room. | |
Exit room. | |
Switch role. | |
Switch room. | |
Request cross-room call. | |
Exit cross-room call. | |
Set subscription mode (which must be set before room entry for it to take effect). | |
Create room subinstance (for concurrent multi-room listen/watch). | |
Terminate room subinstance. | |
Publish a stream. | |
Modify publishing parameters. | |
Stop publishing. | |
Enable the preview image of local camera (mobile). | |
Stop camera preview. | |
Pause/Resume publishing local video stream. | |
Subscribe to remote user's video stream and bind video rendering control. | |
Stop subscribing to remote user's video stream and release rendering control. | |
Stop subscribing to all remote users' video streams and release all rendering resources. | |
Pause/Resume subscribing to remote user's video stream. | |
Pause/Resume subscribing to all remote users' video streams. | |
Set the encoding parameters of video encoder. | |
Set network quality control parameters. | |
Set the rendering parameters of local video image. | |
Set the rendering mode of remote video image. | |
Enable dual-channel encoding mode with big and small images. | |
Switch the big/small image of specified remote user. | |
Set the adaptation mode of gravity sensing (version 11.7 and above). | |
Enable local audio capturing and publishing. | |
Stop local audio capturing and publishing. | |
Pause/Resume publishing local audio stream. | |
Pause/Resume playing back remote audio stream. | |
Pause/Resume playing back all remote users' audio streams. | |
Set the audio playback volume of remote user. | |
Set the capturing volume of local audio. | |
Get the capturing volume of local audio. | |
Set the playback volume of remote audio. | |
Get the playback volume of remote audio. | |
Enable volume reminder. | |
Start local media recording. | |
Stop local media recording. | |
Get device management class (TXDeviceManager). | |
Set special effects such as beauty, brightening, and rosy skin filters. | |
Add watermark. | |
Get sound effect management class (TXAudioEffectManager). | |
Enable system audio capturing(iOS not supported). | |
Stop system audio capturing(iOS not supported). | |
Start screen sharing. | |
Stop screen sharing. | |
Pause screen sharing. | |
Resume screen sharing. | |
Select the screen or window to share (for desktop systems only). | |
Set the video encoding parameters of screen sharing (i.e., substream) (for desktop and mobile systems). | |
Enable/Disable custom video capturing mode. | |
Deliver captured video frames to SDK. | |
Enable custom audio capturing mode. | |
Deliver captured audio data to SDK. | |
Enable/Disable custom audio track. | |
.1 Enable third-party beauty filters in video. | |
.2 Set video data callback for third-party beauty filters. | |
Set the callback of custom rendering for local video. | |
Set the callback of custom rendering for remote video. | |
Set custom audio data callback. | |
Set the callback format of audio frames captured by local mic. | |
Set the callback format of preprocessed local audio frames. | |
Set the callback format of audio frames to be played back by system. | |
Use UDP channel to send custom message to all users in room. | |
Use SEI channel to send custom message to all users in room. | |
Start network speed test (used before room entry). | |
Stop network speed test. | |
Get SDK ScriptVersion information. | |
Get SDK version information. | |
Set log output level. | |
Enable/Disable console log printing. | |
Enable/Disable local log compression. | |
Set local log storage path. | |
Set log callback. | |
Call experimental APIs. |
delete ITRTCCloud* , a compilation error will occur. Please use destroyTRTCShareInstance to release the object pointer.void addCallback |
void enterRoom | |
|
onEnterRoom(result) callback from ITRTCCloudCallback: result parameter will be a positive number ( result > 0), indicating the time in milliseconds (ms) between function call and room entry. result parameter will be a negative number ( result < 0), indicating the TXLiteAVError for room entry failure.Param | DESC |
param | Room entry parameter, which is used to specify the user's identity, role, authentication credentials, and other information. For more information, please see TRTCParams. |
scene | Application scenario, which is used to specify the use case. The same TRTCAppScene should be configured for all users in the same room. |
scene is specified as TRTCAppSceneLIVE or TRTCAppSceneVoiceChatRoom, you must use the role field in TRTCParams to specify the role of the current user in the room. scene should be configured for all users in the same room. Different scene may cause occasional abnormal problems. onExitRoom() callback in ITRTCCloudCallback to notify you.void switchRole |
anchor and audience . role field in TRTCParams during room entry to specify the user role in advance or use the switchRole API to switch roles after room entry.Param | DESC |
role | Role, which is anchor by default: TRTCRoleAnchor: anchor, who can publish their audio/video streams. Up to 50 anchors are allowed to publish streams at the same time in one room. TRTCRoleAudience: audience, who cannot publish their audio/video streams, but can only watch streams of anchors in the room. If they want to publish their streams, they need to switch to the "anchor" role first through switchRole. One room supports an audience of up to 100,000 concurrent online users. |
scene you specify in enterRoom is TRTCAppSceneVideoCall or TRTCAppSceneAudioCall, please do not call this API.void switchRoom |
audience , calling this API is equivalent to exitRoom (current room) + enterRoom (new room). anchor , the API will retain the current audio/video publishing status while switching the room; therefore, during the room switch, camera preview and sound capturing will not be interrupted. switchRoom can get better smoothness and use less code than exitRoom + enterRoom . onSwitchRoom(errCode, errMsg) in ITRTCCloudCallback.Param | DESC |
config |
config parameter contains both roomId and strRoomId parameters. You should pay special attention as detailed below when specifying these two parameters: strRoomId , then set roomId to 0. If both are specified, roomId will be used. strRoomId or roomId at the same time. They cannot be mixed; otherwise, there will be many unexpected bugs.void connectOtherRoom | (string jsonParams) |
connectOtherRoom() to successfully call anchor B in room "102": onRemoteUserEnterRoom(B) and onUserVideoAvailable(B,true) event callbacks of anchor B; that is, all users in room "101" can subscribe to the audio/video streams of anchor B. onRemoteUserEnterRoom(A) and onUserVideoAvailable(A,true) event callbacks of anchor A; that is, all users in room "102" can subscribe to the audio/video streams of anchor A.
roomId in JSON with strRoomId , such as {"strRoomId": "102", "userId": "userB"} Param | DESC |
param | You need to pass in a string parameter in JSON format: roomId represents the room ID in numeric format, strRoomId represents the room ID in string format, and userId represents the user ID of the target anchor. |
void setDefaultStreamRecvMode | (bool autoRecvAudio |
| bool autoRecvVideo) |
startRemoteView API).Param | DESC |
autoRecvAudio | true: automatic subscription to audio; false: manual subscription to audio by calling muteRemoteAudio(false) . Default value: true |
autoRecvVideo | true: automatic subscription to video; false: manual subscription to video by calling startRemoteView . Default value: true |
TRTCCloud was originally designed to work in the singleton mode, which limited the ability to watch concurrently in multiple rooms. TRTCCloud instances, so that you can enter multiple different rooms at the same time to listen/watch audio/video streams. TRTCCloud instances will be limited. roomId values by using the same userId . userId to enter the same room with a specified roomId . TRTCCloud instances at the same time, and can also call APIs related to local audio/video in the sub instance. But need to pay attention to: TRTCCloud subinstancevoid destroySubCloud |
Param | DESC |
subCloud | Room subinstance |
void startPublishMediaStream | |
| |
|
Param | DESC |
config | The On-Cloud MixTranscoding settings. This parameter is invalid in the relay-to-CDN mode. It is required if you transcode and publish the stream to a CDN or to a TRTC room. For details, see TRTCStreamMixingConfig. |
params | The encoding settings. This parameter is required if you transcode and publish the stream to a CDN or to a TRTC room. If you relay to a CDN without transcoding, to improve the relaying stability and playback compatibility, we also recommend you set this parameter. For details, see TRTCStreamEncoderParam. |
target | The publishing destination. You can relay the stream to a CDN (after transcoding or without transcoding) or transcode and publish the stream to a TRTC room. For details, see TRTCPublishTarget. |
target . You will be charged only once for transcoding even if you relay to multiple CDNs.void updatePublishMediaStream | (string taskId |
| |
| |
|
Param | DESC |
config | The On-Cloud MixTranscoding settings. This parameter is invalid in the relay-to-CDN mode. It is required if you transcode and publish the stream to a CDN or to a TRTC room. For details, see TRTCStreamMixingConfig. |
params | The encoding settings. This parameter is required if you transcode and publish the stream to a CDN or to a TRTC room. If you relay to a CDN without transcoding, to improve the relaying stability and playback compatibility, we recommend you set this parameter. For details, see TRTCStreamEncoderParam. |
target | The publishing destination. You can relay the stream to a CDN (after transcoding or without transcoding) or transcode and publish the stream to a TRTC room. For details, see TRTCPublishTarget. |
taskId |
void stopPublishMediaStream | (string taskId) |
Param | DESC |
taskId |
taskId is left empty, the TRTC backend will end all tasks you started through startPublishMediaStream. You can leave it empty if you have started only one task or want to stop all publishing tasks started by you.void startLocalPreview | (bool frontCamera |
| GameObject view) |
onCameraDidReady callback in ITRTCCloudCallback.Param | DESC |
frontCamera | true: front camera; false: rear camera |
view | Control that carries the video image |
void muteLocalVideo | |
| bool mute) |
startLocalPreview/stopLocalPreview when TRTCVideoStreamTypeBig is specified, but has higher performance and response speed. startLocalPreview/stopLocalPreview APIs need to enable/disable the camera, which are hardware device-related operations, so they are very time-consuming. muteLocalVideo only needs to pause or allow the data stream at the software level, so it is more efficient and more suitable for scenarios where frequent enabling/disabling are needed. onUserVideoAvailable(userId, false) callback notification. onUserVideoAvailable(userId, true) callback notification.Param | DESC |
mute | true: pause; false: resume |
streamType | Specify for which video stream to pause (or resume). Only TRTCVideoStreamTypeBig and TRTCVideoStreamTypeSub are supported |
void startRemoteView | (string userId |
| |
| GameObject view) |
userId and render it to the rendering control specified by the view parameter. You can set the display mode of the video image through setRemoteRenderParams. userId of a user who has a video stream in the room, you can directly call startRemoteView to subscribe to the user's video image.Param | DESC |
streamType | Video stream type of the userId specified for watching: HD big image: TRTCVideoStreamTypeBig Smooth small image: TRTCVideoStreamTypeSmall (the remote user should enable dual-channel encoding through enableSmallVideoStream for this parameter to take effect) Substream image (usually used for screen sharing): TRTCVideoStreamTypeSub |
userId | ID of the specified remote user |
view | Rendering control that carries the video image |
userId at the same time, but does not support watching the big image and small image at the same time. userId enables dual-channel encoding through enableSmallVideoStream can the user's small image be viewed. userId does not exist, the SDK will switch to the big image of the user by default.void stopRemoteView | (string userId |
|
Param | DESC |
streamType | Video stream type of the userId specified for watching: HD big image: TRTCVideoStreamTypeBig Smooth small image: TRTCVideoStreamTypeSmall Substream image (usually used for screen sharing): TRTCVideoStreamTypeSub |
userId | ID of the specified remote user |
void muteRemoteVideoStream | (string userId |
| |
| bool mute) |
Param | DESC |
mute | Whether to pause receiving |
streamType | Specify for which video stream to pause (or resume): HD big image: TRTCVideoStreamTypeBig Smooth small image: TRTCVideoStreamTypeSmall Substream image (usually used for screen sharing): TRTCVideoStreamTypeSub |
userId | ID of the specified remote user |
void muteAllRemoteVideoStreams | (bool mute) |
Param | DESC |
mute | Whether to pause receiving |
void setVideoEncoderParam |
Param | DESC |
param | It is used to set relevant parameters for the video encoder. For more information, please see TRTCVideoEncParam. |
void setNetworkQosParam |
Param | DESC |
param | It is used to set relevant parameters for network quality control. For details, please refer to TRTCNetworkQosParam. |
void setLocalRenderParams |
Param | DESC |
params |
void setRemoteRenderParams | (string userId |
| |
|
Param | DESC |
params | |
streamType | It can be set to the primary stream image (TRTCVideoStreamTypeBig) or substream image (TRTCVideoStreamTypeSub). |
userId | ID of the specified remote user |
void enableSmallVideoStream | (bool enable |
|
Param | DESC |
enable | Whether to enable small image encoding. Default value: false |
smallVideoEncParam | Video parameters of small image stream |
void setRemoteVideoStreamType | (string userId |
|
Param | DESC |
streamType | Video stream type, i.e., big image or small image. Default value: big image |
userId | ID of the specified remote user |
void setGravitySensorAdaptiveMode |
Param | DESC |
mode | Gravity sensing mode, see TRTCGravitySensorAdaptiveMode_Disable、TRTCGravitySensorAdaptiveMode_FillByCenterCrop and TRTCGravitySensorAdaptiveMode_FitWithBlackBorder for details, default value: TRTCGravitySensorAdaptiveMode_Disable. |
void startLocalAudio |
Param | DESC |
quality | Sound quality TRTCAudioQualitySpeech - Smooth: mono channel; audio bitrate: 18 Kbps. This is suitable for audio call scenarios, such as online meeting and audio call. TRTCAudioQualityDefault - Default: mono channel; audio bitrate: 50 Kbps. This is the default sound quality of the SDK and recommended if there are no special requirements. TRTCAudioQualityMusic - HD: dual channel + full band; audio bitrate: 128 Kbps. This is suitable for scenarios where Hi-Fi music transfer is required, such as online karaoke and music live streaming. |
void muteLocalAudio | (bool mute) |
muteLocalAudio(true) does not release the mic permission; instead, it continues to send mute packets with extremely low bitrate. muteLocalAudio instead of stopLocalAudio is recommended in scenarios where the requirement for recording file quality is high.Param | DESC |
mute | true: mute; false: unmute |
void muteRemoteAudio | (string userId |
| bool mute) |
Param | DESC |
mute | true: mute; false: unmute |
userId | ID of the specified remote user |
void muteAllRemoteAudio | (bool mute) |
Param | DESC |
mute | true: mute; false: unmute |
void setRemoteAudioVolume | (string userId |
| int volume) |
setRemoteAudioVolume(userId, 0) .Param | DESC |
userId | ID of the specified remote user |
volume | Volume. 100 is the original volume. Value range: [0,150]. Default value: 100 |
void setAudioCaptureVolume | (int volume) |
Param | DESC |
volume | Volume. 100 is the original volume. Value range: [0,150]. Default value: 100 |
void setAudioPlayoutVolume | (int volume) |
Param | DESC |
volume | Volume. 100 is the original volume. Value range: [0,150]. Default value: 100 |
void enableAudioVolumeEvaluation | (bool enable |
|
Param | DESC |
enable | Whether to enable the volume prompt. It’s disabled by default. |
params |
void startLocalRecording |
Param | DESC |
params |
void setBeautyStyle | |
| uint beauty |
| uint white |
| uint ruddiness) |
Param | DESC |
beautyLevel | Strength of the beauty filter. Value range: 0–9; 0 indicates that the filter is disabled, and the greater the value, the more obvious the effect. |
ruddinessLevel | Strength of the rosy skin filter. Value range: 0–9; 0 indicates that the filter is disabled, and the greater the value, the more obvious the effect. |
style | Skin smoothening algorithm ("smooth" or "natural") |
whitenessLevel | Strength of the brightening filter. Value range: 0–9; 0 indicates that the filter is disabled, and the greater the value, the more obvious the effect. |
void setWaterMark | |
| string srcData |
| |
| uint nWidth |
| uint nHeight |
| float xOffset |
| float yOffset |
| float fWidthRatio |
| bool isVisibleOnLocalPreview = false) |
xOffset , yOffset , and fWidthRatio parameters. xOffset : X coordinate of watermark, which is a floating-point number between 0 and 1. yOffset : Y coordinate of watermark, which is a floating-point number between 0 and 1. fWidthRatio : watermark dimensions ratio, which is a floating-point number between 0 and 1.Param | DESC |
fWidthRatio | Ratio of watermark width to image width (the watermark will be scaled according to this parameter) |
isVisibleOnLocalPreview | true: local preview show wartermark;false: local preview hide wartermark.only effect on win/mac. |
nHeight | Pixel height of watermark image (this parameter will be ignored if the source data is a file path) |
nWidth | Pixel width of watermark image (this parameter will be ignored if the source data is a file path) |
srcData | Source data of watermark image (if nullptr is passed in, the watermark will be removed) |
srcType | |
streamType | |
xOffset | Top-left offset on the X axis of watermark |
yOffset | Top-left offset on the Y axis of watermark |
TXAudioEffectManager is a sound effect management API, through which you can implement the following features: isShortFile parameter to true ).void startSystemAudioLoopback | (string deviceName) |
Param | DESC |
deviceName | If this parameter is empty, the audio of the entire system is captured. |
deviceName to the absolute path of an executable file (such as QQMuisc.exe ) of a certain application. In this case, the SDK will only capture the sound of that application (32-bit version of the SDK is supported, 64-bit version of the SDK requires Windows version 10.0.19042 or higher). deviceName as the name of a certain speaker device to capture specific speaker sound (you can use the getDevicesList interface in TXDeviceManager to obtain the speaker devices of type TXMediaDeviceTypeSpeaker). deviceName as the process ID of a certain process (in the format of "process_xxx", where xxx is the process ID), and then the SDK will capture the sound of that process (requires Windows version 10.0.19042 or higher). deviceName as the process ID of a certain process to be excluded (in the format of "exclude_process_xxx", where xxx is the process ID), and then the SDK will capture all sounds except for that process (requires Windows version 10.0.19042 or higher).void startScreenCapture | (GameObject view |
| |
|
Param | DESC |
encParam | Image encoding parameters used for screen sharing, which can be set to empty, indicating to let the SDK choose the optimal encoding parameters (such as resolution and bitrate). |
streamType | Channel used for screen sharing, which can be the primary stream (TRTCVideoStreamTypeBig) or substream (TRTCVideoStreamTypeSub). |
view | Parent control of the rendering control, which can be set to a null value, indicating not to display the preview of the shared screen. |
onError(ERR_SERVER_CENTER_ANOTHER_USER_PUSH_SUB_VIDEO) callback from ITRTCCloudCallback.void selectScreenCaptureTarget | (TRTCScreenCaptureSourceInfo source |
| Rect captureRect |
| TRTCScreenCaptureProperty property) |
source whose type is TRTCScreenCaptureSourceTypeScreen in sourceInfoList , set captureRect to { 0, 0, 0, 0 } . source whose type is TRTCScreenCaptureSourceTypeScreen in sourceInfoList , set captureRect to a non-nullptr value, e.g., { 100, 100, 300, 300 } . source whose type is TRTCScreenCaptureSourceTypeWindow in sourceInfoList , set captureRect to { 0, 0, 0, 0 } . source whose type is TRTCScreenCaptureSourceTypeWindow in sourceInfoList , set captureRect to a non-nullptr value, e.g., { 100, 100, 300, 300 } .Param | DESC |
captureRect | Specify the area to be captured |
property | Specify the attributes of the screen sharing target, such as capturing the cursor and highlighting the captured window. For more information, please see the definition of TRTCScreenCaptureProperty |
source |
void setSubStreamEncoderParam |
Param | DESC |
param |
void enableCustomVideoCapture | |
| bool enable) |
Param | DESC |
enable | Whether to enable. Default value: false |
streamType | Specify video stream type (TRTCVideoStreamTypeBig: HD big image; TRTCVideoStreamTypeSub: substream image). |
void sendCustomVideoData | |
|
pixelFormat is set to I420, length can be calculated according to the following formula: length = width * height * 3 / 2 .Param | DESC |
frame | Video data, which can be in I420 format. |
streamType | Specify video stream type (TRTCVideoStreamTypeBig: HD big image; TRTCVideoStreamTypeSub: substream image). |
timestamp value of a video frame immediately after capturing it, so as to achieve the best audio/video sync effect.void enableCustomAudioCapture | (bool enable) |
Param | DESC |
enable | Whether to enable. Default value: false |
void sendCustomAudioData |
TRTCAudioFrameFormatPCM .Param | DESC |
frame | Audio data |
void enableMixExternalAudioFrame | (bool enablePublish |
| bool enablePlayout) |
Param | DESC |
enablePlayout | Whether the mixed audio track should be played back locally. Default value: false |
enablePublish | Whether the mixed audio track should be played back remotely. Default value: false |
enablePublish and enablePlayout as false , the custom audio track will be completely closed.int enableLocalVideoCustomProcess | (bool enable |
| |
|
Param | DESC |
bufferType | Specify the format of the data called back. |
enable | Whether to enable local video process. It’s disabled by default. |
pixelFormat | Specify the format of the pixel called back. |
void setLocalVideoCustomProcessCallback |
callback you set and use them for further processing by a third-party beauty filter component. Then, the SDK will encode and send the processed video frames.Param | DESC |
callback |
int setLocalVideoRenderCallback | |
| |
|
setLocalVideoRenderCallback(TRTCVideoPixelFormat_Unknown, TRTCVideoBufferType_Unknown, nullptr) to stop the callback.Param | DESC |
bufferType | Specify video data structure type. |
callback | Callback for custom rendering |
pixelFormat | Specify the format of the pixel called back |
int setRemoteVideoRenderCallback | (string userId |
| |
| |
|
setRemoteVideoRenderCallback(TRTCVideoPixelFormat_Unknown, TRTCVideoBufferType_Unknown, nullptr) to stop the callback.Param | DESC |
bufferType | |
callback | Callback for custom rendering |
pixelFormat | Specify the format of the pixel called back |
userId | remote user id |
startRemoteView(userid, nullptr) to get the video stream of the remote user first (set view to nullptr ); otherwise, there will be no data called back.int setAudioFrameCallback |
int setCapturedAudioFrameCallbackFormat |
AudioFrame format called back by onCapturedAudioFrame: 960 = 20 * 48000 / 1000 . number of bytes = number of sample points * number of channels * 2 (bit width) 3840 = 960 * 2 * 2 Param | DESC |
format | Audio data callback format |
int setLocalProcessedAudioFrameCallbackFormat |
number of sample points = number of milliseconds * sample rate / 1000 . 960 = 20 * 48000 / 1000 . number of bytes = number of sample points * number of channels * 2 (bit width) . 3840 = 960 * 2 * 2 .Param | DESC |
format | Audio data callback format |
int setMixedPlayAudioFrameCallbackFormat |
number of sample points = number of milliseconds * sample rate / 1000 . 960 = 20 * 48000 / 1000 . number of bytes = number of sample points * number of channels * 2 (bit width) . 3840 = 960 * 2 * 2 .Param | DESC |
format | Audio data callback format |
bool sendCustomCmdMsg | (int cmdId |
| byte[] data |
| int dataSize |
| bool reliable |
| bool ordered) |
onRecvCustomCmdMsg callback in ITRTCCloudCallback.Param | DESC |
cmdID | Message ID. Value range: [1, 10] |
data | Message to be sent. The maximum length of one single message is 1 KB. |
ordered | Whether orderly sending is enabled, i.e., whether the data packets should be received in the same order in which they are sent; if so, a certain delay will be caused. |
reliable | Whether reliable sending is enabled. Reliable sending can achieve a higher success rate but with a longer reception delay than unreliable sending. |
reliable and ordered must be set to the same value ( true or false ) and cannot be set to different values currently. cmdID values for messages of different types. This can reduce message delay when orderly sending is required.bool sendSEIMsg | (byte[] data |
| int dataSize |
| int repeatCount) |
onRecvSEIMsg callback in ITRTCCloudCallback.Param | DESC |
data | Data to be sent, which can be up to 1 KB (1,000 bytes) |
repeatCount | Data sending count |
repeatCount > 1), the data will be inserted into subsequent repeatCount video frames in a row for sending, which will increase the video bitrate. repeatCount is greater than 1, the data will be sent for multiple times, and the same message may be received multiple times in the onRecvSEIMsg callback; therefore, deduplication is required.void startSpeedTest |
Param | DESC |
params | speed test options |
void setLogLevel |
Param | DESC |
level |
void setConsoleEnabled | (bool enabled) |
Param | DESC |
enabled | Specify whether to enable it, which is disabled by default |
void setLogCompressEnabled | (bool enabled) |
Param | DESC |
enabled | Specify whether to enable it, which is enabled by default |
void setLogDirPath | (string path) |
%appdata%/liteav/log . sandbox Documents/log . /app directory/files/log/liteav/ .Param | DESC |
path | Log storage path |
void callExperimentalAPI | (string jsonStr) |
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback