Members
(constant) TRTCVideoResolution :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCVideoResolution_120_120 |
Number |
Aspect ratio: 1:1; resolution: 120x120; recommended bitrate (VideoCall): 80 Kbps; recommended bitrate (LIVE): 120 Kbps. |
TRTCVideoResolution_160_160 |
Number |
Aspect ratio: 1:1; resolution: 160x160; recommended bitrate (VideoCall): 100 Kbps; recommended bitrate (LIVE): 150 Kbps. |
TRTCVideoResolution_270_270 |
Number |
Aspect ratio: 1:1; resolution: 270x270; recommended bitrate (VideoCall): 200 Kbps; recommended bitrate (LIVE): 300 Kbps. |
TRTCVideoResolution_480_480 |
Number |
Aspect ratio: 1:1; resolution: 480x480; recommended bitrate (VideoCall): 350 Kbps; recommended bitrate (LIVE): 500 Kbps. |
TRTCVideoResolution_160_120 |
Number |
Aspect ratio: 4:3; resolution: 160x120; recommended bitrate (VideoCall): 100 Kbps; recommended bitrate (LIVE): 150 Kbps. |
TRTCVideoResolution_240_180 |
Number |
Aspect ratio: 4:3; resolution: 240x180; recommended bitrate (VideoCall): 150 Kbps; recommended bitrate (LIVE): 250 Kbps. |
TRTCVideoResolution_280_210 |
Number |
Aspect ratio: 4:3; resolution: 280x210; recommended bitrate (VideoCall): 200 Kbps; recommended bitrate (LIVE): 300 Kbps. |
TRTCVideoResolution_320_240 |
Number |
Aspect ratio: 4:3; resolution: 320x240; recommended bitrate (VideoCall): 250 Kbps; recommended bitrate (LIVE): 375 Kbps. |
TRTCVideoResolution_400_300 |
Number |
Aspect ratio: 4:3; resolution: 400x300; recommended bitrate (VideoCall): 300 Kbps; recommended bitrate (LIVE): 450 Kbps. |
TRTCVideoResolution_480_360 |
Number |
Aspect ratio: 4:3; resolution: 480x360; recommended bitrate (VideoCall): 400 Kbps; recommended bitrate (LIVE): 600 Kbps. |
TRTCVideoResolution_640_480 |
Number |
Aspect ratio: 4:3; resolution: 640x480; recommended bitrate (VideoCall): 600 Kbps; recommended bitrate (LIVE): 900 Kbps. |
TRTCVideoResolution_960_720 |
Number |
Aspect ratio: 4:3; resolution: 960x720; recommended bitrate (VideoCall): 1000 Kbps; recommended bitrate (LIVE): 1500 Kbps. |
TRTCVideoResolution_160_90 |
Number |
Aspect ratio: 16:9; resolution: 160x90; recommended bitrate (VideoCall): 150 Kbps; recommended bitrate (LIVE): 250 Kbps. |
TRTCVideoResolution_256_144 |
Number |
Aspect ratio: 16:9; resolution: 256x144; recommended bitrate (VideoCall): 200 Kbps; recommended bitrate (LIVE): 300 Kbps. |
TRTCVideoResolution_320_180 |
Number |
Aspect ratio: 16:9; resolution: 320x180; recommended bitrate (VideoCall): 250 Kbps; recommended bitrate (LIVE): 400 Kbps. |
TRTCVideoResolution_480_270 |
Number |
Aspect ratio: 16:9; resolution: 480x270; recommended bitrate (VideoCall): 350 Kbps; recommended bitrate (LIVE): 550 Kbps. |
TRTCVideoResolution_640_360 |
Number |
Aspect ratio: 16:9; resolution: 640x360; recommended bitrate (VideoCall): 500 Kbps; recommended bitrate (LIVE): 900 Kbps. |
TRTCVideoResolution_960_540 |
Number |
Aspect ratio: 16:9; resolution: 960x540; recommended bitrate (VideoCall): 850 Kbps; recommended bitrate (LIVE): 1300 Kbps. |
TRTCVideoResolution_1280_720 |
Number |
Aspect ratio: 16:9; resolution: 1280x720; recommended bitrate (VideoCall): 1200 Kbps; recommended bitrate (LIVE): 1800 Kbps. If used for screen share, recommended bitrate 1000Kbps for LD(Low Definition), 1600Kbps for HD(High Definition) |
TRTCVideoResolution_1920_1080 |
Number |
Aspect ratio: 16:9; resolution: 1920x1080; recommended bitrate (VideoCall): 2000 Kbps; recommended bitrate (LIVE): 3000 Kbps. |
Video resolution
Here, only the landscape resolution (e.g., 640x360) is defined. If the portrait resolution (e.g., 360x640) needs to be used, Portrait
must be selected for TRTCVideoResolutionMode
.
Type:
- Number
(constant) TRTCVideoResolutionMode :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCVideoResolutionModeLandscape |
Number |
横屏分辨率 |
TRTCVideoResolutionModePortrait |
Number |
竖屏分辨率 |
Video aspect ratio mode
Only the landscape resolution (e.g., 640x360) is defined in TRTCVideoResolution
. If the portrait resolution (e.g., 360x640) needs to be used, Portrait
must be selected for TRTCVideoResolutionMode
.
- Landscape resolution, such as TRTCVideoResolution_640_360 + TRTCVideoResolutionModeLandscape = 640x360.
- Portrait resolution, such as TRTCVideoResolution_640_360 + TRTCVideoResolutionModePortrait = 360x640.
Type:
- Number
(constant) TRTCVideoStreamType :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCVideoStreamTypeBig |
Number |
HD big image: it is generally used to transfer video data from the camera. |
TRTCVideoStreamTypeSmall |
Number |
Smooth small image: it has the same content as the big image, but with lower resolution and bitrate and thus lower definition. |
TRTCVideoStreamTypeSub |
Number |
Substream image: it is generally used for screen sharing. Only one user in the room is allowed to publish the substream video image at any time, while other users must wait for this user to close the substream before they can publish their own substream. |
Video stream type
TRTC provides three different video streams, including:
- HD big image: it is generally used to transfer video data from the camera.
- Smooth small image: it has the same content as the big image, but with lower resolution and bitrate and thus lower definition.
- Substream image: it is generally used for screen sharing. Only one user in the room is allowed to publish the substream video image at any time, while other users must wait for this user to close the substream before they can publish their own substream.
Notice: The SDK does not support enabling the smooth small image alone, which must be enabled together with the big image. It will automatically set the resolution and bitrate of the small image.
Type:
- Number
(constant) TRTCQuality :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCQuality_Unknown |
Number |
Undefined |
TRTCQuality_Excellent |
Number |
Excellent |
TRTCQuality_Good |
Number |
Good |
TRTCQuality_Poor |
Number |
Fair |
TRTCQuality_Bad |
Number |
Bad |
TRTCQuality_Vbad |
Number |
Very bad |
TRTCQuality_Down |
Number |
Down: Network cannot meet the minimum requirements of TRTC |
Network quality
TRTC evaluates the current network quality once every two seconds. The evaluation results are divided into six levels: Excellent
indicates the best, and Down
indicates the worst.
Type:
- Number
(constant) TRTCVideoFillMode :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCVideoFillMode_Fill |
Number |
Fill mode: the video image will be centered and scaled to fill the entire display area, where parts that exceed the area will be cropped. The displayed image may be incomplete in this mode. |
TRTCVideoFillMode_Fit |
Number |
Fit mode: the video image will be scaled based on its long side to fit the display area, where the short side will be filled with black bars. The displayed image is complete in this mode, but there may be black bars. |
Video image fill mode
If the aspect ratio of the video display area is not equal to that of the video image, you need to specify the fill mode:
Type:
- Number
(constant) TRTCVideoRotation :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCVideoRotation0 |
Number |
No rotation |
TRTCVideoRotation90 |
Number |
Clockwise rotation by 90 degrees |
TRTCVideoRotation180 |
Number |
Clockwise rotation by 180 degrees |
TRTCVideoRotation270 |
Number |
Clockwise rotation by 270 degrees |
Video image rotation direction
TRTC provides rotation angle setting APIs for local and remote images. The following rotation angles are all clockwise.
Type:
- Number
(constant) TRTCBeautyStyle :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCBeautyStyleSmooth |
Number |
Smooth style, which uses a more radical algorithm for more obvious effect and is suitable for show live streaming. |
TRTCBeautyStyleNature |
Number |
Natural style, which retains more facial details for more natural effect and is suitable for most live streaming use cases. |
Beauty (skin smoothing) filter algorithm
TRTC has multiple built-in skin smoothing algorithms. You can select the one most suitable for your product.
Type:
- Number
(constant) TRTCVideoPixelFormat :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCVideoPixelFormat_Unknown |
Number |
Undefined format |
TRTCVideoPixelFormat_I420 |
Number |
YUV420P (I420) format |
TRTCVideoPixelFormat_Texture_2D |
Number |
OpenGL 2D texture format |
TRTCVideoPixelFormat_BGRA32 |
Number |
BGRA32 format |
TRTCVideoPixelFormat_RGBA32 |
Number |
RGBA32 format |
Video pixel format
TRTC provides custom video capturing and rendering features.
- For the custom capturing feature, you can use the following enumerated values to describe the pixel format of the video you capture.
- For the custom rendering feature, you can specify the pixel format of the video you expect the SDK to call back.
Type:
- Number
(constant) TRTCVideoBufferType :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCVideoBufferType_Unknown |
Number |
Undefined transfer method |
TRTCVideoBufferType_Buffer |
Number |
Use memory buffer to transfer video data. iOS: |
Video data transfer method
For custom capturing and rendering features, you need to use the following enumerated values to specify the method of transferring video data:
- Method 1. This method uses memory buffer to transfer video data. It is the only method supported on Windows currently.
- Method 2. This method uses texture to transfer video data. It is not supported on Windows. To use this method, you should have a general familiarity with OpenGL programming.
Type:
- Number
(constant) TRTCVideoMirrorType :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCVideoMirrorType_Auto |
Number |
Auto mode: mirror the front camera's image but not the rear camera's image(for mobile devices only). |
TRTCVideoMirrorType_Enable |
Number |
Mirror the images of both the front and rear cameras. |
TRTCVideoMirrorType_Disable |
Number |
Disable mirroring for both the front and rear cameras. |
Video mirror type
Video mirroring refers to the left-to-right flipping of the video image, especially for the local camera preview image. After mirroring is enabled, it can bring anchors a familiar "look into the mirror" experience.
Type:
- Number
(constant) TRTCRecordType :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCRecordTypeAudio |
Number |
Record audio only. |
TRTCRecordTypeVideo |
Number |
Record video only. |
TRTCRecordTypeBoth |
Number |
Record both audio and video. |
Media recording type
This enumerated type is used in the local media recording API startLocalRecording to specify whether to record audio/video files or pure audio files.
Type:
- Number
TRTCRecordType[undefined]
Record audio only.
TRTCRecordType[undefined]
Record video only.
TRTCRecordType[undefined]
Record both audio and video.
(constant) TRTCAppScene :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCAppSceneVideoCall |
Number |
In the video call scenario, 720p and 1080p HD image quality is supported. A single room can sustain up to 300 concurrent online users, and up to 50 of them can speak simultaneously. Use cases: [one-to-one video call], [video conferencing with up to 300 participants], [online medical diagnosis], [small class], [video interview], etc. |
TRTCAppSceneLIVE |
Number |
In the interactive video live streaming scenario, mic can be turned on/off smoothly without waiting for switchover, and the anchor latency is as low as less than 300 ms. Live streaming to hundreds of thousands of concurrent users in the audience role is supported with the playback latency down to 1,000 ms. Use cases: [low-latency interactive live streaming], [big class], [anchor competition], [video dating room], [online interactive classroom], [remote training], [large-scale conferencing], etc. Notice: In this scenario, you must use the |
TRTCAppSceneAudioCall |
Number |
Audio call scenario, where the |
TRTCAppSceneVoiceChatRoom |
Number |
In the interactive audio live streaming scenario, mic can be turned on/off smoothly without waiting for switchover, and the anchor latency is as low as less than 300 ms. Live streaming to hundreds of thousands of concurrent users in the audience role is supported with the playback latency down to 1,000 ms. Use cases: [audio club], [online karaoke room], [music live room], [FM radio], etc. Notice: In this scenario, you must use the |
Use cases
TRTC features targeted optimizations for common audio/video application scenarios to meet the differentiated requirements in various verticals. The main scenarios can be divided into the following two categories:
- Live streaming scenario (LIVE): including
LIVE
(audio + video) andVoiceChatRoom
(pure audio). In the live streaming scenario, users are divided into two roles: "anchor" and "audience". A single room can sustain up to 100,000 concurrent online users. This is suitable for live streaming to a large audience. - Real-Time scenario (RTC): including
VideoCall
(audio + video) andAudioCall
(pure audio). In the real-time scenario, there is no role difference between users, but a single room can sustain only up to 300 concurrent online users. This is suitable for small-scale real-time communication.
Type:
- Number
(constant) TRTCRoleType :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCRoleAnchor |
Number |
Anchor |
TRTCRoleAudience |
Number |
Audience |
Role
Role is applicable only to live streaming scenarios (TRTCAppSceneLIVE
and TRTCAppSceneVoiceChatRoom
). Users are divided into two roles:
-
Anchor, who can publish their audio/video streams. There is a limit on the number of anchors. Up to 50 anchors are allowed to publish streams at the same time in one room.
-
Audience, who can only listen to or watch audio/video 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 can sustain up to 100,000 concurrent online users in the audience role. -
Anchor: An anchor can publish their audio/video streams. There is a limit on the number of anchors. Up to 50 anchors are allowed to publish streams at the same time in one room.
-
Audience: Audience can only listen to or watch audio/video 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 can sustain up to 100,000 concurrent online users in the audience role.
Type:
- Number
(constant) TRTCQosControlMode :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCQosControlModeClient |
Number |
ModeClient(Only for SDK internal test and debug) |
TRTCQosControlModeServer |
Number |
ModeServer(Default) |
QoS control mode (deprecated)
The TRTC SDK adjusts the codec and network module constantly to adapt to changing network conditions. To support quick algorithm upgrade, the SDK provides two QoS control modes:
- ModeClient: Local control, which is used for internal debugging of the SDK and is not recommended
- ModeServer: Cloud control, which is the default mode and is recommended
We recommend the cloud control mode so that when we upgrade the QoS algorithm, you don’t need to update the SDK to get better QoS control results.
Type:
- Number
(constant) TRTCVideoQosPreference :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCVideoQosPreferenceSmooth |
Number |
Ensuring smoothness |
TRTCVideoQosPreferenceClear |
Number |
Ensuring clarity (default value) |
Image quality preference
TRTC has two control modes in weak network environments: "ensuring clarity" and "ensuring smoothness". Both modes will give priority to the transfer of audio data.
- Ensuring smoothness: in this mode, when the current network is unable to transfer a clear and smooth video image, the smoothness of the image will be given priority, but there will be blurs.
- Ensuring clarity (default value): in this mode, when the current network is unable to transfer a clear and smooth video image, the clarity of the image will be given priority, but there will be lags.
Type:
- Number
(constant) TRTCAudioFrameFormat :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCAudioFrameFormatNone |
Number |
Undefined |
TRTCAudioFrameFormatPCM |
Number |
Audio data in PCM format. |
Audio frame content format
Type:
- Number
(constant) TRTCScreenCaptureSourceType :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCScreenCaptureSourceTypeUnknown |
Number |
Undefined |
TRTCScreenCaptureSourceTypeWindow |
Number |
The screen sharing target is the window of an application |
TRTCScreenCaptureSourceTypeScreen |
Number |
The screen sharing target is the entire screen |
TRTCScreenCaptureSourceTypeCustom |
Number |
The screen sharing target is a user-defined data source |
Screen sharing target type
Type:
- Number
(constant) TRTCAudioQuality :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCAudioQualitySpeech |
Number |
Speech mode: sample rate: 16 kHz; mono channel; bitrate: 16 Kbps. This mode has the best resistance among all modes and is suitable for audio call scenarios, such as online meeting and audio call. |
TRTCAudioQualityDefault |
Number |
Default mode: sample rate: 48 kHz; mono channel; bitrate: 50 Kbps. This mode is between the speech mode and the music mode as the default mode in the SDK and is recommended. |
TRTCAudioQualityMusic |
Number |
Music mode: sample rate: 48 kHz; full-band stereo; bitrate: 128 Kbps. This mode is suitable for scenarios where Hi-Fi music transfer is required, such as online karaoke and music live streaming. |
Sound quality
TRTC provides three well-tuned modes to meet the differentiated requirements for sound quality in various verticals:
- Speech mode (Speech): it is suitable for application scenarios that focus on human communication. In this mode, the audio transfer is more resistant, and TRTC uses various voice processing technologies to ensure the optimal smoothness even in weak network environments.
- Music mode (Music): it is suitable for scenarios with demanding requirements for music. In this mode, the amount of transferred audio data is very large, and TRTC uses various technologies to ensure that the high-fidelity details of music signals can be restored in each frequency band.
- Default mode (Default): it is between
Speech
andMusic
. In this mode, the reproduction of music is better than that inSpeech
mode, and the amount of transferred data is much lower than that inMusic
mode; therefore, this mode has good adaptability to various scenarios.
Type:
- Number
(constant) TRTCLogLevel :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCLogLevelVerbose |
Number |
Output logs at all levels |
TRTCLogLevelDebug |
Number |
Output logs at the DEBUG, INFO, WARNING, ERROR, and FATAL levels |
TRTCLogLevelInfo |
Number |
Output logs at the INFO, WARNING, ERROR, and FATAL levels |
TRTCLogLevelWarn |
Number |
Output logs at the WARNING, ERROR, and FATAL levels |
TRTCLogLevelError |
Number |
Output logs at the ERROR and FATAL levels |
TRTCLogLevelFatal |
Number |
Output logs at the FATAL level |
TRTCLogLevelNone |
Number |
Do not output any SDK logs |
Log level
Different log levels indicate different levels of details and number of logs. We recommend you set the log level to TRTCLogLevelInfo
generally.
Type:
- Number
(constant) TRTCDeviceState :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCDeviceStateAdd |
Number |
The device has been plugged in |
TRTCDeviceStateRemove |
Number |
The device has been removed |
TRTCDeviceStateActive |
Number |
The device has been enabled |
TRTCDefaultDeviceChanged |
Number |
System default device changed |
Device operation
Type:
- Number
(constant) TRTCDeviceType :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCDeviceTypeUnknown |
Number |
undefined device type |
TRTCDeviceTypeMic |
Number |
microphone |
TRTCDeviceTypeSpeaker |
Number |
speaker or earpiece |
TRTCDeviceTypeCamera |
Number |
camera |
Device type
Type:
- Number
(constant) TRTCCameraCaptureMode :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCCameraResolutionStrategyAuto |
Number |
Auto adjustment of camera acquisition parameters. SDK selects the appropriate camera output parameters according to the actual acquisition device performance and network situation, and maintains a balance between device performance and video preview quality. |
TRTCCameraResolutionStrategyPerformance |
Number |
Give priority to equipment performance. SDK selects the closest camera output parameters according to the user's encoder resolution and frame rate, so as to ensure the performance of the device. |
TRTCCameraResolutionStrategyHighQuality |
Number |
Give priority to the quality of video preview. SDK selects higher camera output parameters to improve the quality of preview video. In this case, it will consume more CPU and memory to do video preprocessing. |
TRTCCameraCaptureManual |
Number |
Allows the user to set the width and height of the video captured by the local camera. |
Camera acquisition preferences
This enum is used to set camera acquisition parameters.
Type:
- Number
(constant) TRTCWaterMarkSrcType :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCWaterMarkSrcTypeFile |
Number |
Path of the image file, which can be in BMP, GIF, JPEG, PNG, TIFF, Exif, WMF, or EMF format |
TRTCWaterMarkSrcTypeBGRA32 |
Number |
Memory block in BGRA32 format |
TRTCWaterMarkSrcTypeRGBA32 |
Number |
Memory block in RGBA32 format |
Watermark image source type
Type:
- Number
(constant) TRTCTranscodingConfigMode :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCTranscodingConfigMode_Unknown |
Number |
Undefined |
TRTCTranscodingConfigMode_Manual |
Number |
Manual layout mode In this mode, you need to specify the precise position of each video image. This mode has the highest degree of freedom, but its ease of use is the worst:
|
TRTCTranscodingConfigMode_Template_PureAudio |
Number |
Pure audio mode This mode is suitable for pure audio scenarios such as audio call (AudioCall) and audio chat room (VoiceChatRoom).
|
TRTCTranscodingConfigMode_Template_PresetLayout |
Number |
Preset layout mode
This is the most popular layout mode, because it allows you to set the position of each video image in advance through placeholders, and then the SDK automatically adjusts it dynamically according to the number of video images in the room.
In this mode, you still need to set the
|
TRTCTranscodingConfigMode_Template_ScreenSharing |
Number |
Screen sharing mode
This mode is suitable for screen sharing-based use cases such as online education and supported only by the SDKs for Windows and macOS.
In this mode, the SDK will first build a canvas according to the target resolution you set (through the
|
Layout mode of On-Cloud MixTranscoding
TRTC's On-Cloud MixTranscoding service can mix multiple audio/video streams in the room into one stream. Therefore, you need to specify the layout scheme of the video images. The following layout modes are provided:
Type:
- Number
(constant) TRTCMixInputType :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCMixInputTypeUndefined |
Number |
Unspecified. The SDK will determine the stream mix input type according to the value of the |
TRTCMixInputTypeAudioVideo |
Number |
Mix both audio and video |
TRTCMixInputTypePureVideo |
Number |
Mix video only |
TRTCMixInputTypePureAudio |
Number |
Mix audio only |
TRTCMixInputTypeWatermark |
Number |
Mix watermark. In this case, you don't need to specify the |
Stream mix input type
Type:
- Number
(constant) TRTCAudioRecordingContent :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCAudioRecordingContentAll |
Number |
Record both local and remote audio |
TRTCAudioRecordingContentLocal |
Number |
Record local audio only |
TRTCAudioRecordingContentRemote |
Number |
Record remote audio only |
Audio recording content type
** Supported from TRTCSDK 9.3 **
This enumerated type is used in the audio recording API startAudioRecording()
to specify the content of the recorded audio.
Type:
- Number
(constant) TRTCPublishMode :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCPublishModeUnknown |
Number |
Undefined mode |
TRTCPublishBigStreamToCdn |
Number |
You can set this parameter to publish the main stream in your room ( |
TRTCPublishSubStreamToCdn |
Number |
You can set this parameter to publish the auxiliary stream in your room ( |
TRTCPublishMixStreamToCdn |
Number |
You can set this parameter, in conjunction with the encoding output parameters ( |
TRTCPublishMixStreamToRoom |
Number |
You can set this parameter, in conjunction with the media stream encoding output parameters ( |
Media Stream Publishing Mode
This enumeration type is used for the media stream publishing interface startPublishMediaStream
. TRTC's media stream publishing service can mix multiple audio and video streams in the room into one stream and publish it to CDN or push it back to the room. It can also publish your current audio and video stream to Tencent or third-party CDN. Therefore, you need to specify the publishing mode of the corresponding media stream. We provide the following modes.
Type:
- Number
(constant) TRTCVoiceReverbType :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCLiveVoiceReverbType_0 |
Number |
disable |
TRTCLiveVoiceReverbType_1 |
Number |
KTV |
TRTCLiveVoiceReverbType_2 |
Number |
small room |
TRTCLiveVoiceReverbType_3 |
Number |
great hall |
TRTCLiveVoiceReverbType_4 |
Number |
deep voice |
TRTCLiveVoiceReverbType_5 |
Number |
loud voice |
TRTCLiveVoiceReverbType_6 |
Number |
metallic sound |
TRTCLiveVoiceReverbType_7 |
Number |
magnetic sound |
TRTCLiveVoiceReverbType_8 |
Number |
ethereal |
TRTCLiveVoiceReverbType_9 |
Number |
studio |
TRTCLiveVoiceReverbType_10 |
Number |
melodious |
TRTCLiveVoiceReverbType_11 |
Number |
studio2 |
Reverb effects
Reverb effects can be applied to human voice. Based on acoustic algorithms, they can mimic voice in different environments. The following effects are supported currently:
Type:
- Number
(constant) TRTCVoiceChangerType :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCLiveVoiceChangerType_0 |
Number |
disable |
TRTCLiveVoiceChangerType_1 |
Number |
Naughty child |
TRTCLiveVoiceChangerType_2 |
Number |
Lolita |
TRTCLiveVoiceChangerType_3 |
Number |
Uncle |
TRTCLiveVoiceChangerType_4 |
Number |
Heavy Metal |
TRTCLiveVoiceChangerType_5 |
Number |
Influenza |
TRTCLiveVoiceChangerType_6 |
Number |
Foreign Language |
TRTCLiveVoiceChangerType_7 |
Number |
Trapped Beast |
TRTCLiveVoiceChangerType_8 |
Number |
Plump |
TRTCLiveVoiceChangerType_9 |
Number |
Heavy Current |
TRTCLiveVoiceChangerType_10 |
Number |
Heavy Machinery |
TRTCLiveVoiceChangerType_11 |
Number |
Intangible |
Voice change effects
Voice change effects can be applied to the human voice, and the acoustic algorithm can process the human voice twice to obtain the timbre different from the original sound. Currently, the following kinds of acoustic effects are supported
Type:
- Number
(constant) TRTCPluginType :Number
Properties:
Name | Type | Description |
---|---|---|
TRTCPluginTypeVideoProcess |
Number |
Video processing plugin type, useful for customized beauty such as AI beauty |
TRTCPluginTypeMediaEncryptDecrypt |
Number |
Media encryption and decryption, useful for customized security |
TRTCPluginTypeAudioProcess |
Number |
audio processing plugin type, useful for custom audio processing |
Plugin Type
Support video processing plugin and media encryption and decryption plugin
Type:
- Number
Type Definitions
TRTCAudioParallelParams
Properties:
Name | Type | Description |
---|---|---|
maxCount |
Number |
[Field Meaning] Maximum number of parallel playback. Default value: 0.
|
includeUsers |
Array.<String> |
[Field Meaning] Specifies users who must be able to play back in parallel.
|
Parameters for the intelligent parallel playback strategy of remote audio streams
This parameter is used to set up the intelligent parallel playback strategy for remote audio streams.
Type:
- Object
TRTCCameraCaptureParams
Properties:
Name | Type | Description |
---|---|---|
mode |
TRTCCameraCaptureMode |
Acquisition mode |
width |
Number |
Acquisition width |
height |
Number |
Acquisition height |
Camera acquisition parameters
This setting determines the quality of the local preview image.
Type:
- Object
TRTCPluginInfo
Properties:
Name | Type | Description |
---|---|---|
id |
String |
plugin ID. User should be sure that it is unique for each plugin. |
deviceId |
String |
camera device ID. Required when you open multi-camera for customized beauty. Default is empty string. |
enable |
function |
enable current plugin. Success when return 0, otherwise failed. |
disable |
function |
disable current plugin. Success when return 0, otherwise failed. |
setParameter |
function |
set parameter to control plugin. Success when return 0, otherwise failed. The parameter is a JSON string and will be passed to C++ plugin's setParameter function. |
TRTC plugin information
Type:
- Object
TRTCVideoProcessPluginOptions
Properties:
Name | Type | Description |
---|---|---|
enable |
Boolean |
Whether to enable |
pixelFormat |
TRTCVideoPixelFormat |
Pixel format |
Video processing plugin options
Type:
- Object
TRTCMediaEncryptDecryptPluginOptions
Properties:
Name | Type | Description |
---|---|---|
enable |
Boolean |
Whether to enable |
Media encryption and decryption plugin options
Type:
- Object
TRTCAudioProcessPluginOptions
Properties:
Name | Type | Description |
---|---|---|
enable |
Boolean |
Whether to enable |
Audio process plugin options
Type:
- Object
TRTCPublishCdnUrl
Properties:
Name | Type | Description |
---|---|---|
rtmpUrl |
String |
[Field Meaning] Specify the streaming address (RTMP format) of this audio and video stream on Tencent or third-party live streaming service providers. |
isInternalLine |
Boolean |
[Field Meaning] Specify whether this audio and video stream is published to Tencent Cloud. |
URL Configuration Required for Publishing Audio and Video Streams to Tencent or Third-Party CDN
This configuration is used for the target streaming configuration (TRTCPublishTarget
) in the media stream publishing interface startPublishMedia:Stream
.
Type:
- Object
TRTCUser
Properties:
Name | Type | Description |
---|---|---|
userId |
String |
[Field Meaning] User identifier, the current user's userId, equivalent to the username, using UTF-8 encoding. |
intRoomId |
Number |
[Field Meaning] Numeric room number, needs to match the room number type in your room entry parameters ( |
strRoomId |
String |
[Field Meaning] String room number, needs to match the room number type in your room entry parameters (
|
User Information Related to Media Stream Publishing
You can set this parameter, in conjunction with the media stream target publishing parameters (TRTCPublishTarget
) and the mixing and transcoding parameters (TRTCStreamMixingConfig
), to transcode and publish your specified multiple audio and video streams to the target publishing address you fill in.
Type:
- Object
TRTCPublishTarget
Properties:
Name | Type | Description |
---|---|---|
mode |
TRTCPublishMode |
[Field Meaning] Media stream publishing mode. |
cdnUrlList |
Array.<TRTCPublishCdnUrl> |
[Field Meaning] Streaming address (RTMP format) published to Tencent or third-party live streaming service providers. |
mixStreamIdentity |
TRTCUser |
[Field Meaning] Push-back room robot information. |
Target Streaming Configuration
This configuration is used for the media stream publishing interface startPublishMediaStream
.
Type:
- Object
TRTCStreamEncoderParam
Properties:
Name | Type | Description |
---|---|---|
videoEncodedWidth |
Number |
[Field Meaning] Specifies the target resolution (width) of the media publishing stream. |
videoEncodedHeight |
Number |
[Field Meaning] Specifies the target resolution (height) of the media publishing stream. |
videoEncodedFPS |
Number |
[Field Meaning] Specifies the target video frame rate (FPS) of the media publishing stream. |
videoEncodedGOP |
Number |
[Field Meaning] Specifies the target video key frame interval (GOP) of the media publishing stream. |
videoEncodedKbps |
Number |
[Field Meaning] Specifies the target video bitrate (kbps) of the media publishing stream. |
audioEncodedSampleRate |
Number |
[Field Meaning] Specifies the target audio sampling rate of the media publishing stream. |
audioEncodedChannelNum |
Number |
[Field Meaning] Specifies the target number of audio channels of the media publishing stream. |
audioEncodedKbps |
Number |
[Field Meaning] Specifies the target audio bitrate (kbps) of the media publishing stream. |
audioEncodedCodecType |
Number |
[Field Meaning] Specifies the target audio encoding type of the media publishing stream. |
videoEncodedCodecType |
Number |
[Field Meaning] Specifies the target video encoding type of the media publishing stream. |
videoSeiParams |
String |
[Field Meaning] Mixing SEI parameters, not filled in by default.
Currently supported fields and meanings:
|
Media Stream Encoding Output Parameters
[Field Meaning] This configuration is used for the media stream publishing interface (startPublishMediaStream
).
[Special Note] When the mode configuration in your publishing target (TRTCPublishTarget
) is TRTCPublish_MixStream_ToCdn or TRTCPublish_MixStream_ToRoom, this parameter is required.
[Special Note] When you use the forwarding service (mode is TRTCPublishBigStreamToCdn or TRTCPublishSubStreamToCdn), it is also recommended that you fill in the specific parameters of this configuration for better forwarding stability and CDN playback compatibility.
Type:
- Object
TRTCVideoLayout
Properties:
Name | Type | Description |
---|---|---|
rect |
Rect |
[Field Meaning] Specifies the coordinate area (unit: pixels) of this screen. |
zOrder |
Number |
[Field Meaning] Specifies the level (value range: 0 - 15, non-repetitive) of this screen. |
fillMode |
TRTCVideoFillMode |
[Field Meaning] Image filling mode. |
backgroundColor |
Number |
[Field Meaning] Specifies the background color of the mixed screen. |
placeHolderImage |
String |
[Field Meaning] Placeholder image URL, that is, when a specified user temporarily only uploads audio, Tencent Cloud's backend server will mix the image specified by this URL into the final screen.
|
fixedVideoUser |
TRTCUser |
[Field Meaning] Information of users participating in transcoding. |
fixedVideoStreamType |
TRTCVideoStreamType |
[Field Meaning] Specifies whether this screen is a main screen ( |
Transcoding Video Layout
This configuration is used for the transcoding configuration (TRTCStreamMixingConfig
) in the media stream publishing interface (startPublishMediaStream
).
It is used to specify the position, size, layer, and stream type information of each video screen in the transcoded stream.
Type:
- Object
TRTCWatermark
Properties:
Name | Type | Description |
---|---|---|
watermarkUrl |
String |
[Field Meaning] Watermark URL, Tencent Cloud's backend server will mix the image specified by this URL into the final image.
|
rect |
Rect |
[Field Meaning] Specifies the coordinate area (unit: pixels) of this watermark image. |
zOrder |
Number |
[Field Meaning] Specifies the level (value range: 0 - 15, non-repetitive) of this watermark image. |
Watermark Layout
This configuration is used for the transcoding configuration (TRTCStreamMixingConfig
) in the media stream publishing interface (startPublishMediaStream
).
Type:
- Object
TRTCStreamMixingConfig
Properties:
Name | Type | Description |
---|---|---|
backgroundColor |
Number |
[Field Meaning] Specifies the background color of the mixed screen. |
backgroundImage |
String |
[Field Meaning] Specifies the background image URL of the mixed screen. Tencent Cloud's backend server will mix the image specified by this URL into the final image.
|
videoLayoutList |
Array.<TRTCVideoLayout> |
[Field Meaning] Specifies the position, size, layer, and stream type information of each video screen in the mixed screen. |
audioMixUserList |
Array.<TRTCUser> |
[Field Meaning] Specifies the information of each input audio stream in the transcoded stream. |
watermarkList |
Array.<TRTCWatermark> |
[Field Meaning] Specifies the position, size, and layer information of each watermark screen in the mixed screen. |
Media Stream Transcoding Configuration Parameters
This configuration is used for the media stream publishing interface (startPublishMediaStream
).
It is used to specify the layout position information of each screen and the input audio information during transcoding.
Type:
- Object
TRTCMusicPlayObserver
Properties:
Name | Type | Description |
---|---|---|
onStart |
TRTCMusicEvent~onStart | null |
Background music started event |
onPlayProgress |
TRTCMusicEvent~onPlayProgress | null |
Background music playing progress event |
onComplete |
TRTCMusicEvent~onComplete | null |
Background music completed event |
Background music playing event observer
Type:
- Object
TRTCMusicPreloadObserver
Properties:
Name | Type | Description |
---|---|---|
onLoadProgress |
TRTCMusicEvent~onLoadProgress | null |
Background music preloading progress event |
onLoadError |
TRTCMusicEvent~onLoadError | null |
Background music preloading error |
Background music preloading event observer
Type:
- Object
TRTCAudioFrameCallback
Properties:
Name | Type | Description |
---|---|---|
onCapturedAudioFrame |
TRTCAudioFrameCallback~onCapturedAudioFrame | null |
Audio data captured by the local mic and pre-processed by the audio module. |
onLocalProcessedAudioFrame |
TRTCAudioFrameCallback~onLocalProcessedAudioFrame | null |
Audio data captured by the local mic, pre-processed by the audio module, effect-processed and BGM-mixed. |
onPlayAudioFrame |
TRTCAudioFrameCallback~onPlayAudioFrame | null |
Audio data of each remote user before audio mixing. |
onMixedPlayAudioFrame |
TRTCAudioFrameCallback~onMixedPlayAudioFrame | null |
Data mixed from each channel before being submitted to the system for playback. |
onMixedAllAudioFrame |
TRTCAudioFrameCallback~onMixedAllAudioFrame | null |
Data mixed from all the captured and to-be-played audio in the SDK. |
Callback of custom audio processing
Type:
- Object