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 role(support permission credential) | |
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) | |
Enable the preview image of local camera (desktop) | |
Update the preview image of local camera | |
Stop camera preview | |
Pause/Resume publishing local video stream | |
Set placeholder image during local video pause | |
Subscribe to remote user's video stream and bind video rendering control | |
Update remote user's 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 | |
Screencapture video | |
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 audio recording | |
Stop audio recording | |
Start local media recording | |
Stop local media recording | |
Set the parallel strategy of remote audio streams | |
Enable 3D spatial effect | |
Update self position and orientation for 3D spatial effect | |
Update the specified remote user's position for 3D spatial effect | |
Set the maximum 3D spatial attenuation range for userId's audio stream | |
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) | |
Set the volume of system audio capturing | |
Start screen sharing | |
Stop screen sharing | |
Pause screen sharing | |
Resume screen sharing | |
Enumerate shareable screens and windows (for desktop systems only) | |
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) | |
Set the audio mixing volume of screen sharing (for desktop systems only) | |
Add specified windows to the exclusion list of screen sharing (for desktop systems only) | |
Remove specified windows from the exclusion list of screen sharing (for desktop systems only) | |
Remove all windows from the exclusion list of screen sharing (for desktop systems only) | |
Add specified windows to the inclusion list of screen sharing (for desktop systems only) | |
Remove specified windows from the inclusion list of screen sharing (for desktop systems only) | |
Remove all windows from the inclusion list of screen sharing (for desktop systems only) | |
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 | |
Mix custom audio track into SDK | |
Set the publish volume and playback volume of mixed custom audio track | |
Generate custom capturing timestamp | |
.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 | |
Enabling custom audio playback | |
Getting playable audio data | |
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 version information | |
Set log output level | |
Enable/Disable console log printing | |
Enable/Disable local log compression | |
Set local log storage path | |
Set log callback | |
Display dashboard | |
Call experimental APIs | |
Enable or disable private encryption of media streams |
ITRTCCloud* getTRTCShareInstance | (void *context) |
Param | DESC |
context | It is only applicable to the Android platform. The SDK internally converts it into the ApplicationContext of Android to call the Android system API. |
delete ITRTCCloud*
, a compilation error will occur. Please use destroyTRTCCloud
to release the object pointer. getTRTCShareInstance()
API. getTRTCShareInstance(void *context)
API.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. onExitRoom()
callback in ITRTCCloudCallback to notify you. onExitRoom()
callback, so as to avoid the problem of the camera or mic being occupied.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 switchRole | |
| const char* privateMapKey) |
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 |
privateMapKey | Permission credential used for permission control. If you want only users with the specified userId values to enter a room or push streams, you need to use privateMapKey to restrict the permission. We recommend you use this parameter only if you have high security requirements. For more information, please see Enabling Advanced Permission Control. |
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 | (const char* param) |
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.Json::Value jsonObj;jsonObj["roomId"] = 102;jsonObj["userId"] = "userB";Json::FastWriter writer;std::string params = writer.write(jsonObj);trtc.ConnectOtherRoom(params.c_str());
roomId
in JSON with strRoomId
, such as {"strRoomId": "102", "userId": "userB"}Json::Value jsonObj;jsonObj["strRoomId"] = "102";jsonObj["userId"] = "userB";Json::FastWriter writer;std::string params = writer.write(jsonObj);trtc.ConnectOtherRoom(params.c_str());
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. |
onDisconnectOtherRoom()
callback in TRTCCloudDelegate.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.//In the small room that needs interaction, enter the room as an anchor and push audio and video streamsITRTCCloud *mainCloud = getTRTCShareInstance();TRTCParams mainParams;//Fill your paramsmainParams.role = TRTCRoleAnchor;mainCloud->enterRoom(mainParams, TRTCAppSceneLIVE);//...mainCloud->startLocalAudio(TRTCAudioQualityDefault);mainCloud->startLocalPreview(renderView);//In the large room that only needs to watch, enter the room as an audience and pull audio and video streamsITRTCCloud *subCloud = mainCloud->createSubCloud();TRTCParams subParams;//Fill your paramssubParams.role = TRTCRoleAudience;subCloud->enterRoom(subParams, TRTCAppSceneLIVE);//...subCloud->startRemoteView(userId, TRTCVideoStreamTypeBig, renderView);//...//Exit from new room and release it.subCloud->exitRoom();mainCloud->destroySubCloud(subCloud);
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 | |
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 | (const char* 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 | (const char* 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 |
| TXView view) |
enterRoom
, the SDK will only enable the camera and wait until enterRoom
is called before starting push. enterRoom
, the SDK will enable the camera and automatically start pushing the video stream. onCameraDidReady
callback in ITRTCCloudCallback.Param | DESC |
frontCamera | true: front camera; false: rear camera |
view | Control that carries the video image |
BeautyManager
before going live, you can: startLocalPreview
before calling enterRoom
startLocalPreview
and muteLocalVideo(true)
after calling enterRoom
void startLocalPreview | (TXView view) |
setCurrentCameraDevice
can be called first to select whether to use the macOS device's built-in camera or an external camera. enterRoom
, the SDK will only enable the camera and wait until enterRoom
is called before starting push. enterRoom
, the SDK will enable the camera and automatically start pushing the video stream. onCameraDidReady
callback in ITRTCCloudCallback.Param | DESC |
view | Control that carries the video image |
BeautyManager
before going live, you can: startLocalPreview
before calling enterRoom
startLocalPreview
and muteLocalVideo(true)
after calling enterRoom
void updateLocalView | (TXView view) |
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 setVideoMuteImage | |
| int fps) |
muteLocalVideo(true)
to pause the local video image, you can set a placeholder image by calling this API. Then, other users in the room will see this image instead of a black screen.Param | DESC |
fps | Frame rate of the placeholder image. Minimum value: 5. Maximum value: 10. Default value: 5 |
image | Placeholder image. A null value means that no more video stream data will be sent after muteLocalVideo . The default value is null. |
void startRemoteView | (const char* userId |
| |
| TXView 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. enterRoom
.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 updateRemoteView | (const char* userId |
| |
| TXView view) |
Param | DESC |
streamType | Type of the stream for which to set the preview window (only TRTCVideoStreamTypeBig and TRTCVideoStreamTypeSub are supported) |
userId | ID of the specified remote user |
view | Control that carries the video image |
void stopRemoteView | (const char* 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 | (const char* 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 | (const char* 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 | (const char* 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 snapshotVideo | (const char* userId |
| |
|
Param | DESC |
sourceType | Video image source, which can be the video stream image (TRTCSnapshotSourceTypeStream, generally in higher definition) 、the video rendering image (TRTCSnapshotSourceTypeView) or the capture picture (TRTCSnapshotSourceTypeCapture).The captured picture screenshot will be clearer. |
streamType | Video stream type, which can be the primary stream image (TRTCVideoStreamTypeBig, generally for camera) or substream image (TRTCVideoStreamTypeSub, generally for screen sharing) |
userId | User ID. A null value indicates to screencapture the local video. |
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 | (const char* userId |
| bool mute) |
Param | DESC |
mute | true: mute; false: unmute |
userId | ID of the specified remote user |
false
after room exit (exitRoom).void muteAllRemoteAudio | (bool mute) |
Param | DESC |
mute | true: mute; false: unmute |
false
after room exit (exitRoom).void setRemoteAudioVolume | (const char *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 |
startLocalAudio
.int startAudioRecording |
stopAudioRecording
before room exit, it will be automatically stopped after room exit.Param | DESC |
param |
void startLocalRecording |
Param | DESC |
params |
void setRemoteAudioParallelParams | (const TRTCAudioParallelParams& params) |
Param | DESC |
params | Audio parallel parameter. For more information, please see TRTCAudioParallelParams |
void enable3DSpatialAudioEffect | (bool enabled) |
Param | DESC |
enabled | Whether to enable 3D spatial effect. It’s disabled by default. |
void updateSelf3DSpatialPosition | (int position[3] |
| float axisForward[3] |
| float axisRight[3] |
| float axisUp[3]) |
Param | DESC |
axisForward | The unit vector of the forward axis of user coordinate system. The three values represent the forward, right and up coordinate values in turn. |
axisRight | The unit vector of the right axis of user coordinate system. The three values represent the forward, right and up coordinate values in turn. |
axisUp | The unit vector of the up axis of user coordinate system. The three values represent the forward, right and up coordinate values in turn. |
position | The coordinate of self in the world coordinate system. The three values represent the forward, right and up coordinate values in turn. |
void updateRemote3DSpatialPosition | (const char* userId |
| int position[3]) |
Param | DESC |
position | The coordinate of self in the world coordinate system. The three values represent the forward, right and up coordinate values in turn. |
userId | ID of the specified remote user. |
void set3DSpatialReceivingRange | (const char* userId |
| int range) |
Param | DESC |
range | Maximum attenuation range of the audio stream. |
userId | ID of the specified user. |
void setBeautyStyle | |
| uint32_t beautyLevel |
| uint32_t whitenessLevel |
| uint32_t ruddinessLevel) |
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 | |
| const char* srcData |
| |
| uint32_t nWidth |
| uint32_t 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 | Source data type of watermark image |
streamType | Stream type of the watermark to be set ( TRTCVideoStreamTypeBig or TRTCVideoStreamTypeSub ) |
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 | (const char* deviceName = nullptr) |
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 setSystemAudioLoopbackVolume | (uint32_t volume) |
Param | DESC |
volume | Set volume. Value range: [0, 150]. Default value: 100 |
void startScreenCapture | (TXView 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.ITRTCScreenCaptureSourceList* getScreenCaptureSources | (const SIZE &thumbnailSize |
| const SIZE &iconSize) |
Param | DESC |
iconSize | Specify the icon size of the window to be obtained. |
thumbnailSize | Specify the thumbnail size of the window to be obtained. The thumbnail can be drawn on the window selection UI. |
delete ITRTCScreenCaptureSourceList*
to delete the SourceList
; otherwise, crashes may occur. Instead, please use the release
method in ITRTCScreenCaptureSourceList
to release the list.void selectScreenCaptureTarget | (const TRTCScreenCaptureSourceInfo &source |
| const RECT& captureRect |
| const TRTCScreenCaptureProperty &property) |
getScreenCaptureSources
, you can call this API to select the target screen or window you want to share. source
whose type
is Screen
in sourceInfoList
, set captureRect
to { 0, 0, 0, 0 }
. source
whose type
is Screen
in sourceInfoList
, set captureRect
to a non-nullptr value, e.g., { 100, 100, 300, 300 }
. source
whose type
is Window
in sourceInfoList
, set captureRect
to { 0, 0, 0, 0 }
. source
whose type
is Window
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 | Specify sharing source |
void setSubStreamEncoderParam |
Param | DESC |
param |
void setSubStreamMixVolume | (uint32_t volume) |
Param | DESC |
volume | Set audio mixing volume. Value range: 0–100 |
void addExcludedShareWindow | (TXView windowID) |
Param | DESC |
window | Window not to be shared |
type
in TRTCScreenCaptureSourceInfo is specified as TRTCScreenCaptureSourceTypeScreen; that is, the feature of excluding specified windows works only when the entire screen is shared. sourceId
member in TRTCScreenCaptureSourceInfo.void removeExcludedShareWindow | (TXView windowID) |
Param | DESC |
windowID | |
void addIncludedShareWindow | (TXView windowID) |
type
in TRTCScreenCaptureSourceInfo is specified as TRTCScreenCaptureSourceTypeWindow; that is, the feature of additionally including specified windows works only when a window is shared.Param | DESC |
windowID | Window to be shared (which is a window handle HWND on Windows) |
void removeIncludedShareWindow | (TXView windowID) |
type
in TRTCScreenCaptureSourceInfo is specified as TRTCScreenCaptureSourceTypeWindow.Param | DESC |
windowID | Window to be shared (window ID on macOS or HWND on Windows) |
type
in TRTCScreenCaptureSourceInfo is specified as TRTCScreenCaptureSourceTypeWindow.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 mixExternalAudioFrame |
50
is returned, it indicates that the buffer pool has 50 ms of audio data. As long as you call this API again within 50 ms, the SDK can make sure that continuous audio data is mixed. 100
or greater, you can wait after an audio frame is played to call the API again. If the value returned is smaller than 100
, then there isn’t enough data in the buffer pool, and you should feed more audio data into the SDK until the data in the buffer pool is above the safety level. data
: audio frame buffer. Audio frames must be in PCM format. Each frame can be 5-100 ms (20 ms is recommended) in duration. Assume that the sample rate is 48000, and sound channels mono-channel. Then the frame size would be 48000 x 0.02s x 1 x 16 bit = 15360 bit = 1920 bytes. sampleRate
: sample rate. Valid values: 16000, 24000, 32000, 44100, 48000 channel
: number of sound channels (if dual-channel is used, data is interleaved). Valid values: 1
(mono-channel); 2
(dual channel) timestamp
: timestamp (ms). Set it to the timestamp when audio frames are captured, which you can obtain by calling generateCustomPTS after getting an audio frame.Param | DESC |
frame | Audio data |
0
or greater, the value represents the current size of the buffer pool; if the value returned is smaller than 0
, it means that an error occurred. -1
indicates that you didn’t call enableMixExternalAudioFrame to enable custom audio tracks.void setMixExternalAudioVolume | (int publishVolume |
| int playoutVolume) |
Param | DESC |
playoutVolume | set the play volume,from 0 to 100, -1 means no change |
publishVolume | set the publish volume,from 0 to 100, -1 means no change |
timestamp
field in TRTCVideoFrame or TRTCAudioFrame.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 | (const char* 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 |
Param | DESC |
format | Audio data callback format |
int setLocalProcessedAudioFrameCallbackFormat |
Param | DESC |
format | Audio data callback format |
int setMixedPlayAudioFrameCallbackFormat |
Param | DESC |
format | Audio data callback format |
void enableCustomAudioRendering | (bool enable) |
Param | DESC |
enable | Whether to enable custom audio playback. It’s disabled by default. |
void getCustomAudioRenderingFrame |
sampleRate
: sample rate (required). Valid values: 16000, 24000, 32000, 44100, 48000 channel
: number of sound channels (required). 1
: mono-channel; 2
: dual-channel; if dual-channel is used, data is interleaved. data
: the buffer used to get audio data. You need to allocate memory for the buffer based on the duration of an audio frame.Param | DESC |
audioFrame | Audio frames |
sampleRate
and channel
in audioFrame
, and allocate memory for one frame of audio in advance. sampleRate
and channel
.bool sendCustomCmdMsg | (uint32_t cmdId |
| const uint8_t* data |
| uint32_t 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 | (const uint8_t* data |
| uint32_t dataSize |
| int32_t 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 |
sendCustomCmdMsg
). sendCustomCmdMsg
). If a large amount of data is sent, the video bitrate will increase, which may reduce the video quality or even cause lagging. sendCustomCmdMsg
). 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.int 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 | (const char* path) |
%appdata%/liteav/log
. sandbox Documents/log
. /app directory/files/log/liteav/
.Param | DESC |
path | Log storage path |
void showDebugView | (int showType) |
Param | DESC |
showType | 0: does not display; 1: displays lite edition (only with audio/video information); 2: displays full edition (with audio/video information and event information). |
char* callExperimentalAPI | (const char *jsonStr) |
int enablePayloadPrivateEncryption | (bool enabled |
|
Param | DESC |
config | Configure the algorithm and key for private encryption of media streams, please see TRTCPayloadPrivateEncryptionConfig. |
enabled | Whether to enable media stream private encryption. |
Was this page helpful?