Handle multiple screen shares

By default, a session allows one screen share at a time. The host can allow several users to share simultaneously, after which each viewer chooses which share to render. See Sharing multiple screens simultaneously for details about this feature.

Limitations

  • Multiple people can share their screens at the same time, but only one screen can be rendered at a time.
  • The person currently sharing their screen cannot see another person's screen share stream.

Host: enable multi-share

To let several participants share at the same time, the host enables simultaneous sharing with enableMultiShare. Any user can check the current state with isMultiShareEnabled.

let shareHelper = ZoomVideoSDK.shareInstance()?.getShareHelper()
// Host: allow multiple users to share at the same time.
shareHelper?.enableMultiShare(true)
// Anyone: check whether multi-share is currently allowed.
let multiShareEnabled = shareHelper?.isMultiShareEnabled()
ZoomVideoSDKShareHelper *shareHelper = [[ZoomVideoSDK shareInstance] getShareHelper];
// Host: allow multiple users to share at the same time.
[shareHelper enableMultiShare:YES];
// Anyone: check whether multi-share is currently allowed.
BOOL multiShareEnabled = [shareHelper isMultiShareEnabled];

Host: lock sharing

To prevent other participants from starting a share, the host locks sharing with lockShare. While share is locked, only the host can initiate a share. Check isShareLocked to drive the UI for non-host users.

let shareHelper = ZoomVideoSDK.shareInstance()?.getShareHelper()
// Host: lock screen sharing for everyone else.
shareHelper?.lockShare(true)
// Anyone: check the current state.
let shareLocked = shareHelper?.isShareLocked()
ZoomVideoSDKShareHelper *shareHelper = [[ZoomVideoSDK shareInstance] getShareHelper];
// Host: lock screen sharing for everyone else.
[shareHelper lockShare:YES];
// Anyone: check the current state.
BOOL shareLocked = [shareHelper isShareLocked];

Choose which view to display

If the local user would like to subscribe to a specific view instead of the latest view shared from the delegate callback onUserShareStatusChanged, identify the user to subscribe to, retrieve the user's share action list, and subscribe to the selected share action.

let user: ZoomVideoSDKUser  // Get the specific user you want to subscribe to their share screen
let shareActionList = user.getShareActionList()
// The shareActionList can contain 0 to multiple shares coming from the selected user
if let shareActionList = shareActionList, shareActionList.count > 0 {
    // Get the share you want to subscribe to — for example, the first share
    let shareAction = shareActionList[0]
    shareAction.getShareCanvas()?.subscribe(with: yourView, aspectMode: .original, andResolution: ._Auto)
}
ZoomVideoSDKUser* user; // Get the specific user you want to subscribe to their share screen
NSArray* shareActionList = [user getShareActionList];
// The shareActionList can contain 0 to multiple shares coming from the selected user
if (shareActionList.count > 0) {
   // Get the share you want to subscribe to — for example, the first share
   ZoomVideoSDKShareAction* shareAction = [shareActionList objectAtIndex:0];
   [[shareAction getShareCanvas] subscribeWithView:self.yourView aspectMode:ZoomVideoSDKVideoAspect_Original andResolution:ZoomVideoSDKVideoResolution_Auto];
}