API list
API | Description | Minimum supported version |
Creates a video track from the video captured by a camera. | 1.0.0 | |
Creates a client instance for RTC communication. | 1.0.0 | |
Creates a custom audio track. Use this method to convert a MediaStreamTrack that you maintain into an audio track for the SDK. | 1.0.0 | |
Creates a custom video track. Use this method to convert a MediaStreamTrack that you maintain into a video track for the SDK. | 1.0.0 | |
Creates a microphone audio track and a camera video track at the same time. This method creates an audio track from microphone input and a video track from camera input. | 1.0.0 | |
Creates an audio track from the audio captured by a microphone. | 1.0.0 | |
Creates an audio track to handle speaker-related operations. | 1.0.0 | |
Creates a video track for screen sharing. | 1.0.0 | |
Enumerates available video input devices, such as cameras. If the call is successful, the SDK returns the available video input devices as MediaDeviceInfo objects. | 1.0.0 | |
Enumerates available media input and output devices, such as microphones, cameras, and headsets. If the call is successful, the SDK returns the available media devices as MediaDeviceInfo objects. | 1.0.0 | |
Enumerates available audio input devices, such as microphones. If the call is successful, the SDK returns the available audio input devices as MediaDeviceInfo objects. | 1.0.0 | |
Enumerates available audio playback devices, such as speakers. If the call is successful, the SDK returns the available audio playback devices as MediaDeviceInfo objects. | 1.0.0 | |
Gets a list of shareable screen and window objects. | 1.0.0 | |
Sets the SDK integration options. | 1.0.0 | |
The absolute path of the folder where log files are saved. This parameter is a folder path, not a file path. | 1.0.0 | |
Sets the log output level of the SDK. | 1.0.0 | |
Cancels the listener callback function for a specified event. | 1.0.0 | |
Listens for a specified event and sets a callback function. | 1.0.0 | |
Listens for a specified event once. The callback function is removed after it is triggered. | 1.0.0 | |
Cancels the listener callbacks for a specified event or all events of the object. | 1.0.0 |
Event list
DingRTC global events
Event | Callback type | Description | Minimum supported version |
(track:LocalTrack|RemoteTrack) => void | Audio autoplay failed. | 1.0.0 | |
(info:Data type) => void | The status of the video capture device changed. | 1.0.0 | |
(info:Data type) => void | The status of the audio capture device changed. | 1.0.0 | |
(info:Data type) => void | The audio playback device changed. | 1.0.0 |
API details
createClient()
Creates a client instance for RTC communication.
Type Signature
createClient(): DingRTCClient;
Returns
getCameras()
Enumerates available video input devices, such as cameras. A successful call returns an array of MediaDeviceInfo objects.
Type Signature
getCameras(): Promise<MediaDeviceInfo[]>;
Returns
Returns an array of MediaDeviceInfo objects for all available local video input devices.
getPlaybackDevices()
Enumerates available audio playback devices, such as speakers. A successful call returns an array of MediaDeviceInfo objects.
Type Signature
getPlaybackDevices(): Promise<MediaDeviceInfo[]>;
Returns
Returns an array of MediaDeviceInfo objects for all available local audio playback devices.
getScreenCaptureSources()
Retrieves a list of shareable screen and window objects.
Type Signature
getScreenCaptureSources(includeScreen?: boolean): ScreenCaptureSourceInfo[]Parameter | Type | Description |
includeScreen | boolean | Specifies whether to get the list of screens. The default value is false. |
Returns
Returns an array of ScreenCaptureSourceInfo objects for all local screen information.
getDevices()
Enumerates available media input and output devices, such as microphones, cameras, and headsets. A successful call returns an array of MediaDeviceInfo objects.
Type signature
getDevices(): Promise<MediaDeviceInfo[]>;
Returns
Returns an array of MediaDeviceInfo objects for all available local media devices.
getMicrophones()
Enumerates available audio input devices, such as microphones. A successful call returns an array of MediaDeviceInfo objects.
Type signature
getMicrophones(): Promise<MediaDeviceInfo[]>;
Returns
Returns an array of MediaDeviceInfo objects for all available local audio input devices.
createCameraVideoTrack()
Creates a video track from the video captured by a camera.
Type signature
createCameraVideoTrack(config: CameraVideoTrackConfig): Promise<CameraVideoTrack>;
Parameter | Type | Description |
config | The configuration for video capture, including the capture device and encoding settings. |
Back
Promise<CameraVideoTrack>
Camera track
createMicrophoneAudioTrack()
Creates an audio track from the audio captured by a microphone.
Type signature
createMicrophoneAudioTrack(config?: MicrophoneAudioTrackConfig): Promise<MicrophoneAudioTrack>;
Parameters
Parameter | Type | Description |
config | (Optional) The configuration for microphone audio capture, including the capture device and audio encoding settings. |
Returns
Promise<MicrophoneAudioTrack>
Audio track
createPlaybackAudioTrack()
Creates an audio track to handle speaker-related operations.
Type signature
createPlaybackAudioTrack(
config?: PlaybackAudioTrackConfig,
): Promise<PlaybackAudioTrack>Parameters
Parameter | Type | Description |
config | (Optional) The configuration for audio captured by the microphone, including the capture device and audio encoding configuration. |
Back
Promise<PlaybackAudioTrack>
The playback audio track object.
createCustomVideoTrack()
Creates a custom video track. You can use this method to convert a MediaStreamTrack object that you manage into a video track for the SDK.
Type Signature
createCustomVideoTrack(config: CustomVideoTrackConfig): Promise<LocalVideoTrack>;
Parameters
Parameter | Type | Description |
config | The configuration for the custom video track. |
Returns
Promise<LocalVideoTrack>
The custom video track object.
createCustomAudioTrack()
Creates a custom audio track. You can use this method to convert a MediaStreamTrack object that you manage into an audio track for the SDK.
Type signature
createCustomAudioTrack(config: CustomAudioTrackConfig): Promise<LocalAudioTrack>;
Parameters
Parameter | Type | Description |
config | The configuration for the custom audio track. |
Returns
Promise<LocalAudioTrack>
The custom audio track object.
createScreenVideoTrack()
Creates a video track for screen sharing.
Type signature
createScreenVideoTrack(config: ScreenVideoTrackConfig): Promise<LocalVideoTrack[]>;
Parameters
Parameter | Type | Description |
config | The video configuration for screen sharing, including encoding and collection configurations. |
Back
Promise<LocalVideoTrack[]>
Returns an array that contains the video track for screen sharing.
createMicrophoneAndCameraTracks()
Simultaneously creates an audio track from a microphone and a video track from a camera.
Signature
createMicrophoneAndCameraTracks(videoConfig: CameraVideoTrackConfig, audioConfig: MicrophoneAudioTrackConfig): Promise<(CameraVideoTrack | MicrophoneAudioTrack)[]>;
Parameters
Parameter | Type | Description |
videoConfig | The audio capture configuration includes the capture device and the encoding configuration. | |
audioConfig | Specifies the configuration for video capture, including the capture device and the encoding configuration. |
Returns
Promise<(CameraVideoTrack|MicrophoneAudioTrack)[]>
The created audio and video track objects.
setClientConfig()
Sets the SDK integration options.
Type signature:
setClientConfig(config: GlobalClientConfigInfo): void;
Parameters
Parameter | Type | Description |
config | Configuration parameters. |
Returns
void
setLogDirPath()
Sets the storage path for SDK log files.
Type Signature
setLogDirPath(logDirPath: string): voidParameters
Parameter | Type | Description |
logDirPath | string | The absolute path of the folder where log files are saved. This parameter is a folder path, not a file path. |
Back
void
setLogLevel()
Sets the log output level of the SDK.
Type Signature
setLogLevel(level: LogLevel): void;
Parameters
Parameter | Type | Description |
level | The log output level. |
Returns
void
on()
Registers a listener for a specified event.
Type signature
on(event: string, fn: Function): void;
Parameters
Parameter | Type | Description |
event | string | The specified event to listen for. |
fn | Function | The callback function to run when the event is triggered. |
Returns
void
off()
Removes the listener for a specified event.
Type Signature
off(event: string, fn: Function): void;
Parameters
Parameter | Type | Description |
event | string | The specified event to listen for. |
fn | Function | The callback function to run when the event is triggered. |
Returns
void
once()
Registers a one-time listener for a specified event. The listener is removed after it is triggered once.
Type signature
once(event: string, fn: Function): void;
Parameters
Parameter | Type | Description |
event | string | The specified event to listen for. |
fn | Function | The callback function to run when the event is triggered. |
Returns
void
removeAllListeners()
Cancels the listener callbacks for a specified event or all events on the object.
Type signature
removeAllListeners(event?: string): void;
Parameters
Parameter | Type | Description |
event | string | (Optional) If you specify an event, its listener callback functions are cleared. If you omit this parameter, the listener functions for all events of the object are cleared. |
Returns
void
Event details
"autoplay-failed"
Audio autoplay failed.
Type Signature
'autoplay-failed': (track: LocalTrack|RemoteTrack) => void;
Example
DingRTC.on('autoplay-failed', (track) => {
console.log(track);
});"camera-changed"
The video capture device's status changed.
Type signature
'camera-changed': (info: DeviceInfo) => void;
Example
DingRTC.on('camera-changed', (info) => {
console.log(info);
})"microphone-changed"
The state of the audio capture device has changed.
Type signature
'microphone-changed': (info: DeviceInfo) => void;
Example
DingRTC.on('microphone-changed', (info) => {
console.log(info);
})
"playback-device-changed"
The audio playback device has changed.
Type Signature
'playback-device-changed': (info: DeviceInfo) => void;
Example
DingRTC.on('playback-device-changed', (info) => {
console.log(info);
});