Global

Type Definitions

TurnServer

Properties:
Name Type Attributes Default Description
url string

TURN server url

username string <optional>

TURN server auth user name

credential string <optional>

TURN server password

credentialType string <optional>
password

TURN server verify password type

ProxyServer

Properties:
Name Type Attributes Default Description
websocketProxy string <optional>

websocket service proxy

loggerProxy string <optional>

log service agent

turnServer Array.<TurnServer> <optional>

media data transmission agent

iceTransportPolicy 'all' | 'relay' <optional>
'all'

'all' gives priority to directly connecting to TRTC, and tries to go to the turn server if the connection fails.
'relay' forces the connection through the TURN server.

VideoProfile

Properties:
Name Type Description
width number

Video width

height number

Video height

frameRate number

Video frame rate

bitrate number

Video bitrate

Configuration for local video stream

Video configuration parameters, can use preset values in string format or custom resolution and other parameters

Video Profile Resolution (Width x Height) Frame Rate (fps) Bitrate (kbps) Note
120p_2 160 x 120 15 100 v5.1.1+
180p 320 x 180 15 350
180p_2 320 x 180 15 150 v5.1.1+
240p 320 x 240 15 400
240p_2 320 x 240 15 200 v5.1.1+
360p 640 x 360 15 800
360p_2 640 x 360 15 400 v5.1.1+
480p 640 x 480 15 900
480p_2 640 x 480 15 500 Default value, v5.1.1+
720p 1280 x 720 15 1500
1080p 1920 x 1080 15 2000
1440p 2560 x 1440 30 4860
4K 3840 x 2160 30 9000
Type:
  • object | string
Examples
const config = {
 option: {
  profile: '480p',
 },
}
await trtc.startLocalVideo(config);
const config = {
 option: {
   profile: {
     width: 640,
     height: 480,
     frameRate: 15,
     bitrate: 900,
   }
 }
}
await trtc.startLocalVideo(config);

ScreenShareProfile

Properties:
Name Type Description
width number

Screen sharing width

height number

Screen sharing height

frameRate number

Screen sharing frame rate

bitrate number

Screen sharing bitrate

Screen sharing resolution, bit rate, and frame rate configuration Screen sharing configuration parameters, can use preset values or custom resolution and other parameters

Screen Profile Resolution (width x height) Frame Rate (fps) Bitrate (kbps)
480p 640 x 480 5 900
480p_2 640 x 480 30 1000
720p 1280 x 720 5 1200
720p_2 1280 x 720 30 3000
1080p 1920 x 1080 5 1600
1080p_2 1920 x 1080 30 4000
  • The default resolution for screen sharing is 1080p.
  • If the above profiles do not meet your business needs, you can also specify custom resolution, frame rate, and bitrate.
Type:
  • object | string
Example
const config = {
 option: {
  profile: '720p',
 },
}
await trtc.startScreenShare(config);

TRTCStatistics

Properties:
Name Type Description
rtt number

The round-trip time from SDK to TRTC server(SDK -> TRTC server -> SDK). Unit: ms.

upLoss number

Uplink loss rate from SDK to TRTC server. Unit: %

downLoss number

Downlink loss rate from TRTC server to SDK. Unit: %

bytesSent number

Total bytes sent, including signaling data and media data. Unit: bytes.

bytesReceived number

Total bytes received, including signaling data and media data. Unit: bytes.

localStatistics TRTCLocalStatistics

Local statistics.

remoteStatistics Array.<TRTCRemoteStatistics>

Remote statistics.

TRTCLocalStatistics

Properties:
Name Type Description
audio TRTCAudioStatistic

Local audio statistics

video Array.<TRTCVideoStatistic>

Local video statistics

Local statistics

TRTCRemoteStatistics

Properties:
Name Type Description
userId string

The userId of remote user

audio TRTCAudioStatistic

Remote audio statistics

video Array.<TRTCVideoStatistic>

Remote video statistics

Remote statistics.

TRTCAudioStatistic

Properties:
Name Type Description
bitrate number

Audio bitrate. Unit: kbps

audioLevel number

Audio level. Value: float from 0 to 1.

Audio statistics

TRTCVideoStatistic

Properties:
Name Type Description
bitrate number

Video bitrate. Unit: kbps

width number

Video width

height number

Video height

frameRate number

Video frameRate

videoType 'big' | 'small' | 'sub'

Video type: big, small, sub.

Video statistics

PluginName

Plugin name

Type:
  • 'AudioMixer' | 'AIDenoiser' | 'Watermark'

AudioMixerOptions

Properties:
Name Type Attributes Description
id string

Please set a unique ID for each incoming music url.

url string

The url of the music address in MP3, AAC (and other audio formats supported by the browser).

loop boolean <optional>

Whether the background music is repeated or not

volume number <optional>

Background music playback volume (0-1)

AudioMixer start plugin options

Type:
  • Object

UpdateAudioMixerOptions

Properties:
Name Type Attributes Description
id string

Unique ID for music you set before.

loop boolean <optional>

Whether the background music is repeated or not

volume number <optional>

Background music playback volume (0-1)

seekFrom number <optional>

Start seek from X seconds

operation string <optional>

Operation of the background music: 'pause' | 'resume' | 'stop'

AudioMixer update plugin options

Type:
  • Object

StopAudioMixerOptions

Properties:
Name Type Description
id string

Unique ID for music you set before.

AudioMixer stop plugin options

Type:
  • Object

AIDenoiserOptions

Properties:
Name Type Description
assetsPath string

denoiser wasm assets path

sdkAppId number

application SDKAppId

userId string

current user's userId

userSig string

current user's userSig

AIDenoiser start plugin options

Type:
  • Object

VirtualBackgroundOptions

Properties:
Name Type Attributes Description
sdkAppId number

Current application ID

userId string

Current user ID

userSig string

UserSig corresponding to the user ID

type string <optional>

image for image background
- blur for background blur (default)

blurLevel number <optional>

Set the level of blur when type is set to blur. Default value is 3, with a range from 1 to 10.

src string <optional>

Required if type is image | Image URL, such as `https://picsum.photos/seed/picsum/200/300

onAbort function <optional>

Callback to stop plugin due to error.

VirtualBackground start plugin options, tutorial see Enable Virtual Background

Type:
  • Object

UpdateVirtualBackgroundOptions

Properties:
Name Type Attributes Description
type string

image for image background
- blur for background blur (default)

blurLevel number <optional>

Set the level of blur when type is set to blur. Default value is 3, with a range from 1 to 10.

src string <optional>

Required if type is image | Image URL, such as `https://picsum.photos/seed/picsum/200/300

onAbort function <optional>

Callback to stop plugin due to error.

VirtualBackground 插件更新参数,教程可见 Enable Virtual Background

Type:
  • Object

WatermarkOptions

Properties:
Name Type Attributes Description
imageUrl string

Image watermark URL. This parameter is required.

x string <optional>

Watermark left margin. This parameter is optional.

y string <optional>

Watermark top margin. This parameter is optional.

size string | number | object <optional>

Specifies the size of the watermark. This parameter is optional. The default is cover. When passing a string:

  • "cover" scales the background image to fully cover the background area, which may cause parts of the background image to be invisible.
  • "contain" scales the background image to fit entirely within the background area, possibly leaving some areas blank. When passing a number:
  • x scales the background image by x times, e.g., 0.5, with a valid range of (0,1]. When passing an object:
  • You can specify manually by passing {width: 200, height: 300}.

Watermark start plugin options, tutorial see Enable Watermark Plugin

Type:
  • Object