From 78969d0938178a4f0a027ef8389a78858d4fd8c5 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 21 Oct 2022 11:54:52 +0200 Subject: [PATCH] Switch back to using the legacy screen capturing API The new API is buggy and inconsistent, so I think we should move on for now. --- .../LiveKitBridge/Sources/LiveKitBridge/LiveKitBridge.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/live_kit_client/LiveKitBridge/Sources/LiveKitBridge/LiveKitBridge.swift b/crates/live_kit_client/LiveKitBridge/Sources/LiveKitBridge/LiveKitBridge.swift index f9380d747e..c3f0e64449 100644 --- a/crates/live_kit_client/LiveKitBridge/Sources/LiveKitBridge/LiveKitBridge.swift +++ b/crates/live_kit_client/LiveKitBridge/Sources/LiveKitBridge/LiveKitBridge.swift @@ -124,7 +124,7 @@ public func LKRoomVideoTracksForRemoteParticipant(room: UnsafeRawPointer, partic @_cdecl("LKCreateScreenShareTrackForDisplay") public func LKCreateScreenShareTrackForDisplay(display: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { let display = Unmanaged.fromOpaque(display).takeUnretainedValue() - let track = LocalVideoTrack.createMacOSScreenShareTrack(source: display) + let track = LocalVideoTrack.createMacOSScreenShareTrack(source: display, preferredMethod: .legacy) return Unmanaged.passRetained(track).toOpaque() } @@ -149,7 +149,7 @@ public func LKRemoteVideoTrackGetSid(track: UnsafeRawPointer) -> CFString { @_cdecl("LKDisplaySources") public func LKDisplaySources(data: UnsafeRawPointer, callback: @escaping @convention(c) (UnsafeRawPointer, CFArray?, CFString?) -> Void) { - MacOSScreenCapturer.displaySources().then { displaySources in + MacOSScreenCapturer.sources(for: .display, includeCurrentApplication: false, preferredMethod: .legacy).then { displaySources in callback(data, displaySources as CFArray, nil) }.catch { error in callback(data, nil, error.localizedDescription as CFString)