Fastboard API
This page provides the API reference for the Fastboard SDK.
FastboardView class
getFastboard
Get the Fastboard
object.
The Fastboard SDK does not support initializing a Fastboard
instance directly. To get the Fastboard
object, you need to add the FastboardView
object to the app's layout, and then call the getFastboard
method.
Note
Call this method to obtain the Fastboard
object before calling other APIs.
Returns
The Fastboard
object is returned when the method call is successful.
Fastboard class
The Fastboard class provides methods for creating FastRoom
objects.
createFastRoom
Create a FastRoom
object.
Note
Call this method after obtaining the Fastboard
object.
Parameters
roomOptions
: Configuration options for the whiteboard room. See FastRoomOptions for details.
Returns
A FastRoom
object is returned when the method call is successful.
preloadWhiteboardView
Preload the whiteboard view.
This method only takes effect when autoPreload
in FastboardConfig
is set to false
. Successfully calling this method will consume memory to perform one whiteboard view preload, improving the speed of joining rooms next time.
destroy
Destroy the room and release resources.
setConfig
Modifies the auxiliary configuration of the Fastboard
object.
Parameters
config
: The auxiliary configuration of theFastboard
object. See FastboardConfig.
FastRoomOptions
Whiteboard room configuration options.
The FastRoomOptions
class contains the following properties:
appId
: String. App Identifier for the interactive whiteboard project. For details, see Get security credentials for your whiteboard project.uuid
: String. The UUID of the room, which is the unique identifier of the room. For details, see Create a room (POST) for the value of theuuid
parameter in the response package body after the request is successful.token
: String. Room Token of the room, used for user authentication when joining the room. It can be obtained in the following ways:- Call the Generate a room token (POST) RESTful API.
- Build a token generator at your app server. See Generate a token at app server.
uid
: String. The unique identifier of a user in string format. The maximum length is 1,024 bytes. Ensure that theuid
of each user in the same room is unique.writable
: boolean. Whether the user joins the whiteboard room in interactive mode:true
: Join the whiteboard room in interactive mode, that is, with read and write permissions.false
: Join the whiteboard room in subscription mode, that is, with read-only permission.
fastRegion
: The data center, which must be the same as the data center you chose when creating the whiteboard room. See FastRegion.
- Call the Generate a room token (POST) RESTful API.
containerSizeRatio
: Float. In the local display window, the aspect ratio of the content is0.56
by default, which is9:16
.userPayload
: User information displayed by the user's cursor, including the user's nickname and avatar. SeeFastUserPayload
for details.
FastRegion
Data center, containing the following enumeration values:
-
CN_HZ
: Hangzhou, China, the service area covers East Asia, Southeast Asia, and other areas not covered by the data center. -
US_SV
: Silicon Valley, USA, the service area covers North America and South America. -
SG
: Singapore, the service area covers Singapore, East Asia, and Southeast Asia. -
IN_MUM
: Mumbai, India, the service area covers India. -
EU
: London, UK, the service area covers Europe.
FastUserPayload
FastUserPayload
object, used to store the user information displayed on the cursor, contains the following member variables:
-
nickName
: String. The user's nickname displayed on the user's cursor. -
avatar
: String. (Optional) The user avatar displayed on the user cursor, the URL address corresponding to the avatar should be passed in.
FastboardConfig
The auxiliary configuration class of the Fastboard
object, including the following attributes:
enablePreload
: Boolean. Whether to enable whiteboard preloading:true
: Enable whiteboard preloading.false
: (Default) Disable whiteboard preloading.
preloadCount
: Integer. The number of WebViews to preload, defaults to0
. The actual effect of this attribute is limited by the memory capacity. You need to adjust the settings appropriately according to the actual situation.autoPreload
: Boolean. This property only takes effect whenenablePreload
istrue
. Whether to enable automatic preloading:true
: (Default) Enable automatic preloading. After enabling, whiteboard views will be automatically preloaded to improve loading speed, but will occupy additional memory.false
: Disable automatic preloading. After disabling, you can callpreloadWhiteboardView
to manually perform preloading.
FastRoom class
The FastRoom
class provides methods for managing interactive whiteboard real-time rooms.
join [1/2]
Join a whiteboard room.
Note
This method needs to be called after the FastRoom
object is successfully created.
join [2/2]
Join a whiteboard room.
Note
This method needs to be called after the FastRoom
object is successfully created.
Parameters
onRoomReadyCallback
: OnRoomReadyCallback interface instance. Passing innull
means not to register the interface.
OnRoomReadyCallback
The OnRoomReadyCallback
interface is used to send room event notifications to the app and includes the following member methods:
Room ready callback.
Parameters
fastRoom
:FastRoom
object.
isReady
Get whether the room is ready.
After calling the join
method, you need to call this method to get whether the room is ready. After the room is ready, other methods in the FastRoom
class can be called to operate the whiteboard.
Returns
Is the room ready?
true
: ready.false
: Not ready yet.
isWritable
Get whether the local user's current interactive whiteboard real-time room is in interactive mode.
Returns
Get whether the local user is in interactive mode:
true
: interactive mode, that is, with read and write permissions.false
: Subscription mode, that is, with read-only permissions.
redo
Redo, that is, roll back the undo operation.
setWritable [1/2]
Set whether the user is in interactive mode in the room.
Note
This method needs to be called after the room is ready.
Parameters
writable
: whether the user is in interactive mode in the room:true
: interactive mode, that is, with read and write permissions.false
: Subscription mode, that is, with read-only permissions.
setWritable [2/2]
Set whether the user is in interactive mode in the room.
Note
This method needs to be called after the room is ready.
Parameters
writable
: whether the user is in interactive mode in the room:true
: interactive mode, that is, with read and write permissions.false
: Subscription mode, that is, with read-only permissions.
result
: The result of thesetWritable
method call. See FastResult for details. Passing in theFastResult
instance, the SDK will trigger the callback implemented in theFastResult
interface and report whether thesetWritable
method call is successful; passing innull
means not to listen to the callback.
registerApp
Registers a third-party window application to the whiteboard room.
This method allows you to register external applications that can run as independent windows within the whiteboard.
Registration supports two methods:
- Local script registration: Uses local JavaScript code (recommended for its high reliability)
- Remote package registration: Uses a remote URL (may fail due to network issues)
- You must complete the registration before joining the room to ensure the application loads correctly.
- Ensure that all clients use the same version of the application to avoid runtime issues.
- Register the application before joining the room.
- Registered applications can be added to the room using
getRoom().addApp()
.
Parameters
params
: Registration parameters, including app configurations. See FastRegisterAppParams for details.result
: The result of theregisterApp
method call. See FastResult for details. If you pass aFastResult
instance, the SDK triggers the callback implemented in theFastResult
interface to report whether theregisterApp
method call was successful. Passingnull
means the callback is not listened to.
FastRegisterAppParams
A configuration class for registering third-party window app parameters.
The FastRegisterAppParams
class provides two registration methods:
- Local script registration: Registers using a local JavaScript string (recommended for its high reliability)
- Use the
FastRegisterAppParams(String javascriptString, String kind, String variable, Map<String, Object> appOptions)
constructor
- Use the
- Remote package registration: Registers using a published package's URL (may fail due to network issues)
- Use the
FastRegisterAppParams(String url, String kind, Map<String, Object> appOptions)
constructor
- Use the
The FastRegisterAppParams
class includes the following properties:
javascriptString
: String. Local JavaScript script code for local script registration.kind
: String. The name of the registered app, representing the type name of the app.url
: String. The URL address of the remote registration package for remote package registration.appOptions
: Map<String, Object>. Parameters passed during the initialization of the app instance. This configuration is not synchronized to other clients and is considered a local setting, often used to toggle debug mode.variable
: String. The variable name mounted on the window, appearing aswindow.variable
after mounting.
undo
Undo the previous operation.
setStrokeColor
Set the line color.
Parameters
color
: Integer. Line color, RGB format, for example0x0000FF
means blue
setAppliance
Set the currently used whiteboard tool.
Parameters
fastAppliance
: Whiteboard tool. See FastAppliance for details.
FastAppliance
Whiteboard tool, containing the following enumeration values:
-
CLICKER(Appliance.CLICKER)
: Click tool. Currently mainly used for clicking content on HTML5 files. -
SELECTOR(Appliance.SELECTOR)
: Select tool. -
HAND(Appliance.HAND)
: Grab tool, used to move the view. -
PENCIL(Appliance.PENCIL)
: Pencil. -
RECTANGLE(Appliance.RECTANGLE)
: Rectangle tool. -
ELLIPSE(Appliance.ELLIPSE)
: Ellipse tool. -
TEXT(Appliance.TEXT)
: text tool. -
ERASER(Appliance.ERASER)
: Eraser tool. -
PENCIL_ERASER(Appliance.PENCIL_ERASER)
: Pencil eraser tool, used to erase local pencil strokes. -
LASER_POINTER(Appliance.LASER_POINTER)
: Laser pointer. -
ARROW(Appliance.ARROW)
: Arrow. -
STRAIGHT(Appliance.STRAIGHT)
: Straight line. -
PENTAGRAM(Appliance.SHAPE, ShapeType.Pentagram)
: Pentagram. -
RHOMBUS(Appliance.SHAPE, ShapeType.Rhombus)
: rhombus. -
TRIANGLE(Appliance.SHAPE, ShapeType.Triangle)
: triangle. -
BUBBLE(Appliance.SHAPE, ShapeType.SpeechBalloon)
: Speech bubble. -
OTHER_CLEAR()
: Clear the whiteboard content.
setStrokeWidth
Set the width of the line.
Parameters
width
: Integer. Line width (px).
cleanScene
Clear the whiteboard content.
setWritable
Set whether the user is in interactive mode in the room.
Parameters
writable
: boolean. Whether the user is in interactive mode:true
: interactive mode, that is, with read and write permissions.false
: Subscription mode, that is, with read-only permissions.
insertImage
Insert picture.
This method can insert and display the specified network image onto the current whiteboard page.
Parameters
url
: String. The URL address of the image. Please ensure that the app client can access the URL, otherwise the image will not be displayed properly.width
: Integer. The width of the image (px).height
: Integer. The height of the image (px).
insertVideo
Insert and play audio and video in the whiteboard sub-window.
Parameters
url
: URL address of audio and video files. Please ensure that the app client can access the URL, otherwise the audio and video files cannot be loaded normally.title
: window title.
insertStaticDoc
Inserts a static document into a whiteboard subwindow.
Parameters
pages
: DocPage array. The page settings for the inserted document. See DocPage.title
: String. The title of the subwindow.result
: An object that implements theFastResult
interface, used to handle the result of the method call. The SDK will use this object to report the result of the operation. If you do not need to listen to the callback, please pass innull
.
DocPage
A class for configuring the page settings for inserting documents. Includes the following attributes
src
: String. The address of the image or dynamic PPT page.- Image: URL address, which can be generated by yourself or by the document conversion function. You can get the address from the image field returned by the query conversion task progress. Make sure the App client can access the URL, otherwise the image cannot be loaded normally.
- Dynamic PPT page: URI address generated by the document conversion function.
preview
: String. (Optional) URL address of the image or dynamic PPT preview image. The URL address of the dynamic PPT preview image can be obtained from the preview field returned by the query document conversion progress. After passing in, the preview image will be displayed on the left side of the App. Make sure the App client can access the URL, otherwise the preview image cannot be loaded normally.width
: Integer. The width of the inserted document in the whiteboard (px).height
: Integer. The height of the inserted document in the whiteboard (px).
insertPptx
Insert a dynamic document in a whiteboard sub-window.
This method can insert dynamic HTML web pages converted by the document conversion function.
Parameters
taskUUID
: String. The Task UUID of the document conversion task, which is the value of theuuid
field in the response body when the initiate document conversion task request is successful.prefixUrl
: String. The prefix path of the converted result file address, which is the value of theprefix
field in the response body when the query document conversion progress request is successful.title
: String. The title of the sub-window.result
: An object that implements theFastResult
interface, used to handle the result of the method call. The SDK will use this object to report the result of the operation. If you do not need to listen to the callback, please pass innull
.
insertDocs
Note
This method is deprecated since v1.6.0. Use insertStaticDoc or insertPptx instead.
Insert and display documents in the whiteboard subwindow.
After successfully initiating the document conversion task, you can call this method and pass in the relevant parameters of the converted document. The SDK will automatically create a sub-window, insert and display the converted document in pages.
Parameters
params
: Insert the parameter settings of the document. See FastInsertDocParams for details.result
:insertDocs
method call result. See FastResult for details. Passing in theFastResult
instance, the SDK will trigger the callback implemented in theFastResult
interface and report whether theinsertDocs
method call is successful; passing innull
means not to listen to the callback.
FastInsertDocParams
Document parameter settings.
The FastInsertDocParams
class contains the following properties:
taskUUID
: String. Task UUID of the document conversion task, that is, Initiate document conversion task API. When the request is successful, the uuid parameter in the response package body value.taskToken
: String. The Task Token of the document conversion task must be consistent with the Task Token passed in when Initiate document conversion task.converterType
: enumeration. The version of the document conversion service, the values are as follows:Projector
: new version. For details, see New version of document conversion service.WhiteboardConverter
: legacy (default). For details, see Old version of the document conversion service.
fileType
: String. Document type:pdf
: static document.pptx
: dynamic document.
dynamicDoc
: boolean. Whether the document conversion task type is a dynamic conversion task.title
: String. Window title.
setFastStyle
Style the whiteboard user interface.
Parameters
style
: The style of the whiteboard user interface. See FastStyle for details.
FastStyle
Whiteboard user interface style.
The FastStyle
class contains the following member methods:
getMainColor
Gets the theme color of the whiteboard user interface.
Returns
The theme color for the whiteboard user interface.
setMainColor
Set the theme color of the whiteboard user interface.
This method can set the color of some button borders and prompt text when the whiteboard is loaded.
Parameters
color
: The theme color of the whiteboard user interface, RGB format, for example0x0000FF
means blue.
isDarkMode
Gets whether the whiteboard user interface is in dark mode.
Returns
true
: Whiteboard user interface is in dark mode.false
: The whiteboard user interface is in light mode.
setDarkMode
Set the whiteboard user interface to dark mode.
Parameters
-
darkMode
: whether to use dark mode:true
: dark mode.false
: light mode.
setResource
Set resources related to whiteboard color.
Parameters
fastResource
: Whiteboard color-related resources. See FastResource for details.
FastResource
Resources related to whiteboard colors.
Contains the following member methods, all of which can be overridden to customize colors:
getBackgroundColor
Get the background color of the whiteboard control.
Parameters
darkMode
: boolean. Whether the background color of the whiteboard control is dark mode:true
: dark mode.false
: light mode.
Returns
Hexadecimal color value.
getBoardBackgroundColor
Get the whiteboard background color.
Note
If you do not override this method, getBackgroundColor
will be called by default.
Parameters
darkMode
: boolean. Whether the whiteboard background color is dark mode:true
: dark mode.false
: light mode.
Returns
Hexadecimal color value.
FastUiSettings class
The FastUiSettings
class provides methods for setting up the whiteboard user interface.
showRoomController
Demonstrates controls on a whiteboard user interface.
Parameters
ids
: The identifier of the control. See ControllerId for details.
hideRoomController
Hides controls on the whiteboard user interface.
Parameters
ids
: The identifier of the control. See ControllerId for details.
ControllerId
Controls on the whiteboard user interface, including the following enumeration values:
RedoUndo
: redo and undo buttons.ToolBox
: Toolbar.PageIndicator
: Page indicator.
setToolsExpandAppliances
Sets the tool set included in the toolbar in expanded mode.
If the default toolbar provided by Fastboard SDK cannot meet your needs, you can call this method to customize the tools contained in the toolbar and set the toolbar to expand mode. You can pass in a secondary tool list in this method. The elements in the primary list will be expanded and displayed on the toolbar, and the elements in the secondary list will be collapsed.
After successfully calling the setToolsExpandAppliances
method, if you need to switch the toolbar to collapsed mode, you can call setToolboxExpand.
Note
This method needs to be called before joining the whiteboard room.
Parameters
toolsExpandAppliances
: Tools included in the toolbar in expanded mode. See FastAppliance for details.
Example
setToolsCollapseAppliances
Sets the tool set included in the toolbar in collapsed mode.
If the default toolbar provided by Fastboard SDK cannot meet your needs, you can call this method to customize the tools included in the toolbar and set the toolbar to fold mode. You can pass in a first-level tool list in this method, and the elements in the list will be collapsed on the toolbar by default.
After successfully calling the setToolsCollapseAppliances
method, if you need to switch the toolbar to expanded mode, you can call setToolboxExpand.
Note
This method needs to be called before joining the whiteboard room.
Parameters
toolsCollapseAppliances
: Tools included in the whiteboard toolbar. See FastAppliance for details.
Example
setToolsColors
Set the color used by the whiteboard tool.
This method sets the color of graphics, lines, or text drawn using the whiteboard tool.
Note
This method needs to be called before joining the whiteboard room.
Parameters
toolsColors
: Color of whiteboard tools, RGB format, for example0x0000FF
means blue.
setStrokeRange
Sets the range for the line width slider in the toolbox.
This method configures the minimum and maximum values of the line width slider in the toolbox extension panel. Users can adjust the line width within this range when using drawing tools like pencils, rectangles, circles, etc. The default range is [1, 24].
- The line width slider will be restricted to the specified range.
- If the current line width exceeds the new range, it will be constrained within the new range.
- This setting affects all drawing tools that support line width adjustments.
Parameters
min
: int. The minimum value for the line width (inclusive).max
: int. The maximum value for the line width (inclusive).
setToolboxEdgeMargin
Set the margins between the whiteboard toolbar and the sides.
The definition of the margin is determined by the toolbar position set in setToolboxGravity
:
- The toolbar is located on the left side of the whiteboard: the margin refers to the distance between the left side of the toolbar and the left side of the whiteboard.
- The toolbar is located on the right side of the whiteboard: the margin refers to the distance between the right side of the toolbar and the right side of the whiteboard.
Parameters
margin
: Integer. The distance between the toolbar and the side of the whiteboard, inpx
.
setToolboxGravity
Set the position of the toolbar on the whiteboard.
Parameters
-
gravity
: The position of the toolbar on the whiteboard:Gravity.LEFT
: left.Gravity.RIGHT
: Right.
setToolboxExpand
Set whether to expand the toolbar.
The default display state of the toolbar is related to the device. It is expanded by default on tablets and collapsed by default on mobile phones. You can call this method to modify the display state of the toolbar.
Parameters
expand
: Whether to expand the toolbar:true
: expand.false
: fold.
FastLogger Class
The FastLogger
class provides a flexible whiteboard runtime log recording tool that can easily record four different levels of log information: debug
、info
、warn
、error
. TheFastLogger
class uses a Logger
interface and provides a default implementation DefaultLogger
to use the system's Log
class.
setLogger
Set custom logger.
Parameters
logger
: The logger instance. If you need to customize the logger, you need to pass in an implementation class of theLogger
interface, seeLogger
; passing innull
will result in using the system default logger.
Logger
Logger specification, including recording methods for all log levels.
debug
Records a debug log.
Parameters
msg
: String. Log message.
info
Records an info log.
Parameters
msg
: String. Log message.
warn
Records a warn log.
Parameters
msg
: String. Log message.
error
Records an error.
Parameters
msg
: String. Log message.
FastResult
The result of the method call.
The FastResult
interface reports the results of method calls and includes the following callback methods:
onSuccess
: callback when the method call is successful.onError
: callback when an error occurs.