This commit is contained in:
Antonio Scandurra 2022-10-20 20:17:54 +02:00
parent 9b8e6cce02
commit db8b8ef66b
5 changed files with 30 additions and 0 deletions

View file

@ -14,6 +14,7 @@ pub use room::Room;
use std::sync::Arc; use std::sync::Arc;
pub fn init(client: Arc<Client>, user_store: ModelHandle<UserStore>, cx: &mut MutableAppContext) { pub fn init(client: Arc<Client>, user_store: ModelHandle<UserStore>, cx: &mut MutableAppContext) {
live_kit_client::displays();
let active_call = cx.add_model(|cx| ActiveCall::new(client, user_store, cx)); let active_call = cx.add_model(|cx| ActiveCall::new(client, user_store, cx));
cx.set_global(active_call); cx.set_global(active_call);
} }

View file

@ -1,6 +1,7 @@
import Foundation import Foundation
import LiveKit import LiveKit
import WebRTC import WebRTC
import ScreenCaptureKit
class LKRoomDelegate: RoomDelegate { class LKRoomDelegate: RoomDelegate {
var data: UnsafeRawPointer var data: UnsafeRawPointer
@ -154,3 +155,19 @@ public func LKDisplaySources(data: UnsafeRawPointer, callback: @escaping @conven
callback(data, nil, error.localizedDescription as CFString) callback(data, nil, error.localizedDescription as CFString)
} }
} }
@_cdecl("LKDisplays")
public func LKDisplays() {
if #available(macOS 12.3, *) {
Task.init {
let content = try await SCShareableContent.current
print(content.displays.count)
}
// SCShareableContent.getWithCompletionHandler { content, error in
// print(content!.displays.count)
// }
} else {
print("OOOPS")
}
}

View file

@ -81,6 +81,7 @@ fn build_bridge(swift_target: &SwiftTarget) {
} }
fn link_swift_stdlib(swift_target: &SwiftTarget) { fn link_swift_stdlib(swift_target: &SwiftTarget) {
panic!("{:?}", swift_target.paths.runtime_library_paths);
for path in &swift_target.paths.runtime_library_paths { for path in &swift_target.paths.runtime_library_paths {
println!("cargo:rustc-link-search=native={}", path); println!("cargo:rustc-link-search=native={}", path);
} }

View file

@ -62,6 +62,7 @@ extern "C" {
fn LKVideoTrackAddRenderer(track: *const c_void, renderer: *const c_void); fn LKVideoTrackAddRenderer(track: *const c_void, renderer: *const c_void);
fn LKRemoteVideoTrackGetSid(track: *const c_void) -> CFStringRef; fn LKRemoteVideoTrackGetSid(track: *const c_void) -> CFStringRef;
fn LKDisplays();
fn LKDisplaySources( fn LKDisplaySources(
callback_data: *mut c_void, callback_data: *mut c_void,
callback: extern "C" fn( callback: extern "C" fn(
@ -73,6 +74,12 @@ extern "C" {
fn LKCreateScreenShareTrackForDisplay(display: *const c_void) -> *const c_void; fn LKCreateScreenShareTrackForDisplay(display: *const c_void) -> *const c_void;
} }
pub fn displays() {
unsafe {
LKDisplays();
}
}
pub type Sid = String; pub type Sid = String;
pub struct Room { pub struct Room {

View file

@ -9,6 +9,10 @@ use media::core_video::CVImageBuffer;
use parking_lot::Mutex; use parking_lot::Mutex;
use std::{future::Future, sync::Arc}; use std::{future::Future, sync::Arc};
pub fn displays() {
panic!()
}
lazy_static! { lazy_static! {
static ref SERVERS: Mutex<HashMap<String, Arc<TestServer>>> = Default::default(); static ref SERVERS: Mutex<HashMap<String, Arc<TestServer>>> = Default::default();
} }