Data types

更新时间:
复制 MD 格式

Contents

Data type

Description

Minimum supported version

JoinParam

Information required to join a channel.

1.0.0

CameraVideoTrackConfig

Configuration object for creating a camera video stream.

1.0.0

MicrophoneAudioTrackConfig

Configuration object for creating a microphone audio stream.

1.0.0

PlaybackAudioTrackConfig

Create an audio track object for the local speaker

1.0.0

ScreenVideoTrackConfig

Configuration object for creating a screen sharing stream.

1.0.0

CustomAudioTrackConfig

Configuration parameters for creating a custom audio track.

1.0.0

CustomVideoTrackConfig

Configuration parameters for creating a custom video track.

1.0.0

VideoEncoderConfiguration

Configuration object for adjusting video encoding.

1.0.0

TrackMediaType

Media track type.

1.0.0

RotationMode

Video rotation mode.

1.0.0

VideoDimension

Video capture specifications.

1.0.0

DeviceInfo

Device information.

1.0.0

ConnectionState

SDK connection state.

1.0.0

RemoteUser

Information about remote users in the channel.

1.0.0

RemoteStreamType

Subscription mode for remote video streams.

1.0.0

DisconnectedReason

Reason for disconnection from the server.

1.0.0

VideoPlayerConfig

Configuration parameters for video playback.

1.0.0

NetworkQuality

Network quality score.

1.0.0

GlobalClientConfigInfo

Global configuration information for the local client.

1.0.0

LogLevel

Log level.

1.0.0

SubscribeParam

Batch subscription to remote audio and video tracks.

1.0.0

SubscribeResult

Feedback on batch subscription to remote audio and video tracks.

1.0.0

UnsubscribeParam

Batch unsubscription from remote audio and video tracks.

1.0.0

ScreenCaptureSourceInfo

Screen sharing source

1.0.0

Data type details

JoinParam

Information required to join a channel.

interface JoinParam 

Property

Type

Description

Version

appId

string

The AppId of your project in DingRTC. It can contain only uppercase letters, lowercase letters, digits, and underscores (_).

1.0.0

channel

string

The channel ID. It can be up to 64 characters long and can contain only the characters in the set [A-Za-z0-9_-].

1.0.0

token

string

The token for authentication.

1.0.0

uid

string

The user ID. It can be up to 64 characters long and can contain only the characters in the set [A-Za-z0-9_-].

1.0.0

userName

string

The username. The length cannot exceed 64 bytes in UTF-8 encoding.

1.0.0

CameraVideoTrackConfig

Configuration object for creating a camera video stream.

interface CameraVideoTrackConfig 

Property

Type

Description

Version

deviceId?

string

(Optional) The device ID of the camera.

You can call getCameras to get the list of available cameras.

1.0.0

dimension?

VideoDimension

(Optional) The video capture specifications.

1.0.0

frameRate?

number

(Optional) The frame rate.

1.0.0

facingMode?

'user' | 'environment'

(Optional) On a mobile device, specifies whether to use the front or rear camera to capture video.

1.0.0

maxBitrate?

number

(Optional) The maximum bitrate in Kbps. If not set, the SDK calculates a value internally.

1.0.0

optimizationMode?

'detail' | 'motion' | 'balanced'

(Optional) The video transmission optimization mode:

balanced: The default mode. This mode prioritizes clarity for screen sharing streams. For other video stream types, it balances clarity and smoothness. The frame rate and resolution are adjusted in poor network conditions.

detail: Prioritizes clarity. The resolution is generally not reduced, but the frame rate might be.

motion: Prioritizes smoothness. The frame rate is generally not reduced, but the sending resolution might be.

1.0.0

mirror?

boolean

(Optional) Specifies whether to mirror the stream ingest. This feature is disabled by default. It only affects remote playback. If Client Video Orientation (CVO) is set, the video is mirrored after rotation.

1.0.0

MicrophoneAudioTrackConfig

Configuration object for creating a microphone audio stream.

Type signature

interface MicrophoneAudioTrackConfig 

Property

Type

Description

Version

AEC?

boolean

(Optional) Specifies whether to enable acoustic echo cancellation (AEC).

1.0.0

AGC?

boolean

(Optional) Specifies whether to enable automatic gain control (AGC).

1.0.0

ANS?

boolean

(Optional) Specifies whether to enable automatic noise suppression (ANS).

1.0.0

deviceId?

string

(Optional) The device ID.

1.0.0

PlaybackAudioTrackConfig

Configuration object for creating an audio playback track.

Type signature

interface PlaybackAudioTrackConfig {
    deviceId?: string;
}

Property

Type

Description

Version

deviceId?

string

(Optional) The device ID.

1.0.0

ScreenVideoTrackConfig

Configuration object for creating a screen sharing stream.

Type signature

interface ScreenVideoTrackConfig 

Property

Type

Description

Version

type

'window'

'screen'

The type of the shared stream. 'window' indicates an application window. 'screen' indicates the entire screen.

sourceId

string

The ID of the shared source.

frameRate?

number

(Optional) The frame rate.

dimension?

VideoDimension

(Optional) The video specifications.

1.0.0

rotationMode?

RotationMode

(Optional) The video rotation mode.

1.0.0

RotationMode

Video rotation mode

enum RotationMode {
  RotationMode_0 = 0,
  RotationMode_90,
  RotationMode_180,
  RotationMode_270,
}

VideoEncoderConfiguration

Configuration object for adjusting video encoding.

interface VideoEncoderConfiguration 

Property

Type

Description

Version

dimension?

VideoDimension

(Optional) The video capture specifications.

1.0.0

frameRate?

number

(Optional) The frame rate.

1.0.0

maxBitrate?

number

(Optional) The maximum bitrate in Kbps. If not set, the SDK calculates a value internally.

1.0.0

optimizationMode?

'detail' | 'motion' | 'balanced'

(Optional) The video transmission optimization mode:

balanced: The default mode. This mode prioritizes clarity for screen sharing streams. For other video stream types, it balances clarity and smoothness. The frame rate and resolution are adjusted in poor network conditions.

detail: Prioritizes clarity. The resolution is generally not reduced, but the frame rate might be.

motion: Prioritizes smoothness. The frame rate is generally not reduced, but the sending resolution might be.

1.0.0

mirror?

boolean

(Optional) Specifies whether to mirror the stream ingest. This feature is disabled by default. It only affects remote playback. If CVO is set, the video is mirrored after rotation. This parameter is supported only for camera tracks.

1.0.0

VideoDimension

Video capture dimensions.

type VideoDimension = 
'VD_120x120' | 
'VD_160x120' | 
'VD_180x180' | 
'VD_240x180' | 
'VD_320x180' | 
'VD_240x240' | 
'VD_320x240' | 
'VD_424x240' | 
'VD_360x360' | 
'VD_480x360' | 
'VD_640x360' | 
'VD_480x480' | 
'VD_640x480' | 
'VD_840x480' | 
'VD_960x540' | 
'VD_960x720' | 
'VD_1280x720' | 
'VD_1920x1080';

TrackMediaType

Media track type.

type TrackMediaType = 'audio' | 'video';

CustomVideoTrackConfig

Configuration parameters for creating a custom video track.

Type signature

interface CustomVideoTrackConfig 

Property

Type

Description

Version

dimension?

VideoDimension

(Optional) The video specifications.

1.0.0

frameRate?

number

(Optional) The frame rate.

1.0.0

mediaStreamTrack

MediaStreamTrack

The MediaStreamTrack object that you maintain.

1.0.0

maxBitrate?

number

(Optional) The maximum bitrate in Kbps. If this property is not set, the SDK calculates a value.

1.0.0

CustomAudioTrackConfig

Configuration parameters for creating a custom audio track.

Type signature

interface CustomAudioTrackConfig 

Property

Type

Description

Version

mediaStreamTrack

MediaStreamTrack

The MediaStreamTrack object that you maintain.

1.0.0

DeviceInfo

Device information.

Type signature

interface DeviceInfo 

Property

Type

Description

Version

device

MediaDeviceInfo

The device information of the capture device.

1.0.0

state

'active' | 'inactive'

The current plug-in state of the capture device.

"active": The device is plugged in.

"inactive": The device is unplugged.

1.0.0

ConnectionState

The connection state of the SDK.

Type signature

type ConnectionState = 
'disconnected' | 
'connecting' | 
'reconnecting' | 
'connected' | 
'disconnecting';

RemoteUser

You can retrieve information about remote users in the channel from DingRTCClient.remoteUsers or by handling events such as DingRTCClient.on("user-joined").

This object describes the current state of a remote user in the channel, including the user's ID and their audio and video publishing status.

This object describes the current state of a remote user, including the user ID and whether the user has published audio or video streams. If you detect that a remote user has published a stream, you can pass this object to DingRTCClient.subscribe to subscribe to the stream. After a successful subscription, you can retrieve the remote audio and video track objects for playback from the audioTrack or videoTrack field of this object.

Property list

Property

Type

Description

Version

audioMuted

boolean

Indicates whether the remote user's microphone is currently muted.

1.0.0

videoMuted

boolean

Indicates whether the remote user's camera is currently turned off.

1.0.0

auxiliaryMuted

boolean

Indicates whether the remote user's screen sharing is currently turned off.

1.0.0

audioTrack

RemoteAudioTrack

If you successfully subscribe to the remote user's audio, this field stores the remote audio track object.

1.0.0

auxiliaryTrack

RemoteVideoTrack

If you successfully subscribe to the remote user's screen sharing, this field stores the remote screen sharing video track object.

1.0.0

hasAudio

boolean

Indicates whether the remote user is currently sending audio.

1.0.0

hasAuxiliary

boolean

Indicates whether the remote user is currently sending a screen sharing stream.

1.0.0

hasVideo

boolean

Indicates whether the remote user is currently sending video.

1.0.0

userId

string

The ID of the remote user.

1.0.0

videoTrack

RemoteVideoTrack

If you successfully subscribe to the remote user's video, this field stores the remote video track object.

1.0.0

RemoteStreamType

The subscription mode for remote video streams.

Type signature

type RemoteStreamType = 'high' | 'low' | 'FHD' | 'HD' | 'SD' | 'LD';

Type

Description

Version

high

Ultra-high definition (UHD) stream. This quality is available if the device performance, network conditions, and stream ingest resolution meet the requirements. This corresponds to the 1080p pricing tier.

1.0.0

FHD

UHD stream. This quality is available if the device performance, network conditions, and stream ingest resolution meet the requirements. This corresponds to the 1080p pricing tier.

3.3.0

HD

High definition (HD) stream. This quality is available if the device performance, network conditions, and stream ingest resolution meet the requirements. This corresponds to the 720p pricing tier.

3.3.0

SD

Standard definition (SD) stream. This quality is available if the device performance, network conditions, and stream ingest resolution meet the requirements. This corresponds to the 480p pricing tier.

3.3.0

LD

Low definition (LD) stream. This quality is available if the device performance, network conditions, and stream ingest resolution meet the requirements. This corresponds to the 480p pricing tier.

3.3.0

low

LD stream. This quality is available if the device performance, network conditions, and stream ingest resolution meet the requirements. This corresponds to the 480p pricing tier.

1.0.0

DisconnectedReason

The reason for the disconnection from the server.

Type signature

type DisconnectedReason = 
'leave' |  // The user actively left.
'network_error' |  // An exception occurred with the client-side network connection.
'server_error' | // A server-side error occurred.
'uid_banned' | // The UID was removed.
'uid_replaced' | // The user was disconnected because another user logged on with the same UID.
'channel_banned'| // The channel was closed.
'timeout'; // The user left due to a timeout.

LocalAudioStates

Statistics for the local audio track.

Type signature

interface LocalAudioStates 

Property

Type

Description

Version

channelCount?

number

(Optional) The number of captured sound channels.

1.0.0

codec?

string

(Optional) The audio encoding format.

1.0.0

sampleRate?

number

(Optional) The audio sampling rate.

1.0.0

sendBytes?

number

(Optional) The total number of audio bytes sent.

1.0.0

sendPackets?

number

(Optional) The total number of audio packets sent.

1.0.0

sendPacketsLost?

number

(Optional) The total number of lost audio packets.

1.0.0

timestamp?

number

(Optional) The timestamp when the call was made.

1.0.0

rtt?

number

(Optional) The round-trip time (RTT) in ms.

1.0.0

VideoPlayerConfig

Configuration parameters for video playback.

Type signature

interface VideoPlayerConfig 

Property

Type

Description

Version

fit?

'contain' | 'cover'

(Optional) The video fill mode.

'contain': The image is resized to fit the aspect ratio of its container. If the aspect ratio of the image does not match the aspect ratio of the container, black bars are added.

'cover': The image is resized to fit the aspect ratio of its container. If the aspect ratio of the image does not match the aspect ratio of the container, the image is cut to fit.

1.0.0

mirror?

boolean

(Optional) Specifies whether to mirror the playback.

1.0.0

GlobalClientConfigInfo

Global configuration information for the local client.

Type signature

interface GlobalClientConfigInfo 

Property

Type

Description

Version

gslb?

string | string[]

(Optional) The GSLB domain name.

1.0.0

NetworkQuality

After a local user joins a channel, the SDK triggers the "network-quality" callback every two seconds to report the user's uplink and downlink network quality. The quality is calculated based on the average round-trip time (RTT) and packet loss rate.

- 0: The network status is unknown.

- 1: The network quality is excellent.

- 2: The network quality is good.

- 3: The network quality is fair.

- 4: The network quality is poor.

- 5: The network quality is very poor.

- 6: The network is disconnected.

Type signature:

type NetworkQuality = 0 | 1 | 2 | 3 | 4 | 5 | 6;

LogLevel

Specifies the log level. Only logs at the specified level or higher are output.

- debug: Outputs all logs.

- info: Outputs info, warn, and error logs.

- warn: Outputs warn and error logs.

- error: Outputs error logs.

- none: Outputs no logs.

Type signature

type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'none';

SubscribeParam

Parameters for batch subscribing to user audio and video tracks.

interface SubscribeParam

Property

Type

Description

Version

uid

string

The userId of the remote user.

1.0.0

mediaType

TrackMediaType

The type of the media track to subscribe to.

1.0.0

auxiliary?

string

If subscribing to a video track, specifies whether it is a screen sharing stream.

1.0.0

SubscribeResult

The result of a batch subscription to user audio and video tracks.

interface SubscribeResult

Property

Type

Description

Version

uid

string

The userId of the remote user.

1.0.0

auxiliary?

string

If subscribing to a video track, indicates whether it is a screen sharing stream.

1.0.0

track

RemoteTrack

The audio or video track object obtained after the subscription is complete.

1.0.0

error

DingRTCError

The error message if the subscription fails.

1.0.0

UnsubscribeParam

Parameters for batch unsubscribing from user audio and video tracks.

interface UnsubscribeParam

Property

Type

Description

Version

uid

string

The userId of the remote user.

1.0.0

mediaType

TrackMediaType

The type of the media track to unsubscribe from.

1.0.0

auxiliary?

string

When you unsubscribe from a video track, is the stream a shared stream?

1.0.0

ScreenCaptureSourceInfo

Screen sharing source

interface ScreenCaptureSourceInfo {
    iconImageSrc?: string;
    sourceId: string;
    sourceName: string;
    thumbImageSrc?: string;
    type: "window" | "screen";
}

Property

Type

Description

Version

iconImageSrc

string

The ID of the audio group to join. A new group is created if the specified group does not exist.

1.0.0

sourceId

string

Custom data for joining a group

1.0.0

sourceName

boolean

Specifies whether to automatically mix the audio stream into the group upon joining.

1.0.0

thumbImageSrc

type