Skip to main content

Sharing screen on iOS

This document explains how to setup screen sharing on a iOS App using Dyte SDK.
To use this feature one should join the meeting with Presets in which Screenshare is enabled.

warning

This guide is being updated, and might not work as expected in its current form

Overview

  1. Add a new Broadcast Upload Extension to your project.
  2. Setup app groups.
  3. Download DyteSampleHandler class from Github repo .
  4. Have your SampleHandler class inherited from this downloaded class DyteSampleHandler .
  5. Update Info.plist.

Add a new Broadcast Upload Extension to your project.

Add a Broadcast Upload Extension through File -> New -> Target. Choose iOS -> Broadcast Upload Extension and fill out the required information for your extension and click Finish.

meeting UI screenshot with labeled parts meeting UI screenshot with labeled parts

Setup app groups

Add your extension to an app group by going to your extension's target in the project; in the Signings & Capabilities tab, click the + button in the top left and add App Groups. If you haven't done so already, add App Groups to your main app as well, ensuring that the App Group identifier is the same for both.

meeting UI screenshot with labeled parts meeting UI screenshot with labeled parts

Setup SampleHandler

  • Edit your SampleHandler class to look something like this.
import ReplayKit

class SampleHandler: DyteSampleHandler {}

Modify Info.plist

Make sure both of them (App and Extension Info.plist) contains below key.

  <key>RTCAppGroupIdentifier</key>
<string>(name of the group you have created)</string>

Add below key inside the Info.plist of the main App.

<key>RTCScreenSharingExtension</key>
<string>(Bundle Identifier of the Broadcast upload extension you have added in your project)</string>

Info.plist screenshot

Start the Screenshare

To Launch the broadcast extension and call the method enableScreenshare()

dyteClient.localUser.enableScreenshare()

Stop the Screenshare

To stop the ongoing screenshare and call the method disableScreenshare(). This will show the system alert with a stop button for stopping screen share.

dyteClient.localUser.disbaleScreenshare()

screenshot screenshot