Quick Start
Enable screen sharing with a single method call:- iOS
- macOS
On iOS, LiveKit supports two screen capture modes:
- In-app Capture (default): Share screen content within your app only
- Broadcast Capture: Share screen content even when users switch to other apps
iOS Screen Sharing
In-App Capture
By default, LiveKit uses In-app Capture mode, which requires no additional configuration. When screen sharing is enabled, the system prompts the user with a screen recording permission dialog.- Only captures content within your app
- Application audio is not supported
- Permission prompt appears once per app execution
Broadcast Capture
Broadcast Capture mode allows capturing screen content system-wide, including when the app is in the background. This requires setting up a Broadcast Upload Extension.<main-app-bundle-id>.broadcastSampleHandler.swift with:import LiveKit
#if os(iOS)
@available(macCatalyst 13.1, *)
class SampleHandler: LKSampleHandler {
override var enableLogging: Bool { true }
}
#endif
Overriding
enableLogging to true enables logging in the extension’s process, making logs available through the macOS Console app for troubleshooting.group.<main-app-bundle-id>Application Audio
When using Broadcast Capture, you can capture app audio even when users navigate away from your app. The captured audio is mixed with the microphone track:Troubleshooting iOS Screen Sharing
To debug broadcast extension issues:- Launch the Console app on macOS
- Select your iOS device from the left sidebar
- Click Start Streaming
- In the search bar, filter for messages with category “LKSampleHandler”
- Initiate a screen share in your app and inspect Console for errors
Advanced: Manual Track Publication
By default, when a broadcast begins externally (e.g., via Control Center), the local participant automatically publishes a screen share track. To handle publication manually:Custom Identifiers
By default:- App group identifier:
group.<main-app-bundle-id> - Broadcast extension bundle ID:
<main-app-bundle-id>.broadcast
- Set
RTCAppGroupIdentifierin Info.plist for both targets - Set
RTCScreenSharingExtensionin Info.plist for the main app
macOS Screen Sharing
On macOS, LiveKit captures the main screen by default:Advanced: Capture Specific Display or Window
For more control over what to capture:Screen Share Capture Options
Configure screen sharing withScreenShareCaptureOptions:
Disable Screen Sharing
To stop screen sharing:See Also
- LocalParticipant.swift:355 (
setScreenShare(enabled:)) - Docs/ios-screen-sharing.md