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 asuspendfunction, so call it from a coroutine. It throws aVideoSDKExceptionif the request fails, including4056(WHITEBOARD_OPERATION_IN_PROGRESS) while another start or stop is still running. Called before the room is joined, or while it is reconnecting, it reports3035or3065ononErrorand returns without throwing.
Events associated with startWhiteboard
-
Every participant receives
onWhiteboardStarted(url)on theirRoomEventListeneronce the whiteboard is open. Loadurlin aWebViewto show the whiteboard. An emptyurlmeans 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 asuspendfunction. It throws and reports errors the same way asstartWhiteboard().
Events associated with stopWhiteboard
- Every participant receives
onWhiteboardStopped()on theirRoomEventListeneronce the whiteboard is closed. Hide theWebViewat 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

