Whiteboard sharing

The Video SDK lets an app share a whiteboard within a session, allowing users to start, view, and collaborate on a digital canvas. Manage this feature through the dedicated ZoomVideoSDKWhiteboardHelper.

Integrate the module

To add whiteboard support to your iOS app, you will primarily use the ZoomVideoSDKWhiteboardHelperinterface, which you access using

ZoomVideoSDK.shareInstance()?.getWhiteboardHelper()

You can also manage events using the ZoomVideoSDKDelegate protocol. Manage these dependencies using CocoaPods or Swift Package Manager (SPM). You can also import them manually like how you have done it for the other xcframeworks with "Embed & Sign".

Share and manage the whiteboard

These helper classes are available for you to manage the whiteboard.

Method**Purpose
getWhiteboardHelper()Retrieves the instance of the whiteboard helper.
canStartShareWhiteboard()Checks if the current user is permitted to start a new whiteboard.
startShareWhiteboard()Starts a new, blank whiteboard session.
canStopShareWhiteboard()Checks if the current user can stop the active whiteboard share.
stopShareWhiteboard()Stops the current whiteboard share.
// 1. Get the Whiteboard Helper
if let whiteboardHelper = ZoomVideoSDK.shareInstance()?.getWhiteboardHelper() {
    // 2. Start Sharing
    if whiteboardHelper.canStartShareWhiteboard() {
        let result = whiteboardHelper.startShareWhiteboard()
        // Check 'result' for success (.success)
    }
    // 3. Stop Sharing
    if whiteboardHelper.canStopShareWhiteboard() {
        let result = whiteboardHelper.stopShareWhiteboard()
        // Check 'result' for success
    }
}
// 1. Get the Whiteboard Helper
ZoomVideoSDKWhiteboardHelper *whiteboardHelper = [[ZoomVideoSDK sharedSDK] getWhiteboardHelper];
// 2. Start Sharing
if ([whiteboardHelper canStartShareWhiteboard]) {
    ZoomVideoSDKError result = [whiteboardHelper startShareWhiteboard];
    // Check 'result' for success (ZoomVideoSDKErrors_Success)
}
// 3. Stop Sharing
if ([whiteboardHelper canStopShareWhiteboard]) {
    ZoomVideoSDKError result = [whiteboardHelper stopShareWhiteboard];
    // Check 'result' for success
}

View or subscribe to the whiteboard

To allow users to see and interact with a shared whiteboard, you must subscribe to the stream and provide a UIView for rendering.

MethodPurpose
subscribeWhiteboard:(UIViewController*)vcSubscribes to the active whiteboard stream and renders it within the specified UIViewController
unSubscribeWhiteboard()Unsubscribes from the whiteboard stream and stops rendering.
isOtherSharingWhiteboardChecks if any other user is currently sharing a whiteboard.

To view the whiteboard

// Get the helper as shown above
if let whiteboardHelper = ZoomVideoSDK.shareInstance()?.getWhiteboardHelper() {
    whiteboardHelper.subscribeWhiteboard(selectedVC)
    // The whiteboard UI will now be displayed in the selectedVC
}
// Get the helper as shown above
ZoomVideoSDKWhiteboardHelper *whiteboardHelper = [[ZoomVideoSDK sharedSDK] getWhiteboardHelper];
[whiteboardHelper subscribeWhiteboard:selectedVC];
// The whiteboard UI will now be displayed in the selectedVC

To stop viewing the whiteboard

// Get the helper as shown above
if let whiteboardHelper = ZoomVideoSDK.shareInstance()?.getWhiteboardHelper() {
    whiteboardHelper.unSubscribeWhiteboard()
}
// Get the helper as shown above
ZoomVideoSDKWhiteboardHelper *whiteboardHelper = [[ZoomVideoSDK sharedSDK] getWhiteboardHelper];
[whiteboardHelper unSubscribeWhiteboard];

Whiteboard events and status changes

You'll handle whiteboard events in your ZoomVideoSDKDelegate implementation.

Callback/MethodPurpose
onUserWhiteboardShareStatusChanged(_ user: ZoomVideoSDKUser, whiteboardhelper whiteboardHelper: ZoomVideoSDKWhiteboardHelper) {}Called when any user starts or stops sharing a whiteboard. This is your cue to subscribe or unsubscribe.
ZoomVideoSDKUser.getWhiteboardStatus()Returns a user's current whiteboard status (.started or .stopped}).
// Implement this method in your class that conforms to ZoomVideoSDKDelegate
func onUserWhiteboardShareStatusChanged(_ user: ZoomVideoSDKUser, whiteboardhelper whiteboardHelper: ZoomVideoSDKWhiteboardHelper) {
    switch user.getWhiteboardStatus() {
    case .started:
        // A user has started sharing a whiteboard. Subscribe to display it.
        whiteboardHelper.subscribeWhiteboard(selectedVC)
    case .stopped:
        // The whiteboard sharing has ended. Unsubscribe to remove the view.
        whiteboardHelper.unSubscribeWhiteboard()
    }
}
// Implement this method in your class that conforms to ZoomVideoSDKDelegate
-(void)onUserWhiteboardShareStatusChanged:(ZoomVideoSDKUser *_Nonnull)user whiteboardhelper:(ZoomVideoSDKWhiteboardHelper*_Nonnull)whiteboardHelper {
    if (user.getWhiteboardStatus == ZoomVideoSDKWhiteboardStatus_Started) {
        // A user has started sharing a whiteboard. Subscribe to display it.
        [whiteboardHelper subscribeWhiteboardOn:selectedVC];
    } else {
        // The whiteboard sharing has ended. Unsubscribe to remove the view.
        [whiteboardHelper unSubscribeWhiteboardOn:selectedVC];
    }
}

Export whiteboard content

Export the wh iteboard as a PDF document.

Method/EnumPurpose
exportWhiteboard:(ZoomVideoSDKWhiteboardExportFormatType)formatTriggers the asynchronous export process. Currently supports .PDF.
ZoomVideoSDKWhiteboardExportFormatTypeThe enum value to specify PDF as the export format.
onWhiteboardExported:(ZoomVideoSDKWhiteboardExportFormatType)format data:(NSData*)data {}The delegate callback that provides the exported file data as an NSData (Objective-C) or Data (Swift) object.

To export and retrieve the data

// 1. Trigger the export
if let whiteboardHelper = ZoomVideoSDK.shareInstance()?.getWhiteboardHelper() {
    whiteboardHelper.exportWhiteboard(.format_PDF)
}
// 2. Receive the data in your delegate
override func onWhiteboardExported(format: ZoomVideoSDKExportFormat, data: Data) {
    if format == .format_PDF {
        // 'data' is the Swift Data object (byte array) of the PDF file.
        // You can now write this Data object to a file on the device.
        savePdfFile(data)
    }
}
// 1. Trigger the export
ZoomVideoSDKWhiteboardHelper *whiteboardHelper = [[ZoomVideoSDK sharedSDK] getWhiteboardHelper];
[whiteboardHelper exportWhiteboard:ZoomVideoSDKWhiteboardExport_Format_PDF];
// 2. Receive the data in your delegate
- (void)onWhiteboardExported:(ZoomVideoSDKWhiteboardExportFormatType)format data:(NSData*)data {
    if (format == ZoomVideoSDKWhiteboardExport_Format_PDF) {
        // 'data' is the NSData object of the PDF file.
        // You can now write this NSData object to a file on the device.
        [self savePdfFile:data];
    }
}

Manage the data

Because the whiteboard data isn't stored in the cloud, you'll need to handle the data storage. Data can be lost when someone stops sharing the whiteboard, a user leaves a session, or when a user joins a sub-session, or when the app crashes or has network connectivity issues.