This topic describes the WhiteboardManager interface for the DingRTC Web Whiteboard software development kit (SDK).
Properties
Property | Type | Description | Minimum supported version |
isConnected | boolean | Indicates whether the SDK instance is connected to the server. | 1.0.1 |
API List
API | Description | Minimum supported version |
Gets a whiteboard instance. | 1.0.1 | |
Gets an annotation instance. | 1.0.2 | |
Joins a channel. Use this method when using the whiteboard feature independently. | 1.0.1 | |
Leaves a channel. Use this method when using the whiteboard feature independently. | 1.0.1 | |
Clears the local cache of whiteboard or annotation instances. Call this method when you leave a channel. | 1.0.2 | |
Cancels the listener callback for a specified event. | 1.0.1 | |
Listens for a specified event and sets a callback function. | 1.0.1 | |
Listens for a specified event once. The callback function is removed after it is triggered. | 1.0.1 | |
Cancels the listener callbacks for a specified event or all events on the object. | 1.0.1 |
Events
DingRTC global events
Event | Callback type | Description | Minimum supported version |
(whiteboardId: string) => void; | A new whiteboard is created in the channel. | 1.0.1 | |
(whiteboardId: string) => void; | A whiteboard is closed in the channel. | 1.0.1 | |
(annotationId: string, sourceType: 'video' | 'share' | 'external') => void; | A new annotation is created in the channel. | 1.0.2 | |
(annotationId: string, sourceType: 'video' | 'share' | 'external') => void; | An annotation is closed in the channel. | 1.0.2 | |
(curState:ConnectionState, revState:ConnectionState, reason?:DisconnectedReason) => void | The callback that is triggered when the connection state between the SDK and the server changes. | 1.0.1 |
Method details
getWhiteboard()
Retrieves a whiteboard instance.
Type signature
getWhiteboard(whiteboardId: string): RTCWhiteboard;Parameters
Parameter | Type | Description |
whiteboardId | string | The whiteboard ID. The ID can contain only letters, digits, underscores (_), and hyphens (-). The ID can be up to 64 characters in length. |
Returns
RTCWhiteboard
getAnnotation()
Retrieves an annotation instance.
Type Signature
getAnnotation(annotationId: string, sourceType: 'video' | 'share' | 'external'): RTCWhiteboard;Parameters
Parameter | Type | Description |
annotationId | string | The annotation ID. The ID can contain only letters, digits, underscores (_), and hyphens (-). The ID can be up to 64 characters in length. If `sourceType` is `video` or `share`, include the UID of the user who owns the annotated video stream in the `annotationId`. |
sourceType | 'video' | 'share' | 'external' | `video`: The annotation belongs to a camera video stream. `share`: The annotation belongs to a shared stream. `external`: The annotation belongs to a user-defined source. |
Returns
RTCWhiteboard
join()
Joins a channel so that users in the same channel can communicate. Use this method only when using the whiteboard feature independently. Do not call this method if you use the whiteboard feature with DingRTC.
Type signature
join(joinInfo: JoinParam): Promise<void>;Parameters
Parameter | Type | Description |
joinInfo | The parameters required to join a channel. |
Returns
Promise<void>
leave()
This method leaves a channel. Call this method only when you use the whiteboard feature independently. Do not call this method if you use the whiteboard feature with DingRTC.
Type signature
leave(): void;
Back
void
clear()
Call this method when you leave a channel to clear the local cache of whiteboard or annotation instances.
Type signature
clear(): void;
Returns
void
on()
Listens for a specified event and sets a callback.
Type signature
on(event: string, fn: Function): void;
Parameters
Parameter | Type | Description |
event | string | The event to listen for. |
fn | Function | The callback function that is triggered when the event occurs. |
Returns
void
off()
Removes the listener callback for a specified event.
Signature
off(event: string, fn: Function): void;
Parameters
Parameter | Type | Description |
event | string | The event to listen for. |
fn | Function | The callback function that is triggered when the event occurs. |
Back
void
once()
Listens for a specified event. The callback function is triggered only once and then removed.
Type Signature
once(event: string, fn: Function): void;
Parameters
Parameter | Type | Description |
event | string | The event to listen for. |
fn | Function | The callback function that is triggered when the event occurs. |
Returns
void
removeAllListeners()
Unregisters 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, the corresponding listener callbacks are cleared. If you do not specify this parameter, the listener callbacks for all events on the object are cleared. |
Back
void
Event details
"whiteboard-start"
A new whiteboard appears in the channel.
Signature
'whiteboard-start': (whiteboardId: string) => void;Example
WhiteboardManager.on('whiteboard-start', (whiteboardId) => {
console.log(whiteboardId);
});"whiteboard-stop"
A whiteboard in the channel has been closed.
Signature
'whiteboard-stop': (whiteboardId: string) => void;Example
WhiteboardManager.on('whiteboard-stop', (whiteboardId) => {
console.log(whiteboardId);
});"annotation-start"
A new annotation appears in the channel.
Type Signature
'annotation-start': (annotationId: string, sourceType: 'video' | 'share' | 'external') => void;Example
WhiteboardManager.on('annotation-start', (annotationId, sourceType) => {
console.log(annotationId, sourceType);
});"annotation-stop"
An annotation in the channel has been closed.
Type signature
'annotation-stop': (annotationId: string, sourceType: 'video' | 'share' | 'external') => void;Example
WhiteboardManager.on('annotation-stop', (annotationId, sourceType) => {
console.log(annotationId, sourceType);
});"connection-state-change"
This callback is triggered when the connection state between the SDK and the server changes. You only need to listen for this event when using the whiteboard feature independently, not when using it with DingRTC.
Type signature
'connection-state-change': (curState: ConnectionState, prevState: ConnectionState, reason?: DisconnectedReason) => void;Example
WhiteboardManager.on('connection-state-change', (curState, prevState, reason) => {
console.log(curState, prevState, reason);
});