onError

open fun onError(error: VideoSDKError)

Called when the SDK detects an error locally or the server reports one for this room.

Most errors a suspend call throws are also reported here; Room lists which.

Unlike the other callbacks, this one can arrive off the main thread: an action rejected because the room is not joined reports on the caller's thread, and a camera or microphone capture fault on the capture thread. Post to the main thread before touching UI.

Code Example:

override fun onError(error: VideoSDKError) {
when (error) {
VideoSDKError.ERROR_ROOM_RECONNECTING -> showBanner("Reconnecting…")
else -> Log.e("Room", "Error ${error.code} (${error.name}): ${error.message}")
}
}

Parameters

error

the error. It equals its catalogue constant in VideoSDKError and carries the server's message when the server sent one; VideoSDKError.name is empty only for a code this SDK version does not know that arrived without a name.