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.
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
: Frankfurt, Germany, 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.
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.
undo
Undo the previous operation.
setStrokeColor
Set the line color.
Parameters
color
: int. 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. -
PENCIL(Appliance.PENCIL)
: Pencil. -
RECTANGLE(Appliance.RECTANGLE)
: Rectangle tool. -
ELLIPSE(Appliance.ELLIPSE)
: Ellipse tool. -
TEXT(Appliance.TEXT)
: text tool. -
ERASER(Appliance.ERASER)
: Eraser tool. -
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
: int. 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
: int. The width of the image (px).height
: int. 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.
insertDocs
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.
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
: int. 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.
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.