Namespaces | |
liteav | |
Data Structures | |
class | ITRTCCloud |
Exported C function | |
Export the following C-style interface to facilitate “LoadLibrary()” You can use the following methods to create and destroy TRTCCloud instance: ITRTCCloud *trtcCloud = getTRTCShareInstance(); if(trtcCloud) { std::string version(trtcCloud->getSDKVersion()); } // // destroyTRTCShareInstance(); trtcCloud = nullptr; | |
TRTC_API liteav::ITRTCCloud * | getTRTCShareInstance (void *context) |
TRTC_API liteav::ITRTCCloud * | getTRTCShareInstance () |
TRTC_API void | destroyTRTCShareInstance () |
Tencent Cloud TRTC Core Function Interface.
class liteav::ITRTCCloud |
Protected Member Functions | |
virtual | ~ITRTCCloud () |
Create Instance And Event Callback | |
static TRTC_API liteav::ITRTCCloud * | getTRTCShareInstance (void *context) |
static TRTC_API liteav::ITRTCCloud * | getTRTCShareInstance () |
static TRTC_API void | destroyTRTCShareInstance () |
virtual void | addCallback (ITRTCCloudCallback *callback)=0 |
virtual void | removeCallback (ITRTCCloudCallback *callback)=0 |
Room APIs | |
virtual void | enterRoom (const TRTCParams ¶m, TRTCAppScene scene)=0 |
virtual void | exitRoom ()=0 |
virtual void | switchRole (TRTCRoleType role)=0 |
virtual void | switchRoom (const TRTCSwitchRoomConfig &config)=0 |
virtual void | connectOtherRoom (const char *param)=0 |
virtual void | disconnectOtherRoom ()=0 |
virtual void | setDefaultStreamRecvMode (bool autoRecvAudio, bool autoRecvVideo)=0 |
virtual ITRTCCloud * | createSubCloud ()=0 |
virtual void | destroySubCloud (ITRTCCloud *subCloud)=0 |
virtual void | startPublishing (const char *streamId, TRTCVideoStreamType streamType)=0 |
virtual void | stopPublishing ()=0 |
virtual void | startPublishCDNStream (const TRTCPublishCDNParam ¶m)=0 |
virtual void | stopPublishCDNStream ()=0 |
virtual void | setMixTranscodingConfig (TRTCTranscodingConfig *config)=0 |
Video APIs | |
virtual void | startLocalPreview (bool frontCamera, TXView view)=0 |
virtual void | startLocalPreview (TXView view)=0 |
virtual void | updateLocalView (TXView view)=0 |
virtual void | stopLocalPreview ()=0 |
virtual void | muteLocalVideo (TRTCVideoStreamType streamType, bool mute)=0 |
virtual void | startRemoteView (const char *userId, TRTCVideoStreamType streamType, TXView view)=0 |
virtual void | updateRemoteView (const char *userId, TRTCVideoStreamType streamType, TXView view)=0 |
virtual void | stopRemoteView (const char *userId, TRTCVideoStreamType streamType)=0 |
virtual void | stopAllRemoteView ()=0 |
virtual void | muteRemoteVideoStream (const char *userId, TRTCVideoStreamType streamType, bool mute)=0 |
virtual void | muteAllRemoteVideoStreams (bool mute)=0 |
virtual void | setVideoEncoderParam (const TRTCVideoEncParam ¶m)=0 |
virtual void | setNetworkQosParam (const TRTCNetworkQosParam ¶m)=0 |
virtual void | setLocalRenderParams (const TRTCRenderParams ¶ms)=0 |
virtual void | setRemoteRenderParams (const char *userId, TRTCVideoStreamType streamType, const TRTCRenderParams ¶ms)=0 |
virtual void | setVideoEncoderRotation (TRTCVideoRotation rotation)=0 |
virtual void | setVideoEncoderMirror (bool mirror)=0 |
virtual void | enableSmallVideoStream (bool enable, const TRTCVideoEncParam &smallVideoEncParam)=0 |
virtual void | setRemoteVideoStreamType (const char *userId, TRTCVideoStreamType streamType)=0 |
virtual void | snapshotVideo (const char *userId, TRTCVideoStreamType streamType, TRTCSnapshotSourceType sourceType)=0 |
Audio APIs | |
virtual void | startLocalAudio (TRTCAudioQuality quality)=0 |
virtual void | stopLocalAudio ()=0 |
virtual void | muteLocalAudio (bool mute)=0 |
virtual void | muteRemoteAudio (const char *userId, bool mute)=0 |
virtual void | muteAllRemoteAudio (bool mute)=0 |
virtual void | setRemoteAudioVolume (const char *userId, int volume)=0 |
virtual void | setAudioCaptureVolume (int volume)=0 |
virtual int | getAudioCaptureVolume ()=0 |
virtual void | setAudioPlayoutVolume (int volume)=0 |
virtual int | getAudioPlayoutVolume ()=0 |
virtual void | enableAudioVolumeEvaluation (uint32_t interval)=0 |
virtual int | startAudioRecording (const TRTCAudioRecordingParams ¶m)=0 |
virtual void | stopAudioRecording ()=0 |
virtual void | startLocalRecording (const TRTCLocalRecordingParams ¶ms)=0 |
virtual void | stopLocalRecording ()=0 |
virtual void | setRemoteAudioParallelParams (const TRTCAudioParallelParams ¶ms)=0 |
Device management APIs | |
virtual ITXDeviceManager * | getDeviceManager ()=0 |
Beauty filter and watermark APIs | |
virtual void | setBeautyStyle (TRTCBeautyStyle style, uint32_t beautyLevel, uint32_t whitenessLevel, uint32_t ruddinessLevel)=0 |
virtual void | setWaterMark (TRTCVideoStreamType streamType, const char *srcData, TRTCWaterMarkSrcType srcType, uint32_t nWidth, uint32_t nHeight, float xOffset, float yOffset, float fWidthRatio)=0 |
Background music and sound effect APIs | |
virtual ITXAudioEffectManager * | getAudioEffectManager ()=0 |
virtual void | startSystemAudioLoopback (const char *deviceName=nullptr)=0 |
virtual void | stopSystemAudioLoopback ()=0 |
virtual void | setSystemAudioLoopbackVolume (uint32_t volume)=0 |
Screen sharing APIs | |
virtual void | startScreenCapture (TXView view, TRTCVideoStreamType streamType, TRTCVideoEncParam *encParam)=0 |
virtual void | stopScreenCapture ()=0 |
virtual void | pauseScreenCapture ()=0 |
virtual void | resumeScreenCapture ()=0 |
virtual ITRTCScreenCaptureSourceList * | getScreenCaptureSources (const SIZE &thumbnailSize, const SIZE &iconSize)=0 |
virtual void | selectScreenCaptureTarget (const TRTCScreenCaptureSourceInfo &source, const RECT &captureRect, const TRTCScreenCaptureProperty &property)=0 |
virtual void | setSubStreamEncoderParam (const TRTCVideoEncParam ¶m)=0 |
virtual void | setSubStreamMixVolume (uint32_t volume)=0 |
virtual void | addExcludedShareWindow (TXView windowID)=0 |
virtual void | removeExcludedShareWindow (TXView windowID)=0 |
virtual void | removeAllExcludedShareWindow ()=0 |
virtual void | addIncludedShareWindow (TXView windowID)=0 |
virtual void | removeIncludedShareWindow (TXView windowID)=0 |
virtual void | removeAllIncludedShareWindow ()=0 |
Custom capturing and rendering APIs | |
virtual void | enableCustomVideoCapture (TRTCVideoStreamType streamType, bool enable)=0 |
virtual void | sendCustomVideoData (TRTCVideoStreamType streamType, TRTCVideoFrame *frame)=0 |
virtual void | enableCustomAudioCapture (bool enable)=0 |
virtual void | sendCustomAudioData (TRTCAudioFrame *frame)=0 |
virtual void | enableMixExternalAudioFrame (bool enablePublish, bool enablePlayout)=0 |
virtual int | mixExternalAudioFrame (TRTCAudioFrame *frame)=0 |
virtual void | setMixExternalAudioVolume (int publishVolume, int playoutVolume)=0 |
virtual uint64_t | generateCustomPTS ()=0 |
virtual int | setLocalVideoProcessCallback (TRTCVideoPixelFormat pixelFormat, TRTCVideoBufferType bufferType, ITRTCVideoFrameCallback *callback)=0 |
virtual int | setLocalVideoRenderCallback (TRTCVideoPixelFormat pixelFormat, TRTCVideoBufferType bufferType, ITRTCVideoRenderCallback *callback)=0 |
virtual int | setRemoteVideoRenderCallback (const char *userId, TRTCVideoPixelFormat pixelFormat, TRTCVideoBufferType bufferType, ITRTCVideoRenderCallback *callback)=0 |
virtual int | setAudioFrameCallback (ITRTCAudioFrameCallback *callback)=0 |
virtual int | setCapturedRawAudioFrameCallbackFormat (TRTCAudioFrameCallbackFormat *format)=0 |
virtual int | setLocalProcessedAudioFrameCallbackFormat (TRTCAudioFrameCallbackFormat *format)=0 |
virtual int | setMixedPlayAudioFrameCallbackFormat (TRTCAudioFrameCallbackFormat *format)=0 |
virtual void | enableCustomAudioRendering (bool enable)=0 |
virtual void | getCustomAudioRenderingFrame (TRTCAudioFrame *audioFrame)=0 |
Custom message sending APIs | |
virtual bool | sendCustomCmdMsg (uint32_t cmdId, const uint8_t *data, uint32_t dataSize, bool reliable, bool ordered)=0 |
virtual bool | sendSEIMsg (const uint8_t *data, uint32_t dataSize, int32_t repeatCount)=0 |
Network test APIs | |
virtual int | startSpeedTest (const TRTCSpeedTestParams ¶ms)=0 |
virtual void | stopSpeedTest ()=0 |
Debugging APIs | |
virtual const char * | getSDKVersion ()=0 |
virtual void | setLogLevel (TRTCLogLevel level)=0 |
virtual void | setConsoleEnabled (bool enabled)=0 |
virtual void | setLogCompressEnabled (bool enabled)=0 |
virtual void | setLogDirPath (const char *path)=0 |
virtual void | setLogCallback (ITRTCLogCallback *callback)=0 |
virtual void | showDebugView (int showType)=0 |
virtual const char * | callExperimentalAPI (const char *jsonStr)=0 |
virtual void | callExperimentalAPI (const char *jsonStr)=0 |
Disused APIs (the corresponding new APIs are recommended) | |
virtual void | enableCustomVideoCapture (bool enable)=0 |
virtual void | sendCustomVideoData (TRTCVideoFrame *frame)=0 |
virtual void | muteLocalVideo (bool mute)=0 |
virtual void | muteRemoteVideoStream (const char *userId, bool mute)=0 |
virtual void | startSpeedTest (uint32_t sdkAppId, const char *userId, const char *userSig)=0 |
virtual void | startSpeedTest (uint32_t sdkAppId, const char *userId, const char *userSig)=0 |
|
inlineprotectedvirtual |
|
pure virtual |
Set TRTC event callback
You can use TRTCCloudDelegate to get various event notifications from the SDK, such as error codes, warning codes, and audio/video status parameters.
|
pure virtual |
Add specified windows to the exclusion list of screen sharing (for desktop systems only)
The excluded windows will not be shared. This feature is generally used to add a certain application's window to the exclusion list to avoid privacy issues. You can set the filtered windows before starting screen sharing or dynamically add the filtered windows during screen sharing.
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.
|
pure virtual |
Add specified windows to the inclusion list of screen sharing (for desktop systems only)
This API takes effect only if the type
in TRTCScreenCaptureSourceInfo is specified as TRTCScreenCaptureSourceTypeWindow; that is, the feature of additionally including specified windows works only when a window is shared. You can call it before or after startScreenCapture.
windowID | Window to be shared (which is a window handle HWND on Windows) |
|
pure virtual |
Call experimental APIs
|
pure virtual |
|
pure virtual |
Request cross-room call
By default, only users in the same room can make audio/video calls with each other, and the audio/video streams in different rooms are isolated from each other. However, you can publish the audio/video streams of an anchor in another room to the current room by calling this API. At the same time, this API will also publish the local audio/video streams to the target anchor's room. In other words, you can use this API to share the audio/video streams of two anchors in two different rooms, so that the audience in each room can watch the streams of these two anchors. This feature can be used to implement anchor competition. The result of requesting cross-room call will be returned through the onConnectOtherRoom()
callback in TRTCCloudDelegate. For example, after anchor A in room "101" uses 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.All users in room "102" will receive the 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.
Room 101 Room 102 --------------------- --------------------- Before cross-room call: | Anchor: A | | Anchor: B | | Users : U, V, W | | Users: X, Y, Z | --------------------- ---------------------
Room 101 Room 102 --------------------- --------------------- After cross-room call: | Anchors: A and B | | Anchors: B and A | | Users : U, V, W | | Users : X, Y, Z | --------------------- ---------------------
For compatibility with subsequent extended fields for cross-room call, parameters in JSON format are used currently. Case 1: numeric room ID If anchor A in room "101" wants to co-anchor with anchor B in room "102", then anchor A needs to pass in {"roomId": 102, "userId": "userB"} when calling this API. Below is the sample code:
Json::Value jsonObj; jsonObj["roomId"] = 102; jsonObj["userId"] = "userB"; Json::FastWriter writer; std::string params = writer.write(jsonObj); trtc.ConnectOtherRoom(params.c_str());
Case 2: string room ID If you use a string room ID, please be sure to replace the roomId
in JSON with strRoomId
, such as {"strRoomId": "102", "userId": "userB"} Below is the sample code:
Json::Value jsonObj; jsonObj["strRoomId"] = "102"; jsonObj["userId"] = "userB"; Json::FastWriter writer; std::string params = writer.write(jsonObj); trtc.ConnectOtherRoom(params.c_str());
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. |
|
pure virtual |
Create room subinstance (for concurrent multi-room listen/watch)
TRTCCloud
was originally designed to work in the singleton mode, which limited the ability to watch concurrently in multiple rooms. By calling this API, you can create multiple TRTCCloud
instances, so that you can enter multiple different rooms at the same time to listen/watch audio/video streams. However, it should be noted that because there are still only one camera and one mic available, you can exist as an "anchor" in only one TRTCCloud
instance at any time; that is, you can only publish your audio/video streams in one TRTCCloud
instance at any time. This feature is mainly used in the "super small class" use case in the online education scenario to break the limit that "only up to 50 users can publish their audio/video streams simultaneously in one TRTC room". Below is the sample code:
ITRTCCloud *mainCloud = getTRTCShareInstance(); mainCloud->enterRoom(params1, TRTCAppSceneLIVE); //... //Switch the role from "anchor" to "audience" in your own room mainCloud->switchRole(TRTCRoleAudience); mainCloud->muteLocalVideo(true); mainCloud->muteLocalAudio(true); //... //Use subcloud to enter another room and switch the role from "audience" to "anchor" ITRTCCloud *subCloud = mainCloud->createSubCloud(); subCloud->enterRoom(params2, TRTCAppSceneLIVE); subCloud->switchRole(TRTCRoleAnchor); subCloud->muteLocalVideo(false); subCloud->muteLocalAudio(false); //... //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
instance at any time. If streams are pushed simultaneously in different rooms, a status mess will be caused in the cloud, leading to various bugs.TRTCCloud
instance created by the createSubCloud
API cannot call APIs related to the local audio/video in the subinstance, except switchRole
, muteLocalVideo
, and muteLocalAudio
. To use APIs such as the beauty filter, please use the original TRTCCloud
instance object. TRTCCloud
subinstance
|
pure virtual |
Terminate room subinstance
subCloud |
|
static |
Terminate TRTCCloud
instance (singleton mode)
|
pure virtual |
Exit cross-room call
The result will be returned through the onDisconnectOtherRoom()
callback in TRTCCloudDelegate.
|
pure virtual |
Enable volume reminder
After this feature is enabled, the SDK will return the remote audio volume in the onUserVoiceVolume callback of TRTCCloudDelegate.
startLocalAudio
. interval | Set the interval in ms for triggering the onUserVoiceVolume callback. The minimum interval is 100 ms. If the value is smaller than or equal to 0, the callback will be disabled. We recommend you set this parameter to 300 ms. |
|
pure virtual |
Enable custom audio capturing mode
After this mode is enabled, the SDK will not run the original audio capturing process (i.e., stopping mic data capturing) and will retain only the audio encoding and sending capabilities. You need to use sendCustomAudioData to continuously insert the captured audio data into the SDK.
enable | Whether to enable. Default value: false |
|
pure virtual |
Enabling custom audio playback
You can use this API to enable custom audio playback if you want to connect to an external audio device or control the audio playback logic by yourself. After you enable custom audio playback, the SDK will stop using its audio API to play back audio. You need to call getCustomAudioRenderingFrame to get audio frames and play them by yourself.
enable | Whether to enable custom audio playback. It’s disabled by default. |
|
pure virtual |
Enable custom video capturing mode
enableCustomVideoCapture(streamType,enable)
instead.
|
pure virtual |
Enable/Disable custom video capturing mode
After this mode is enabled, the SDK will not run the original video capturing process (i.e., stopping camera data capturing and beauty filter operations) and will retain only the video encoding and sending capabilities. You need to use sendCustomVideoData to continuously insert the captured video image into the SDK.
streamType | Specify video stream type (TRTCVideoStreamTypeBig: HD big image; TRTCVideoStreamTypeSub: substream image). |
enable | Whether to enable. Default value: false |
|
pure virtual |
Enable/Disable custom audio track
After this feature is enabled, you can mix a custom audio track into the SDK through this API. With two boolean parameters, you can control whether to play back this track remotely or locally.
enablePublish | Whether the mixed audio track should be played back remotely. Default value: false |
enablePlayout | Whether the mixed audio track should be played back locally. Default value: false |
enablePublish
and enablePlayout
as false
, the custom audio track will be completely closed.
|
pure virtual |
Enable dual-channel encoding mode with big and small images
In this mode, the current user's encoder will output two channels of video streams, i.e., HD big image and Smooth small image, at the same time (only one channel of audio stream will be output though). In this way, other users in the room can choose to subscribe to the HD big image or Smooth small image according to their own network conditions or screen size.
enable | Whether to enable small image encoding. Default value: false |
smallVideoEncParam | Video parameters of small image stream |
|
pure virtual |
Enter room
All TRTC users need to enter a room before they can "publish" or "subscribe to" audio/video streams. "Publishing" refers to pushing their own streams to the cloud, and "subscribing to" refers to pulling the streams of other users in the room from the cloud. When calling this API, you need to specify your application scenario (TRTCAppScene) to get the best audio/video transfer experience. We provide the following four scenarios for your choice:
onEnterRoom(result)
callback from TRTCCloudDelegate: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 error code for room entry failure. 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.
|
pure virtual |
Exit room
Calling this API will allow the user to leave the current audio or video room and release the camera, mic, speaker, and other device resources. After resources are released, the SDK will use the onExitRoom()
callback in TRTCCloudDelegate to notify you. If you need to call enterRoom again or switch to the SDK of another provider, we recommend you wait until you receive the onExitRoom()
callback, so as to avoid the problem of the camera or mic being occupied.
|
pure virtual |
Generate custom capturing timestamp
This API is only suitable for the custom capturing mode and is used to solve the problem of out-of-sync audio/video caused by the inconsistency between the capturing time and delivery time of audio/video frames. When you call APIs such as sendCustomVideoData or sendCustomAudioData for custom video or audio capturing, please use this API as instructed below:
timestamp
field in TRTCVideoFrame or TRTCAudioFrame.
|
pure virtual |
Get the capturing volume of local audio
|
pure virtual |
Get sound effect management class (TXAudioEffectManager)
TXAudioEffectManager
is a sound effect management API, through which you can implement the following features:
isShortFile
parameter to true
).
|
pure virtual |
Get the playback volume of remote audio
|
pure virtual |
Getting playable audio data
Before calling this API, you need to first enable custom audio playback using enableCustomAudioRendering. Fill the fields in TRTCAudioFrame as follows (other fields are not required):
sampleRate
: sample rate (required). Valid values: 16000, 24000, 32000, 44100, 48000channel
: 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. The PCM data obtained can have a frame duration of 10 ms or 20 ms. 20 ms is recommended. Assume that the sample rate is 48000, and sound channels mono-channel. The buffer size for a 20 ms audio frame would be 48000 x 0.02s x 1 x 16 bit = 15360 bit = 1920 bytes.audioFrame | Audio frames |
sampleRate
and channel
in audioFrame
, and allocate memory for one frame of audio in advance.sampleRate
and channel
.
|
pure virtual |
Get device management class (TXDeviceManager)
|
pure virtual |
Enumerate shareable screens and windows (for desktop systems only)
When you integrate the screen sharing feature of a desktop system, you generally need to display a UI for selecting the sharing target, so that users can use the UI to choose whether to share the entire screen or a certain window. Through this API, you can query the IDs, names, and thumbnails of sharable windows on the current system. We provide a default UI implementation in the demo for your reference.
delete ITRTCScreenCaptureSourceList*
to delete the SourceList
; otherwise, crashes may occur. Instead, please use the release
method in ITRTCScreenCaptureSourceList
to release the list. thumbnailSize | Specify the thumbnail size of the window to be obtained. The thumbnail can be drawn on the window selection UI. |
iconSize | Specify the icon size of the window to be obtained. |
|
pure virtual |
Get SDK version information
|
static |
|
static |
Create TRTCCloud
instance (singleton mode)
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.
|
pure virtual |
Mix custom audio track into SDK
Before you use this API to mix custom PCM audio into the SDK, you need to first enable custom audio tracks through enableMixExternalAudioFrame. You are expected to feed audio data into the SDK at an even pace, but we understand that it can be challenging to call an API at absolutely regular intervals. Given this, we have provided a buffer pool in the SDK, which can cache the audio data you pass in to reduce the fluctuations in intervals between API calls. The value returned by this API indicates the size (ms) of the buffer pool. For example, if 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. If the value returned is 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. Fill the fields in TRTCAudioFrame as follows (other fields are not required).
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 s x 1 x 16 bit = 15360 bit = 1920 bytes.sampleRate
: sample rate. Valid values: 16000, 24000, 32000, 44100, 48000channel
: 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.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 {} to enable custom audio tracks.
|
pure virtual |
Pause/Resume playing back all remote users' audio streams
When you mute the audio of all remote users, the SDK will stop playing back all their audio streams and pulling all their audio data.
mute | true: mute; false: unmute |
false
after room exit (exitRoom).
|
pure virtual |
Pause/Resume subscribing to all remote users' video streams
This API only pauses/resumes receiving all users' video streams but does not release displaying resources; therefore, the video image will freeze at the last frame before it is called.
mute | Whether to pause receiving |
|
pure virtual |
Pause/Resume publishing local audio stream
After local audio publishing is paused, other users in the room will receive the onUserAudioAvailable(userId, false) notification. After local audio publishing is resumed, other users in the room will receive the onUserAudioAvailable(userId, true) notification. Different from stopLocalAudio, muteLocalAudio(true)
does not release the mic permission; instead, it continues to send mute packets with extremely low bitrate. This is very suitable for scenarios that require on-cloud recording, as video file formats such as MP4 have a high requirement for audio continuity, while an MP4 recording file cannot be played back smoothly if stopLocalAudio is used. Therefore, muteLocalAudio
instead of stopLocalAudio
is recommended in scenarios where the requirement for recording file quality is high.
mute | true: mute; false: unmute |
|
pure virtual |
Pause/Resume publishing local video stream
muteLocalVideo(streamType, mute)
instead.
|
pure virtual |
Pause/Resume publishing local video stream
This API can pause (or resume) publishing the local video image. After the pause, other users in the same room will not be able to see the local image. This API is equivalent to the two APIs of startLocalPreview/stopLocalPreview
when TRTCVideoStreamTypeBig is specified, but has higher performance and response speed. The startLocalPreview/stopLocalPreview
APIs need to enable/disable the camera, which are hardware device-related operations, so they are very time-consuming. In contrast, 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. After local video publishing is paused, other members in the same room will receive the onUserVideoAvailable(userId, false)
callback notification. After local video publishing is resumed, other members in the same room will receive the onUserVideoAvailable(userId, true)
callback notification.
streamType | Specify for which video stream to pause (or resume). Only TRTCVideoStreamTypeBig and TRTCVideoStreamTypeSub are supported |
mute | true: pause; false: resume |
|
pure virtual |
Pause/Resume playing back remote audio stream
When you mute the remote audio of a specified user, the SDK will stop playing back the user's audio and pulling the user's audio data.
userId | ID of the specified remote user |
mute | true: mute; false: unmute |
false
after room exit (exitRoom).
|
pure virtual |
Pause/Resume subscribing to remote user's video stream
muteRemoteVideoStream(userId, streamType, mute)
instead.
|
pure virtual |
Pause/Resume subscribing to remote user's video stream
This API only pauses/resumes receiving the specified user's video stream but does not release displaying resources; therefore, the video image will freeze at the last frame before it is called.
userId | ID of the specified remote user |
streamType | Specify for which video stream to pause (or resume). Only TRTCVideoStreamTypeBig and TRTCVideoStreamTypeSub are supported |
mute | Whether to pause receiving |
|
pure virtual |
Pause screen sharing
|
pure virtual |
Remove all windows from the exclusion list of screen sharing (for desktop systems only)
|
pure virtual |
Remove all windows from the inclusion list of screen sharing (for desktop systems only)
This API takes effect only if the type
in TRTCScreenCaptureSourceInfo is specified as TRTCScreenCaptureSourceTypeWindow. That is, the feature of additionally including specified windows works only when a window is shared.
|
pure virtual |
Remove TRTC event callback
callback |
|
pure virtual |
Remove specified windows from the exclusion list of screen sharing (for desktop systems only)
windowID |
|
pure virtual |
Remove specified windows from the inclusion list of screen sharing (for desktop systems only)
This API takes effect only if the type
in TRTCScreenCaptureSourceInfo is specified as TRTCScreenCaptureSourceTypeWindow. That is, the feature of additionally including specified windows works only when a window is shared.
windowID | Window to be shared (window ID on macOS or HWND on Windows) |
|
pure virtual |
Resume screen sharing
|
pure virtual |
Select the screen or window to share (for desktop systems only)
After you get the sharable screens and windows through getScreenCaptureSources
, you can call this API to select the target screen or window you want to share. During the screen sharing process, you can also call this API at any time to switch the sharing target. The following four sharing modes are supported:
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 }
. source | Specify sharing source |
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 |
|
pure virtual |
Deliver captured audio data to SDK
We recommend you enter the following information for the TRTCAudioFrame parameter (other fields can be left empty):
TRTCAudioFrameFormatPCM
.48000 *s * 1 * 16 bit = 15360 bit = 1920 bytes
.For more information, please see Custom Capturing and Rendering.
frame | Audio data |
|
pure virtual |
Use UDP channel to send custom message to all users in room
This API allows you to use TRTC's UDP channel to broadcast custom data to other users in the current room for signaling transfer. The UDP channel in TRTC was originally designed to transfer audio/video data. This API works by disguising the signaling data you want to send as audio/video data packets and sending them together with the audio/video data to be sent. Other users in the room can receive the message through the onRecvCustomCmdMsg
callback in TRTCCloudDelegate.
cmdID | Message ID. Value range: 1–10 |
data | Message to be sent. The maximum length of one single message is 1 KB. |
reliable | Whether reliable sending is enabled. Reliable sending can achieve a higher success rate but with a longer reception delay than unreliable sending. |
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
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.
|
pure virtual |
Deliver captured video data to SDK
sendCustomVideoData(streamType, TRTCVideoFrame)
instead.
|
pure virtual |
Deliver captured video frames to SDK
You can use this API to deliver video frames you capture to the SDK, and the SDK will encode and transfer them through its own network module. We recommend you enter the following information for the TRTCVideoFrame parameter (other fields can be left empty):
pixelFormat
is set to I420, length
can be calculated according to the following formula: length = width * height * 3 / 2.For more information, please see Custom Capturing and Rendering.
streamType | Specify video stream type (TRTCVideoStreamTypeBig: HD big image; TRTCVideoStreamTypeSub: substream image). |
frame | Video data, which can be in I420 format. |
timestamp
value of a video frame immediately after capturing it, so as to achieve the best audio/video sync effect.
|
pure virtual |
Use SEI channel to send custom message to all users in room
This API allows you to use TRTC's SEI channel to broadcast custom data to other users in the current room for signaling transfer. The header of a video frame has a header data block called SEI. This API works by embedding the custom signaling data you want to send in the SEI block and sending it together with the video frame. Therefore, the SEI channel has a better compatibility than sendCustomCmdMsg as the signaling data can be transferred to the CSS CDN along with the video frame. However, because the data block of the video frame header cannot be too large, we recommend you limit the size of the signaling data to only a few bytes when using this API. The most common use is to embed the custom timestamp into video frames through this API so as to implement a perfect alignment between the message and video image (such as between the teaching material and video signal in the education scenario). Other users in the room can receive the message through the onRecvSEIMsg
callback in TRTCCloudDelegate.
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.
|
pure virtual |
Set the capturing volume of local audio
volume | Volume. 100 is the original volume. Value range: [0,150]. Default value: 100 |
|
pure virtual |
Set custom audio data callback
After this callback is set, the SDK will internally call back the audio data (in PCM format), including:
|
pure virtual |
Set the playback volume of remote audio
This API controls the volume of the sound ultimately delivered by the SDK to the system for playback. It affects the volume of the recorded local audio file but not the volume of in-ear monitoring.
volume | Volume. 100 is the original volume. Value range: [0,150]. Default value: 100 |
|
pure virtual |
Set special effects such as beauty, brightening, and rosy skin filters
The SDK is integrated with two skin smoothing algorithms of different styles:
style | Skin smoothening algorithm ("smooth" or "natural") |
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. |
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. |
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. |
|
pure virtual |
Set the callback format of original audio frames captured by local mic
This API is used to set the AudioFrame
format called back by onCapturedRawAudioFrame:
If you want to calculate the callback frame length in milliseconds, the formula for converting the number of milliseconds into the number of sample points is as follows: number of sample points = number of milliseconds * sample rate / 1000 For example, if you want to call back the data of 20 ms frame length with 48000 sample rate, then the number of sample points should be entered as 960 = 20 * 48000 / 1000 Note that the frame length of the final callback is in bytes, and the calculation formula for converting the number of sample points into the number of bytes is as follows: number of bytes = number of sample points * number of channels * 2 (bit width) For example, if the parameters are 48000 sample rate, dual channel, 20 ms frame length, and 960 sample points, then the number of bytes is 3840 = 960 * 2 * 2
format | Audio data callback format |
|
pure virtual |
Enable/Disable console log printing
enabled | Specify whether to enable it, which is disabled by default |
|
pure virtual |
Set subscription mode (which must be set before room entry for it to take effect)
You can switch between the "automatic subscription" and "manual subscription" modes through this API:
startRemoteView
API).{@muteRemoteAudio} (false)
API to start playing back the audio stream. In most scenarios, users will subscribe to the audio/video streams of all anchors in the room after room entry. Therefore, TRTC adopts the automatic subscription mode by default in order to achieve the best "instant streaming experience". In your application scenario, if there are many audio/video streams being published at the same time in each room, and each user only wants to subscribe to 1–2 streams of them, we recommend you use the "manual subscription" mode to reduce the traffic costs. 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 |
|
pure virtual |
Set the callback format of preprocessed local audio frames
This API is used to set the AudioFrame
format called back by onLocalProcessedAudioFrame:
If you want to calculate the callback frame length in milliseconds, the formula for converting the number of milliseconds into the number of sample points is as follows: number of sample points = number of milliseconds * sample rate / 1000 For example, if you want to call back the data of 20 ms frame length with 48000 sample rate, then the number of sample points should be entered as 960 = 20 * 48000 / 1000 Note that the frame length of the final callback is in bytes, and the calculation formula for converting the number of sample points into the number of bytes is as follows: number of bytes = number of sample points * number of channels * 2 (bit width) For example, if the parameters are 48000 sample rate, dual channel, 20 ms frame length, and 960 sample points, then the number of bytes is 3840 = 960 * 2 * 2
format | Audio data callback format |
|
pure virtual |
Set the rendering parameters of local video image
The parameters that can be set include video image rotation angle, fill mode, and mirror mode.
params | Video image rendering parameters. For more information, please see TRTCRenderParams. |
|
pure virtual |
Set video data callback for third-party beauty filters
After this callback is set, the SDK will call back the captured video frames through the listener
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.
listener | Custom preprocessing callback. For more information, please see ITRTCVideoFrameCallback |
|
pure virtual |
Set the callback of custom rendering for local video
After this callback is set, the SDK will skip its own rendering process and call back the captured data. Therefore, you need to complete image rendering on your own.
setLocalVideoRenderCallback(TRTCVideoPixelFormat_Unknown, TRTCVideoBufferType_Unknown, nullptr)
to stop the callback.pixelFormat | Specify the format of the pixel called back |
bufferType | Specify video data structure type. Only TRTCVideoBufferType_Buffer is supported currently |
callback | Callback for custom rendering |
|
pure virtual |
Set log callback
|
pure virtual |
Enable/Disable local log compression
If compression is enabled, the log size will significantly reduce, but logs can be read only after being decompressed by the Python script provided by Tencent Cloud. If compression is disabled, logs will be stored in plaintext and can be read directly in Notepad, but will take up more storage capacity.
enabled | Specify whether to enable it, which is enabled by default |
|
pure virtual |
Set local log storage path
You can use this API to change the default storage path of the SDK's local logs, which is as follows:
appdata%/liteav/log
.sandbox Documents/log
./app directory/files/log/liteav/
. path | Log storage path |
|
pure virtual |
Set log output level
level | For more information, please see TRTCLogLevel. Default value: TRTCLogLevelNone |
|
pure virtual |
Set the callback format of audio frames to be played back by system
This API is used to set the AudioFrame
format called back by onMixedPlayAudioFrame:
If you want to calculate the callback frame length in milliseconds, the formula for converting the number of milliseconds into the number of sample points is as follows: number of sample points = number of milliseconds * sample rate / 1000 For example, if you want to call back the data of 20 ms frame length with 48000 sample rate, then the number of sample points should be entered as 960 = 20 * 48000 / 1000 Note that the frame length of the final callback is in bytes, and the calculation formula for converting the number of sample points into the number of bytes is as follows: number of bytes = number of sample points * number of channels * 2 (bit width) For example, if the parameters are 48000 sample rate, dual channel, 20 ms frame length, and 960 sample points, then the number of bytes is 3840 = 960 * 2 * 2
format | Audio data callback format |
|
pure virtual |
Set the publish volume and playback volume of mixed custom audio track
publishVolume | set the publish volume,from 0 to 100, -1 means no change |
playoutVolume | set the play volume,from 0 to 100, -1 means no change |
|
pure virtual |
Set the layout and transcoding parameters of On-Cloud MixTranscoding
In a live room, there may be multiple anchors publishing their audio/video streams at the same time, but for audience on CSS CDN, they only need to watch one video stream in HTTP-FLV or HLS format. When you call this API, the SDK will send a command to the TRTC mixtranscoding server to combine multiple audio/video streams in the room into one stream. You can use the TRTCTranscodingConfig parameter to set the layout of each channel of image. You can also set the encoding parameters of the mixed audio/video streams. For more information, please see On-Cloud MixTranscoding.
**Image 1** => decoding ====> \ \ **Image 2** => decoding => image mixing => encoding => **mixed image** // **Image 3** => decoding ====> //
**Audio 1** => decoding ====> \ \ **Audio 2** => decoding => audio mixing => encoding => **mixed audio** // **Audio 3** => decoding ====> //
config | If config is not empty, On-Cloud MixTranscoding will be started; otherwise, it will be stopped. For more information, please see TRTCTranscodingConfig. |
streamId
in the config
parameter, TRTC will mix the multiple channels of images in the room into the audio/video streams corresponding to the current user, i.e., A + B => A.streamId
in the config
parameter, TRTC will mix the multiple channels of images in the room into the specified streamId
, i.e., A + B => streamId.config
empty to cancel it; otherwise, additional fees may be incurred.
|
pure virtual |
Set network quality control parameters
This setting determines the quality control policy in a poor network environment, such as "image quality preferred" or "smoothness preferred".
param | It is used to set relevant parameters for network quality control. For details, please refer to TRTCNetworkQosParam. |
|
pure virtual |
Set the parallel strategy of remote audio streams
For room with many speakers.
params | Audio parallel parameter. For more information, please see TRTCAudioParallelParams |
|
pure virtual |
Set the audio playback volume of remote user
You can mute the audio of a remote user through setRemoteAudioVolume(userId, 0)
.
userId | ID of the specified remote user |
volume | Volume. 100 is the original volume. Value range: [0,150]. Default value: 100 |
|
pure virtual |
Set the rendering mode of remote video image
The parameters that can be set include video image rotation angle, fill mode, and mirror mode.
userId | ID of the specified remote user |
streamType | It can be set to the primary stream image (TRTCVideoStreamTypeBig) or substream image (TRTCVideoStreamTypeSub). |
params | Video image rendering parameters. For more information, please see TRTCRenderParams. |
|
pure virtual |
Set the callback of custom rendering for remote video
After this callback is set, the SDK will skip its own rendering process and call back the captured data. Therefore, you need to complete image rendering on your own.
setLocalVideoRenderCallback(TRTCVideoPixelFormat_Unknown, TRTCVideoBufferType_Unknown, nullptr)
to stop the callback.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. userId | remote user id |
pixelFormat | Specify the format of the pixel called back |
bufferType | Specify video data structure type. Only TRTCVideoBufferType_Buffer is supported currently |
callback | Callback for custom rendering |
|
pure virtual |
Switch the big/small image of specified remote user
After an anchor in a room enables dual-channel encoding, the video image that other users in the room subscribe to through startRemoteView will be HD big image by default. You can use this API to select whether the image subscribed to is the big image or small image. The API can take effect before or after startRemoteView is called.
userId | ID of the specified remote user |
streamType | Video stream type, i.e., big image or small image. Default value: big image |
|
pure virtual |
Set the video encoding parameters of screen sharing (i.e., substream) (for desktop and mobile systems)
This API can set the image quality of screen sharing (i.e., the substream) viewed by remote users, which is also the image quality of screen sharing in on-cloud recording files. Please note the differences between the following two APIs:
param | Substream encoding parameters. For more information, please see TRTCVideoEncParam. |
type=TRTCVideoStreamTypeBig
when calling startScreenCapture
), you still need to call the setSubStreamEncoderParam API instead of the {} API to set the screen sharing encoding parameters.
|
pure virtual |
Set the audio mixing volume of screen sharing (for desktop systems only)
The greater the value, the larger the ratio of the screen sharing volume to the mic volume. We recommend you not set a high value for this parameter as a high volume will cover the mic sound.
volume | Set audio mixing volume. Value range: 0–100 |
|
pure virtual |
Set the volume of system audio capturing
volume | Set volume. Value range: [0, 150]. Default value: 100 |
|
pure virtual |
Set the mirror mode of image output by encoder
This setting does not affect the mirror mode of the local video image, but affects the mirror mode of the image viewed by other users in the room (and on-cloud recording files).
mirror | Whether to enable remote mirror mode. true: yes; false: no. Default value: false |
|
pure virtual |
Set the encoding parameters of video encoder
This setting can determine the quality of image viewed by remote users, which is also the image quality of on-cloud recording files.
param | It is used to set relevant parameters for the video encoder. For more information, please see TRTCVideoEncParam. |
|
pure virtual |
Set the direction of image output by video encoder
This setting does not affect the preview direction of the local video image, but affects the direction of the image viewed by other users in the room (and on-cloud recording files). When a phone or tablet is rotated upside down, as the capturing direction of the camera does not change, the video image viewed by other users in the room will become upside-down. In this case, you can call this API to rotate the image encoded by the SDK 180 degrees, so that other users in the room can view the image in the normal direction. If you want to achieve the aforementioned user-friendly interactive experience, we recommend you directly call setGSensorMode to implement smarter direction adaptation, with no need to call this API manually.
rotation | Currently, rotation angles of 0 and 180 degrees are supported. Default value: TRTCVideoRotation_0 (no rotation) |
|
pure virtual |
Add watermark
The watermark position is determined by the 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.streamType | Stream type of the watermark to be set (TRTCVideoStreamTypeBig or TRTCVideoStreamTypeSub ) |
srcData | Source data of watermark image (if nullptr is passed in, the watermark will be removed) |
srcType | Source data type of watermark image |
nWidth | Pixel width of watermark image (this parameter will be ignored if the source data is a file path) |
nHeight | Pixel height of watermark image (this parameter will be ignored if the source data is a file path) |
xOffset | Top-left offset on the X axis of watermark |
yOffset | Top-left offset on the Y axis of watermark |
fWidthRatio | Ratio of watermark width to image width (the watermark will be scaled according to this parameter) |
|
pure virtual |
Display dashboard
"Dashboard" is a semi-transparent floating layer for debugging information on top of the video rendering control. It is used to display audio/video information and event information to facilitate integration and debugging.
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). |
|
pure virtual |
Screencapture video
You can use this API to screencapture the local video image or the primary stream image and substream (screen sharing) image of a remote user.
userId | User ID. A null value indicates to screencapture the local video. |
streamType | Video stream type, which can be the primary stream image (TRTCVideoStreamTypeBig, generally for camera) or substream image (TRTCVideoStreamTypeSub, generally for screen sharing) |
sourceType | Video image source, which can be the video stream image (TRTCSnapshotSourceTypeStream, generally in higher definition) or the video rendering image (TRTCSnapshotSourceTypeView) |
|
pure virtual |
Start audio recording
After you call this API, the SDK will selectively record local and remote audio streams (such as local audio, remote audio, background music, and sound effects) into a local file. This API works when called either before or after room entry. If a recording task has not been stopped through stopAudioRecording
before room exit, it will be automatically stopped after room exit.
param | Recording parameter. For more information, please see TRTCAudioRecordingParams |
|
pure virtual |
Enable local audio capturing and publishing
The SDK does not enable the mic by default. When a user wants to publish the local audio, the user needs to call this API to enable mic capturing and encode and publish the audio to the current room. After local audio capturing and publishing is enabled, other users in the room will receive the onUserAudioAvailable(userId, true) notification.
quality | Sound quality
|
|
pure virtual |
Enable the preview image of local camera (mobile)
If this API is called before enterRoom
, the SDK will only enable the camera and wait until enterRoom
is called before starting push. If it is called after enterRoom
, the SDK will enable the camera and automatically start pushing the video stream. When the first camera video frame starts to be rendered, you will receive the onCameraDidReady
callback in TRTCCloudDelegate.
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
|
pure virtual |
Enable the preview image of local camera (desktop)
Before this API is called, setCurrentCameraDevice
can be called first to select whether to use the macOS device's built-in camera or an external camera. If this API is called before enterRoom
, the SDK will only enable the camera and wait until enterRoom
is called before starting push. If it is called after enterRoom
, the SDK will enable the camera and automatically start pushing the video stream. When the first camera video frame starts to be rendered, you will receive the onCameraDidReady
callback in TRTCCloudDelegate.
view | Control that carries the video image |
BeautyManager
before going live, you can:startLocalPreview
before calling enterRoom
startLocalPreview
and muteLocalVideo(true)
after calling enterRoom
|
pure virtual |
Start local media recording
This API records the audio/video content during live streaming into a local file.
params | Recording parameter. For more information, please see TRTCLocalRecordingParams |
|
pure virtual |
Start publishing audio/video streams to non-Tencent Cloud CDN
This API is similar to the startPublishing
API. The difference is that startPublishing
can only publish audio/video streams to Tencent Cloud CDN, while this API can relay streams to live streaming CDN services of other cloud providers.
param | CDN relaying parameter. For more information, please see TRTCPublishCDNParam |
startPublishing
API to publish audio/video streams to Tencent Cloud CSS CDN does not incur additional fees.startPublishCDNStream
API to publish audio/video streams to non-Tencent Cloud CDN incurs additional relaying bandwidth fees.
|
pure virtual |
Start publishing audio/video streams to Tencent Cloud CSS CDN
This API sends a command to the TRTC server, requesting it to relay the current user's audio/video streams to CSS CDN. You can set the StreamId
of the live stream through the streamId
parameter, so as to specify the playback address of the user's audio/video streams on CSS CDN. For example, if you specify the current user's live stream ID as user_stream_001
through this API, then the corresponding CDN playback address is: "http://yourdomain/live/user_stream_001.flv", where yourdomain
is your playback domain name with an ICP filing. You can configure your playback domain name in the CSS console. Tencent Cloud does not provide a default playback domain name. You can also specify the streamId
when setting the TRTCParams
parameter of enterRoom
, which is the recommended approach.
streamId | Custom stream ID. |
streamType | Only TRTCVideoStreamTypeBig and TRTCVideoStreamTypeSub are supported. |
|
pure virtual |
Subscribe to remote user's video stream and bind video rendering control
Calling this API allows the SDK to pull the video stream of the specified 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
.Calling this API only starts pulling the video stream, and the image needs to be loaded and buffered at this time. After the buffering is completed, you will receive a notification from onFirstVideoFrame.
userId | ID of the specified remote user |
streamType | Video stream type of the userId specified for watching:
|
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 enableEncSmallVideoStream 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.
|
pure virtual |
Start desktop screen sharing
This API can capture the screen content or a specified application(desktop only) and share it with other users in the same room.
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.(desktop only) |
streamType | Channel used for screen sharing, which can be the primary stream (TRTCVideoStreamTypeBig) or substream (TRTCVideoStreamTypeSub). |
encParam | Image encoding parameters used for screen sharing, which can be set to nil , indicating to let the SDK choose the optimal encoding parameters (such as resolution and bitrate). |
onError(ERR_SERVER_CENTER_ANOTHER_USER_PUSH_SUB_VIDEO)
callback from TRTCCloudDelegate.
|
pure virtual |
Start network speed test (used before room entry)
params | speed test options |
|
pure virtual |
Start network speed test (used before room entry)
startSpeedTest(params)
instead.
|
pure virtual |
|
pure virtual |
Enable system audio capturing (for desktop systems only)
This API captures audio data from the sound card of the anchor’s computer and mixes it into the current audio stream of the SDK. This ensures that other users in the room hear the audio played back by the anchor’s computer. In online education scenarios, a teacher can use this API to have the SDK capture the audio of instructional videos and broadcast it to students in the room. In live music scenarios, an anchor can use this API to have the SDK capture the music played back by his or her player so as to add background music to the room.
deviceName | If this parameter is empty, the audio of the entire system is captured. On Windows, if the parameter is a speaker name, you can capture this speaker. About speaker device name you can see TXDeviceManager On Windows, you can also set deviceName to the deviceName of an executable file (such as QQMuisc.exe ) to have the SDK capture only the audio of the application. |
deviceName
only on Windows and with 32-bit TRTC SDK.
|
pure virtual |
Stop subscribing to all remote users' video streams and release all rendering resources
Calling this API will cause the SDK to stop receiving all remote video streams and release all decoding and rendering resources.
|
pure virtual |
Stop audio recording
If a recording task has not been stopped through this API before room exit, it will be automatically stopped after room exit.
|
pure virtual |
Stop local audio capturing and publishing
After local audio capturing and publishing is stopped, other users in the room will receive the onUserAudioAvailable(userId, false) notification.
|
pure virtual |
Stop camera preview
|
pure virtual |
Stop local media recording
If a recording task has not been stopped through this API before room exit, it will be automatically stopped after room exit.
|
pure virtual |
Stop publishing audio/video streams to non-Tencent Cloud CDN
|
pure virtual |
Stop publishing audio/video streams to Tencent Cloud CSS CDN
|
pure virtual |
Stop subscribing to remote user's video stream and release rendering control
Calling this API will cause the SDK to stop receiving the user's video stream and release the decoding and rendering resources for the stream.
userId | ID of the specified remote user |
streamType | Video stream type of the userId specified for watching:
|
|
pure virtual |
Stop screen sharing
|
pure virtual |
Stop network speed test
|
pure virtual |
Stop system audio capturing (for desktop systems only)
|
pure virtual |
Switch role
This API is used to switch the user role between "anchor" and "audience". As video live rooms and audio chat rooms need to support an audience of up to 100,000 concurrent online users, the rule "only anchors can publish their audio/video streams" has been set. Therefore, when some users want to publish their streams (so that they can interact with anchors), they need to switch their role to "anchor" first. You can use the 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.
role | Role, which is "anchor" by default:
|
|
pure virtual |
Switch room
This API is used to quickly switch a user from one room to another.
exitRoom
(current room) + enterRoom
(new room).switchRoom
can get better smoothness and use less code than exitRoom + enterRoom
. The API call result will be called back through onSwitchRoom(errCode, errMsg)
in TRTCCloudDelegate. config | Room parameter. For more information, please see TRTCSwitchRoomConfig. |
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.
|
pure virtual |
Update the preview image of local camera
|
pure virtual |
Update remote user's video rendering control
This API can be used to update the rendering control of the remote video image. It is often used in interactive scenarios where the display area needs to be switched.
view | Control that carries the video image |
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 |
TRTC_API void destroyTRTCShareInstance | ( | ) |
TRTC_API liteav::ITRTCCloud* getTRTCShareInstance | ( | ) |
TRTC_API liteav::ITRTCCloud* getTRTCShareInstance | ( | void * | context | ) |