Calling config
Invitation config
Advanced Features
APIs and Events Referencelink
Migration Guide - v4.xlink
Powered Byspreading
directory
pageON THIS PAGE

Screen sharing

What's screen sharing?

Screen sharing refers to the process of broadcasting the contents of one screen to another device or multiple devices in a video call or interactive video scene.

Starts screen sharing

Screen shared by mobile apps

Screen shared by web apps

Landscape mode

null
null
null
null

Implementation

Use the screen sharing

Screen sharing is only supported in the gallery layout. To share your screen, you will need to set the layout inside the ZegoUIKitPrebuiltCallConfig to Gallery first.

To decide whether to use the full-screen mode by default during screen sharing, you will need to configure the showNewScreenSharingViewInFullscreenMode inside the ZegoLayoutGalleryConfig. Set it to true (default setting), meaning that the shared screen will automatically be in full screen when the screen sharing starts.

Meanwhile, the full-screen mode button is customizable, you can decide the way how it shows. To set it, configure the showScreenSharingFullscreenModeToggleButtonRules inside the ZegoLayoutGalleryConfig:

  • showWhenScreenPressed: (default setting) shows the full-screen mode button when clicking the shared screen.

  • alwaysShow: always shows the full-screen mode button.

  • alwaysHide: always hides the full-screen mode button.

Add/customize the buttons

To start the screen sharing, add the ZegoMenuBarButtonName.toggleScreenSharingButton config to the bottomMenuBarConfig to let the screen sharing button show.

Copy

To customize the UI of the full-screen mode button, configure the foregroundBuilder. To decide whether to show the shared screen in full-screen mode, use the controller.showScreenSharingViewInFullscreenMode inside the custom foregroundBuilder.

Copy

Create a Broadcast Upload Extension (for iOS only)

TIPS

The memory limit of the Broadcast Upload Extension is 50 MB, make sure the memory usage of the Extension for screen sharing does not exceed 50 MB.

  1. Open your project in Xcode, and select File > New > Target.

    null
  2. In the following window, select the Broadcast Upload Extension, and click Next.

    null
  3. Fill in items or choose options for your new target, such as fill in the Product Name as ScreenShare, and choose options for the Team, Language, and other required information, and then click Finish.

WARNING

Don't need to check the Include UI Extension option.

null
  1. Set screen sharing target minimum support version. The minimum support version needs to be greater than or equal to 12. If your phone's system version is lower than this minimum support version, screen sharing function will not be available.

    null
  2. After you created the Broadcast Upload Extension, you will see a folder for this Extension in your project with a structure similar to the following. This folder is used to store the implementation codes for the screen sharing feature:

    null
  3. Add the ZegoExpressEngine.xcframework dependency.

  • Run the cd command in the Terminal to navigate to your iOS project directory, and run the pod install to install the ZegoExpressEngine library.

    null
  • Click the + button as shown in the following figure.

    null
  • Select and add the ZegoExpressEngine.xcframework.

    null
  • Set Embed to Do Not Embed.

    null
  1. Replace the code in the SampleHandler file with the following code:

Copy

pageON THIS PAGE
backBack to top