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

Integrate the module

To add whiteboard support to your app, you will primarily use the IZoomVideoSDKWhiteboardHelper interface, which is part of the IZoomVideoSDKShareHelper interface. You can also manage events using the IZoomVideoSDKDelegate protocol.

```cpp
// Include the necessary Zoom Video SDK header files
#include "zoom_video_sdk.h"
#include "zoom_video_sdk_whiteboard_helper_interface.h"
// Get the main SDK instance, or create it if is isn't made yet
IZoomVideoSDK* pVideoSDK = ZoomVideoSDKMgr::CreateZoomVideoSDKObj();
```

Share and manage the whiteboard

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

MethodPurpose
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.
```cpp
// 1. Get the Whiteboard Helper
IZoomVideoSDKWhiteboardHelper* pWhiteboardHelper =
    pVideoSDK->getShareHelper()->getWhiteboardHelper();
// 2. Start Sharing
if (pWhiteboardHelper->CanStartShareWhiteboard()) {
    ZoomVideoSDKErrors result = pWhiteboardHelper->startShareWhiteboard();
    // Check 'result' for success (ZoomVideoSDKErrors_Success)
}
// 3. Stop Sharing
if (pWhiteboardHelper->canStopShareWhiteboard()) {
    ZoomVideoSDKErrors result = pWhiteboardHelper->stopShareWhiteboard();
    // Check 'result' for success
}
```

View or subscribe to the whiteboard

Use the SDK interfaces subscribeWhiteboard, unSubscribeWhiteboard, and setCustomizedResIcon to control the display of the whiteboard in a dedicated window or view.

MethodPurpose
subscribeWhiteboard(void* hOwner)Displays the whiteboard view. hOwner is the handle of the owner window (or nullptr for desktop owner).
unSubscribeWhiteboard()Closes the whiteboard view.
setCustomizedResIcon(void* hResInstance, unsigned int iconID)Sets a custom icon for the whiteboard view window.
isOtherSharingWhiteboardChecks if any other user is currently sharing a whiteboard.

To view the whiteboard

// Get the helper as shown above
IZoomVideoSDKWhiteboardHelper* pWhiteboardHelper =
    pVideoSDK->getShareHelper()->getWhiteboardHelper();
// 1. Subscribe to the whiteboard on your selected owner window (e.g., your application's main window handle)
// HWND hMainWnd = ...; // Get your window handle
void* hOwner = (void*)hMainWnd;
ZoomVideoSDKErrors result = pWhiteboardHelper->subscribeWhiteboard(hOwner);
// The whiteboard UI will now be displayed, owned by hOwner

To stop viewing the whiteboard

// Get the helper as shown above
IZoomVideoSDKWhiteboardHelper* pWhiteboardHelper =
    pVideoSDK->getShareHelper()->getWhiteboardHelper();
pWhiteboardHelper->unSubscribeWhiteboard();

Whiteboard events and status changes

You'll handle whiteboard events by implementing the IZoomVideoSDKDelegate interface.

CallbackMethodPurpose
onUserWhiteboardShareStatusChanged(IZoomVideoSDKUser* pUser, IZoomVideoSDKWhiteboardHelper* pWhiteboardHelper)Called when any user starts or stops sharing a whiteboard. This is your cue to subscribe or unsubscribe.
IZoomVideoSDKUser::GetWhiteboardStatus()Returns a user's current whiteboard status (WhiteboardStatus_Started or WhiteboardStatus_Stopped).
// Implement this method in your class that inherits IZoomVideoSDKDelegate
void YourSDKDelegateClass::onUserWhiteboardShareStatusChanged(IZoomVideoSDKUser* pUser, IZoomVideoSDKWhiteboardHelper* pWhiteboardHelper) {
    // HWND hMainWnd = ...; // Get your window handle
    void* hOwner = (void*)hMainWnd;
    ZoomVideoSDKWhiteboardStatus status = pUser->getWhiteboardStatus();
    if (status == WhiteboardStatus_Started) {
        // A user has started sharing a whiteboard. Subscribe to the whiteboard view.
        pWhiteboardHelper->subscribeWhiteboard(hOwner);
        // Note: Windows Whiteboard Helper does not have setWhiteboardViewPos/Size.
        // The view position is managed by the SDK relative to hOwner.
    } else if (status == WhiteboardStatus_Stopped) {
        // The whiteboard sharing has ended. Unsubscribe to close the view.
        pWhiteboardHelper->unSubscribeWhiteboard();
    }
}

Export whiteboard content

Export the whiteboard as a PDF document.

Method/EnumPurpose
exportWhiteboard(ZoomVideoSDKExportFormat format)Triggers the asynchronous export process. Currently supports EXPORT_FORMAT_PDF.
ZoomVideoSDKExportFormatThe enum value to specify PDF as the export format.
onWhiteboardExported(ZoomVideoSDKExportFormat format, unsigned char* data, long length)The delegate callback that provides the exported file data as an unsigned char * pointer.

To export and retrieve the data

// 1. Trigger the export
IZoomVideoSDKWhiteboardHelper* pWhiteboardHelper =
    pVideoSDK->getShareHelper()->getWhiteboardHelper();
pWhiteboardHelper->exportWhiteboard(EXPORT_FORMAT_PDF);
// 2. Receive the data in your delegate
void YourSDKDelegateClass::onWhiteboardExported(ZoomVideoSDKExportFormat format, unsigned char* data, long length) {
    if (format == EXPORT_FORMAT_PDF) {
        // 'data' is the unsigned char* pointer to the PDF file data.
        // 'length' is the size of the data buffer.
        // You can now write this data to a file on the device.
        SavePdfFile(data, length);
    }
}

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.