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. |
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. |
jitterBufferDelay |
number |
Playback delay, unit: ms. Since |
point2pointDelay |
number |
End-to-end delay, unit: ms. This indicator is an estimate and may be affected by network quality. Since |
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. |
jitterBufferDelay |
number |
Playback delay, unit: ms. Since |
point2pointDelay |
number |
End-to-end delay, unit: ms. This indicator is an estimate and may be affected by network quality. Since |
Video statistics
PluginName
Plugin name
Type:
- 'AudioMixer' | 'AIDenoiser' | 'Watermark' | 'VirtualBackground' | 'SmallStreamAutoSwitcher'
UpdateAudioMixerOptions
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). |
|
track |
MediaStreamAudioTrack |
<optional> |
Since v5.4.3+, MediaStreamAudioTrack from tag, If |
loop |
boolean |
<optional> |
Whether the background music is repeated or not |
volume |
number |
<optional> |
Background music playback volume (0-1) |
playbackRate |
number |
<optional> |
Set the playback rate, the default is 1.0 |
onDurationChange |
function |
<optional> |
Callback function, which will be executed after the music is loaded. The parameter is (duration: number) which indicates the total duration of the music |
onTimeUpdate |
function |
<optional> |
Callback function, which will be executed after the music is loaded. The parameter is (duration: number) which indicates the total duration of the music |
onEnded |
function |
<optional> |
Callback function, executed when the music ends (note that it will not be executed every time the music ends during loop), no parameters /** AudioMixer update plugin options |
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' |
playbackRate |
number |
<optional> |
Set the playback rate, the default is 1.0 |
onDurationChange |
function |
<optional> |
Callback function, which will be executed after the music is loaded. The parameter is (duration: number) which indicates the total duration of the music |
onTimeUpdate |
function |
<optional> |
Callback function, which will be executed after the music is loaded. The parameter is (duration: number) which indicates the total duration of the music |
onEnded |
function |
<optional> |
Callback function, executed when the music ends (note that it will not be executed every time the music ends during loop), no parameters |
AudioMixer start 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 |
mode |
number |
since v5.13.0+, support denoiser mode |
AIDenoiser start plugin options
Type:
- Object
UpdateDenoiserOptions
Properties:
Name | Type | Description |
---|---|---|
mode |
number |
Two modes are supported: |
AIDenoiser update 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> |
|
enableFaceCentering |
boolean |
<optional> |
Start from v5.11.0, whether to enable face centering. Default is false. |
blurLevel |
number |
<optional> |
Set the level of blur when |
src |
string |
<optional> |
Required if type is |
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 |
|
|
enableFaceCentering |
boolean |
<optional> |
Start from v5.11.0, whether to enable face centering. Default is false. |
blurLevel |
number |
<optional> |
Set the level of blur when |
src |
string |
<optional> |
Required if type is |
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
|
Watermark start plugin options, tutorial see Enable Watermark Plugin
Type:
- Object
SmallStreamAutoSwitcherOptions
Properties:
Name | Type | Description |
---|---|---|
sdkAppId |
number |
Current application ID |
userId |
string |
Current user ID |
userSig |
string |
UserSig corresponding to the user ID |
SmallStreamAutoSwitcher start plugin options, tutorial see Enable Small Stream Auto Switcher Plugin
Type:
- Object
SmallStreamAutoSwitcherOptions
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
rttPoorLimit |
number |
<optional> |
200
|
Delay threshold (ms), when network delay exceeds this value, start calculating the condition to switch to small stream |
lossPoorLimit |
number |
<optional> |
20
|
Loss rate threshold (%), when loss rate exceeds this value, start calculating the condition to switch to small stream |
poorDuration |
number |
<optional> |
10000
|
Network poor condition duration threshold (ms), when delay or loss rate continuously exceeds the threshold for this duration, start checking if switching to small stream is needed |
rttGoodLimit |
number |
<optional> |
100
|
Good delay threshold (ms), when network delay is less than this value, start calculating the condition to switch to large stream |
lossGoodLimit |
number |
<optional> |
10
|
Good loss rate threshold (%), when loss rate is less than this value, start calculating the condition to switch to large stream |
goodDuration |
number |
<optional> |
20000
|
The duration threshold (in milliseconds) of good network conditions. When the delay and packet loss rate are continuously lower than the threshold for this duration, the system starts checking whether to switch to the high-speed network. |
sleepTime |
number |
<optional> |
30000
|
The sleep time after switching (in milliseconds), during which automatic switching will not be triggered again to avoid frequent switching |
maxAutoSwitchToSmallCount |
number |
<optional> |
2
|
The maximum number of times each user is allowed to automatically switch to low-rate streaming. After this number is exceeded, the user will no longer automatically switch to low-rate streaming. |
SmallStreamAutoSwitcher plugin configuration options
Type:
- Object
VoiceChangerStartOptions
Properties:
Name | Type | Description |
---|---|---|
sdkAppId |
number |
sdkAppId |
userId |
string |
userId |
userSig |
string |
userSig |
voiceType |
number |
voice Type |
VoiceChanger start plugin parameters
Type:
- Object
VoiceChangerUpdateOptions
Properties:
Name | Type | Description |
---|---|---|
voiceType |
number |
voice Type |
VoiceChanger update plugin parameters
Type:
- Object