Hi LiveKit team! 👋
I’m working on a Flutter desktop app (macOS) that uses livekit_client for screen sharing, and I’ve identified an issue that might affect other developers as well.
Problem:
When using LocalVideoTrack.createScreenShareTrack() with ScreenShareCaptureOptions, LiveKit captures directly from the operating system. On macOS, this means it’s not possible to exclude specific windows from a display during capture.
Scenario:
• The user selects only certain windows/apps to share
• The in-app preview correctly shows only those windows (using ScreenCaptureKit with SCContentFilter that supports excludingWindows)
• But when I publish to LiveKit using createScreenShareTrack(), participants see the entire display, including unauthorized windows
Current code:
_screenShareTrack = await LocalVideoTrack.createScreenShareTrack(
ScreenShareCaptureOptions(
sourceId: displayId.toString(),
maxFrameRate: 30.0,
),
);
The issue is that ScreenShareCaptureOptions only supports sourceId (which display/window), but does not support custom filters like excludingWindows.
Question:
Is there any GitHub issue, PR, or fork that addresses this problem? In particular:
1. Support for custom filters in ScreenShareCaptureOptions (e.g. excludingWindows on macOS)
2. The ability to create a LocalVideoTrack from already captured frames (CVPixelBuffer) instead of capturing directly from the system
3. Examples or best practices for screen sharing with custom filters on desktop
Current workaround:
I’m considering capturing filtered frames in native Swift code using ScreenCaptureKit and manually feeding those frames into an RTCVideoSource created with flutter_webrtc, but this approach has performance overhead.
Technical info:
• Platform: macOS 12.3+
• Flutter: 3.4.0+
• livekit_client: 2.5.3
• flutter_webrtc: 1.2.0
Thanks in advance for any suggestions! 🙏