Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Room<CALLBACKS>

The Room interface extends the Displayer interface and adds properties for operating a live Interactive Whiteboard room.

Type parameters

Hierarchy

Index

Properties

calibrationTimestamp

calibrationTimestamp: number

The current timestamp (ms) that is calibrated using the server time.

since

2.13.8

callbacks

callbacks: Callbacks<CALLBACKS>

Callbacks. Refer to the following example to set a callback:

example
// Listens for the onSliceChanged callback
function sliceChangeCallback(slice) {

}

// Registers the callback
displayer.callbacks.on("onSliceChanged", sliceChangeCallback);

// Unregisters the callback
displayer.callbacks.off("onSliceChanged", sliceChangeCallback);

// Sets the callback to occur once only
displayer.callbacks.once("onSliceChanged", function(slice) {

});

canRedoSteps

canRedoSteps: number

The number of remaining redoable actions (the number of times redo can be called).

canUndoSteps

canUndoSteps: number

The number of remaining undoable actions (the number of times undo can be called).

deviceType

deviceType: DeviceType

The user's device type, which determines how the SDK handles mouse and touch events.

disableCameraTransform

disableCameraTransform: boolean

Whether to disable the user from adjusting (moving or zooming) the view through touchscreen gestures or mousewheel movement:

  • true: Disable the user from adjusting the view.
  • false: (Default) Enable the user to adjust the view.

Note

This method does not affect the setCameraBound, moveCamera, or moveCameraToContain methods.

disableDeviceInputs

disableDeviceInputs: boolean

Whether to disable the user from operating the whiteboard tools through the mouse, keyboard, or touchscreen:

  • true: Disable the user from operating the whiteboard tools.
  • false: Enable the user to operate the whiteboard tools.

This method is different from isWritable. See Prohibited operation.

disableEraseImage

disableEraseImage: boolean

Whether to disable the eraser from erasing images on the whiteboard:

  • true: Disable the eraser from erasing images.
  • false: Enable the eraser to erase images.
since

2.3.12

disableOthersSelectingBox

disableOthersSelectingBox: boolean

Whether to disable the highlighted box when another user puts their cursor on an object on the whiteboard:

since

2.12.0

  • true: Disable the highlighted box.
  • false: (Default) Enable the highlighted box.

Note

This property does not affect the highlighted box of the local user.

disableSerialization

disableSerialization: boolean

Whether to disable the local serialization:

  • true: Disable the local serialization.
  • false: Enable the local serialization.

The following methods cannot take effect after the setting of disableSerialization(true):

  • redo
  • undo
  • duplicate
  • copy
  • paste
warning

To set disableSerialization as false, ensure that every user in the room uses one of the following SDKs; otherwise, the application may crash:

  • Web SDK v2.9.3 or later
  • Android SDK v2.9.3 or later
  • iOS SDK v2.9.3 or later

enableWriteNow

enableWriteNow: boolean

Whether the user currently has write permission:

since

2.10.0

  • true: The user has write permission.
  • false: The user does not have write permission.

handToolActive

handToolActive: boolean

Whether to enable the hand tool:

  • true: Enable the hand tool.
  • false: Disable the hand tool.

handToolKey

handToolKey: string | undefined

The hotkeys for the hand tool. The user can use the hand tool to move the page. If you set this property to undefined, the hand tool has no hotkeys.

isWritable

isWritable: boolean

Whether the user is in interactive mode in the room:

  • true: In interactive mode, where the user has read and write permissions on the whiteboard.
  • false: In subscription mode, where the user has read-only access to the whiteboard.

observerId

observerId: number

The ID of the user.

In a live Interactive Whiteboard room, observerId is the ID of the local user.

phase

phase: RoomPhase

The connection state of the room. See RoomPhase.

region

region: string

The data center, which supports the following values:

region Data center Service area
us-sv Silicon Valley, United States North America and South America
sg Singapore Singapore, East Asia, and Southeast Asia
in-mum Mumbai, India India
eu Frankfurt, Europe Europe
cn-hz Hangzhou, China Areas not covered by other data centers

roomToken

roomToken: string

The Room Token for user authentication.

screenType

screenType: ScreenType

The user's screen type, which is used to adjust parameters for gesture recognition.

session

session: string

The unique identifier (UUID) of the current session in the room. If you enable the SDK to report logs all the time, this parameter is reported in the logs. If the SDK has not connected to the server when reporting logs, this parameter is shown as undefined.

slice

slice: string

The unique identifier (UUID) of the current slice.

state

state: RoomState

The business status of the room.

timeDelay

timeDelay: number

Sets the delay (ms) for displaying remote whiteboard contents on the local client. The value of timeDelay must be equal to or greater than 0. The default value is 0.

After you set this parameter, when the local user receives the remote whiteboard contents, the SDK delays displaying the contents based on the value of timeDelay.

In scenarios with significant audio and video transmission delays, for example, when using a CDN to distribute audio and video streams, you can use this parameter to delay displaying the received remote whiteboard contents, so as to ensure that the whiteboard contents and the audio and video streams are synchronized.

uid

uid: string

The unique identifier of a user in the room, which is in string format.

useNativeClipboard

useNativeClipboard: boolean

Whether to use the native clipboard:

  • true: Use the native clipboard. The whiteboard shortcuts, such as copy and paste in {@link Hotkeys HotKeys}, will be disabled and replaced with the native copy and paste events.
  • false: (Default) Do not use the native clipboard.
note

This feature requires browser support and user permission to access the clipboard, otherwise it will automatically fall back to a virtual clipboard implementation.

uuid

uuid: string

Room UUID, the unique identifier of a room.

version

version: string

The version of the current SDK.

since

2.13.14

Methods

addMagixEventListener

  • Adds a listener for a customized event.

    You can receive the customized event callback after a successful call of this method.

    Note

    The SDK triggers only one callback for the customized events with the same name.

    Parameters

    • event: string

      The name of the customized event to be listened for.

    • listener: EventListener

      The customized event callback. See EventListener. If you add multiple callbacks for the same event, the callback added later overrides the one added earlier.

    • Optional options: MagixEventListenerOptions

      Since v2.15.2. Options for setting a custom event listener. See MagixEventListenerOptions.

    Returns void

  • Adds a high-frequency listener for a customized event.

    You can receive the customized event callback after a successful call of this method.

    Note

    The SDK triggers only one callback for the customized events with the sane name.

    example
    function listener(events) {
        for (const event of events) {
        }
    }
    displayer.addMagixEventListener("my-event", listener, 100);

    Parameters

    • event: string

      The name of the customized event to be listened for.

    • listener: EventsListener

      The customized events callback. See EventsListener. If you add multiple callbacks for the same event, the callback added later overrides the one added earlier.

    • fireInterval: number

      The interval (ms) at which the SDK triggers the callback. The minimum interval is 500 ms. The SDK automatically adjusts the value smaller than 500 to 500.

    Returns void

bindHtmlElement

  • bindHtmlElement(element: HTMLDivElement | null): void
  • Binds the whiteboard to an HTML container.

    Parameters

    • element: HTMLDivElement | null

      The HTML container for the whiteboard. You can unbind the whiteboard by setting this parameter to null.

    Returns void

cleanCurrentScene

  • cleanCurrentScene(retainPpt?: boolean): void
  • Clears all contents on the current scene.

    Parameters

    • Optional retainPpt: boolean

      Whether to retain the PPT slide:

      • true: (Default) Leave the PPT slide on the scene.
      • false: Clear the PPT slide together with all other contents.

    Returns void

clearUndoHistory

  • clearUndoHistory(includeRedo?: boolean): void
  • Clears the undo history, setting the number of undo steps canUndoSteps to 0 immediately.

    since

    2.16.48

    Parameters

    • Optional includeRedo: boolean

      Whether to clear the redo history as well:

      • true: (default) Clear the redo history as well.
      • false: Do not clear the redo history.

    Returns void

completeImageUpload

  • completeImageUpload(uuid: string, src: string): void
  • Displays an image in the specified image placeholder.

    The method inserts and displays an online image in the specified image placeholder.

    Note

    Ensure that you have called insertImage to insert an image placeholder on the whiteboard.

    Parameters

    • uuid: string

      The unique identifier of the image, which is the image UUID that you pass in ImageInformation of the insertImage method.

    • src: string

      The URL address of the image. Ensure the application client can access the URL; otherwise, the image cannot be displayed.

    Returns void

convertToPointInWorld

  • convertToPointInWorld(point: { x: number; y: number }): { x: number; y: number }
  • Converts the coordinates of a point on the whiteboard.

    This method converts the coordinates of the screen coordinate system (taking the upper left corner as the origin) to the coordinates of the world coordinate system (taking the center of the initial whiteboard as the origin).

    Parameters

    • point: { x: number; y: number }

      The coordinates of the point in the screen coordinate system.

      • x: number

        The X coordinate of the point in the screen coordinate system.

      • y: number

        The Y coordinate of the point in the screen coordinate system.

    Returns { x: number; y: number }

    The coordinates of the point in the world coordinate system.

    • x: number

      The X coordinate of the point in the world coordinate system.

    • y: number

      The Y coordinate of the point in the world coordinate system.

copy

  • copy(): void
  • Copies the selected content.

    Note

    • This method stores the selected content to the memory, but does not paste it to the whiteboard.
    • This method takes effect only when you set disableSerialization as false.
    since

    2.9.0

    Returns void

createInvisiblePlugin

  • Creates an invisible plugin object.

    Type parameters

    Parameters

    • pluginClass: InvisiblePluginClass<K, A, P>

      The class of the invisible plugin.

    • attributes: A

      The attributes of the invisible plugin.

    Returns Promise<InvisiblePlugin<A>>

    The created invisible plugin object.

createScenesCallback

  • Creates a listener object for a scene directory.

    After the listener object is successfully created, when the scenes and subdirectories in the specified scene directory change, the SDK triggers the callbacks you have registered in ScenesCallbacks to report the scene events. When you no longer need the created listener, call dispose to release the listener object.

    note
    • Call this method after joining the whiteboard room.
    • You can create only one listener object for each scene directory. If you need to create a new listener object, you must call dispose to release the created listener object first.

    Parameters

    • path: string

      The path of the scene directory. If you pass in a scene path, the SDK sets the listened object to its parent scene directory.

    • Optional callbacks: Partial<ScenesCallbacks>

      The callbacks to be listened to. See ScenesCallbacks.

    Returns ScenesCallbacksNode | null

    • The ScenesCallbacksNode object if the method call succeeds.
    • null if the method call fails. The method call can fail because the specified scene directory does not exist.

delete

  • delete(): void

disconnect

  • disconnect(): Promise<void>
  • Disconnects from the live Interactive Whiteboard room.

    This method allows the user to leave the room and releases all resources related to the room. The user that has left the room must call joinRoom again to join the room.

    Returns Promise<void>

    • The global state of the room, if the method call succeeds.
    • An error message, if the method call fails.

dispatchMagixEvent

  • dispatchMagixEvent(event: string, payload: any): void
  • Sends a custom event.

    Note

    All users that listen for this event receive the notification.

    Parameters

    • event: string

      The custom event.

    • payload: any

      The content of the custom event.

    Returns void

duplicate

  • duplicate(): void
  • Copies and pastes the selected content into the center of the user view on the whiteboard.

    Note

    • This method takes effect only when you set disableSerialization asfalse.
    • If you call this method multiple times, random offset may occur, which causes the pasted content not to center the user view.
    since

    2.9.0

    Returns void

entireScenes

exportScene

  • exportScene(scenePath: string): Promise<Blob>
  • Exports a scene.

    since

    v2.14.5

    This method can export all contents of a specified scene, including the image or web page displayed on the scene.

    After a successful method call, the SDK exports the contents of the specified scene and saves them as a binary file (Blob object).

    Parameters

    • scenePath: string

      The path of the scene to be exported.

    Returns Promise<Blob>

    The Blob object of the exported scene contents.

fillSceneSnapshot

  • fillSceneSnapshot(scenePath: string, div: HTMLElement, width: number, height: number): void
  • Generates the snapshot of the specified scene.

    Parameters

    • scenePath: string

      The path of the specified scene.

    • div: HTMLElement

      The div for the snapshot.

    • width: number

      The width of the snapshot. This parameter is optional since v2.3.8. If you do not set this parameter, it is set to the width of the div for the snapshot.

    • height: number

      The height of the snapshot. This parameter is optional since v2.3.8. If you do not set this parameter, it is set to the height of the div for the snapshot.

    Returns void

generateScreenshot

  • generateScreenshot(scenePath?: string, width?: number, height?: number): Promise<string>
  • Generates the screenshot of the specified scene.

    Parameters

    • Optional scenePath: string

      The path of the scene. You can get the current scenePath via room.state.sceneState.scenePath.

    • Optional width: number

      The width of the screenshot.

    • Optional height: number

      The height of the screenshot.

    Returns Promise<string>

    The URL address of the screenshot.

    Note

    If the scene displays an image or dynamic PPT slide, ensure that the storage server of the image or the PPT slide supports cross-origin resource sharing; otherwise, the image or PPT slide may not be shown in the generated screenshot.

getInvisiblePlugin

getPluginAttributes

  • getPluginAttributes(identifier: Identifier): any | undefined
  • Gets the attributes of the component plugin object.

    Parameters

    • identifier: Identifier

      The unique identifier of the plugin in the room.

    Returns any | undefined

getPluginRectangle

  • getPluginRectangle(identifier: string): Rectangle | undefined
  • Gets the position of the component plugin object on the whiteboard.

    Parameters

    • identifier: string

      The unique identifier of the plugin in the room.

    Returns Rectangle | undefined

    The rectangle for the component plugin object.

getScene

  • Gets the information about a specified scene.

    Parameters

    • path: string

      The path of a scene. Ensure the scene path stars with / and consists of the scene directory and scene name. For example, /math/classA.

    Returns WhiteScene | undefined

    The information about the specified scene. See WhiteScene.

importScene

  • Imports a scene.

    since

    v2.14.5

    You can call this method to import the contents of a scene exported by the exportScene method.

    Parameters

    • dir: string

      The scene directory to which the scene contents are imported. Ensure that ScenePathType of the scene directory is not conflictï¼›otherwise, the scene cannot be imported. You can use scenePathType to get the path type of the scene directory.

    • payload: Blob

      The Blob object of the scene contents.

    Returns Promise<SceneDefinition>

    A SceneDefinition object, if the method call succeeds. The returned SceneDefinition object includes name of the imported scene. The path of the imported scene is dir+ name. You can call moveScene to change the scene path if needed.

insertImage

  • Inserts an image placeholder on the whiteboard.

    The method sets up and inserts an image placeholder on the whiteboard per imageInfo you pass in.

    You also need to call completeImageUpload to pass in the URL address of the image to insert and display the image in the placeholder.

    Parameters

    Returns void

insertPlugin

  • Inserts a component plugin object to the whiteboard.

    Parameters

    • kind: string

      The type of the component plugin, which is the unique identifier of the plugin.

    • Optional description: PluginDescription

      Description of the component plugin.

    Returns Identifier

    The unique identifier of the plugin in the room.

insertText

  • insertText(x: number, y: number, textContent?: string): Identifier
  • Inserts text at a specified position.

    Parameters

    • x: number

      The X coordinate of the midpoint of the left edge of the first character in the world coordinate system.

    • y: number

      The Y coordinate of the midpoint of the left edge of the first character in the world coordinate system.

    • Optional textContent: string

      The initial text. If you do not pass in a value, the content is empty.

    Returns Identifier

    The identifier of the text in string format.

lockImage

  • lockImage(uuid: string, locked: boolean): void
  • Locks an image.

    When an image is locked, users cannot move or zoom the image.

    Parameters

    • uuid: string

      The unique identifier (UUID) of the image.

    • locked: boolean

      Whether to lock the image:

      • true: Lock the image.
      • false: Do not lock the image.

    Returns void

lockImages

  • lockImages(locked: boolean): void
  • Locks selected images.

    since

    v2.14.5

    This method can modify the locking state of selected images. When an image is locked, users cannot move, zoom, or delete the image.

    Parameters

    • locked: boolean

      Whether to lock selected images:

      • true: Lock the images.
      • false: Unlock the images.

    Returns void

memberState

moveCamera

moveCameraToContain

moveScene

  • moveScene(originalPath: string, targetPath: string): void
  • Moves a scene.

    After a scene is moved, the path of the scene changes.

    Parameters

    • originalPath: string

      The original path of the scene to be moved. It cannot be the path of a scene directory.

    • targetPath: string

      The path of the target scene directory or the target path of the scene under the current directory:

      • If you pass in the path of the target scene directory, the path of the scene changes, but the name of the scene does not change.
      • If you pass in the target path of the scene under the current directory, both the path of the scene and the name of the scene change.

    Returns void

moveSelectedComponentsToBottom

  • moveSelectedComponentsToBottom(): void
  • Moves the selected components to the bottom layer.

    since

    v2.14.5

    Returns void

moveSelectedComponentsToTop

  • moveSelectedComponentsToTop(): void
  • Moves the selected components to the top layer.

    since

    v2.14.5

    Returns void

paste

  • paste(): void
  • Pastes the copied content.

    Note

    • This method pastes the content copied by the copy method into the center of the user view on the whiteboard.
    • This method takes effect only when you set disableSerialization as false.
    • If you call this method multiple times, random offset may occur, which causes the pasted content not to center the user view.
    since

    2.9.0

    Returns void

pptNextStep

  • pptNextStep(): void
  • Plays the next slide of the dynamic PPT file.

    When the current PPT slide finishes playing, the SDK switches to the next scene to play the next PPT slide.

    Returns void

pptPreviousStep

  • pptPreviousStep(): void
  • Returns to the previous slide of the dynamic PPT file.

    When the current PPT slide is rolled back, the SDK switches back to the previous scene to play the previous PPT slide.

    Returns void

putScenes

  • putScenes(path: string, scenes: ReadonlyArray<SceneDefinition>, index?: number): void
  • Inserts multiples scenes under the specified scene directory.

    Note

    This method does not switch the whiteboard scene to any of the newly inserted scenes. You need to call setScenePath to switch to one of the newly inserted scenes.

    Parameters

    • path: string

      The path of the scene directory, which must starts with / and cannot be the path of a scene. For example, "/math".

    • scenes: ReadonlyArray<SceneDefinition>

      An array of scenes. For the files of a single scene, see SceneDefinition.

    • Optional index: number

      The index of the first scene to be inserted under the specified scene directory. The index of a scene under a scene directory starts from 0.

      • If the specified index number is no greater than the index of an existing scene, the new scenes are put before the existing scene corresponding to the specified index number;
      • If the index is greater than the index of any existing scene, the new scenes are put after the last existing scene.
      • If you do not specify the index (because this parameter is optional, you can just omit it), the new scenes are put after the last existing scene.

    Returns void

redo

  • redo(): number
  • Redoes an undone action.

    Note

    This method takes effect only when you set disableSerialization as false.

    Returns number

    The number of remaining redoable actions.

refreshViewSize

  • refreshViewSize(): void
  • Refreshes the whiteboard view.

    When the whiteboardView changes, you need to call this method to refresh the whiteboard view. This method takes effect only when autoResize is set to false.

    Returns void

removeMagixEventListener

  • removeMagixEventListener(event: string, listener?: EventListener): void
  • Removes a listener for a customized event.

    Parameters

    • event: string

      The name of the event.

    • Optional listener: EventListener

      The listener you want to remove. If you do not set this parameter, all listeners for the event are removed.

    Returns void

removePlugin

  • Deletes a component plugin object.

    Parameters

    • identifier: Identifier

      The unique identifier of the plugin in the room.

    Returns boolean

removeScenes

  • removeScenes(path: string): void
  • Deletes a scene or a scene directory.

    Note

    • There must be at least one scene in the live Interactive Whiteboard room. If you delete all scenes, the SDK automatically creates an initial scene with the path of /init.

    • If you delete the current whiteboard scene, the whiteboard displays the last scene under the current scene directory.

    • If you delete a scene directory, all scenes under the directory will be deleted.

    • If you delete the current scene directory, for example, dirA, the SDK executes upward recursive logic to locate the new scene:

      1. If there is a scene directory after the deleted scene directory under the same directory, for example, dirB,the SDK switches the whiteboard scene to the first scene under dirB (with the index of 0).
      2. If there is no scene directory after the deleted scene directory under the same directory, then the SDK looks for scenes under the directory. If there are scenes under the directory, the SDK switches the whiteboard scene to the first scene (with the index of 0).
      3. If there is neither a scene directory after the deleted scene directory nor scenes under the same directory, then the SDK looks for scene directories before the deleted scene directory. If there is a scene directory, for example, dirC, before the deleted dirA, then the SDK switches the whiteboard scene to the first scene under dirC (with the index of 0).

      The SDK continues executing upward recursive logic until a new scene is found.

    Parameters

    • path: string

      The path of a scene or a scene directory. If you pass in the path of a scene directory, this method deletes all scenes under the directory.

    Returns void

scalePptToFit

scenePathType

scenePreview

  • scenePreview(scenePath: string, div: HTMLElement, width: number | undefined, height: number | undefined): void
  • Generates the preview of the specified scene.

    Parameters

    • scenePath: string

      The path of the specified scene.

    • div: HTMLElement

      The div for the preview.

    • width: number | undefined

      The width of the preview. This parameter is optional since v2.3.8. If you do not set this parameter, it is set to the width of the div for the preview.

    • height: number | undefined

      The height of the preview. This parameter is optional since v2.3.8. If you do not set this parameter, it is set to the height of the div for the preview.

    Returns void

screenshotToCanvas

  • screenshotToCanvas(context: CanvasRenderingContext2D, scenePath: string, width: number, height: number, camera: Camera, ratio?: number): void
  • Generates the snapshot and writes it into the specified CanvasRenderingContext2D object.

    Parameters

    • context: CanvasRenderingContext2D

      The CanvasRenderingContext2D object.

    • scenePath: string

      The path of the scene. You can get the current scenePath via room.state.sceneState.scenePath.

    • width: number

      The width of the snapshot.

    • height: number

      The height of the snapshot.

    • camera: Camera

      The description of the view angle. See Camera.

    • Optional ratio: number

      The device pixel ratio. This parameter is optional. If you do not set this parameter, the default value is 1.

    Returns void

screenshotToCanvasAsync

  • screenshotToCanvasAsync(context: CanvasRenderingContext2D, scenePath: string, width: number, height: number, camera: Camera, ratio?: number, timeout?: number): Promise<void>
  • Generates a screen snapshot and writes it into the specified CanvasRenderingContext2D object after the images in the target scene have finished loading.

    note
    • This feature is under experimental stage.
    • If the images in the target scene fail to load, this function cannot return a screen snapshot. You need to handle the timeout logic yourself.
    • If you want to generate a screen snapshot without including images, use screenshotToCanvas.

    Parameters

    • context: CanvasRenderingContext2D

      The CanvasRenderingContext2D object.

    • scenePath: string

      The path of the scene. You can get the current scenePath via room.state.sceneState.scenePath.

    • width: number

      The width of the snapshot.

    • height: number

      The height of the snapshot.

    • camera: Camera

      The description of the view angle. See Camera.

    • Optional ratio: number

      The device pixel ratio. This parameter is optional. If you do not set this parameter, the default value is 1.

    • Optional timeout: number

      The timeout time (ms) for image loading. The default is never to time out and can only be set to a number greater than 0. If the image loading time exceeds this value, the SDK proceeds to the next drawing operation without waiting for the image to complete loading.

    Returns Promise<void>

setCameraBound

setGlobalState

  • Modifies the globalState of the live Interactive Whiteboard room.

    The globalState property of the live Interactive Whiteboard room is a public global variable. All users in the room can read the globalState property, while users in interactive mode can modify the globalState property. The modified globalState will be updated to all users in the room immediately.

    Refer to the following example to modify the globalState property:

    example
    room.setGlobalState({
        foobar: "hello world",
    });

    Set globalState to undefined to delete it:

    example
    room.setGlobalState({
        foobar: undefined,
    });

    Parameters

    • modifyState: Partial<GlobalState>

      The globalState property.

    Returns GlobalState

    The modified globalState.

setMemberState

  • Modifies the state of the whiteboard tool.

    A successful call of this method updates the MemberState of the room immediately.

    Refer to the following example to modify MemberState:

    example
    room.setMemberState({
        foobar: "hello world",
    });

    Set MemberState to undefined to delete it:

    example
    room.setMemberState({
        foobar: undefined,
    });

    Parameters

    Returns MemberState

    The modified state.

setSceneIndex

  • setSceneIndex(index: number): void
  • Switches to the specified scene under the current scene directory.

    A successful call of this method switches the whiteboard scene to the specified scene.

    Note

    The specified scene must exist in the current scene directory; otherwise, the method call fails.

    Parameters

    • index: number

      The index of the target scene in the current scene directory.

    Returns void

setScenePath

  • setScenePath(scenePath: string): void
  • Switches to the specified scene.

    A successful call of this method switches the whiteboard scene to the specified scene.

    Note

    This method call is synchronous.

    The scene switch may fail due to the following reasons:

    • The specified scene path is invalid. Ensure the scene path stars with / and consists of the scene directory and scene name.
    • The specified scene does not exist.
    • The path passed in is the path of the scene directory, not the path of the scene.

    Parameters

    • scenePath: string

      The path of the scene that you want to switch to. Ensure the scene path stars with / and consists of the scene directory and scene name. For example, /math/classA.

    Returns void

setViewMode

  • Sets the view mode of the user.

    In the live Interactive Whiteboard room, you can set one of the following view modes for a user:

    • Broadcaster: Host mode.
    • Follower: Follower mode.
    • Freedom: (Default) Freedom mode.

    Note

    The view mode setting of a user is affected by the view mode setting of other users in the room as follows:

    • When there is no host in the room, all users are in Freedom view mode by default.
    • When a user’s view mode is set as Broadcaster, the view mode of every other user in the room (including users that join subsequently) is automatically set as 'Follower'.
    • When a user in Follower view mode operates the whiteboard, their view mode automatically switches to Freedom mode.

    Parameters

    Returns void

setWritable

  • setWritable(isWritable: boolean): Promise<void>
  • Sets whether a user is in interactive mode in the room.

    Parameters

    • isWritable: boolean

      Whether the user is in interactive mode:

      • true: The user is in interactive mode (has read and write permissions on the whiteboard).
      • false: The user is in subscription mode (has read-only access to the whiteboard).

    Returns Promise<void>

stopBlockTimestamp

  • stopBlockTimestamp(): void
  • Cancels the Unix timestamp (ms) for displaying remote whiteboard contents on the local client, which is set by syncBlockTimestamp.

    since

    2.13.8

    Returns void

syncBlockTimestamp

  • syncBlockTimestamp(timestamp: number): void
  • Sets the Unix timestamp (ms) for displaying remote whiteboard contents on the local client.

    since

    2.12.11

    After you call this method, the SDK displays the received remote whiteboard contents based on the value of timestamp you set in this method.

    In scenarios where users subscribe to audio and video streams and whiteboard contents at the same time, you can obtain time information from the SEI frame attached to the audio and video streams, and call this method to set the local display time for the remote whiteboard contents, so as to ensure audio and video streams and the whiteboard contents are synchronized in real time.

    Parameters

    • timestamp: number

      The Unix timestamp (ms) for displaying remote whiteboard contents on the local client.

    Returns void

undo

  • undo(): number

updatePlugin

  • Updates the description of the component plugin object.

    Parameters

    Returns boolean

updateSelectedText

  • Modifies the font style of the currently selected text.

    After selecting some text, you can call this method to modify the font size, color, bold style, and italic style of the text.

    Parameters

    Returns void

updateText

  • updateText(identifier: Identifier, textContent: string): void
  • Modifies the specified text.

    After calling insertText, you can call this method and pass in the identifier returned by the insertText method to modify the content of the specified text.

    Parameters

    • identifier: Identifier

      The identifier of the text, which is the return value of insertText.

    • textContent: string

      The new text.

    Returns void

waitMagixEvent