When you enter a whiteboard room, you see a page that extends infinitely in all directions. Agora Interactive Whiteboard calls this page a scene. On a scene, you can write and draw, insert an image, and present a dynamic PPT slide. In a whiteboard room, you can add multiple scenes, switch between scenes, and move a scene. These capabilities enable you to implement advanced functions such as displaying a complete PPT file on the whiteboard.
This page introduces the scene structure, scene identification, the contents that can be displayed on a scene, and the rules for adding, deleting, and modifying a scene. Once you grasp these basic concepts, you can build an interactive whiteboard application with multiple scenes according to your business needs.
An Agora Interactive Whiteboard room can have scene directories and scenes, which are organized in a tree structure. A newly created Agora Interactive Whiteboard room contains a root scene directory and an initial scene by default. By using the APIs provided by the Whiteboard SDK, you can insert multiple scene directories or scenes in the room. Under a scene directory there can be subdirectories or scenes.
The whiteboard room supports displaying a specific scene, but not a scene directory. The room can display one scene at a time.
The following schematic diagram shows an example scene structure of an Agora Interactive Whiteboard room:
In an Agora Interactive Whiteboard room, each scene or scene directory has a unique path in string format as its identifier. The path of a scene or scene directory is the path of its direct parent node plus the name of the scene or scene directory. The scene or scene directory path must begin with /
and use /
to separate the scene hierarchy.
Note the following:
/
and the path of the initial scene is /init
./
is used to separate scene directories, do not include any /
symbols in scene names.For example, if you insert a scene directory named Math
that contains scenes ClassA
and ClassB
in the root directory, then the paths of the new scene directory and scenes are as follows:
/Math
/Math/ClassA
/Math/ClassB
The order of scenes in a scene directory is identified by the index number, which starts from 0. By specifying the index number, you can switch to a specific scene or insert a new scene at a specific location.
On a whiteboard scene, in addition to writing and drawing by using the whiteboard tools, you can also display images or web pages in the following formats:
By calling APIs of the whiteboard SDK, you can add, delete, and move scenes. The rules for managing a scene are as follows:
Adding scenes
When you add a new scene, the SDK performs one of the following operations, depending on the path of the new scene:
Deleting scenes
The root directory in a whiteboard room cannot be deleted and each room must have at least one scene. When all scenes and subdirectories in a scene directory are deleted, the scene directory is deleted along with them; when all scenes in a whiteboard room are deleted, the SDK automatically creates an initial scene with the path /init
.
Moving scenes
Scenes are ordered, but scene directories are not. You can call the API to move a specified scene, but you cannot change the position of a scene directory through the API.
Scenes example
The following example demonstrates the rules for adding and deleting scenes:
Assuming the current whiteboard room is new, it has only the root scene directory / and the scene /init
.
When you add a new scene with the path /math/class-A
, the SDK automatically creates a scene directory with the path /math
.
Subsequently, when you add a new scene with path /math/class-B
, the SDK directly adds the new scene to the /math
scene directory.
When you delete the /math/class-A scene
, the SDK removes the scene class-A
from the /math
scene directory.
After that, when you delete the /math/class-B
scene, the SDK automatically deletes the /math
scene directory because all the scenes in that directory are deleted.