유형 정의
Copyright (c) 2021 Tencent. All rights reserved.
Module: TRTC key class definition
Description: definitions of enumerated and constant values such as resolution and quality level
Type Define
StructType
FuncList | DESC |
Room entry parameters | |
Video encoding parameters | |
Network QoS control parameter set | |
Rendering parameters of video image | |
Network quality | |
Volume | |
Network speed testing parameters | |
Network speed test result | |
Video texture data | |
Video frame information | |
Audio frame data | |
Description information of each video image in On-Cloud MixTranscoding | |
Layout and transcoding parameters of On-Cloud MixTranscoding | |
Push parameters required to be set when publishing audio/video streams to non-Tencent Cloud CDN | |
Local audio file recording parameters | |
Local media file recording parameters | |
Sound effect parameter (disused) | |
Room switch parameter | |
Format parameter of custom audio callback | |
Screen sharing parameter (for Android only) | |
The users whose streams to publish | |
The destination URL when you publish to Tencent Cloud or a third-party CDN | |
The publishing destination | |
The video layout of the transcoded stream | |
The watermark layout | |
The encoding parameters | |
The transcoding parameters | |
Media Stream Private Encryption Configuration | |
Volume evaluation and other related parameter settings. |
EnumType
EnumType | DESC |
Video resolution | |
Video aspect ratio mode | |
Video stream type | |
Video image fill mode | |
Video image rotation direction | |
Beauty (skin smoothing) filter algorithm | |
Video pixel format | |
Video data transfer method | |
Video mirror type | |
Data source of local video screenshot | |
Use cases | |
Role | |
QoS control mode (disused) | |
Image quality preference | |
Network quality | |
Audio/Video playback status | |
Reasons for playback status changes | |
Audio sample rate | |
Sound quality | |
Audio route (i.e., audio playback mode) | |
Audio reverb mode | |
Voice changing type | |
System volume type (only for mobile devices) | |
Audio frame content format | |
Audio capability type supported by the system (only for Android devices) | |
Audio callback data operation mode | |
Log level | |
G-sensor switch (for mobile devices only) | |
Layout mode of On-Cloud MixTranscoding | |
Media recording type | |
Stream mix input type | |
Debugging information displayed in the rendering control | |
Audio recording content type | |
The publishing mode | |
Encryption Algorithm | |
Speed Test Scene | |
Set the adaptation mode of gravity sensing (only applicable to mobile terminals) |
TRTCVideoResolution
TRTCVideoResolution
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
.Enum | Value | DESC |
TRTC_VIDEO_RESOLUTION_120_120 | 1 | Aspect ratio: 1:1; resolution: 120x120; recommended bitrate (VideoCall): 80 Kbps; recommended bitrate (LIVE): 120 Kbps. |
TRTC_VIDEO_RESOLUTION_160_160 | 3 | Aspect ratio: 1:1; resolution: 160x160; recommended bitrate (VideoCall): 100 Kbps; recommended bitrate (LIVE): 150 Kbps. |
TRTC_VIDEO_RESOLUTION_270_270 | 5 | Aspect ratio: 1:1; resolution: 270x270; recommended bitrate (VideoCall): 200 Kbps; recommended bitrate (LIVE): 300 Kbps. |
TRTC_VIDEO_RESOLUTION_480_480 | 7 | Aspect ratio: 1:1; resolution: 480x480; recommended bitrate (VideoCall): 350 Kbps; recommended bitrate (LIVE): 500 Kbps. |
TRTC_VIDEO_RESOLUTION_160_120 | 50 | Aspect ratio: 4:3; resolution: 160x120; recommended bitrate (VideoCall): 100 Kbps; recommended bitrate (LIVE): 150 Kbps. |
TRTC_VIDEO_RESOLUTION_240_180 | 52 | Aspect ratio: 4:3; resolution: 240x180; recommended bitrate (VideoCall): 150 Kbps; recommended bitrate (LIVE): 250 Kbps. |
TRTC_VIDEO_RESOLUTION_280_210 | 54 | Aspect ratio: 4:3; resolution: 280x210; recommended bitrate (VideoCall): 200 Kbps; recommended bitrate (LIVE): 300 Kbps. |
TRTC_VIDEO_RESOLUTION_320_240 | 56 | Aspect ratio: 4:3; resolution: 320x240; recommended bitrate (VideoCall): 250 Kbps; recommended bitrate (LIVE): 375 Kbps. |
TRTC_VIDEO_RESOLUTION_400_300 | 58 | Aspect ratio: 4:3; resolution: 400x300; recommended bitrate (VideoCall): 300 Kbps; recommended bitrate (LIVE): 450 Kbps. |
TRTC_VIDEO_RESOLUTION_480_360 | 60 | Aspect ratio: 4:3; resolution: 480x360; recommended bitrate (VideoCall): 400 Kbps; recommended bitrate (LIVE): 600 Kbps. |
TRTC_VIDEO_RESOLUTION_640_480 | 62 | Aspect ratio: 4:3; resolution: 640x480; recommended bitrate (VideoCall): 600 Kbps; recommended bitrate (LIVE): 900 Kbps. |
TRTC_VIDEO_RESOLUTION_960_720 | 64 | Aspect ratio: 4:3; resolution: 960x720; recommended bitrate (VideoCall): 1000kbps; recommended bitrate (LIVE): 1500kbps。 |
TRTC_VIDEO_RESOLUTION_160_90 | 100 | Aspect ratio: 16:9; resolution: 160x90; recommended bitrate (VideoCall): 150 Kbps; recommended bitrate (LIVE): 250 Kbps. |
TRTC_VIDEO_RESOLUTION_256_144 | 102 | Aspect ratio: 16:9; resolution: 256x144; recommended bitrate (VideoCall): 200 Kbps; recommended bitrate (LIVE): 300 Kbps. |
TRTC_VIDEO_RESOLUTION_320_180 | 104 | Aspect ratio: 16:9; resolution: 320x180; recommended bitrate (VideoCall): 250 Kbps; recommended bitrate (LIVE): 400 Kbps. |
TRTC_VIDEO_RESOLUTION_480_270 | 106 | Aspect ratio: 16:9; resolution: 480x270; recommended bitrate (VideoCall): 350 Kbps; recommended bitrate (LIVE): 550 Kbps. |
TRTC_VIDEO_RESOLUTION_640_360 | 108 | Aspect ratio: 16:9; resolution: 640x360; recommended bitrate (VideoCall): 500 Kbps; recommended bitrate (LIVE): 900 Kbps. |
TRTC_VIDEO_RESOLUTION_960_540 | 110 | Aspect ratio: 16:9; resolution: 960x540; recommended bitrate (VideoCall): 850 Kbps; recommended bitrate (LIVE): 1300 Kbps. |
TRTC_VIDEO_RESOLUTION_1280_720 | 112 | Aspect ratio: 16:9; resolution: 1280x720; recommended bitrate (VideoCall): 1200 Kbps; recommended bitrate (LIVE): 1800 Kbps. |
TRTC_VIDEO_RESOLUTION_1920_1080 | 114 | Aspect ratio: 16:9; resolution: 1920x1080; recommended bitrate (VideoCall): 2000 Kbps; recommended bitrate (LIVE): 3000 Kbps. |
TRTCVideoResolutionMode
TRTCVideoResolutionMode
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
.Enum | Value | DESC |
TRTC_VIDEO_RESOLUTION_MODE_LANDSCAPE | 0 | Landscape resolution, such as TRTCVideoResolution_640_360 + TRTCVideoResolutionModeLandscape = 640x360. |
TRTC_VIDEO_RESOLUTION_MODE_PORTRAIT | 1 | Portrait resolution, such as TRTCVideoResolution_640_360 + TRTCVideoResolutionModePortrait = 360x640. |
TRTCVideoStreamType
TRTCVideoStreamType
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.
Note
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.
Enum | Value | DESC |
TRTC_VIDEO_STREAM_TYPE_BIG | 0 | HD big image: it is generally used to transfer video data from the camera. |
TRTC_VIDEO_STREAM_TYPE_SMALL | 1 | Smooth small image: it has the same content as the big image, but with lower resolution and bitrate and thus lower definition. |
TRTC_VIDEO_STREAM_TYPE_SUB | 2 | 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. |
TRTCVideoFillMode
TRTCVideoFillMode
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:
Enum | Value | DESC |
TRTC_VIDEO_RENDER_MODE_FILL | 0 | 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. |
TRTC_VIDEO_RENDER_MODE_FIT | 1 | 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. |
TRTC_VIDEO_RENDER_MODE_SCALE_FILL | 2 | Scale-to-fill mode: This means that regardless of the aspect ratio of the image, it will be stretched or compressed to completely fill the display area. In this mode, the aspect ratio of the image may be altered, leading to distortion in the rendered image. |
TRTCVideoRotation
TRTCVideoRotation
Video image rotation direction
TRTC provides rotation angle setting APIs for local and remote images. The following rotation angles are all clockwise.
Enum | Value | DESC |
TRTC_VIDEO_ROTATION_0 | 0 | No rotation |
TRTC_VIDEO_ROTATION_90 | 1 | Clockwise rotation by 90 degrees |
TRTC_VIDEO_ROTATION_180 | 2 | Clockwise rotation by 180 degrees |
TRTC_VIDEO_ROTATION_270 | 3 | Clockwise rotation by 270 degrees |
TRTCBeautyStyle
TRTCBeautyStyle
Beauty (skin smoothing) filter algorithm
TRTC has multiple built-in skin smoothing algorithms. You can select the one most suitable for your product.
Enum | Value | DESC |
TRTC_BEAUTY_STYLE_SMOOTH | 0 | Smooth style, which uses a more radical algorithm for more obvious effect and is suitable for show live streaming. |
TRTC_BEAUTY_STYLE_NATURE | 1 | Natural style, which retains more facial details for more natural effect and is suitable for most live streaming use cases. |
TRTC_BEAUTY_STYLE_PITU | 2 | Pitu style, which is provided by YouTu Lab. Its skin smoothing effect is between the smooth style and the natural style, that is, it retains more skin details than the smooth style and has a higher skin smoothing degree than the natural style. |
TRTCVideoPixelFormat
TRTCVideoPixelFormat
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.
Enum | Value | DESC |
TRTC_VIDEO_PIXEL_FORMAT_UNKNOWN | 0 | Undefined format |
TRTC_VIDEO_PIXEL_FORMAT_I420 | 1 | YUV420P (I420) format |
TRTC_VIDEO_PIXEL_FORMAT_Texture_2D | 2 | OpenGL 2D texture format |
TRTC_VIDEO_PIXEL_FORMAT_TEXTURE_EXTERNAL_OES | 3 | OES external texture format (for Android) |
TRTC_VIDEO_PIXEL_FORMAT_NV21 | 4 | NV21 format |
TRTC_VIDEO_PIXEL_FORMAT_RGBA | 5 | RGBA format |
TRTCVideoBufferType
TRTCVideoBufferType
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 efficient on iOS but inefficient on Android. It is the only method supported on Windows currently.
Method 2. This method uses texture to transfer video data. It is efficient on both iOS and Android but is not supported on Windows. To use this method, you should have a general familiarity with OpenGL programming.
Enum | Value | DESC |
TRTC_VIDEO_BUFFER_TYPE_UNKNOWN | 0 | Undefined transfer method |
TRTC_VIDEO_BUFFER_TYPE_BYTE_BUFFER | 1 | Use memory buffer to transfer video data. iOS: PixelBuffer ; Android: Direct Buffer for JNI layer; Windows: memory data block. |
TRTC_VIDEO_BUFFER_TYPE_BYTE_ARRAY | 2 | Use memory buffer to transfer video data. iOS: more compact memory block in NSData type after additional processing; Android: byte[] for Java layer.This transfer method has a lower efficiency than other methods. |
TRTC_VIDEO_BUFFER_TYPE_TEXTURE | 3 | Use OpenGL texture to transfer video data |
TRTCVideoMirrorType
TRTCVideoMirrorType
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.
Enum | Value | DESC |
TRTC_VIDEO_MIRROR_TYPE_AUTO | 0 | Auto mode: mirror the front camera's image but not the rear camera's image (for mobile devices only). |
TRTC_VIDEO_MIRROR_TYPE_ENABLE | 1 | Mirror the images of both the front and rear cameras. |
TRTC_VIDEO_MIRROR_TYPE_DISABLE | 2 | Disable mirroring for both the front and rear cameras. |
TRTCSnapshotSourceType
TRTCSnapshotSourceType
Data source of local video screenshot
The SDK can take screenshots from the following two data sources and save them as local files:
Video stream: the SDK screencaptures the native video content from the video stream. The screenshots are not controlled by the display of the rendering control.
Rendering layer: the SDK screencaptures the displayed video content from the rendering control, which can achieve the effect of WYSIWYG, but if the display area is too small, the screenshots will also be very small.
Enum | Value | DESC |
TRTC_SNAPSHOT_SOURCE_TYPE_STREAM | 0 | The SDK screencaptures the native video content from the video stream. The screenshots are not controlled by the display of the rendering control. |
TRTC_SNAPSHOT_SOURCE_TYPE_VIEW | 1 | The SDK screencaptures the displayed video content from the rendering control, which can achieve the effect of WYSIWYG, but if the display area is too small, the screenshots will also be very small. |
TRTC_SNAPSHOT_SOURCE_TYPE_CAPTURE | 2 | The SDK screencaptures the capture video content from the capture control, which can capture the captured high-definition screenshots. |
TRTCAppScene
TRTCAppScene
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.
Enum | Value | DESC |
TRTC_APP_SCENE_VIDEOCALL | 0 | 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. |
TRTC_APP_SCENE_LIVE | 1 | 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. Note In this scenario, you must use the role field in TRTCParams to specify the role of the current user. |
TRTC_APP_SCENE_AUDIOCALL | 2 | 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. |
TRTC_APP_SCENE_VOICE_CHATROOM | 3 | 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. Note In this scenario, you must use the role field in TRTCParams to specify the role of the current user. |
TRTCRoleType
TRTCRoleType
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.
Enum | Value | DESC |
TRTCRoleAnchor | 20 | 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. |
TRTCRoleAudience | 21 | 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. |
TRTCQosControlMode(Deprecated)
TRTCQosControlMode(Deprecated)
QoS control mode (disused)
Enum | Value | DESC |
VIDEO_QOS_CONTROL_CLIENT | 0 | Client-based control, which is for internal debugging of SDK and shall not be used by users. |
VIDEO_QOS_CONTROL_SERVER | 1 | On-cloud control, which is the default and recommended mode. |
TRTCVideoQosPreference
TRTCVideoQosPreference
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.
Enum | Value | DESC |
TRTC_VIDEO_QOS_PREFERENCE_SMOOTH | 1 | 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. |
TRTC_VIDEO_QOS_PREFERENCE_CLEAR | 2 | 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. |
TRTCQuality
TRTCQuality
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.Enum | Value | DESC |
TRTC_QUALITY_UNKNOWN | 0 | Undefined |
TRTC_QUALITY_Excellent | 1 | The current network is excellent |
TRTC_QUALITY_Good | 2 | The current network is good |
TRTC_QUALITY_Poor | 3 | The current network is fair |
TRTC_QUALITY_Bad | 4 | The current network is bad |
TRTC_QUALITY_Vbad | 5 | The current network is very bad |
TRTC_QUALITY_Down | 6 | The current network cannot meet the minimum requirements of TRTC |
TRTCAVStatusType
TRTCAVStatusType
Audio/Video playback status
This enumerated type is used in the audio status changed API onRemoteAudioStatusUpdated and the video status changed API onRemoteVideoStatusUpdated to specify the current audio/video status.
Enum | Value | DESC |
TRTCAVStatusStopped | 0 | Stopped |
TRTCAVStatusPlaying | 1 | Playing |
TRTCAVStatusLoading | 2 | Loading |
TRTCAVStatusChangeReason
TRTCAVStatusChangeReason
Reasons for playback status changes
This enumerated type is used in the audio status changed API onRemoteAudioStatusUpdated and the video status changed API onRemoteVideoStatusUpdated to specify the reason for the current audio/video status change.
Enum | Value | DESC |
TRTCAVStatusChangeReasonInternal | 0 | Default value |
TRTCAVStatusChangeReasonBufferingBegin | 1 | The stream enters the Loading state due to network congestion |
TRTCAVStatusChangeReasonBufferingEnd | 2 | The stream enters the Playing state after network recovery |
TRTCAVStatusChangeReasonLocalStarted | 3 | As a start-related API was directly called locally, the stream enters the Playing state |
TRTCAVStatusChangeReasonLocalStopped | 4 | As a stop-related API was directly called locally, the stream enters the Stopped state |
TRTCAVStatusChangeReasonRemoteStarted | 5 | As the remote user started (or resumed) publishing the audio or video stream, the stream enters the Loading or Playing state |
TRTCAVStatusChangeReasonRemoteStopped | 6 | As the remote user stopped (or paused) publishing the audio or video stream, the stream enters the "Stopped" state |
TRTCAudioSampleRate
TRTCAudioSampleRate
Audio sample rate
The audio sample rate is used to measure the audio fidelity. A higher sample rate indicates higher fidelity. If there is music in the use case,
TRTCAudioSampleRate48000
is recommended.Enum | Value | DESC |
TRTCAudioSampleRate16000 | 16000 | 16 kHz sample rate |
TRTCAudioSampleRate32000 | 32000 | 32 kHz sample rate |
TRTCAudioSampleRate44100 | 44100 | 44.1 kHz sample rate |
TRTCAudioSampleRate48000 | 48000 | 48 kHz sample rate |
TRTCAudioQuality
TRTCAudioQuality
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.Enum | Value | DESC |
TRTC_AUDIO_QUALITY_SPEECH | 1 | Speech mode: mono channel; bitrate: 18 Kbps. This mode has the best resistance among all modes and is suitable for audio call scenarios, such as online meeting and audio call. |
TRTC_AUDIO_QUALITY_DEFAULT | 2 | Default mode: 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. |
TRTC_AUDIO_QUALITY_MUSIC | 3 | Music mode: 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. |
TRTCAudioRoute
TRTCAudioRoute
Audio route (i.e., audio playback mode)
"Audio route" determines whether the sound is played back from the speaker or receiver of a mobile device; therefore, this API is applicable only to mobile devices such as phones.
Generally, a phone has two speakers: one is the receiver at the top, and the other is the stereo speaker at the bottom.
If the audio route is set to the receiver, the volume is relatively low, and the sound can be heard clearly only when the phone is put near the ear. This mode has a high level of privacy and is suitable for answering calls.
If the audio route is set to the speaker, the volume is relatively high, so there is no need to put the phone near the ear. Therefore, this mode can implement the "hands-free" feature.
Enum | Value | DESC |
TRTC_AUDIO_ROUTE_UNKNOWN | -1 | Unknown:default router. |
TRTC_AUDIO_ROUTE_SPEAKER | 0 | Speakerphone: the speaker at the bottom is used for playback (hands-free). With relatively high volume, it is used to play music out loud. |
TRTC_AUDIO_ROUTE_EARPIECE | 1 | Earpiece: the receiver at the top is used for playback. With relatively low volume, it is suitable for call scenarios that require privacy. |
TRTC_AUDIO_ROUTE_WIRED_HEADSET | 2 | WiredHeadset:play using wired headphones. |
TRTC_AUDIO_ROUTE_BLUETOOTH_HEADSET | 3 | BluetoothHeadset:play with bluetooth headphones. |
TRTC_AUDIO_ROUTE_SOUND_CARD | 4 | SoundCard:play using a USB sound card. |
TRTCReverbType
TRTCReverbType
Audio reverb mode
This enumerated value is used to set the audio reverb mode in the live streaming scenario and is often used in show live streaming.
Enum | Value | DESC |
TRTC_REVERB_TYPE_0 | 0 | Disable reverb |
TRTC_REVERB_TYPE_1 | 1 | KTV |
TRTC_REVERB_TYPE_2 | 2 | Small room |
TRTC_REVERB_TYPE_3 | 3 | Hall |
TRTC_REVERB_TYPE_4 | 4 | Deep |
TRTC_REVERB_TYPE_5 | 5 | Resonant |
TRTC_REVERB_TYPE_6 | 6 | Metallic |
TRTC_REVERB_TYPE_7 | 7 | Husky |
TRTCVoiceChangerType
TRTCVoiceChangerType
Voice changing type
This enumerated value is used to set the voice changing mode in the live streaming scenario and is often used in show live streaming.
Enum | Value | DESC |
TRTC_VOICE_CHANGER_TYPE_0 | 0 | Disable voice changing |
TRTC_VOICE_CHANGER_TYPE_1 | 1 | Child |
TRTC_VOICE_CHANGER_TYPE_2 | 2 | Girl |
TRTC_VOICE_CHANGER_TYPE_3 | 3 | Middle-Aged man |
TRTC_VOICE_CHANGER_TYPE_4 | 4 | Heavy metal |
TRTC_VOICE_CHANGER_TYPE_5 | 5 | Nasal |
TRTC_VOICE_CHANGER_TYPE_6 | 6 | Punk |
TRTC_VOICE_CHANGER_TYPE_7 | 7 | Trapped beast |
TRTC_VOICE_CHANGER_TYPE_8 | 8 | Otaku |
TRTC_VOICE_CHANGER_TYPE_9 | 9 | Electronic |
TRTC_VOICE_CHANGER_TYPE_10 | 10 | Robot |
TRTC_VOICE_CHANGER_TYPE_11 | 11 | Ethereal |
TRTCSystemVolumeType
TRTCSystemVolumeType
System volume type (only for mobile devices)
Smartphones usually have two types of system volume: call volume and media volume.
Call volume is designed for call scenarios. It comes with acoustic echo cancellation (AEC) and supports audio capturing by Bluetooth earphones, but its sound quality is average.
If you cannot turn the volume down to 0 (i.e., mute the phone) using the volume buttons, then your phone is using call volume.
Media volume is designed for media scenarios such as music playback. AEC does not work when media volume is used, and Bluetooth earphones cannot be used for audio capturing. However, media volume delivers better music listening experience.
If you are able to mute your phone using the volume buttons, then your phone is using media volume.
The SDK offers three system volume control modes: auto, call volume, and media volume.
Enum | Value | DESC |
TRTCSystemVolumeTypeAuto | 0 | Auto: In the auto mode, call volume is used for anchors, and media volume for audience. This mode is suitable for live streaming scenarios. If the scenario you select during enterRoom is TRTCAppSceneLIVE or TRTCAppSceneVoiceChatRoom , the SDK will automatically use this mode. |
TRTCSystemVolumeTypeMedia | 1 | Media volume: In this mode, media volume is used in all scenarios. It is rarely used, mainly suitable for music scenarios with demanding requirements on audio quality. Use this mode if most of your users use peripheral devices such as audio cards. Otherwise, it is not recommended. |
TRTCSystemVolumeTypeVOIP | 2 | Call volume: In this mode, the audio module does not change its work mode when users switch between anchors and audience, enabling seamless mic on/off. This mode is suitable for scenarios where users need to switch frequently between anchors and audience. If the scenario you select during enterRoom is TRTCAppSceneVideoCall or TRTCAppSceneAudioCall , the SDK will automatically use this mode. |
TRTCAudioFrameFormat
TRTCAudioFrameFormat
Audio frame content format
Enum | Value | DESC |
TRTC_AUDIO_FRAME_FORMAT_PCM | 1 | Audio data in PCM format |
TRTCAudioCapabilityType
TRTCAudioCapabilityType
Audio capability type supported by the system (only for Android devices)
The SDK currently provides two types of system audio capabilities to query whether they are supported: low-latency chorus capability and low-latency earmonitor capability.
Enum | Value | DESC |
TRTCAudioCapabilityLowLatencyChorus | 1 | low-latency chorus capability |
TRTCAudioCapabilityLowLatencyEarMonitor | 2 | low-latency earmonitor capability |
TRTCAudioFrameOperationMode
TRTCAudioFrameOperationMode
Audio callback data operation mode
TRTC provides two modes of operation for audio callback data.
Read-only mode (ReadOnly): Get audio data only from the callback.
ReadWrite mode (ReadWrite): You can get and modify the audio data of the callback.
Enum | Value | DESC |
TRTC_AUDIO_FRAME_OPERATION_MODE_READWRITE | 0 | Read-write mode: You can get and modify the audio data of the callback, the default mode. |
TRTC_AUDIO_FRAME_OPERATION_MODE_READONLY | 1 | Read-only mode: Get audio data from callback only. |
TRTCLogLevel
TRTCLogLevel
Log level
Different log levels indicate different levels of details and number of logs. We recommend you set the log level to
TRTCLogLevelInfo
generally.Enum | Value | DESC |
TRTC_LOG_LEVEL_VERBOSE | 0 | Output logs at all levels |
TRTC_LOG_LEVEL_DEBUG | 1 | Output logs at the DEBUG, INFO, WARNING, ERROR, and FATAL levels |
TRTC_LOG_LEVEL_INFO | 2 | Output logs at the INFO, WARNING, ERROR, and FATAL levels |
TRTC_LOG_LEVEL_WARN | 3 | Output logs at the WARNING, ERROR, and FATAL levels |
TRTC_LOG_LEVEL_ERROR | 4 | Output logs at the ERROR and FATAL levels |
TRTC_LOG_LEVEL_FATAL | 5 | Output logs at the FATAL level |
TRTC_LOG_LEVEL_NULL | 6 | Do not output any SDK logs |
TRTCGSensorMode
TRTCGSensorMode
G-sensor switch (for mobile devices only)
Enum | Value | DESC |
TRTC_GSENSOR_MODE_DISABLE | 0 | Do not adapt to G-sensor orientation This mode is the default value for desktop platforms. In this mode, the video image published by the current user is not affected by the change of the G-sensor orientation. |
TRTC_GSENSOR_MODE_UIAUTOLAYOUT | 1 | Adapt to G-sensor orientation This mode is the default value on mobile platforms. In this mode, the video image published by the current user is adjusted according to the G-sensor orientation, while the orientation of the local preview image remains unchanged. One of the adaptation modes currently supported by the SDK is as follows: when the phone or tablet is upside down, in order to ensure that the screen orientation seen by the remote user is normal, the SDK will automatically rotate the published video image by 180 degrees. If the UI layer of your application has enabled G-sensor adaption, we recommend you use the UIFixLayout mode. |
TRTC_GSENSOR_MODE_UIFIXLAYOUT | 2 | Adapt to G-sensor orientation In this mode, the video image published by the current user is adjusted according to the G-sensor orientation, and the local preview image will also be rotated accordingly. One of the features currently supported is as follows: when the phone or tablet is upside down, in order to ensure that the screen orientation seen by the remote user is normal, the SDK will automatically rotate the published video image by 180 degrees. If the UI layer of your application doesn't support G-sensor adaption, but you want the video image in the SDK to adapt to the G-sensor orientation, we recommend you use the UIFixLayout mode.@deprecated Begin from v11.5 version, it no longer supports TRTCGSensorMode_UIFixLayout and only supports the above two modes. |
TRTCTranscodingConfigMode
TRTCTranscodingConfigMode
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:
Enum | Value | DESC |
TRTC_TranscodingConfigMode_Unknown | 0 | Undefined |
TRTC_TranscodingConfigMode_Manual | 1 | 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. |
TRTC_TranscodingConfigMode_Template_PureAudio | 2 | 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. |
TRTC_TranscodingConfigMode_Template_PresetLayout | 3 | 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. |
TRTC_TranscodingConfigMode_Template_ScreenSharing | 4 | 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. |
TRTCRecordType
TRTCRecordType
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.
Enum | Value | DESC |
TRTC_RECORD_TYPE_AUDIO | 0 | Record audio only |
TRTC_RECORD_TYPE_VIDEO | 1 | Record video only |
TRTC_RECORD_TYPE_BOTH | 2 | Record both audio and video |
TRTCMixInputType
TRTCMixInputType
Stream mix input type
Enum | Value | DESC |
TRTC_MixInputType_Undefined | 0 | Default. Considering the compatibility with older versions, if you specify the inputType as Undefined, the SDK will determine the stream mix input type according to the value of the pureAudio parameter |
TRTC_MixInputType_AudioVideo | 1 | Mix both audio and video |
TRTC_MixInputType_PureVideo | 2 | Mix video only |
TRTC_MixInputType_PureAudio | 3 | Mix audio only |
TRTC_MixInputType_Watermark | 4 | 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. |
TRTCDebugViewLevel
TRTCDebugViewLevel
Debugging information displayed in the rendering control
Enum | Value | DESC |
TRTC_DEBUG_VIEW_LEVEL_GONE | 0 | Do not display debugging information in the rendering control |
TRTC_DEBUG_VIEW_LEVEL_STATUS | 1 | Display audio/video statistics in the rendering control |
TRTC_DEBUG_VIEW_LEVEL_ALL | 2 | Display audio/video statistics and key historical events in the rendering control |
TRTCAudioRecordingContent
TRTCAudioRecordingContent
Audio recording content type
This enumerated type is used in the audio recording API startAudioRecording to specify the content of the recorded audio.
Enum | Value | DESC |
TRTC_AudioRecordingContent_All | 0 | Record both local and remote audio |
TRTC_AudioRecordingContent_Local | 1 | Record local audio only |
TRTC_AudioRecordingContent_Remote | 2 | Record remote audio only |
TRTCPublishMode
TRTCPublishMode
The publishing mode
TRTC can mix multiple streams in a room and publish the mixed stream to a CDN or to a TRTC room. It can also publish the stream of the local user to Tencent Cloud or a third-party CDN.
You can specify one of the following publishing modes to use:
Enum | Value | DESC |
TRTC_PublishMode_Unknown | 0 | Undefined |
TRTC_PublishBigStream_ToCdn | 1 | Use this parameter to publish the primary stream (TRTCVideoStreamTypeBig) in the room to Tencent Cloud or a third-party CDN (only RTMP is supported). |
TRTC_PublishSubStream_ToCdn | 2 | Use this parameter to publish the substream (TRTCVideoStreamTypeSub) in the room to Tencent Cloud or a third-party CDN (only RTMP is supported). |
TRTC_PublishMixStream_ToCdn | 3 | Use this parameter together with the encoding parameter TRTCStreamEncoderParam and On-Cloud MixTranscoding parameter TRTCStreamMixingConfig to transcode the streams you specify and publish the mixed stream to Tencent Cloud or a third-party CDN (only RTMP is supported). |
TRTC_PublishMixStream_ToRoom | 4 | Use this parameter together with the encoding parameter TRTCStreamEncoderParam and On-Cloud MixTranscoding parameter TRTCStreamMixingConfig to transcode the streams you specify and publish the mixed stream to the room you specify. Use TRTCUser in TRTCPublishTarget to specify the robot that publishes the transcoded stream to a TRTC room. |
TRTCEncryptionAlgorithm
TRTCEncryptionAlgorithm
Encryption Algorithm
This enumeration type is used for media stream private encryption algorithm selection.
Enum | Value | DESC |
TRTC_EncryptionAlgorithm_Aes_128_Gcm | 0 | AES GCM 128。 |
TRTC_EncryptionAlgorithm_Aes_256_Gcm | 1 | AES GCM 256。 |
TRTCSpeedTestScene
TRTCSpeedTestScene
Speed Test Scene
This enumeration type is used for speed test scene selection.
Enum | Value | DESC |
TRTC_SpeedTestScene_Delay_Testing | 1 | Delay testing. |
TRTC_SpeedTestScene_Delay_Bandwidth_Testing | 2 | Delay and bandwidth testing. |
TRTC_SpeedTestScene_Online_Chorus_Testing | 3 | Online chorus testing. |
TRTCGravitySensorAdaptiveMode
TRTCGravitySensorAdaptiveMode
Set the adaptation mode of gravity sensing (only applicable to mobile terminals)
Enum | Value | DESC |
TRTC_GRAVITY_SENSOR_ADAPTIVE_MODE_DISABLE | 0 | Turn off the gravity sensor and make a decision based on the current acquisition resolution and the set encoding resolution. If the two are inconsistent, rotate 90 degrees to ensure the maximum frame. |
TRTC_GRAVITY_SENSOR_ADAPTIVE_MODE_FILL_BY_CENTER_CROP | 1 | Turn on the gravity sensor to always ensure that the remote screen image is positive. When the intermediate process needs to deal with inconsistent resolutions, use the center cropping mode. |
TRTC_GRAVITY_SENSOR_ADAPTIVE_MODE_FIT_WITH_BLACK_BORDER | 2 | Turn on the gravity sensor to always ensure that the remote screen image is positive. When the resolution needs to be processed inconsistently in the intermediate process, use the superimposed black border mode. |
TRTCParams
TRTCParams
Room entry parameters
As the room entry parameters in the TRTC SDK, these parameters must be correctly set so that the user can successfully enter the audio/video room specified by
roomId
or strRoomId
.For historical reasons, TRTC supports two types of room IDs:
roomId
and strRoomId
.Note: do not mix
roomId
and strRoomId
, because they are not interchangeable. For example, the number 123
and the string 123
are two completely different rooms in TRTC.EnumType | DESC |
businessInfo | Field description: business data, which is optional. This field is needed only by some advanced features. Recommended value: do not set this field on your own. |
privateMapKey | Field description: permission credential used for permission control, which is optional. If you want only users with the specified userId values to enter a room, you need to use privateMapKey to restrict the permission.Recommended value: we recommend you use this parameter only if you have high security requirements. For more information, please see Enabling Advanced Permission Control. |
role | Field description: role in the live streaming scenario, which is applicable only to the live streaming scenario (TRTCAppSceneLIVE or TRTCAppSceneVoiceChatRoom) but doesn't take effect in the call scenario. |
roomId | Field description: numeric room ID. Users (userId) in the same room can see one another and make audio/video calls. Recommended value: value range: 1–4294967294. @note roomId and strRoomId are mutually exclusive. If you decide to use strRoomId , then roomId should be entered as 0. If both are entered, roomId will be used.Note do not mix roomId and strRoomId , because they are not interchangeable. For example, the number 123 and the string 123 are two completely different rooms in TRTC. |
sdkAppId | Field description: application ID, which is required. Tencent Cloud generates bills based on sdkAppId .Recommended value: the ID can be obtained on the account information page in the TRTC console after the corresponding application is created. |
strRoomId | Field description: string-type room ID. Users (userId) in the same room can see one another and make audio/video calls. @note roomId and strRoomId are mutually exclusive. If you decide to use strRoomId , then roomId should be entered as 0. If both are entered, roomId will be used.Note do not mix roomId and strRoomId , because they are not interchangeable. For example, the number 123 and the string 123 are two completely different rooms in TRTC.Recommended value: the length limit is 64 bytes. The following 89 characters are supported: Uppercase and lowercase letters (a–z and A–Z) Digits (0–9) Space, "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", and ",". |
streamId | Field description: specified streamId in Tencent Cloud CSS, which is optional. After setting this field, you can play back the user's audio/video stream on Tencent Cloud CSS CDN through a standard pull scheme (FLV or HLS).Recommended value: this parameter can contain up to 64 bytes and can be left empty. We recommend you use sdkappid_roomid_userid_main as the streamid , which is easier to identify and will not cause conflicts in your multiple applications.Note to use Tencent Cloud CSS CDN, you need to enable the auto-relayed live streaming feature on the "Function Configuration" page in the console first. |
userDefineRecordId | Field description: on-cloud recording field, which is optional and used to specify whether to record the user's audio/video stream in the cloud. Recommended value: it can contain up to 64 bytes. Letters (a–z and A–Z), digits (0–9), underscores, and hyphens are allowed. Scheme 1. Manual recording 1. Enable on-cloud recording in "Application Management" > "On-cloud Recording Configuration" in the console. 2. Set "Recording Mode" to "Manual Recording". 3. After manual recording is set, in a TRTC room, only users with the userDefineRecordId parameter set will have video recording files in the cloud, while users without this parameter set will not.4. The recording file will be named in the format of "userDefineRecordId_start time_end time" in the cloud. Scheme 2. Auto-recording 1. You need to enable on-cloud recording in "Application Management" > "On-cloud Recording Configuration" in the console. 2. Set "Recording Mode" to "Auto-recording". 3. After auto-recording is set, any user who upstreams audio/video in a TRTC room will have a video recording file in the cloud. 4. The file will be named in the format of "userDefineRecordId_start time_end time". If userDefineRecordId is not specified, the file will be named in the format of "streamId_start time_end time". |
userId | Field description: user ID, which is required. It is the userId of the local user in UTF-8 encoding and acts as the username.Recommended value: if the ID of a user in your account system is "mike", userId can be set to "mike". |
userSig | Field description: user signature, which is required. It is the authentication signature corresponding to the current userId and acts as the login password for Tencent Cloud services. |
TRTCVideoEncParam
TRTCVideoEncParam
Video encoding parameters
These settings determine the quality of image viewed by remote users as well as the image quality of recorded video files in the cloud.
EnumType | DESC |
enableAdjustRes | Field description: whether to allow dynamic resolution adjustment. Once enabled, this field will affect on-cloud recording. Recommended value: this feature is suitable for scenarios that don't require on-cloud recording. After it is enabled, the SDK will intelligently select a suitable resolution according to the current network conditions to avoid the inefficient encoding mode of "large resolution + small bitrate". Note default value: false. If you need on-cloud recording, please do not enable this feature, because if the video resolution changes, the MP4 file recorded in the cloud cannot be played back normally by common players. |
minVideoBitrate | Field description: minimum video bitrate. The SDK will reduce the bitrate to as low as the value specified by minVideoBitrate to ensure the smoothness only if the network conditions are poor.Note: default value: 0, indicating that a reasonable value of the lowest bitrate will be automatically calculated by the SDK according to the resolution you specify. Recommended value: you can set the videoBitrate and minVideoBitrate parameters at the same time to restrict the SDK's adjustment range of the video bitrate: If you want to "ensure clarity while allowing lag in weak network environments", you can set minVideoBitrate to 60% of videoBitrate . If you want to "ensure smoothness while allowing blur in weak network environments", you can set minVideoBitrate to a low value, for example, 100 Kbps. If you set videoBitrate and minVideoBitrate to the same value, it is equivalent to disabling the adaptive adjustment capability of the SDK for the video bitrate. |
videoBitrate | Field description: target video bitrate. The SDK encodes streams at the target video bitrate and will actively reduce the bitrate only in weak network environments. Recommended value: please see the optimal bitrate for each specification in TRTCVideoResolution . You can also slightly increase the optimal bitrate.For example, TRTCVideoResolution_1280_720 corresponds to the target bitrate of 1,200 Kbps. You can also set the bitrate to 1,500 Kbps for higher definition.Note you can set the videoBitrate and minVideoBitrate parameters at the same time to restrict the SDK's adjustment range of the video bitrate: If you want to "ensure clarity while allowing lag in weak network environments", you can set minVideoBitrate to 60% of videoBitrate . If you want to "ensure smoothness while allowing blur in weak network environments", you can set minVideoBitrate to a low value, for example, 100 Kbps. If you set videoBitrate and minVideoBitrate to the same value, it is equivalent to disabling the adaptive adjustment capability of the SDK for the video bitrate. |
videoFps | Field description: video capturing frame rate Recommended value: 15 or 20 fps. If the frame rate is lower than 5 fps, there will be obvious lagging; if lower than 10 fps but higher than 5 fps, there will be slight lagging; if higher than 20 fps, the bandwidth will be wasted (the frame rate of movies is generally 24 fps). Note the front cameras on certain Android phones do not support a capturing frame rate higher than 15 fps. For some Android phones that focus on beautification features, the capturing frame rate of the front cameras may be lower than 10 fps. |
videoResolution | Field description: video resolution Recommended value For mobile video call, we recommend you select a resolution of 360x640 or below and select Portrait (portrait resolution) for resMode . For mobile live streaming, we recommend you select a resolution of 540x960 and select Portrait (portrait resolution) for resMode . For desktop platforms (Windows and macOS), we recommend you select a resolution of 640x360 or above and select Landscape (landscape resolution) for resMode .Note to use a portrait resolution, please specify resMode as Portrait ; for example, when used together with Portrait , 640x360 represents 360x640. |
videoResolutionMode | Field description: resolution mode (landscape/portrait) Recommended value: for mobile platforms (iOS and Android), Portrait is recommended; for desktop platforms (Windows and macOS), Landscape is recommended.Note to use a portrait resolution, please specify resMode as Portrait ; for example, when used together with Portrait , 640x360 represents 360x640. |
TRTCNetworkQosParam
TRTCNetworkQosParam
Network QoS control parameter set
Network QoS control parameter. The settings determine the QoS control policy of the SDK in weak network conditions (e.g., whether to "ensure clarity" or "ensure smoothness").
EnumType | DESC |
controlMode | Field description: QoS control mode (disused) Recommended value: on-cloud control Note please set the on-cloud control mode (TRTCQosControlModeServer). |
preference | Field description: whether to ensure smoothness or clarity Recommended value: ensuring clarity Note this parameter mainly affects the audio/video performance of TRTC in weak network environments: 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. See TRTC_VIDEO_QOS_PREFERENCE_SMOOTH 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. See TRTC_VIDEO_QOS_PREFERENCE_CLEAR |
TRTCRenderParams
TRTCRenderParams
Rendering parameters of video image
You can use these parameters to control the video image rotation angle, fill mode, and mirror mode.
EnumType | DESC |
fillMode | Field description: image fill mode Recommended value: fill (the image may be stretched or cropped) or fit (there may be black bars in unmatched areas). Default value: TRTCVideoFillMode_Fill |
mirrorType | Field description: image mirror mode Recommended value: default value: TRTCVideoMirrorType_Auto |
rotation | Field description: clockwise image rotation angle Recommended value: rotation angles of 90, 180, and 270 degrees are supported. Default value: TRTCVideoRotation_0 |
TRTCQualityInfo
TRTCQualityInfo
Network quality
This indicates the quality of the network. You can use it to display the network quality of each user on the UI.
EnumType | DESC |
quality | Network quality |
userId | User ID |
TRTCVolumeInfo
TRTCVolumeInfo
Volume
This indicates the audio volume value. You can use it to display the volume of each user in the UI.
EnumType | DESC |
pitch | The local user's vocal frequency (unit: Hz), the value range is [0 - 4000]. For remote users, this value is always 0. |
spectrumData | Audio spectrum data, which divides the sound frequency into 256 frequency domains, spectrumData records the energy value of each frequency domain, The value range of each energy value is [-300, 0] in dBFS. Note The local spectrum is calculated using the audio data before encoding, which will be affected by the capture volume, BGM, etc.; the remote spectrum is calculated using the received audio data, and operations such as adjusting the remote playback volume locally will not affect it. |
userId | userId of the speaker. An empty value indicates the local user. |
vad | Vad result of the local user. 0: not speech 1: speech. |
volume | Volume of the speaker. Value range: 0–100. |
TRTCSpeedTestParams
TRTCSpeedTestParams
Network speed testing parameters
You can test the network speed through the startSpeedTest: interface before the user enters the room (this API cannot be called during a call).
EnumType | DESC |
expectedDownBandwidth | Expected downstream bandwidth (kbps, value range: 10 to 5000, no downlink bandwidth test when it is 0). Note When the parameter scene is set to TRTCSpeedTestScene_OnlineChorusTesting , in order to obtain more accurate information such as rtt / jitter, the value range is limited to 10 ~ 1000. |
expectedUpBandwidth | Expected upstream bandwidth (kbps, value range: 10 to 5000, no uplink bandwidth test when it is 0). Note When the parameter scene is set to TRTCSpeedTestScene_OnlineChorusTesting , in order to obtain more accurate information such as rtt / jitter, the value range is limited to 10 ~ 1000. |
scene | Speed test scene. |
sdkAppId | |
userId | |
userSig |
TRTCSpeedTestResult
TRTCSpeedTestResult
Network speed test result
The startSpeedTest: API can be used to test the network speed before a user enters a room (this API cannot be called during a call).
EnumType | DESC |
availableDownBandwidth | Downstream bandwidth (in kbps, -1: invalid value). |
availableUpBandwidth | Upstream bandwidth (in kbps, -1: invalid value). |
downJitter | Downlink data packet jitter (ms) refers to the stability of data communication in the user's current network environment. The smaller the value, the better. The normal value range is 0ms - 100ms. -1 means that the speed test failed to obtain an effective value. Generally, the Jitter of the WiFi network will be slightly larger than that of the 4G/5G environment. |
downLostRate | Downstream packet loss rate between 0 and 1.0. For example, 0.2 indicates that 2 data packets may be lost in every 10 packets received from the server. |
errMsg | Error message for network speed test. |
ip | Server IP address. |
quality | Network quality, which is tested and calculated based on the internal evaluation algorithm. For more information, please see TRTCQuality |
rtt | Delay in milliseconds, which is the round-trip time between the current device and TRTC server. The smaller the value, the better. The normal value range is 10–100 ms. |
success | Whether the network speed test is successful. |
upJitter | Uplink data packet jitter (ms) refers to the stability of data communication in the user's current network environment. The smaller the value, the better. The normal value range is 0ms - 100ms. -1 means that the speed test failed to obtain an effective value. Generally, the Jitter of the WiFi network will be slightly larger than that of the 4G/5G environment. |
upLostRate | Upstream packet loss rate between 0 and 1.0. For example, 0.3 indicates that 3 data packets may be lost in every 10 packets sent to the server. |
TRTCTexture
TRTCTexture
Video texture data
EnumType | DESC |
eglContext10 | Field description: OpenGL context defined by (javax.microedition.khronos.egl.*) |
eglContext14 | Field description: OpenGL context defined by (android.opengl.*) |
textureId | Field description: video texture ID |
TRTCVideoFrame
TRTCVideoFrame
Video frame information
TRTCVideoFrame
is used to describe the raw data of a frame of the video image, which is the image data before frame encoding or after frame decoding.EnumType | DESC |
buffer | Field description: video data when bufferType is TRTCCloudDef#TRTC_VIDEO_BUFFER_TYPE_BYTE_BUFFER, which carries the Direct Buffer used for the JNI layer. |
bufferType | Field description: video data structure type |
data | Field description: video data when bufferType is TRTCCloudDef#TRTC_VIDEO_BUFFER_TYPE_BYTE_ARRAY, which carries the byte array used for the Java layer. |
height | Field description: video height Recommended value: please enter the height of the video data passed in. |
pixelFormat | Field description: video pixel format |
rotation | Field description: clockwise rotation angle of video pixels |
texture | Field description: video data when bufferType is TRTCCloudDef#TRTC_VIDEO_PIXEL_FORMAT_Texture_2D, which carries the texture data used for OpenGL rendering. |
timestamp | Field description: video frame timestamp in milliseconds Recommended value: this parameter can be set to 0 for custom video capturing. In this case, the SDK will automatically set the timestamp field. However, please "evenly" set the calling interval of sendCustomVideoData . |
width | Field description: video width Recommended value: please enter the width of the video data passed in. |
TRTCAudioFrame
TRTCAudioFrame
Audio frame data
EnumType | DESC |
channel | Field description: number of sound channels |
data | Field description: audio data |
extraData | Field description: extra data in audio frame, message sent by remote users through onLocalProcessedAudioFrame that add to audio frame will be callback through this field. |
sampleRate | Field description: sample rate |
timestamp | Field description: timestamp in ms |
TRTCMixUser
TRTCMixUser
Description information of each video image in On-Cloud MixTranscoding
TRTCMixUser
is used to specify the location, size, layer, and stream type of each video image in On-Cloud MixTranscoding.EnumType | DESC |
height | Field description: specify the height of this video image in px |
image | Field description: specify the placeholder or watermark image. The placeholder image will be displayed when there is no upstream video.A watermark image is a semi-transparent image posted in the mixed image, and this image will always be overlaid on the mixed image. When the inputType field is set to TRTCMixInputTypePureAudio, the image is a placeholder image, and you need to specify userId . When the inputType field is set to TRTCMixInputTypeWatermark, the image is a watermark image, and you don't need to specify userId .Recommended value: default value: null, indicating not to set the placeholder or watermark image. Note TRTC's backend service will mix the image specified by the URL address into the final stream.URL link length is limited to 512 bytes. The image size is limited to 10MB.Support png, jpg, jpeg, bmp format. Take effects iff the inputType field is set to TRTCMixInputTypePureAudio or TRTCMixInputTypeWatermark. |
inputType | Field description: specify the mixed content of this stream (audio only, video only, audio and video, or watermark). Recommended value: default value: TRTCMixInputTypeUndefined. Note When specifying inputType as TRTCMixInputTypeUndefined and specifying pureAudio to YES, it is equivalent to setting inputType to TRTCMixInputTypePureAudio . When specifying inputType as TRTCMixInputTypeUndefined and specifying pureAudio to NO, it is equivalent to setting inputType to TRTCMixInputTypeAudioVideo . When specifying inputType as TRTCMixInputTypeWatermark, you don't need to specify the userId field, but you need to specify the image field. |
pureAudio | Field description: specify whether this stream mixes audio only Recommended value: default value: false Note this field has been disused. We recommend you use the new field inputType introduced in v8.5. |
renderMode | Field description: specify the display mode of this stream. Recommended value: default value: 0. 0 is cropping, 1 is zooming, 2 is zooming and displaying black background. Note image doesn't support setting renderMode temporarily, the default display mode is forced stretch. |
roomId | Field description: ID of the room where this audio/video stream is located (an empty value indicates the local room ID) |
soundLevel | Field description: specify the target volumn level of On-Cloud MixTranscoding. (value range: 0-100) Recommended value: default value: 100. |
streamType | Field description: specify whether this video image is the primary stream image (TRTCVideoStreamTypeBig) or substream image (TRTCVideoStreamTypeSub). |
userId | Field description: user ID |
width | Field description: specify the width of this video image in px |
x | Field description: specify the X coordinate of this video image in px |
y | Field description: specify the Y coordinate of this video image in px |
zOrder | Field description: specify the level of this video image (value range: 1–15; the value must be unique) |
TRTCTranscodingConfig
TRTCTranscodingConfig
Layout and transcoding parameters of On-Cloud MixTranscoding
These parameters are used to specify the layout position information of each video image and the encoding parameters of mixtranscoding during On-Cloud MixTranscoding.
EnumType | DESC |
appId | Field description: appId of Tencent Cloud CSSRecommended value: please click Application Management > Application Information in the TRTC console and get the appId in Relayed Live Streaming Info . |
audioBitrate | Field description: specify the target audio bitrate of On-Cloud MixTranscoding Recommended value: default value: 64 Kbps. Value range: [32,192]. |
audioChannels | Field description: specify the number of sound channels of On-Cloud MixTranscoding Recommended value: default value: 1, which means mono channel. Valid values: 1: mono channel; 2: dual channel. |
audioCodec | Field description: specify the audio encoding type of On-Cloud MixTranscoding Recommended value: default value: 0, which means LC-AAC. Valid values: 0: LC-AAC; 1: HE-AAC; 2: HE-AACv2. Note HE-AAC and HE-AACv2 only support [48000, 44100, 32000, 24000, 16000] sample rate. HE-AACv2 only support dual channel. HE-AAC and HE-AACv2 take effects iff the output streamId is specified. |
audioSampleRate | Field description: specify the target audio sample rate of On-Cloud MixTranscoding Recommended value: default value: 48000 Hz. Valid values: 12000 Hz, 16000 Hz, 22050 Hz, 24000 Hz, 32000 Hz, 44100 Hz, 48000 Hz. |
backgroundColor | Field description: specify the background color of the mixed video image. Recommended value: default value: 0x000000, which means black and is in the format of hex number; for example: "0x61B9F1" represents the RGB color (97,158,241). |
backgroundImage | Field description: specify the background image of the mixed video image. **Recommended value: default value: null, indicating not to set the background image. Note TRTC's backend service will mix the image specified by the URL address into the final stream.URL link length is limited to 512 bytes. The image size is limited to 10MB.Support png, jpg, jpeg, bmp format. |
bizId | Field description: bizId of Tencent Cloud CSSRecommended value: please click Application Management > Application Information in the TRTC console and get the bizId in Relayed Live Streaming Info . |
mixUsers | Field description: specify the position, size, layer, and stream type of each video image in On-Cloud MixTranscoding Recommended value: this field is an array in TRTCMixUser type, where each element represents the information of a video image. |
mode | Field description: layout mode Recommended value: please choose a value according to your business needs. The preset mode has better applicability. |
streamId | Field description: ID of the live stream output to CDN Recommended value: default value: null, that is, the audio/video streams in the room will be mixed into the audio/video stream of the caller of this API. If you don't set this parameter, the SDK will execute the default logic, that is, it will mix the multiple audio/video streams in the room into the audio/video stream of the caller of this API, i.e., A + B => A. If you set this parameter, the SDK will mix the audio/video streams in the room into the live stream you specify, i.e., A + B => C (C is the streamId you specify). |
videoBitrate | Field description: specify the target video bitrate (Kbps) of On-Cloud MixTranscoding Recommended value: if you enter 0, TRTC will estimate a reasonable bitrate value based on videoWidth and videoHeight . You can also refer to the recommended bitrate value in the video resolution enumeration definition (in the comment section). |
videoFramerate | Field description: specify the target video frame rate (fps) of On-Cloud MixTranscoding Recommended value: default value: 15 fps. Value range: (0,30]. |
videoGOP | Field description: specify the target video keyframe interval (GOP) of On-Cloud MixTranscoding Recommended value: default value: 2 (in seconds). Value range: [1,8]. |
videoHeight | Field description: specify the target resolution (height) of On-Cloud MixTranscoding Recommended value: 640 px. If you only mix audio streams, please set both width and height to 0; otherwise, there will be a black background in the live stream after mixtranscoding. |
videoSeiParams | Field description: SEI parameters. default value: null Note the parameter is passed in the form of a JSON string. Here is an example to use it: `json{ "payLoadContent":"xxx", "payloadType":5, "payloadUuid":"1234567890abcdef1234567890abcdef", "interval":1000, "followIdr":false } `The currently supported fields and their meanings are as follows: payloadContent: Required. The payload content of the passthrough SEI, which cannot be empty. payloadType: Required. The type of the SEI message, with a value range of 5 or an integer within the range of [100, 254] (excluding 244, which is an internally defined timestamp SEI). payloadUuid: Required when payloadType is 5, and ignored in other cases. The value must be a 32-digit hexadecimal number. interval: Optional, default is 1000. The sending interval of the SEI, in milliseconds. followIdr: Optional, default is false. When this value is true, the SEI will be ensured to be carried when sending a key frame, otherwise it is not guaranteed. |
videoWidth | Field description: specify the target resolution (width) of On-Cloud MixTranscoding Recommended value: 360 px. If you only mix audio streams, please set both width and height to 0; otherwise, there will be a black background in the live stream after mixtranscoding. |
TRTCPublishCDNParam
TRTCPublishCDNParam
Push parameters required to be set when publishing audio/video streams to non-Tencent Cloud CDN
TRTC's backend service supports publishing audio/video streams to third-party live CDN service providers through the standard RTMP protocol.
If you use the Tencent Cloud CSS CDN service, you don't need to care about this parameter; instead, just use the startPublish API.
EnumType | DESC |
appId | Field description: appId of Tencent Cloud CSSRecommended value: please click Application Management > Application Information in the TRTC console and get the appId in Relayed Live Streaming Info . |
bizId | Field description: bizId of Tencent Cloud CSSRecommended value: please click Application Management > Application Information in the TRTC console and get the bizId in Relayed Live Streaming Info . |
streamId | Field description: specify the push address (in RTMP format) of this audio/video stream at the third-party live streaming service provider Recommended value: default value: null,that is, the audio/video streams in the room will be pushed to the target service provider of the caller of this API. |
url | Field description: specify the push address (in RTMP format) of this audio/video stream at the third-party live streaming service provider Recommended value: the push URL rules vary greatly by service provider. Please enter a valid push URL according to the requirements of the target service provider. TRTC's backend server will push audio/video streams in the standard format to the third-party service provider according to the URL you enter. Note the push URL must be in RTMP format and meet the specifications of your target live streaming service provider; otherwise, the target service provider will reject the push requests from TRTC's backend service. |
TRTCAudioRecordingParams
TRTCAudioRecordingParams
Local audio file recording parameters
This parameter is used to specify the recording parameters in the audio recording API startAudioRecording.
EnumType | DESC |
filePath | Field description: storage path of the audio recording file, which is required. Note this path must be accurate to the file name and extension. The extension determines the format of the audio recording file. Currently, supported formats include PCM, WAV, and AAC. For example, if you specify the path as mypath/record/audio.aac , it means that you want the SDK to generate an audio recording file in AAC format.Please specify a valid path with read/write permissions; otherwise, the audio recording file cannot be generated. |
maxDurationPerFile | Field description: maxDurationPerFile is the max duration of each recorded file segments, in milliseconds, with a minimum value of 10000. The default value is 0, indicating no segmentation. |
recordingContent | Field description: Audio recording content type. Note: Record all local and remote audio by default. |
TRTCLocalRecordingParams
TRTCLocalRecordingParams
Local media file recording parameters
This parameter is used to specify the recording parameters in the local media file recording API startLocalRecording.
The
startLocalRecording
API is an enhanced version of the startAudioRecording
API. The former can record video files, while the latter can only record audio files.EnumType | DESC |
filePath | Field description: address of the recording file, which is required. Please ensure that the path is valid with read/write permissions; otherwise, the recording file cannot be generated. Note this path must be accurate to the file name and extension. The extension determines the format of the recording file. Currently, only the MP4 format is supported. For example, if you specify the path as mypath/record/test.mp4 , it means that you want the SDK to generate a local video file in MP4 format.Please specify a valid path with read/write permissions; otherwise, the recording file cannot be generated. |
interval | Field description: interval is the update frequency of the recording information in milliseconds. Value range: 1000–10000. Default value: -1, indicating not to call back |
maxDurationPerFile | Field description: maxDurationPerFile is the max duration of each recorded file segments, in milliseconds, with a minimum value of 10000. The default value is 0, indicating no segmentation. |
recordType | Field description: media recording type, which is TRTCRecordTypeBoth by default, indicating to record both audio and video. |
TRTCSwitchRoomConfig
TRTCSwitchRoomConfig
Room switch parameter
This parameter is used for the room switch API switchRoom, which can quickly switch a user from one room to another.
EnumType | DESC |
privateMapKey | Field description: permission credential used for permission control, which is optional. If you want only users with the specified userId values to enter a room, you need to use privateMapKey to restrict the permission.Recommended value: we recommend you use this parameter only if you have high security requirements. For more information, please see Enabling Advanced Permission Control. |
roomId | Field description: numeric room ID, which is optional. Users in the same room can see one another and make audio/video calls. Recommended value: value range: 1–4294967294. Note either roomId or strRoomId must be entered. If both are entered, roomId will be used. |
strRoomId | Field description: string-type room ID, which is optional. Users in the same room can see one another and make audio/video calls. Note either roomId or strRoomId must be entered. If both are entered, roomId will be used. |
userSig | Field description: user signature, which is optional. It is the authentication signature corresponding to the current userId and acts as the login password.If you don't specify the newly calculated userSig during room switch, the SDK will continue to use the userSig you specified during room entry (enterRoom).This requires you to ensure that the old userSig is still within the validity period allowed by the signature at the moment of room switch; otherwise, room switch will fail. |
TRTCAudioFrameDelegateFormat
TRTCAudioFrameDelegateFormat
Format parameter of custom audio callback
This parameter is used to set the relevant format (including sample rate and number of channels) of the audio data called back by the SDK in the APIs related to custom audio callback.
EnumType | DESC |
channel | Field description: number of sound channels Recommended value: default value: 1, which means mono channel. Valid values: 1: mono channel; 2: dual channel. |
mode | Field description: audio callback data operation mode Recommended value: TRTCAudioFrameOperationModeReadOnly, get audio data from callback only. The modes that can be set are TRTCAudioFrameOperationModeReadOnly, TRTCAudioFrameOperationModeReadWrite. |
sampleRate | Field description: sample rate Recommended value: default value: 48000 Hz. Valid values: 16000, 32000, 44100, 48000. |
samplesPerCall | Field description: number of sample points Recommended value: the value must be an integer multiple of sampleRate/100. |
TRTCScreenShareParams
TRTCScreenShareParams
Screen sharing parameter (for Android only)
This parameter is used to specify the floating window and other related information during screen sharing in the screen sharing API startScreenCapture.
EnumType | DESC |
enableForegroundService | @deprecated Begin from v11.8 version, in order to adapt to targetSdkVersion 34 and above, screen sharing will default to launching a built-in foreground service. This value setting will be invalid. |
floatingView | Field description: you can set a floating view through this parameter. Recommended value: starting from Android 7.0, applications running in the background with no session keep-alive configured will be force stopped by the Android system very soon. However, when an application is sharing the screen, it will inevitably be switched to the system background. In this case, if a floating window can pop up, it can prevent the application from being force stopped by the system. In addition, the pop-up floating window also informs the user of the ongoing screen sharing, helping remind the user to avoid the leakage of confidential information. Note you can also use the WindowsManager API of Android to achieve the same effect. |
mediaProjection | Field description: you can set a MediaProjection to SDK through this parameter. Recommended value: this parameter can be set as null normally. |
TRTCUser
TRTCUser
The users whose streams to publish
You can use this parameter together with the publishing destination parameter TRTCPublishTarget and On-Cloud MixTranscoding parameter TRTCStreamMixingConfig to transcode the streams you specify and publish the mixed stream to the destination you specify.
EnumType | DESC |
intRoomId | Value: Value range: 1-4294967294 Note: You cannot use both intRoomId and strRoomId . If you specify strRoomId , you need to set intRoomId to 0 . If you set both, only intRoomId will be used. |
strRoomId | Note: You cannot use both intRoomId and strRoomId . If you specify roomId , you need to leave strRoomId empty. If you set both, only intRoomId will be used.Value: 64 bytes or shorter; supports the following character set (89 characters): Uppercase and lowercase letters (a-z and A-Z) Numbers (0-9) Space, "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", "," |
userId | /Description: UTF-8-encoded user ID (required) Value: For example, if the ID of a user in your account system is "mike", set it to mike . |
TRTCPublishCdnUrl
TRTCPublishCdnUrl
The destination URL when you publish to Tencent Cloud or a third-party CDN
This enum type is used by the publishing destination parameter TRTCPublishTarget of the publishing API startPublishMediaStream.
EnumType | DESC |
isInternalLine | Description: Whether to publish to Tencent Cloud Value: The default value is true .Note: If the destination URL you set is provided by Tencent Cloud, set this parameter to true , and you will not be charged relaying fees. |
rtmpUrl | Description: The destination URL (RTMP) when you publish to Tencent Cloud or a third-party CDN. Value: The URLs of different CDN providers may vary greatly in format. Please enter a valid URL as required by your service provider. TRTC's backend server will push audio/video streams in the standard format to the URL you provide. Note: The URL must be in RTMP format. It must also meet the requirements of your service provider, or your service provider may reject push requests from the TRTC backend. |
TRTCPublishTarget
TRTCPublishTarget
The publishing destination
EnumType | DESC |
cdnUrlList | Description: The destination URLs (RTMP) when you publish to Tencent Cloud or third-party CDNs. Note: You don’t need to set this parameter if you set the publishing mode to TRTCPublishMixStreamToRoom . |
mixStreamIdentity | Description: The information of the robot that publishes the transcoded stream to a TRTC room. Note: You need to set this parameter only if you set the publishing mode to TRTCPublishMixStreamToRoom . Note: After you set this parameter, the stream will be pushed to the room you specify. We recommend you set it to a special user ID to distinguish the robot from the anchor who enters the room via the TRTC SDK. Note: Users whose streams are transcoded cannot subscribe to the transcoded stream. Note: If you set the subscription mode (@link setDefaultStreamRecvMode}) to manual before room entry, you need to manage the streams to receive by yourself (normally, if you receive the transcoded stream, you need to unsubscribe from the streams that are transcoded). Note: If you set the subscription mode (setDefaultStreamRecvMode) to auto before room entry, users whose streams are not transcoded will receive the transcoded stream automatically and will unsubscribe from the users whose streams are transcoded. You call muteRemoteVideoStream and muteRemoteAudio to unsubscribe from the transcoded stream. |
mode | Description: The publishing mode. Value: You can relay streams to a CDN, transcode streams, or publish streams to an RTC room. Select the mode that fits your needs.Note If you need to use more than one publishing mode, you can call startPublishMediaStream multiple times and set TRTCPublishTarget to a different value each time.You can use one mode each time you call the startPublishMediaStream) API. To modify the configuration, call updatePublishCDNStream. |
TRTCVideoLayout
TRTCVideoLayout
The video layout of the transcoded stream
This enum type is used by the On-Cloud MixTranscoding parameter TRTCStreamMixingConfig of the publishing API startPublishMediaStream.
You can use this parameter to specify the position, size, layer, and stream type of each video in the transcoded stream.
EnumType | DESC |
backgroundColor | Description: The background color of the mixed stream. Value: The value must be a hex number. For example, "0x61B9F1" represents the RGB color value (97,158,241). Default value: 0x000000 (black). |
fillMode | Description: The rendering mode. Value: The rendering mode may be fill (the image may be stretched or cropped) or fit (there may be black bars). Default value: TRTCVideoFillMode_Fill. |
fixedVideoStreamType | Description: Whether the video is the primary stream (TRTCVideoStreamTypeBig) or substream (e TRTCVideoStreamTypeSub). |
fixedVideoUser | Description: The users whose streams are transcoded.Note If you do not specify TRTCUser ( userId , intRoomId , strRoomId ), the TRTC backend will automatically mix the streams of anchors who are sending audio/video in the room according to the video layout you specify. |
height | Description: The height (in pixels) of the video. |
placeHolderImage | Description: The URL of the placeholder image. If a user sends only audio, the image specified by the URL will be mixed during On-Cloud MixTranscoding. Value: This parameter is left empty by default, which means no placeholder image will be used.Note You need to specify the userId parameter in fixedVideoUser . The URL can be 512 bytes long at most, and the image must not exceed 2 MB. The image can be in PNG, JPG, JPEG, or BMP format. We recommend you use a semitransparent image in PNG format. |
width | Description: The width (in pixels) of the video. |
x | Description: The X coordinate (in pixels) of the video. |
y | Description: The Y coordinate (in pixels) of the video. |
zOrder | Description: The layer of the video, which must be unique. Value range: 0-15. |
TRTCWatermark
TRTCWatermark
The watermark layout
This enum type is used by the On-Cloud MixTranscoding parameter TRTCStreamMixingConfig of the publishing API startPublishMediaStream.
EnumType | DESC |
height | Description: The height (in pixels) of the watermark. |
watermarkUrl | Description: The URL of the watermark image. The image specified by the URL will be mixed during On-Cloud MixTranscoding.Note The URL can be 512 bytes long at most, and the image must not exceed 2 MB. The image can be in PNG, JPG, JPEG, or BMP format. We recommend you use a semitransparent image in PNG format. |
width | Description: The width (in pixels) of the watermark. |
x | Description: The X coordinate (in pixels) of the watermark. |
y | Description: The Y coordinate (in pixels) of the watermark. |
zOrder | Description: The layer of the watermark, which must be unique. Value range: 0-15. |
TRTCStreamEncoderParam
TRTCStreamEncoderParam
The encoding parameters
Note:
This parameter is required if you set the publishing mode to TRTCPublish_MixStream_ToCdn
or TRTCPublish_MixStream_ToRoom
in TRTCPublishTarget. Note:
If you use the relay to CDN feature (the publishing mode set to RTCPublish_BigStream_ToCdn
or TRTCPublish_SubStream_ToCdn
), to improve the relaying stability and playback compatibility, we also recommend you set this parameter.EnumType | DESC |
audioEncodedChannelNum | Description: The sound channels of the stream to publish. Value: Valid values: 1 (mono channel); 2 (dual-channel). Default: 1. |
audioEncodedCodecType | Description: The audio codec of the stream to publish. Value: Valid values: 0 (LC-AAC); 1 (HE-AAC); 2 (HE-AACv2). Default: 0.Note The audio sample rates supported by HE-AAC and HE-AACv2 are 48000, 44100, 32000, 24000, and 16000. When HE-AACv2 is used, the output stream can only be dual-channel. |
audioEncodedKbps | Description: The audio bitrate (Kbps) of the stream to publish. Value: Value range: [32,192]. Default: 50. |
audioEncodedSampleRate | Description: The audio sample rate of the stream to publish. Value: Valid values: [48000, 44100, 32000, 24000, 16000, 8000]. Default: 48000 (Hz). |
videoEncodedCodecType | Description: The video codec of the stream to publish. Value: Valid values: 0 (H264); 1 (H265). Default: 0. |
videoEncodedFPS | Description: The frame rate (fps) of the stream to publish. Value: Value range: (0,30]. Default: 20. |
videoEncodedGOP | Description: The keyframe interval (GOP) of the stream to publish. Value: Value range: [1,5]. Default: 3 (seconds). |
videoEncodedHeight | Description: The resolution (height) of the stream to publish. Value: Recommended value: 640. If you mix only audio streams, to avoid displaying a black video in the transcoded stream, set both width and height to 0 . |
videoEncodedKbps | Description: The video bitrate (Kbps) of the stream to publish. Value: If you set this parameter to 0 , TRTC will work out a bitrate based on videoWidth and videoHeight . For details, refer to the recommended bitrates for the constants of the resolution enum type (see comment). |
videoEncodedWidth | Description: The resolution (width) of the stream to publish. Value: Recommended value: 368. If you mix only audio streams, to avoid displaying a black video in the transcoded stream, set both width and height to 0 . |
videoSeiParams | Description: SEI parameters. Default: null Note: the parameter is passed in the form of a JSON string. Here is an example to use it:
The currently supported fields and their meanings are as follows: payloadContent: Required. The payload content of the passthrough SEI, which cannot be empty. payloadType: Required. The type of the SEI message, with a value range of 5 or an integer within the range of [100, 254] (excluding 244, which is an internally defined timestamp SEI). payloadUuid: Required when payloadType is 5, and ignored in other cases. The value must be a 32-digit hexadecimal number. interval: Optional, default is 1000. The sending interval of the SEI, in milliseconds. followIdr: Optional, default is false. When this value is true, the SEI will be ensured to be carried when sending a key frame, otherwise it is not guaranteed. |
TRTCStreamMixingConfig
TRTCStreamMixingConfig
The transcoding parameters
You can use this parameter to specify the video layout and input audio information for On-Cloud MixTranscoding.
EnumType | DESC |
audioMixUserList | Description: The information of each audio stream to mix. Value: This parameter is an array. Each TRTCUser element in the array indicates the information of an audio stream.Note If you do not specify this array, the TRTC backend will automatically mix all streams of the anchors who are sending audio in the room according to the audio encode param TRTCStreamEncoderParam you specify (currently only supports up to 16 audio and video inputs). |
backgroundColor | Description: The background color of the mixed stream. Value: The value must be a hex number. For example, "0x61B9F1" represents the RGB color value (97,158,241). Default value: 0x000000 (black). |
backgroundImage | Description: The URL of the background image of the mixed stream. The image specified by the URL will be mixed during On-Cloud MixTranscoding. Value: This parameter is left empty by default, which means no background image will be used.Note The URL can be 512 bytes long at most, and the image must not exceed 2 MB. The image can be in PNG, JPG, JPEG, or BMP format. We recommend you use a semitransparent image in PNG format. |
videoLayoutList | Description: The position, size, layer, and stream type of each video in On-Cloud MixTranscoding. Value: This parameter is an array. Each TRTCVideoLayout element in the array indicates the information of a video in On-Cloud MixTranscoding. |
watermarkList | Description: The position, size, and layer of each watermark image in On-Cloud MixTranscoding. Value: This parameter is an array. Each TRTCWatermark element in the array indicates the information of a watermark. |
TRTCPayloadPrivateEncryptionConfig
TRTCPayloadPrivateEncryptionConfig
Media Stream Private Encryption Configuration
This configuration is used to set the algorithm and key for media stream private encryption.
EnumType | DESC |
encryptionAlgorithm | Description: Encryption algorithm, the default is TRTCEncryptionAlgorithmAes128Gcm. |
encryptionKey | Description: encryption key, string type. Value: If the encryption algorithm is TRTCEncryptionAlgorithmAes128Gcm, the key length must be 16 bytes;if the encryption algorithm is TRTCEncryptionAlgorithmAes256Gcm, the key length must be 32 bytes. |
encryptionSalt | Description: Salt, initialization vector for encryption. Value: It is necessary to ensure that the array filled in this parameter is not empty, not all 0 and the data length is 32 bytes. |
TRTCAudioVolumeEvaluateParams
TRTCAudioVolumeEvaluateParams
Volume evaluation and other related parameter settings.
This setting is used to enable vocal detection and sound spectrum calculation.
EnumType | DESC |
enablePitchCalculation | Description: Whether to enable local vocal frequency calculation. |
enableSpectrumCalculation | Description: Whether to enable sound spectrum calculation. |
enableVadDetection | Description: Whether to enable local voice detection.Note Call before startLocalAudio. |
interval | Description: Set the trigger interval of the onUserVoiceVolume callback, the unit is milliseconds, the minimum interval is 100ms, if it is less than or equal to 0, the callback will be closed. Value: Recommended value: 300, in milliseconds.Note When the interval is greater than 0, the volume prompt will be enabled by default, no additional setting is required. |
- StructType
- EnumType
- TRTCVideoResolution
- TRTCVideoResolutionMode
- TRTCVideoStreamType
- TRTCVideoFillMode
- TRTCVideoRotation
- TRTCBeautyStyle
- TRTCVideoPixelFormat
- TRTCVideoBufferType
- TRTCVideoMirrorType
- TRTCSnapshotSourceType
- TRTCAppScene
- TRTCRoleType
- TRTCQosControlMode(Deprecated)
- TRTCVideoQosPreference
- TRTCQuality
- TRTCAVStatusType
- TRTCAVStatusChangeReason
- TRTCAudioSampleRate
- TRTCAudioQuality
- TRTCAudioRoute
- TRTCReverbType
- TRTCVoiceChangerType
- TRTCSystemVolumeType
- TRTCAudioFrameFormat
- TRTCAudioCapabilityType
- TRTCAudioFrameOperationMode
- TRTCLogLevel
- TRTCGSensorMode
- TRTCTranscodingConfigMode
- TRTCRecordType
- TRTCMixInputType
- TRTCDebugViewLevel
- TRTCAudioRecordingContent
- TRTCPublishMode
- TRTCEncryptionAlgorithm
- TRTCSpeedTestScene
- TRTCGravitySensorAdaptiveMode
- TRTCParams
- TRTCVideoEncParam
- TRTCNetworkQosParam
- TRTCRenderParams
- TRTCQualityInfo
- TRTCVolumeInfo
- TRTCSpeedTestParams
- TRTCSpeedTestResult
- TRTCTexture
- TRTCVideoFrame
- TRTCAudioFrame
- TRTCMixUser
- TRTCTranscodingConfig
- TRTCPublishCDNParam
- TRTCAudioRecordingParams
- TRTCLocalRecordingParams
- TRTCSwitchRoomConfig
- TRTCAudioFrameDelegateFormat
- TRTCScreenShareParams
- TRTCUser
- TRTCPublishCdnUrl
- TRTCPublishTarget
- TRTCVideoLayout
- TRTCWatermark
- TRTCStreamEncoderParam
- TRTCStreamMixingConfig
- TRTCPayloadPrivateEncryptionConfig
- TRTCAudioVolumeEvaluateParams