By default, any user who enters the room can operate the whiteboard. But sometimes, business scenarios need to restrict the operation permissions of different users who join the room.
Up to this chapter, we assume that you have installed the Netless interactive whiteboard SDK and introduced the project, and have obtained the real-time room instance room
object. If not, you may have skipped the previous chapters. It is strongly recommended to read 《Install》, 《Real-time Room》 first.
Even if a line of code is not written, users can write and draw on the whiteboard through their own devices. For example, PC users can operate with a mouse, while mobile users can operate with a touch screen. If you want to prohibit this behavior, you can use the following code to achieve.
room.disableDeviceInputs = true;
You can also use the following code to cancel the prohibition of device operation.
room.disableDeviceInputs = false;
Prohibiting device operations only prohibits users from autonomously inputting operations through the device, but does not prohibit changing the state of the room through codes. For example, you can still actively call the setMemberState
method to modify the room state, you can insert a picture, you can insert a PPT.
Netless interactive whiteboard allows to join the room in "read only mode". The following operations are attached to the room when joining the room, declaring to join in read-only mode.
whiteWebSdk.joinRoom({
uuid: "The uuid of the room",
roomToken: "room token of the room",
isWritable: false, // Declare to join the room in read-only mode, the default value is true
});
You can also switch from interactive mode to read-only mode by calling the following method.
room.setWritable(false).then(function() {
// switch successfully
}).catch(function(err) {
// switch failed, error err
});
In the read-only mode, users cannot write or draw on the whiteboard by means of device operation, and cannot change the status of the whiteboard with codes. He is like a spectator, unable to have any influence on the rest of the room.
You can switch back to interactive mode from read-only mode by calling the following method.
room.setWritable(true).then(function() {
// switch successfully
}).catch(function(err) {
// switch failed, error err
});
Netless interactive whiteboard, in the same room, the maximum number of users in interactive mode is 50. If the upper limit is exceeded, the room will prevent users in the next interactive mode from joining. However, there are no restrictions on users in read-only mode.
If your business scenario is special, please allocate the quotas for read-only mode and interactive mode reasonably. For example, someone’s business scenario is a large public class with 5 teachers and 50,000 students. Five of the teachers can operate the whiteboard, but the students do not have the authority to operate the whiteboard and can only watch the teacher's operation results.
This kind of business scenario can set 5 teachers to interactive mode and 50,000 students to read-only mode. If the teachers and students are set to interactive mode by default without thinking, obviously, the room cannot accommodate so many students to join.
Prohibiting device operations is only a lightweight mode. Even if device operations are prohibited, the current user still belongs to the interactive mode.
In addition, the billing for read-only mode and interactive mode are different. If you set all users into an interactive mode without thinking, you may have to pay some unnecessary fees.