orange-activity-56584
05/18/2026, 11:32 AMtall-airline-16756
05/18/2026, 11:32 AMtall-airline-16756
05/18/2026, 11:32 AMclient-sdk-swift supports screen sharing on visionOS 26+. The SDK is known to support iOS and macOS screen sharing (as seen in the demo), but visionOS-specific screen sharing support is not documented.
Could you tell me:
• Are you trying to capture the entire display or just an app/window on visionOS?
• Which SDK version are you using?
• Do you need a native visionOS API-based implementation (ReplayKit/ScreenCapture) or an alternative approach?, with interactive elementsorange-activity-56584
05/18/2026, 11:36 AMtall-airline-16756
05/18/2026, 11:37 AMsetScreenShareEnabled(true) or creating a screen track via createLocalTracks() with a screen source). This relies on the OS picker to select full-screen vs. a window/app.
• You don’t need to drop down to ReplayKit/ScreenCapture unless you need custom capture behavior; LiveKit’s APIs wrap the native capture mechanisms and are the recommended approach.
If you’d like, tell me:
• Which exact API call or code path you’re planning to use (e.g., setScreenShareEnabled vs createLocalTracks) so I can give a short example/snippet for visionOS., with interactive elementsorange-activity-56584
05/18/2026, 11:38 AMsetScreenShareEnabledtall-airline-16756
05/18/2026, 11:38 AMsetScreenShareEnabled with LiveKit client-sdk-swift 2.13.0 will present the system screen-picker on visionOS 26+, which lets the user choose the entire screen or a specific app/window. LiveKit’s API wraps the platform capture APIs, so you don't need to implement ReplayKit/ScreenCapture yourself unless you want custom capture.
If you'd like a short example snippet for calling setScreenShareEnabled(true) in your Swift code and any entitlements to check, tell me whether you're using the LiveKit Swift SDK's high-level `Room`/`LocalParticipant` objects or a lower-level track creation flow and I’ll provide the matching snippet.
, with interactive elementsorange-activity-56584
05/18/2026, 11:39 AMtall-airline-16756
05/18/2026, 11:39 AMsetScreenShareEnabled(true) on the local participant will invoke the OS screen-capture flow on visionOS 26+.
• The system picker appears and lets the user choose the entire screen or a specific app/window. LiveKit wraps the native capture APIs; no extra ReplayKit work is required for the common cases.
Minimal example (Room / LocalParticipant)
1. Enable screen share:
// assume `room` is your connected Room
room.localParticipant.setScreenShareEnabled(true)
1. To stop:
room.localParticipant.setScreenShareEnabled(false)
Entitlements / checks to confirm
• Ensure your app has any required screen-capture entitlements for Apple platforms (standard for apps that present system pickers).
• Confirm your app targets visionOS 26+ and is built with the SDK that includes the platform capture APIs.
If you want, I can:
• Provide a slightly fuller snippet that handles permission errors / publishes the returned screen track, or
• Show how to observe track state changes on LocalParticipant after enabling screen share. Which would you prefer?, with interactive elementsorange-activity-56584
05/18/2026, 11:45 AMLocalParticipant after enabling screen share. Which would you prefer?
Bothtall-airline-16756
05/18/2026, 11:46 AMLocalParticipant. This assumes LiveKit client-sdk-swift 2.13.0 and that room is already connected.
1) Enable screen share with basic permission/error handling and publish flow
import LiveKit
func enableScreenShare(room: Room) {
let participant = room.localParticipant
participant.setScreenShareEnabled(true) { result in
switch result {
case .success(let screenTrack):
// screenTrack is published and available on the participant
print("Screen share started: \(screenTrack.sid ?? "no-sid")")
// Optional: store reference to stop later
self.currentScreenTrack = screenTrack
case .failure(let error):
// Handle common permission/capture errors
print("Failed to start screen share: \(error.localizedDescription)")
// Present UX to user explaining permission issue if needed
}
}
}
2) Stop screen share
func disableScreenShare(room: Room) {
let participant = room.localParticipant
participant.setScreenShareEnabled(false) { result in
switch result {
case .success:
print("Screen share stopped")
self.currentScreenTrack = nil
case .failure(let error):
print("Failed to stop screen share: \(error.localizedDescription)")
}
}
}
3) Observe track state changes on LocalParticipant
import Combine
var cancellables = Set<AnyCancellable>()
func observeLocalParticipantTracks(room: Room) {
let participant = room.localParticipant
// Observe publishedTracks or track collection changes (API names may vary)
participant.$publishedTracks
.sink { publishedTracks in
for published in publishedTracks {
print("Published track: \(published.trackName) state: \(published.state)")
}
}
.store(in: &cancellables)
// If there is a per-track publisher:
participant.onTrackPublished = { publication in
print("Track published: \(publication.trackName)")
publication.onTrackStateChanged = { state in
print("Track \(publication.trackName) state changed: \(state)")
}
}
}
Notes and tips
• The system picker on visionOS 26+ will present options for entire screen vs specific app/window; LiveKit relies on that native UI.
• Keep a reference to the returned screenTrack so you can mute/unpublish or stop it later.
• Show clear user-facing messaging if permission is denied or capture fails (errors from the completion handler).
• If you want, I can adapt these snippets to match the exact function/property names in your SDK build (some bindings differ slightly); share a small excerpt of your LocalParticipant API if you’d like exact code for your copy., with interactive elements