From 9b8e6cce02f9ce89497dc543e6bb251df198049d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 20 Oct 2022 19:28:21 +0200 Subject: [PATCH] WIP: Try using the new ScreenCaptureKit API when possible --- .../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 af6485ce69..716d96644c 100644 --- a/crates/live_kit_client/LiveKitBridge/Sources/LiveKitBridge/LiveKitBridge.swift +++ b/crates/live_kit_client/LiveKitBridge/Sources/LiveKitBridge/LiveKitBridge.swift @@ -123,7 +123,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, preferredMethod: .legacy) + let track = LocalVideoTrack.createMacOSScreenShareTrack(source: display) return Unmanaged.passRetained(track).toOpaque() } @@ -148,7 +148,7 @@ public func LKRemoteVideoTrackGetSid(track: UnsafeRawPointer) -> CFString { @_cdecl("LKDisplaySources") public func LKDisplaySources(data: UnsafeRawPointer, callback: @escaping @convention(c) (UnsafeRawPointer, CFArray?, CFString?) -> Void) { - MacOSScreenCapturer.sources(for: .display, includeCurrentApplication: false, preferredMethod: .legacy).then { displaySources in + MacOSScreenCapturer.displaySources().then { displaySources in callback(data, displaySources as CFArray, nil) }.catch { error in callback(data, nil, error.localizedDescription as CFString)