I’m using the ZoomVideoSDK and trying to implement the whiteboard feature. I’ve noticed that most of the time, the users can both join the whiteboard on the first attempt. However, if one of them leave the whiteboard, or a new whiteboard is started, the other user is not able to join. Lots of error messages with the format:
Collaboration server handshake failed - s-code-d05cca9618-1771363688026
Relavent Code:
//MARK: WhiteBoard
var whiteBoardHelper: ZoomVideoSDKWhiteboardHelper? {
return ZoomVideoSDK.shareInstance()?.getWhiteboardHelper()
}
@objc func showWhiteboardPressed() {
print("whiteBoardHelper?.canStartWhiteboard: \(whiteBoardHelper?.canStartShareWhiteboard())")
let canStartWhiteboard = whiteBoardHelper?.canStartShareWhiteboard() ?? false
if canStartWhiteboard {
let result = whiteBoardHelper?.startShareWhiteboard()
print("result share whiteboard: \(result?.rawValue)")
if result?.rawValue == 0 {
presentWhiteBoardVC(shouldStart: true)
} else {
if let error = result {
self.showError(error)
} else {
let alert = UIAlertController(title: "Oops!", message: "We were unable to start a whiteboard because of an unknown error. Please try again.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .cancel, handler: { action in
}))
self.present(alert, animated: true)
}
}
} else {
let alert = UIAlertController(title: "Oops!", message: "You are unable to start a whiteboard, as you do not have the correct privelages.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .cancel, handler: { action in
}))
self.present(alert, animated: true)
}
}
func presentWhiteBoardVC(shouldStart: Bool = false) {
whiteBoardVC = WhiteBoardViewController()
whiteBoardVC?.shouldStart = shouldStart
whiteBoardVC?.onExit = {
// self.whiteBoardHelper?.stopShareWhiteboard()
// self.whiteBoardHelper?.unSubscribeWhiteboard()
self.whiteBoardVC = nil
}
let nav = UINavigationController(rootViewController: whiteBoardVC!)
nav.modalPresentationStyle = .fullScreen
self.present(nav, animated: true) {
}
}
func onUserWhiteboardShareStatusChanged(_ user: ZoomVideoSDKUser, whiteboardhelper whiteboardHelper: ZoomVideoSDKWhiteboardHelper) {
switch user.getWhiteboardStatus() {
case .started:
// A user has started sharing a whiteboard. Subscribe to display it.
print("\(Date()): \(String(describing: Swift.type(of: self))), \(#function), \(#line)")
if user.getID() != getMySelf?.getID() {
if whiteBoardVC == nil {
presentWhiteBoardVC()
}
}
case .stopped:
// The whiteboard sharing has ended. Unsubscribe to remove the view.
print("\(Date()): \(String(describing: Swift.type(of: self))), \(#function), \(#line)")
if user.getID() != getMySelf?.getID() {
whiteboardHelper.unSubscribeWhiteboard()
whiteBoardVC?.dismiss(animated: true)
whiteBoardVC = nil
}
@unknown default:
print("unknown whiteboard status")
}
}
import UIKit
import ZoomVideoSDK
import ZoomVideoSDK.ZoomVideoSDKWhiteboardHelper
class WhiteBoardViewController: UIViewController {
var shouldStart = false
var onExit : (() -> ())? = { }
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.view.backgroundColor = .white
self.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .stop, target: self, action: #selector(exit))
self.title = "Whiteboard"
self.whiteBoardHelper?.subscribeWhiteboard(self)
}
@objc func exit() {
self.onExit?()
if shouldStart {
whiteBoardHelper?.stopShareWhiteboard()
}
whiteBoardHelper?.unSubscribeWhiteboard()
self.dismiss(animated: true)
}
var whiteBoardHelper: ZoomVideoSDKWhiteboardHelper? {
return ZoomVideoSDK.shareInstance()?.getWhiteboardHelper()
}
}