Whiteboard operation
Readonly
Starting from 2.2.0, the API can be replaced by the following two APIs:
- Perspective locking API:
disableCameraTransform
(for details, please refer to Perspective Operations -> Locking Perspective); - Disable tool API:
disableDeviceInputs
(for details, please refer to tool operation -> disable tool)
/// room.d.ts
// Disable responding to user gestures
room.disableOperations = true;
// Respond to user gestures
room.disableOperations = false;
Read-only mode
2.6.0 and higher supported
After entering the room in read-only mode, it can only receive information synchronized by other people, and cannot operate teaching aids and modify room status. People entering the room in read-only mode cannot be detected by others, nor can they appear in the room member list.
To join a room in read-only mode, you can add the following parameters when joining the room:
whiteWebSdk.joinRoom({
uuid: "room-uuid",
roomToken: "room-token",
isWritable: false, // Join a room in read-only mode
});
After joining the room, you can switch to read-only mode by:
room.setWritable (false) .then (function () {
// success
}). catch (function (error) {
// fail
});
After joining the room, you can switch to writable mode as follows:
room.setWritable(true).then(function() {
// success
}).catch(function (error) {
// fail
});
Customize GlobalState
globalState
is currently an Object
. Developers can insert their own fields in globalState
to share the state information required by their business throughout the room.
// Just pass in the fields that need to be updated and return the complete new GlobalState
const newGlobalState = room.setGlobalState({key: "newValue"});
- Note
globalState
is only for lightweight use, the storage content is as small as possible (recommended within 100KB), when updating, only the fields that need to be updated inGlobalState
are passed in.
Zoom
Starting with 2.2.0, this API is no longer recommended. New API provides animation options, please refer to Viewpoint Operation -> Adjust Viewpoint
The user can zoom out the whiteboard with gestures.
On the other hand, SDK also supports zooming with zoomChange
.
///displayer.d.ts
// "room" & "player" for public use
// Proportion to original whiteboard size
room.zoomChange(3);
// Get the current zoom ratio
let scale = room.state.zoomScale;
Active delay
//room.d.ts
// Delay 1 second
room.timeDelay = 1000;
// Get active delay time of whiteboard
let delay = room.timeDelay;
Use the room.timeDelay
method to quickly set the whiteboard delay. You can artificially add a delay to the whiteboard to delay playback.
- Note
- The parameter unit is millisecond.
- This method works only for local clients.
- This method also affects custom events.
- The user draws locally and still appears in real time.
Clear screen
///room.d.ts
/**
* Clear the current screen content
* @param retainPPT Whether to keep ppt
*/
let retainPpt = true;
room.cleanCurrentScene(retainPpt);
Active disconnection
///room.d.ts
await room.disconnect();
//... Successfully disconnected