Skip to main content
Version: 3.x.x

Whiteboard - Android

The whiteboard is a shared canvas that every participant in the room can draw, write and annotate on at the same time.

This guide shows how to start and stop the whiteboard and which events tell you it changed.

startWhiteboard()​

  • Call room.startWhiteboard() to open a whiteboard for the room.

  • startWhiteboard() is a suspend function, so call it from a coroutine. It throws a VideoSDKException if the request fails, including 4056 (WHITEBOARD_OPERATION_IN_PROGRESS) while another start or stop is still running. Called before the room is joined, or while it is reconnecting, it reports 3035 or 3065 on onError and returns without throwing.

Events associated with startWhiteboard​

  • Every participant receives onWhiteboardStarted(url) on their RoomEventListener once the whiteboard is open. Load url in a WebView to show the whiteboard. An empty url means there is nothing to show. Don't open it in a browser: that sends your app to the background, and on Android 15 and later the call can drop (see Background Handling).

  • Participants draw on the whiteboard inside that WebView. For detailed instructions on rendering the whiteboard, refer to this guide.

val roomEventListener = object : RoomEventListener() {
override fun onWhiteboardStarted(url: String) {
super.onWhiteboardStarted(url)
//...
}
//...
}

room!!.addEventListener(roomEventListener)

lifecycleScope.launch {
try {
room!!.startWhiteboard()
} catch (e: VideoSDKException) {
Log.e("VideoSDK", "startWhiteboard failed: ${e.code} ${e.message}")
}
}

stopWhiteboard()​

  • Call room.stopWhiteboard() to close the whiteboard for everyone.

  • stopWhiteboard() is also a suspend function. It throws and reports errors the same way as startWhiteboard().

Events associated with stopWhiteboard​

  • Every participant receives onWhiteboardStopped() on their RoomEventListener once the whiteboard is closed. Hide the WebView at that point.
val roomEventListener = object : RoomEventListener() {
override fun onWhiteboardStopped() {
super.onWhiteboardStopped()
//...
}
//...
}

room!!.addEventListener(roomEventListener)

lifecycleScope.launch {
try {
room!!.stopWhiteboard()
} catch (e: VideoSDKException) {
Log.e("VideoSDK", "stopWhiteboard failed: ${e.code} ${e.message}")
}
}

API Reference​

Got a Question? Ask us on discord