-
Notifications
You must be signed in to change notification settings - Fork 154
iOS Screen Sharing
LiveKit supports integration with ReplayKit to publish a video track based on your device's screen, even while using other apps.
- Add a new Broadcast Upload Extension to your project.
- Create an App Group and add both your new extension and your main app to it.
- Have your
SampleHandlerclass extendLKSampleHandler - Add your app group identifier to your Info.plist in both targets under
RTCAppGroupIdentifier - Add your extension's bundle identifier to your main app's Info.plist under
RTCScreenSharingExtension.
Add a Broadcast Upload Extension through File -> New -> Target.
Fill out the required information for your extension and click Finish.

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.
-
import LiveKitthen change yourSampleHandlerclass to extendLKSampleHandlerinstead ofRPBroadcastSampleHandler. - Clear the body of the
SampleHandlerclass - you typically won't need any overrides at all to use it. - Add your app group identifier to your Info.plist in both extension and main app targets under
RTCAppGroupIdentifier - Add your extension's bundle identifier to your main app's Info.plist under
RTCScreenSharingExtension.
The result should look similar to the one in our example.
Your broadcast extension is now ready. Call try await room.localParticipant.set(source: .screenShareVideo, enabled: false, captureOptions: ScreenShareCaptureOptions(useBroadcastExtension: true)) from your main app to turn it on.