Data types
Contents
Type | Description | Version |
Parameters for joining a channel. | 0.7.0 | |
The SDK's connection state. | 0.7.0 | |
The reason for disconnection. | 0.7.0 | |
Information about a remote user in the channel. | 0.7.0 | |
The log level. | 0.7.0 | |
The media type. | 0.7.0 | |
A remote track. | 0.7.0 | |
The result of a publish operation. | 0.7.0 | |
Parameters for subscribing to a remote track. | 0.7.0 |
Data type details
JoinParam
The parameters required to join a channel.
interface JoinParam
Parameter | Type | Description | Version |
appId | string | The App ID for your DingRTC project. It must consist of uppercase letters, lowercase letters, numbers, and underscores. | 0.7.0 |
channel | string | The channel ID. It must consist of characters from the set | 0.7.0 |
token | string | The token used for authentication. | 0.7.0 |
uid | string | The user ID. It must consist of characters from the set | 0.7.0 |
userName | string | The user name. Cannot exceed 64 bytes in UTF-8 encoding. | 0.7.0 |
ConnectionState
The SDK's connection state with the server.
Type signature
type ConnectionState =
'disconnected' |
'connecting' |
'reconnecting' |
'connected' |
'disconnecting';DisconnectedReason
The reason the SDK disconnected from the server.
Type signature
type DisconnectedReason =
'leave' | // The user actively left the channel.
'network_error' | // A client-side network error occurred.
'server_error' | // A server error occurred.
'uid_banned' | // The user ID was banned.
'uid_replaced' | // Replaced by another session with the same user ID.
'channel_banned' | // The channel was closed.
'timeout'; // The connection timed out.RemoteUser
Represents a remote user in the channel. You can obtain RemoteUser objects from DingRTCClient.remoteUsers or through events such as DingRTCClient.on("user-joined").
This object describes the current state of a remote user, including their user ID and whether they are publishing audio or video.
If a remote user is publishing, you can pass this object to DingRTCClient.subscribe to subscribe to their streams.
Parameters
Parameter | Type | Description | Version |
audioMuted | boolean | Indicates whether the remote user's microphone is muted. | 0.7.0 |
videoMuted | boolean | Indicates whether the remote user's camera is turned off. | 0.7.0 |
auxiliaryMuted | boolean | Indicates whether the remote user's screen sharing is turned off. | 0.7.0 |
hasAudio | boolean | Indicates whether the remote user is publishing an audio track. | 0.7.0 |
hasAuxiliary | boolean | Indicates whether the remote user is publishing an auxiliary stream (screen sharing). | 0.7.0 |
hasVideo | boolean | Indicates whether the remote user is publishing a video track. | 0.7.0 |
userId | string | The remote user's user ID. | 0.7.0 |
LogLevel
The log output level. Setting a log level filters the output to show logs at that level and higher.
- 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';TrackMediaType
The media type.
- audio: The media type is audio.
- video: The media type is video.
Type signature
type TrackMediaType = 'audio' | 'video';RemoteTrack
Represents a remote track.
Type signature
interface RemoteTrack {
/**
* The RTMP pull stream URL.
* Note: In v0.7.0, this field is typically used to bind to the `src` attribute of the native <live-player> component.
* If this field is empty or undefined, you may need to specify certain parameters during subscription or obtain the stream URL through another method.
*/
rtmpPullUrl?: string;
}PublishResult
The result of a publish operation.
Type signature
interface PublishResult {
/**
* The RTMP push stream URL.
* Note: In Mini Program environments, the SDK handles publishing automatically. This field is mainly for debugging or advanced scenarios.
* In most cases, you only need to call `publish` and not handle this URL manually.
*/
rtmpPushUrl?: string;
}SubscribeParam
The parameters for subscribing to a remote track.
Type signature
interface SubscribeParam {
/**
* The user ID of the remote user.
* Note: The SDK internally converts this ID to a string.
*/
uid: string;
/**
* The media type to subscribe to.
* 'audio': Subscribes to the audio track only.
* 'video': Subscribes to the video track only.
*/
mediaType: 'audio' | 'video';
/**
* Whether to subscribe to the auxiliary stream (screen sharing).
* `true`: Subscribes to the screen sharing stream.
* `false` or `undefined`: Subscribes to the main stream (camera).
*/
auxiliary?: boolean;
}