Here's the Swift code:
func onUserShareStatusChanged(_ helper: ZoomVideoSDKShareHelper?, user: ZoomVideoSDKUser?, status: ZoomVideoSDKReceiveSharingStatus) {
// Use helper to perform sharing actions.
// User is the user who's share status has changed.
// Status is the new share status of that user.
guard user != localUser else{
if UserStore.shared.userType == "S" && localShareHelper.isOtherSharing() == true{
self.presentedViewController?.dismiss(animated: true, completion: {
self.logMessage(messageText: "The other user is sharing canvas. Please wait.".localized)
self.stopScreenSharing()
})
}
return
}
switch status {
case .start:
// User has begun sharing.
// To render the share stream, you must update the relevant share canvas.
// Obtain the share canvas for a user using getShareCanvas.
let usersShareCanvas = user?.getShareCanvas()
// Call subscribe with the UIView to render upon.
usersShareCanvas?.subscribe(with: self.remoteView, aspectMode: .panAndScan, andResolution: ._Auto)
case .stop:
// Get User's videoCanvas.
if let usersVideoCanvas = remoteUser.getVideoCanvas() {
// Subscribe User's videoCanvas to render their video stream.
usersVideoCanvas.subscribe(with: remoteView, aspectMode: .panAndScan, andResolution: ._Auto)
}
default:
break
}
}