Global

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: PixelBuffer; Android: Direct Buffer for JNI layer; Windows: memory data block.

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 role field in TRTCParams to specify the role of the current user.

TRTCAppSceneAudioCall Number

Audio call scenario, where the SPEECH sound quality is used by default. 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 audio call], [audio conferencing with up to 300 participants], [audio chat], [online Werewolf], etc.

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 role field in TRTCParams to specify the role of the current user.

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) and VoiceChatRoom (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) and AudioCall (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 and Music. In this mode, the reproduction of music is better than that in Speech mode, and the amount of transferred data is much lower than that in Music 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:

  • You need to enter all the parameters in TRTCTranscodingConfig, including the position coordinates of each video image (TRTCMixUser).
  • You need to listen on the onUserVideoAvailable() and onUserAudioAvailable() event callbacks in TRTCCloudDelegate and constantly adjust the mixUsers parameter according to the audio/video status of each user with mic on in the current room.
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).

  • You only need to set it once through the setMixTranscodingConfig() API after room entry, and then the SDK will automatically mix the audio of all mic-on users in the room into the current user's live stream.
  • You don't need to set the mixUsers parameter in TRTCTranscodingConfig; instead, you only need to set the audioSampleRate, audioBitrate and audioChannels parameters.
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 mixUsers parameter, but you can set userId as a "placeholder". Placeholder values include:

  • "$PLACE_HOLDER_REMOTE$": image of remote user. Multiple images can be set.
  • "$PLACE_HOLDER_LOCAL_MAIN$": local camera image. Only one image can be set.
  • "$PLACE_HOLDER_LOCAL_SUB$": local screen sharing image. Only one image can be set. In this mode, you don't need to listen on the onUserVideoAvailable() and onUserAudioAvailable() callbacks in TRTCCloudDelegate to make real-time adjustments. Instead, you only need to call setMixTranscodingConfig() once after successful room entry. Then, the SDK will automatically populate the placeholders you set with real userId values.
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 videoWidth and videoHeight parameters).

  • Before the teacher enables screen sharing, the SDK will scale up the teacher's camera image and draw it onto the canvas.
  • After the teacher enables screen sharing, the SDK will draw the video image shared on the screen onto the same canvas. The purpose of this layout mode is to ensure consistency in the output resolution of the mixtranscoding module and avoid problems with blurred screen during course replay and webpage playback (web players don't support adjustable resolution). Meanwhile, the audio of mic-on students will be mixed into the teacher's audio/video stream by default.
    Video content is primarily the shared screen in teaching mode, and it is a waste of bandwidth to transfer camera image and screen image at the same time. Therefore, the recommended practice is to directly draw the camera image onto the current screen through the setLocalVideoRenderCallback API. In this mode, you don't need to set the mixUsers parameter in TRTCTranscodingConfig, and the SDK will not mix students' images so as not to interfere with the screen sharing effect.
    You can set width x height in TRTCTranscodingConfig to 0 px x 0 px, and the SDK will automatically calculate a suitable resolution based on the aspect ratio of the user's current screen.
  • If the teacher's current screen width is less than or equal to 1920 px, the SDK will use the actual resolution of the teacher's current screen.
  • If the teacher's current screen width is greater than 1920 px, the SDK will select one of the three resolutions of 1920x1080 (16:9), 1920x1200 (16:10), and 1920x1440 (4:3) according to the current screen aspect ratio.

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 pureAudio parameter

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 userId parameter, but you need to specify the image parameter. It is recommended to use png format.

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 (TRTCVideoStreamTypeBig) to Tencent or third-party live streaming CDN service providers (only standard RTMP protocol is supported).

TRTCPublishSubStreamToCdn Number

You can set this parameter to publish the auxiliary stream in your room (TRTCVideoStreamTypeSub) to Tencent or third-party live streaming CDN service providers (only standard RTMP protocol is supported).

TRTCPublishMixStreamToCdn Number

You can set this parameter, in conjunction with the encoding output parameters (TRTCStreamEncoderParam) and the mixing and transcoding parameters (TRTCStreamMixingConfig), to transcode and publish your specified multiple audio and video streams to Tencent or third-party live streaming CDN service providers (only standard RTMP protocol is supported).

TRTCPublishMixStreamToRoom Number

You can set this parameter, in conjunction with the media stream encoding output parameters (TRTCStreamEncoderParam) and the mixing and transcoding parameters (TRTCStreamMixingConfig), to transcode and publish your specified multiple audio and video streams to the room you specify. Specify the robot information of the push-back room through TRTCUser in TRTCPublishTarget.

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.

  • If maxCount > 0 and the actual number of people > maxCount, the SDK will intelligently select maxCount routes of data for playback in real-time, which will greatly reduce performance consumption.
  • If maxCount = 0, the SDK does not limit the number of parallel playback. This may trigger performance issues in rooms with many people on the mic.
includeUsers Array.<String>

[Field Meaning] Specifies users who must be able to play back in parallel.
[Special Instructions] Specifies the user ID list that must be played back in parallel. These users do not participate in intelligent selection.

  • The number of includeUsers must be less than maxCount, otherwise the parallel playback setting will be invalid.
  • includeUsers is only valid when maxCount > 0. When includeUsers takes effect, the maximum number of parallel playback participants in intelligent selection = maxCount - the number of valid includeUsers.

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.
[Recommended Value] The streaming address rules of each service provider vary greatly. Please fill in a valid streaming URL according to the requirements of the target service provider. TRTC's backend server will push standard format audio and video streams to third-party service providers according to the URL you fill in.
[Special Note] The streaming URL must be in RTMP format and must comply with the specification requirements of your target live streaming service provider, otherwise the target service provider will reject the streaming request from TRTC's backend service.

isInternalLine Boolean

[Field Meaning] Specify whether this audio and video stream is published to Tencent Cloud.
[Recommended Value] Default value: true.
[Special Note] If your target live streaming service provider is Tencent, please set this parameter to true. At this time, the backend billing system will not calculate the forwarding service fee for this.

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.
[Recommended Value] If a user's ID in your account system is "mike", then userId can be set to "mike".

intRoomId Number

[Field Meaning] Numeric room number, needs to match the room number type in your room entry parameters (TRTCParams).
[Recommended Value] Value range: 1 - 4294967294.
[Special Note] intRoomId and strRoomId are mutually exclusive. If you choose strRoomId in your room entry parameters, then intRoomId needs to be set to 0. If both are filled, the SDK will preferentially use intRoomId.

strRoomId String

[Field Meaning] String room number, needs to match the room number type in your room entry parameters (TRTCParams).
[Special Note] intRoomId and strRoomId are mutually exclusive. If you choose roomId in your room entry parameters, then strRoomId does not need to be filled. If both are filled, the SDK will preferentially use intRoomId.
[Recommended Value] Limited to a length of 64 bytes. The following is the supported character set range (a total of 89 characters):

  • Uppercase and lowercase English letters (a-zA-Z);
  • Digits (0-9);
  • Space, !,#,$,%,&,(,),+,-,:,;,<,=,.,>,?,@,[,],^,_,{,},|,~,,.

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.
[Recommended Value] Please choose according to your business scenario requirements. TRTC supports forwarding, transcoding, and pushing back to RTC room modes.
[Special Note] If your business scenario requires multiple publishing modes, you can call the media stream publishing interface (startPublishMediaStream) multiple times and set different TRTCPublishTarget respectively.
[Special Note] The same mode should correspond to one media stream publishing interface (startPublishMediaStream), and use updatePublishMediaStream for updates when needed.

cdnUrlList Array.<TRTCPublishCdnUrl>

[Field Meaning] Streaming address (RTMP format) published to Tencent or third-party live streaming service providers.
[Special Note] If your mode is set to TRTCPublishMixStreamToRoom, you do not need to set this parameter.

mixStreamIdentity TRTCUser

[Field Meaning] Push-back room robot information.
[Special Note] Only when your mode is set to TRTCPublishMixStreamToRoom, you need to set this parameter.
[Special Note] After setting, the transcoded audio and video data will be pushed back to the room you specify. It is recommended to set a special userId to avoid confusion between the push-back robot and the anchor who enters the room through the TRTC SDK.
[Special Note] Users participating in the mix stream do not support subscribing to this transcoded stream.
[Special Note] When the subscription mode (setDefaultStreamRecvMode) you set before entering the room is manual, you need to manage the audio and video streams you want to pull yourself (usually when you pull the transcoded stream of the push-back room, you should unsubscribe from the corresponding audio and video single streams involved in transcoding).
[Special Note] When the subscription mode (setDefaultStreamRecvMode) you set before entering the room is automatic, users who do not participate in transcoding will automatically receive the transcoded stream issued by the backend and will no longer continue to receive the audio and video single streams involved in transcoding. Unless you explicitly unsubscribe (muteRemoteVideoStream and muteRemoteAudio), the transcoded stream data will continue to be issued.

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.
[Recommended Value] Unit: pixel value, recommended value: 368. If you only mix audio streams, set both width and height to 0, otherwise there will be a black background in the live stream after mixing and transcoding.

videoEncodedHeight Number

[Field Meaning] Specifies the target resolution (height) of the media publishing stream.
[Recommended Value] Unit: pixel value, recommended value: 640. If you only mix audio streams, set both width and height to 0, otherwise there will be a black background in the live stream after mixing and transcoding.

videoEncodedFPS Number

[Field Meaning] Specifies the target video frame rate (FPS) of the media publishing stream.
[Recommended Value] Recommended value: 20fps, value range is (0,30].

videoEncodedGOP Number

[Field Meaning] Specifies the target video key frame interval (GOP) of the media publishing stream.
[Recommended Value] Recommended value: 3, unit: seconds, value range is [1,5].

videoEncodedKbps Number

[Field Meaning] Specifies the target video bitrate (kbps) of the media publishing stream.
[Recommended Value] If you fill in 0, TRTC will estimate a reasonable bitrate value based on videoEncodedWidth and videoEncodedHeight. You can also refer to the recommended bitrate value in the video resolution enumeration definition (see the comment part).

audioEncodedSampleRate Number

[Field Meaning] Specifies the target audio sampling rate of the media publishing stream.
[Recommended Value] Default value: 48000Hz. Value range is [48000, 44100, 32000, 24000, 16000, 8000], unit is Hz.

audioEncodedChannelNum Number

[Field Meaning] Specifies the target number of audio channels of the media publishing stream.
[Recommended Value] Default value: 1, representing mono. There are only two possible values: 1-mono, 2-stereo.

audioEncodedKbps Number

[Field Meaning] Specifies the target audio bitrate (kbps) of the media publishing stream.
[Recommended Value] Default value: 50kbps, value range is [32, 192].

audioEncodedCodecType Number

[Field Meaning] Specifies the target audio encoding type of the media publishing stream.
[Recommended Value] Default value: 0, representing LC-AAC. There are only three possible values: 0 - LC-AAC, 1 - HE-AAC, 2 - HE-AACv2.
[Special Note] HE-AAC and HE-AACv2 support output stream audio sampling rates ranging from [48000, 44100, 32000, 24000, 16000].
[Special Note] When the audio encoding is set to HE-AACv2, only stereo audio channels are supported.

videoEncodedCodecType Number

[Field Meaning] Specifies the target video encoding type of the media publishing stream.
[Recommended Value] Default value: 0, representing H264. There are only two possible values: 0 - H264, 1 - H265.

videoSeiParams String

[Field Meaning] Mixing SEI parameters, not filled in by default.
[Special Note] The parameter is passed in as a JSON string, as shown below:

{
"payLoadContent":"xxx",
"payloadType":5,
"payloadUuid":"1234567890abcdef1234567890abcdef",
"interval":1000,
"followIdr":false
}

Currently supported fields and meanings:

  • payloadContent: Required. The payload content of the transmitted sei, which cannot be empty;
  • payloadType: Required. The type of the sei message, value range: 5 or integers within [100, 254] (except 244, which is an internally customized timestamp sei);
  • payloadUuid: Must be filled in when payloadType is 5, otherwise it will be ignored. This value must be a 32-character hexadecimal number;
  • interval: Optional, default 1000. The sending interval of the sei, in milliseconds;
  • followIdr: Optional, default false. When this value is true, it ensures that the sei is carried when sending keyframes, otherwise it does not guarantee.

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.
[Recommended Value] Fill (the image may be stretched and cropped) or adapt (there may be black edges), default value: TRTCVideoFillMode_Fill.

backgroundColor Number

[Field Meaning] Specifies the background color of the mixed screen.
[Recommended Value] Default value: 0x000000 represents black. The format is a hexadecimal number, such as "0x61B9F1" represents RGB values of (97,158,241).

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.
[Recommended Value] Default value: null, that is, no placeholder image is set.
[Special Note] At this time, you need to specify the userId in the fixedVideoUser user information.
[Special Note]

  • The URL link length limit is 512 bytes. The image size limit does not exceed 2MB.
  • Image formats support png, jpg, jpeg, bmp formats. It is recommended to use a semi-transparent png image as a placeholder.
fixedVideoUser TRTCUser

[Field Meaning] Information of users participating in transcoding.
[Special Note] User information (TRTCUser) can be left blank (that is, userId, intRoomId and strRoomId are not filled in). At this time, when there is audio and video data uploaded by the anchor in the room where the mix stream is initiated, TRTC's backend server will automatically fill the corresponding anchor's audio and video into the layout you specified.

fixedVideoStreamType TRTCVideoStreamType

[Field Meaning] Specifies whether this screen is a main screen (TRTCVideoStreamTypeBig) or a secondary screen (TRTCVideoStreamTypeSub).

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.
[Special Note]

  • The URL link length limit is 512 bytes. The image size limit does not exceed 2MB.
  • Image formats support png, jpg, jpeg, bmp formats. It is recommended to use a semi-transparent png image as a watermark.
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.
[Recommended Value] Default value: 0x000000 represents black. The format is a hexadecimal number, such as "0x61B9F1" representing RGB values of (97, 158, 241).

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.
[Recommended Value] Default value: null, that is, no background image is set.
[Special Note]

  • The URL link length limit is 512 bytes. The image size limit does not exceed 2MB.
  • Image formats support png, jpg, jpeg, bmp formats. It is recommended to use a semi-transparent png image as the background image.
videoLayoutList Array.<TRTCVideoLayout>

[Field Meaning] Specifies the position, size, layer, and stream type information of each video screen in the mixed screen.
[Recommended Value] This field is an array of TRTCVideoLayout types. Each element in the array represents the information of each screen.

audioMixUserList Array.<TRTCUser>

[Field Meaning] Specifies the information of each input audio stream in the transcoded stream.
[Recommended Value] This field is an array of TRTCUser types. Each element in the array represents the information of each input audio stream.
[Special Note] User information can be left blank (that is, audioMixUserList is empty). At this time, if the audio-related encoding output parameters in TRTCStreamEncoderParam are set, TRTC's backend server will automatically mix all anchors' audio for output (currently only supports up to 16 channels of audio and video input).

watermarkList Array.<TRTCWatermark>

[Field Meaning] Specifies the position, size, and layer information of each watermark screen in the mixed screen.
[Recommended Value] This field is an array of TRTCWatermark types. Each element in the array represents the information of each watermark.

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