Fastboard API
This page provides the API reference for the Fastboard SDK.
FastboardView class
getFastboard
Gets the Fastboard
instance.
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
You must call this method before calling any other API.
Returnss
The Fastboard
instance when the method call succeeds.
Fastboard class
The Fastboard
class provides methods to create the FastRoom
instance.
Creates a FastRoom
instance.
Note
Call this method after getting the Fastboard
instance.
Parameters
roomOptions
: Configuration options for a whiteboard room. see FastRoomOptions.
Returns
The FastRoom
instance when the method call succeeds.
FastRoomOptions
Configuration options for a whiteboard room.
The FastRoomOptions
class contains the following properties:
appId
: String. The App Identifier of your Interactive Whiteboard project issued by Agora. See Get security credentials for your whiteboard project.uuid
: String. The room UUID, that is, the unique identifier of a room. See the value of theuuid
parameter in the response body after a successful call of Create a room (POST).token
: String. The room token for user authentication, which can be obtained through one of the following methods:- 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.
FastRegion
Data centers.
FastRegion
has the following enumerators:
CN_HZ
: Hangzhou, China, which provides services to areas not covered by other data centers.US_SV
: Silicon Valley, United States, which provides services to North America and South America.SG
: Singapore, which provides services to Singapore, East Asia, and Southeast Asia.IN_MUM
: Mumbai, India, which provides services to India.EU
: Frankfurt, Europe, which provides services to Europe.
FastRoom class
The FastRoom
class provides methods to manage the whiteboard room.
join [1/2]
Joins the whiteboard room.
Note
Call this method after successfully creating the FastRoom
instance.
join [2/2]
Joins the whiteboard room.
Note
Call this method after successfully creating the FastRoom
instance.
Parameters
onRoomReadyCallback
: The OnRoomReadyCallback instance. Passing innull
means not registering the interface.
OnRoomReadyCallback
The OnRoomReadyCallback
interface provides callbacks that report room events to your application. It has the following member functions:
Occurs when the room is ready.
Parameters
fastRoom
: TheFastRoom
instance.
isReady
Gets whether the room is ready.
After calling the join
method, you need to call this method to get whether the room is ready. When the room is ready, you can call other methods in the FastRoom
class to operate the whiteboard.
Returns
Whether the room is ready:
true
: The room is ready.false
: The room is not ready.
redo
Redoes an undone action.
undo
Undoes an action.
setStrokeColor
Sets the stroke color.
Parameters
color
: int. The stroke color in RGB format. For example,0x0000FF
represents blue.
setAppliance
Sets the whiteboard tool currently in use.
Parameters
fastAppliance
: The whiteboard tool. See FastAppliance.
FastAppliance
Whiteboard tools.
FastAppliance
has the following enumerators:
CLICKER(Appliance.CLICKER)
: Clicker, which can be used for clicking and selecting content on an HTML5 file.SELECTOR(Appliance.SELECTOR)
: Selector.PENCIL (Appliance.PENCIL)
: Pencil.RECTANGLE(Appliance.RECTANGLE)
: Rectangle.ELLIPSE(Appliance.ELLIPSE)
: Ellipse.TEXT(Appliance.TEXT)
: Text.ERASER(Appliance.ERASER)
: Eraser.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 balloon.OTHER_CLEAR()
: Clears all contents on the current whiteboard page.
setStokeWidth
Sets the stroke width.
Parameters
strokeWidth
: int. The stroke width (px).
cleanScene
Clears all contents on the current whiteboard page.
setWritable
Sets 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 permission.
insertImage
Inserts an image.
This method inserts and displays a specified online image on the current whiteboard page.
Parameters
url
: String. The URL address of the image. Ensure your app clients can access the URL; otherwise, the image cannot be displayed.width
: int. The width (px) of the image.height
: int. The height (px) of the image.
insertVideo
Inserts and plays audio and video in the whiteboard sub-window.
Parameters
url
: The URL address of the audio or video file. Make sure your app clients can access the URL; otherwise, the audio or video file cannot be loaded properly.title
: The title of the sub-window.
insertDocs
Inserts and displays a document in the whiteboard sub-window.
After successfully launching a file conversion task, you can call this method and pass in the parameters of the converted file. After a successful call, the SDK automatically creates a sub-window to insert and display the converted file per page.
Parameters
params
: Parameters of the converted file. See FastInsertDocParams.result
: The call result ofinsertDocs
. See FastResult. After you pass in aFastResult
instance, the SDK triggers the callbacks implemented in theFastResult
instance to report the call result ofinsertDocs
. Passing innull
means not monitoring the callbacks.
FastInsertDocParams
Parameters of the converted file.
The FastInsertDocParams
class has the following properties:
taskUUID
: String. The UUID of the file conversion task. You can getuuid
from the response body when the Start file conversion API call succeeds.taskToken
: String. The task token of the file conversion task, which must be the same as the task token that you use to start the file conversion task.fileType
: String. The document type:pdf
: A static document.pptx
: A dynamic document.
title
: String. The title of the sub-window.
FastResult
The result of calling insertDocs
.
The FastResult
interface provides callbacks that report the result of calling insertDocs
. The interface provides the following callbacks:
onSuccess
: Occurs when theinsertDoc
s call succeeds.onError
: Occurs when theinsertDoc
s call fails.
setFastStyle
Sets the style of the whiteboard user interface.
Parameters
- style: The style of the whiteboard user interface. See FastStyle.
FastStyle
The style of the whiteboard user interface.
The FastStyle
class contains the following member methods:
getMainColor
Gets the theme color of the whiteboard user interface.
Returns
The theme color of the whiteboard user interface.
setMainColor
Sets the theme color of the whiteboard user interface.
This method sets the color of the following user interface elements:
- The borders of some buttons.
- The prompt text when the whiteboard is loaded.
Parameters
color
: The theme color in RGB format of the whiteboard user interface. For example,0x0000FF
represents blue.
isDarkMode
Gets whether the whiteboard user interface is in dark mode.
Returns
true
: The whiteboard user interface is in dark mode.false
: The whiteboard user interface is in light mode.
setDarkMode
Sets whether to use dark mode for the whiteboard user interface.
Parameters
darkMode
: Whether to use dark mode for the whiteboard user interface:true
: Use dark mode.false
: Use light mode.
FastUiSettings class
The FastUiSettings
class provides methods to configure the whiteboard user interface.
showRoomController
Shows the controls on the whiteboard user interface.
Parameters
ids
: Identifiers of the user interface controls. See ControllerId.
hideRoomController
Hides the controls on the whiteboard user interface.
Parameters
ids
: Identifiers of the user interface controls. See ControllerId.
ControllerId
Identifiers of whiteboard user interface controls.
ControllerId
contains the following enumerators:
RedoUndo
: The redo and undo buttonsToolBox
: The toolbar.PageIndicator
: The page indicator.
setToolsExpandAppliances
Sets the toolset contained in the toolbar in expanded mode.
If the default toolbar provided by UI Kit does not meet your needs, you can call this method to customize the tools contained in the toolbar and set the toolbar to expanded mode. You can pass a two-level list of tools in this method. The elements in the first-level list are expanded and displayed on the toolbar, while the elements in the second-level list are collapsed.
If you want to switch the toolbar to collapsed mode after successfully calling this methods, you can call setToolboxExpand.
Note
Call this method before joining the whiteboard room.
Parameters
toolsExpandAppliances
: Tools contained in the toolbar in expanded mode. See FastAppliance.
Example
setToolsCollapseAppliances
Sets the toolset contained in the toolbar in collapsed mode.
If the default toolbar provided by UI Kit does not meet your needs, you can call this method to customize the tools contained in the toolbar and set the toolbar to collapsed mode. You can pass a one-level list of tools in this method. The elements in the list are collapsed.
If you want to switch the toolbar to expanded mode after successfully calling this method, you can call setToolboxExpand.
Note
Call this method before joining the whiteboard room.
Parameters
toolsCollapseAppliances
: Tools contained in the toolbar in collapsed mode. See FastAppliance.
Example
setToolsColors
Sets the color set of the palette.
The palette applies to the pencil, text editor, and shape tools. When a user uses these tools to draw and write on the whiteboard, they can select a color from the palette.
Note
Call this method before joining the whiteboard room.
Parameters
toolsColors
: Colors in RGB format. For example,0x0000FF
represents blue.
setToolboxGravity
Sets the position of the toolbar on the whiteboard.
Parameters
Gravity
: The position of the toolbar on the whiteboard:Gravity.LEFT
: The toolbar is on the left side.Gravity.RIGHT
: The toolbar is on the left side.
setToolboxExpand
Sets whether to expand the toolbar.
The default display state of the toolbar varies by device. The toolbar is expanded by default on tablets and collapsed by default on phones. You can call this method to modify the display state of the toolbar.
Parameters
expand
: Whether to expand the toolbar:true
: Expand the toolbar.false
: Collapse the toolbar.