Screen Sharing

Enhance the collaborative experience of a session by using the screen sharing feature provided by the Video SDK. This feature gives users the ability to share their screen's content on a macOS device.

Screen sharing options

There are two different approaches for screen sharing with the Video SDK:

  1. Share the entire display
  2. Share a specific window

To utilize either method, you must retrieve an ZMVideoSDKShareHelper instance through the SDK:


ZMVideoSDKShareHelper *helper = [[ZMVideoSDK sharedZMVideoSDK] getShareHelper];

let helper = ZMVideoSDK.shared()?.getShareHelper()

After determining the type of share you are going to use, you must obtain the ID of the display or window you would like to share.

Start sharing

After obtaining the ID of the window/display you intend to share with your session, pass it into the corresponding startShare method.

Share a display


[helper startShareScreen:displayId shareOption:shareOptions];

helper?.startShareScreen(displayId, shareOption: ZMVideoSDKShareOption())

Share a window


[helper startShareView:windowId shareOption:shareOptions];

helper?.startShareView(windowId, shareOption: ZMVideoSDKShareOption())

Verify screen share

After successfully completing the above steps to share your screen, verify that your screen share has started by responding to the following callback within your ZMVideoSDKDelegate:


- (void) onUserShareStatusChanged:(ZMVideoSDKShareHelper *)helper user:(ZMVideoSDKUser *)user status:(ZMVideoSDKShareStatus)status {
    switch (status) {
case ZMVideoSDKShareStatus_Start: {
    // User has started sharing.
}
case ZMVideoSDKShareStatus_Pause: {
    // User has paused sharing.
}
case ZMVideoSDKShareStatus_Resume: {
    // User has resumed sharing.
}
case ZMVideoSDKShareStatus_Stop: {
    // User has stopped sharing.
}
}
}

func onUserShareStatusChanged(_ helper: ZMVideoSDKShareHelper, _ user: ZMVideoSDKUser!, _ status: ZMVideoSDKShareStatus) {
    switch (status) {
case ZMVideoSDKShareStatus_Start:
    // User has started sharing.
case ZMVideoSDKShareStatus_Stop:
    // User has stopped sharing.
case ZMVideoSDKShareStatus_Pause:
    // User has stopped sharing.
case ZMVideoSDKShareStatus_Resume:
    // User has resumed sharing.
}
}

To verify that the screen share data of a user is accessible on another device, subscribe to the user's share pipe:


ZMVideoSDKRawDataPipe *sharePipe = [user getSharePipe];
[sharePipe subscribe:ZMVideoSDKResolution_720P listener:self];

let sharePipe = user.getSharePipe()
sharePipe?.subscribe(ZMVideoSDKResolution_720P, listener: self)

Share device audio

There are two aspects to this:

  • Starting a share with audio enabled.
  • Starting audio share.

Starting share with audio enabled


ZMVideoSDKShareOption *shareOption = [[ZMVideoSDKShareOption alloc] init];
shareOption.isOptimizeForSharedVideo = true;
shareOption.isWithDeviceAudio = true;

let shareOptions = ZMVideoSDKShareOption()
shareOptions.isOptimizeForSharedVideo = true
shareOptions.isWithDeviceAudio = true

Starting audio share


[helper enableShareDeviceAudio:true];
[helper enableOptimizeForSharedVideo:true];

helper?.enableShareDeviceAudio(true)
helper?.enableOptimize(forSharedVideo: true)

Next Steps

Need help?

If you're looking for help, try Developer Support or our Developer Forum. Priority support is also available with Premier Developer Support plans.