0

I am trying to start video on Screenshare success. But I am not able to get the proper shareStatus from zoom videoSDK.

I have tried using the stream.shareStatus() method in videoSDK to get the share status of the screen. But It is returning "ended" even after screenshare success. Can anyone help me with this? or any other solution is also appreciated.

2 Answers2

0

You can get share screen status with user by this code user.getShareCanvas.videoStatus.on

change share screen then this method triggered . set you conditions according to status change when share the 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 {
    }
}
0

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
    }
}
K.Pandey
  • 135
  • 1
  • 10