Fastboard API
Updated
The API reference guide for the Fastboard SDK.
This page provides the API reference for the Fastboard SDK.
Reference
Fastboard class
createFastRoom
public class func createFastRoom(withFastRoomConfig config: FastRoomConfiguration)Create a FastRoom instance.
Parameters
config: Configuration ofFastRoominstance. See FastRoomConfiguration for details.
Returns
A FastRoom object is returned when the method call is successful.
FastRoomConfiguration
FastRoomConfiguration class provides methods to initialize FastRoomConfiguration instances.
public init(appIdentifier: String,
roomUUID: String,
roomToken: String,
region: Region,
userUID: String,
userPayload: FastUserPayload? = nil)Parameters
-
appIdentifier: String. App Identifier for the interactive whiteboard project. For details, see Get security credentials for your whiteboard project. -
roomUUID: String. The UUID of the room, which is the unique identifier of the room. For details, see Create a room (POST) The value of theuuidparameter in the response package body after the request is successful. -
roomToken: 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.
- Use code to generate it on the app server. For details, see Generate a Token at App Server.
-
region: data center. SeeRegionfor details. -
userUID: String. The user's UID, that is, the user's unique identifier, in string format, cannot exceed 1024 bytes. Please ensure that each user in the same room has a unique UID. -
userPayload: User information displayed by the user's cursor, including the user's nickname and avatar. SeeFastUserPayloadfor details.
Region
Data center, containing the following enumerations:
CN: Hangzhou, China. The service area covers East Asia, Southeast Asia, and other areas not covered by the data center.US: Silicon Valley, USA, service area covers North America and South America.SG: Singapore, the service area covers Singapore, East Asia, and Southeast Asia.IN: Mumbai, India, service area covers India.EU: Europe (Frankfurt), service area covers Europe.
FastUserPayload
public class FastUserPayload: NSObject {
let nickName: String?
let avatar: String?
var dic: [String: String] {
var r = [String: String]()
if let nickName = nickName { r["nickName"] = nickName }
if let avatar = avatar { r["avatar"] = avatar }
return r
}
public init(nickName: String) {
self.nickName = nickName
self.avatar = nil
super.init()
}
public init(nickName: String, avatar: String) {
self.nickName = nickName
self.avatar = avatar
super.init()
}
}FastUserPayload class, used to store user information displayed on the cursor, contains the following properties:
-
nickName: String. (Optional) 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.
joinRoom
public func joinRoom(completionHandler: ((Result<WhiteRoom, FastRoomError>)->Void)? = nil)Join a whiteboard room.
Note
This method needs to be called after creating the FastRoom object.
Parameters
completionHandler: method call result callback. Passing innilmeans not to register a callback.
disconnectRoom
public func disconnectRoom()Leave the whiteboard room.
insertImg
public func insertImg(_ src: URL, imageSize: CGSize)Insert picture.
This method can insert and display the specified network image onto the current whiteboard page.
Parameters
src: 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.imageSizewidth: CGSize. The size of the image.
insertMedia
public func insertMedia(_ src: URL, title: String, completionHandler: ((String)->Void)? = nil)Insert and play audio and video in the whiteboard sub-window.
Parameters
src: String. 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: String. Window title.completionHandler: method call result callback. Passing innilmeans not to register a callback.
insertPptx
public func insertPptx(
uuid: String,
url: String,
title: String,
completionHandler: ((String)->Void)? = nil
)Insert and display dynamic documents in the whiteboard sub-window.
Dynamic documents refer to HTML web pages converted from PPTX format files through Agora Interactive Whiteboard Document Conversion Service. The converted file will retain the animation effects in the source file.
Successfully Initiate document conversion task and call Query document conversion task progress API. After obtaining the document conversion result, you can call this method and pass in the obtained document conversion result. After a successful call, the SDK automatically creates a sub-window to insert and display the converted document per page.
Parameters
uuid: uuid of the conversion task, the unique identifier of the conversion task.url: Conversion result file address prefix path.title: window title when inserting.completionHandler: method call result callback. Passing innilmeans not to register a callback.
insertStaticDocument
public func insertStaticDocument(_ pages: [WhitePptPage],
title: String,
completionHandler: ((String)->Void)? = nil)Insert and display static documents in the whiteboard sub-window.
Static documents refer to files converted from PPT, PPTX, DOC, DOCX, and PDF formats through Agora File Conversion Service into still images in the PNG or JPG/JPEG format.
Successfully initiate document conversion task and call Query document conversion task progress API. After obtaining the document conversion result, you can call this method and pass in the obtained document conversion result. The SDK automatically creates a sub-window and inserts and displays the converted document in pages.
Parameters
pages: Converted file list. For details, see Query Document Conversion Task Progress API. TheconvertedFileListparameter in the response package body returned after a successful request.title: Window title.completionHandler: Method call result callback. Passing innilmeans not to register a callback.
followSystemPencilBehavior
public static var followSystemPencilBehavior(iPad only) Set whether Apple Pencil behavior follows the system default when using a whiteboard:
YES: Follow the system default settings. In this state, users can use the Apple Pencil's system default functions to operate the whiteboard, such as double-clicking to switch the current tool to the eraser, double-clicking to display the palette, and using Apple Pencil to doodle.NO: Do not follow the system default settings. In this state, the system default functions of Apple Pencil are unavailable.
FastRoomThemeManager class
The FastRoomThemeManager class provides methods for setting the theme of the whiteboard user interface.
apply
public func apply(_ theme: FastRoomThemeAsset)Apply whiteboard theme.
Fastboard SDK follows the system's theme settings by default on iOS 13.0 or above, and uses the light theme by default on iOS 13.0 or earlier. If the default theme settings cannot meet your needs, you can call this method to apply a predefined theme or a custom theme provided by the SDK.
Parameters
-
theme: Whiteboard theme.-
Predefined themes:
FastRoomDefaultTheme.defaultLightTheme: light theme.FastRoomDefaultTheme.defaultDarkTheme: dark theme.FastRoomDefaultTheme.defaultAutoTheme: automatic theme, which follows the system theme setting. This option is only available on iOS 13.0 or above.
-
Custom theme: see FastRoomThemeAsset for details.
-
Example
-
Apply predefined dark theme:
FastRoomThemeManager.shared.apply(FastRoomDefaultTheme.defaultDarkTheme) -
Apply a custom theme:
let white = FastRoomWhiteboardAssets(whiteboardBackgroundColor: .green, containerColor: .yellow) let control = FastRoomControlBarAssets(backgroundColor: .blue, borderColor: .gray, effectStyle: .init(style: .regular)) let panel = FastRoomPanelItemAssets(normalIconColor: .black, selectedIconColor: .systemRed, highlightBgColor: .cyan, subOpsIndicatorColor: .yellow, pageTextLabelColor: .orange) let theme = FastRoomThemeAsset(whiteboardAssets: white, controlBarAssets: control, panelItemAssets: panel) FastRoomThemeManager.shared.apply(theme)
FastRoomThemeAsset
Whiteboard theme style.
open class FastRoomThemeAsset: NSObject {
@objc
public init(whiteboardAssets: FastRoomWhiteboardAssets,
controlBarAssets: FastRoomControlBarAssets,
panelItemAssets: FastRoomPanelItemAssets) {
self.whiteboardAssets = whiteboardAssets
self.controlBarAssets = controlBarAssets
self.panelItemAssets = panelItemAssets
}
@objc
open var whiteboardAssets: FastRoomWhiteboardAssets
@objc
open var controlBarAssets: FastRoomControlBarAssets
@objc
open var panelItemAssets: FastRoomPanelItemAssets
}The FastRoomThemeAsset class contains the following properties:
whiteboardAssets: Whiteboard style. See FastRoomWhiteboardAssets for details.controlBarAssets: The style of the control bar. See FastRoomControlBarAssets for details.panelItemAssets: The style of the button. See FastRoomPanelItemAssets for details.
FastRoomWhiteboardAssets
Whiteboard style.
open class FastRoomWhiteboardAssets: NSObject {
@objc
public init(whiteboardBackgroundColor: UIColor, containerColor: UIColor) {
self.whiteboardBackgroundColor = whiteboardBackgroundColor
self.containerColor = containerColor
}
@objc
open var whiteboardBackgroundColor: UIColor
@objc
open var containerColor: UIColor
}The FastRoomWhiteboardAssets class contains the following properties:
whiteboardBackgroundColor: Whiteboard background color.containerColor: The color of the HTML container where the whiteboard is mounted.
FastRoomControlBarAssets
The style of the control bar.
open class FastRoomControlBarAssets: NSObject {
@objc
public init(backgroundColor: UIColor, borderColor: UIColor, effectStyle: UIBlurEffect? = nil) {
self.backgroundColor = backgroundColor
self.borderColor = borderColor
self.effectStyle = effectStyle
}
@objc
var backgroundColor: UIColor
@objc
var borderColor: UIColor
@objc
var effectStyle: UIBlurEffect?
}FastRoomControlBarAssets contains the following properties:
backgroundColor: The background color of the control bar.borderColor: Control the color of the bar border.effectStyle: frosted glass effect. See UIBlurEffect for details.
FastRoomPanelItemAssets
Assets for buttons.
open class FastRoomPanelItemAssets: NSObject {
@objc
public init(normalIconColor: UIColor,
selectedIconColor: UIColor,
selectedIconBgColor: UIColor,
highlightColor: UIColor,
highlightBgColor: UIColor,
disableColor: UIColor,
subOpsIndicatorColor: UIColor,
pageTextLabelColor: UIColor,
selectedBackgroundCornerradius: CGFloat,
selectedBackgroundEdgeinset: UIEdgeInsets) {
self.normalIconColor = normalIconColor
self.selectedIconColor = selectedIconColor
self.selectedIconBgColor = selectedIconBgColor
self.highlightColor = highlightColor
self.highlightBgColor = highlightBgColor
self.disableColor = disableColor
self.subOpsIndicatorColor = subOpsIndicatorColor
self.pageTextLabelColor = pageTextLabelColor
self.selectedBackgroundCornerRadius = selectedBackgroundCornerradius
self.selectedBackgroundEdgeinset = selectedBackgroundEdgeinset
}
@objc
open var selectedBackgroundCornerRadius: CGFloat
@objc
open var selectedBackgroundEdgeinset: UIEdgeInsets
@objc
open var normalIconColor: UIColor
@objc
open var selectedIconColor: UIColor
@objc
open var selectedIconBgColor: UIColor
@objc
open var highlightColor: UIColor
@objc
open var highlightBgColor: UIColor
@objc
open var disableColor: UIColor
@objc
open var subOpsIndicatorColor: UIColor
@objc
open var pageTextLabelColor: UIColor
}The FastRoomPanelItemAssets class contains the following properties:
normalIconColor: The color of the button icon in the normal state (that is, when the button is not selected).selectedIconColor: The color of the button icon in the selected state.selectedIconBgColor: The background color of the button in the selected state.highlightColor: The color of the button icon in the highlighted state (that is, when the button is pressed).highlightBgColor: The background color of the button when it is highlighted (that is, when the button is pressed).disableColor: The color of the button in the unclickable state.subOpsIndicatorColor: The color of the drop-down button.pageTextLabelColor: The color of the page number.selectedBackgroundCornerradius: background rounded corners in the selected state.selectedBackgroundEdgeinset: The background padding of the selected state.
FastRoomDefaultOperationItem class
The FastRoomDefaultOperationItem class is used to customize the operation components on the whiteboard user interface.
defaultColors
public static var defaultColors: [UIColor]The default color collection for the palette.
You can pass a custom [UIColor] object in this property to modify the color collection of the palette. The set of palette colors set by this property applies to tools such as pencils, text, and graphics.
