我正在尝试在Screenshare上开始视频成功。但是我无法从zoom videoSDK获得适当的shareStatus。
我已经尝试在videoSDK中使用stream.shareStatus()方法来获取屏幕的共享状态。但是它正在返回"结束"。即使在屏幕分享成功之后。有人能帮我一下吗?或任何其他解决方案也很受欢迎。
您可以通过以下代码获取用户的共享屏幕状态user. getshareccanvas . videostatus .on
change share screen则触发此方法。根据共享屏幕时的状态变化设置相应的条件。
- (void)onUserShareStatusChanged:(ZoomVideoSDKShareHelper *)helper user:(ZoomVideoSDKUser *)user status:(ZoomVideoSDKReceiveSharingStatus)status; { NSLog(@"onUserShareStatusChanged====>%@, %@",user, @(status)); if (status == ZoomVideoSDKReceiveSharingStatus_Start) { self.fullScreenCanvas.dataType = ZoomVideoSDKVideoType_ShareData; } else if (status == ZoomVideoSDKReceiveSharingStatus_Stop) { self.fullScreenCanvas.dataType = ZoomVideoSDKVideoType_VideoData; } if (user.getShareCanvas.shareStatus.sharingStatus == ZoomVideoSDKReceiveSharingStatus_Start) { } else { } }
Swift代码:
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
}
}