Skip to main content
Android
iOS
Web

Fastboard API

This page provides the API reference for the Fastboard SDK.

FastboardView class

getFastboard


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


_1
public FastRoom createFastRoom(FastRoomOptions roomOptions)

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.


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

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 the uuid 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.
    • 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.
  • containerSizeRatio: Float. In the local display window, the aspect ratio of the content is 0.56 by default, which is 9:16.
  • userPayload: User information displayed by the user's cursor, including the user's nickname and avatar. See FastUserPayload 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


_13
public class FastUserPayload {
_13
private final String nickName;
_13
private final String avatar;
_13
_13
public FastUserPayload(String nickName) {
_13
this(nickName, null);
_13
}
_13
_13
public FastUserPayload(String nickName, String avatar) {
_13
this.nickName = nickName;
_13
this.avatar = avatar;
_13
}
_13
}

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]


_1
public void join()

Join a whiteboard room.

Note

This method needs to be called after the FastRoom object is successfully created.

join [2/2]


_1
public void join(@Nullable OnRoomReadyCallback onRoomReadyCallback)

Join a whiteboard room.

Note

This method needs to be called after the FastRoom object is successfully created.

Parameters

  • onRoomReadyCallback: OnRoomReadyCallback interface instance. Passing in null 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:


_1
void onRoomReady(FastRoom fastRoom);

Room ready callback.

Parameters

  • fastRoom: FastRoom object.

isReady


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


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


_1
public void redo()

Redo, that is, roll back the undo operation.

setWritable [1/2]


_1
public void setWritable(boolean writable)

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]


_1
public void setWritable(boolean writable, FastResult<Boolean> result)

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 the setWritable method call. See FastResult for details. Passing in the FastResult instance, the SDK will trigger the callback implemented in the FastResult interface and report whether the setWritable method call is successful; passing in null means not to listen to the callback.

undo


_1
public void undo()

Undo the previous operation.

setStrokeColor


_1
public void setStrokeColor(@ColorInt int color)

Set the line color.

Parameters

  • color: int. Line color, RGB format, for example 0x0000FF means blue

setAppliance


_1
public void setAppliance(FastAppliance fastAppliance)

Set the currently used whiteboard tool.

Parameters

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


_1
public void setStrokeWidth(int width)

Set the width of the line.

Parameters

  • width: int. Line width (px).

cleanScene


_1
public void cleanScene()

Clear the whiteboard content.

setWritable


_1
public void setWritable(boolean writable)

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


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

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


_1
public void insertVideo(String url, String title)

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


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

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 the FastResult instance, the SDK will trigger the callback implemented in the FastResult interface and report whether the insertDocs method call is successful; passing in null means not to listen to the callback.

FastInsertDocParams

Document parameter settings.


_9
public class FastInsertDocParams {
_9
private String taskUUID;
_9
private String taskToken;
_9
private FastRegion region;
_9
private ConverterType converterType;
_9
private String fileType;
_9
private Boolean dynamicDoc;
_9
private String title;
_9
}

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:
  • 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


_1
public void setFastStyle(FastStyle style)

Style the whiteboard user interface.

Parameters

  • style: The style of the whiteboard user interface. See FastStyle for details.

FastStyle

Whiteboard user interface style.


_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 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 example 0x0000FF 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


_1
public void setResource(FastResource fastResource)

Set resources related to whiteboard color.

Parameters

  • fastResource: Whiteboard color-related resources. See FastResource for details.

FastResource

Resources related to whiteboard colors.


_14
public class FastResource {
_14
@ColorInt
_14
public int getBackgroundColor(boolean darkMode) {
_14
return color(darkMode
_14
? R.color.fast_dark_mode_bg
_14
: R.color.fast_light_mode_bg
_14
);
_14
}
_14
_14
@ColorInt
_14
public int getBoardBackgroundColor(boolean darkMode) {
_14
return getBackgroundColor(darkMode);
_14
}
_14
}

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


_1
public void showRoomController(ControllerId... ids)

Demonstrates controls on a whiteboard user interface.

Parameters

  • ids: The identifier of the control. See ControllerId for details.

hideRoomController


_1
public void hideRoomController(ControllerId... ids)

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


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

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


_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 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


_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)

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 example 0x0000FF means blue.

setToolboxEdgeMargin


_1
public void setToolboxEdgeMargin(int margin)

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, in px.

setToolboxGravity


_1
public void setToolboxGravity(int gravity)

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


_1
public void setToolboxExpand(boolean expand)

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.


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

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.
vundefined