Skip to main content

Fastboard API

This page provides the API reference for the Fastboard SDK.

FastboardView class

getFastboard


_1
public Fastboard 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.


_1
public FastRoom createFastRoom(FastRoomOptions roomOptions)

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.


_22
public class FastRoomOptions {
_22
private final String appId;
_22
private final String uuid;
_22
private final String token;
_22
private final String uid;
_22
private final boolean writable;
_22
_22
private final FastRegion fastRegion;
_22
_22
public FastRoomOptions(String appId, String uuid, String token, String uid, FastRegion fastRegion) {
_22
this(appId, uuid, token, uid, fastRegion, true);
_22
}
_22
_22
public FastRoomOptions(String appId, String uuid, String token, String uid, FastRegion fastRegion, boolean writable) {
_22
this.appId = appId;
_22
this.uuid = uuid;
_22
this.token = token;
_22
this.uid = uid;
_22
this.fastRegion = fastRegion;
_22
this.writable = writable;
_22
}
_22
}

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 the uuid 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:
  • uid: String. The unique identifier of a user in string format. The maximum length is 1,024 bytes. Ensure that the uid 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.
  • GB_LON: London, United Kingdom, which provides services to Europe.

FastRoom class

The FastRoom class provides methods to manage the whiteboard room.

join [1/2]


_1
public void join()

Joins the whiteboard room.

Note

Call this method after successfully creating the FastRoom instance.

join [2/2]


_1
public void join(@Nullable OnRoomReadyCallback onRoomReadyCallback)

Joins the whiteboard room.

Note

Call this method after successfully creating the FastRoom instance.

Parameters

  • onRoomReadyCallback: The OnRoomReadyCallback instance. Passing in null means not registering the interface.

OnRoomReadyCallback

The OnRoomReadyCallback interface provides callbacks that report room events to your application. It has the following member functions:


_1
void onRoomReady(FastRoom fastRoom);

Occurs when the room is ready.

Parameters

  • fastRoom: The FastRoom instance.

isReady


_1
public boolean 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


_1
public void redo()

Redoes an undone action.

undo


_1
public void undo()

Undoes an action.

setStrokeColor


_1
public void setStrokeColor(@ColorInt int color)

Sets the stroke color.

Parameters

  • color: int. The stroke color in RGB format. For example, 0x0000FF represents blue.

setAppliance


_1
public void setAppliance(FastAppliance fastAppliance)

Sets the whiteboard tool currently in use.

Parameters

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


_1
public void setStokeWidth(int width)

Sets the stroke width.

Parameters

  • strokeWidth: int. The stroke width (px).

cleanScene


_1
public void cleanScene()

Clears all contents on the current whiteboard page.

setWritable


_1
public void setWritable(boolean writable)

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


_1
public void insertImage(String url, int width, int height)

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


_1
public void insertVideo(String url, String title)

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


_1
public void insertDocs(FastInsertDocParams params, FastResult<String> result)

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 of insertDocs. See FastResult. After you pass in a FastResult instance, the SDK triggers the callbacks implemented in the FastResult instance to report the call result of insertDocs. Passing in null means not monitoring the callbacks.

FastInsertDocParams

Parameters of the converted file.


_11
public class FastInsertDocParams {
_11
_11
private String taskUUID;
_11
_11
private String taskToken;
_11
_11
private String fileType;
_11
_11
private String title;
_11
_11
}

The FastInsertDocParams class has the following properties:

  • taskUUID: String. The UUID of the file conversion task. You can get uuid 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.


_4
public interface FastResult<T> {
_4
void onSuccess(T value);
_4
void onError(Exception exception);
_4
}

The FastResult interface provides callbacks that report the result of calling insertDocs. The interface provides the following callbacks:

  • onSuccess: Occurs when the insertDocs call succeeds.
  • onError: Occurs when the insertDocs call fails.

setFastStyle


_1
public void setFastStyle(FastStyle style)

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.


_30
public class FastStyle {
_30
private int mainColor;
_30
private boolean darkMode;
_30
_30
public FastStyle() {
_30
}
_30
_30
public int getMainColor() {
_30
return mainColor;
_30
}
_30
_30
public void setMainColor(@ColorInt int color) {
_30
this.mainColor = color;
_30
}
_30
_30
public boolean isDarkMode() {
_30
return darkMode;
_30
}
_30
_30
public void setDarkMode(boolean darkMode) {
_30
this.darkMode = darkMode;
_30
}
_30
_30
public FastStyle copy() {
_30
FastStyle style = new FastStyle();
_30
style.mainColor = mainColor;
_30
style.darkMode = darkMode;
_30
return style;
_30
}
_30
}

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


_1
public void showRoomController(ControllerId... ids)

Shows the controls on the whiteboard user interface.

Parameters

  • ids: Identifiers of the user interface controls. See ControllerId.

hideRoomController


_1
public void hideRoomController(ControllerId... ids)

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 buttons
  • ToolBox: The toolbar.
  • PageIndicator: The page indicator.

setToolsExpandAppliances


_1
public static void setToolsExpandAppliances(List<List<FastAppliance>> toolsExpandAppliances)

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


_25
ArrayList<List<FastAppliance>> config = new ArrayList<>();
_25
config.add(Arrays.asList(
_25
FastAppliance.CLICKER,
_25
FastAppliance.PENCIL,
_25
FastAppliance.TEXT,
_25
FastAppliance.SELECTOR,
_25
FastAppliance.ERASER
_25
));
_25
config.add(Arrays.asList(FastAppliance.SELECTOR));
_25
config.add(Arrays.asList(FastAppliance.PENCIL));
_25
config.add(Arrays.asList(FastAppliance.TEXT));
_25
config.add(Arrays.asList(FastAppliance.ERASER));
_25
config.add(Arrays.asList(
_25
FastAppliance.STRAIGHT,
_25
FastAppliance.ARROW,
_25
FastAppliance.RECTANGLE,
_25
FastAppliance.ELLIPSE,
_25
FastAppliance.PENTAGRAM,
_25
FastAppliance.RHOMBUS,
_25
FastAppliance.BUBBLE,
_25
FastAppliance.TRIANGLE
_25
));
_25
config.add(Arrays.asList(FastAppliance.OTHER_CLEAR));
_25
_25
FastUiSettings.setToolsExpandAppliances(config);

setToolsCollapseAppliances


_1
public static void setToolsCollapseAppliances(List<FastAppliance> toolsCollapseAppliances)

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


_9
ArrayList<FastAppliance> collapseAppliances = new ArrayList<>();
_9
collapseAppliances.add(FastAppliance.PENCIL);
_9
collapseAppliances.add(FastAppliance.ERASER);
_9
collapseAppliances.add(FastAppliance.ARROW);
_9
collapseAppliances.add(FastAppliance.SELECTOR);
_9
collapseAppliances.add(FastAppliance.TEXT);
_9
collapseAppliances.add(FastAppliance.OTHER_CLEAR);
_9
_9
FastUiSettings.setToolsCollapseAppliances(collapseAppliances);

setToolsColors


_1
public static void setToolsColors(List<Integer> toolsColors)

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


_1
public void setToolboxGravity(int gravity)

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


_1
public void setToolboxExpand(boolean expand)

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.