WIP: Getting a big black window, then a crash

This commit is contained in:
Nathan Sobo
2022-10-17 09:59:16 +02:00
committed by Antonio Scandurra
parent 0bbba90f30
commit 9569323f93
3 changed files with 33 additions and 16 deletions
+7 -10
View File
@@ -38,11 +38,6 @@ fn main() {
let live_kit_secret = std::env::var("LIVE_KIT_SECRET").unwrap();
cx.spawn(|mut cx| async move {
match live_kit::display_sources().await {
Ok(sources) => println!("found {} sources", sources.len()),
Err(error) => println!("error finding display sources {}", error),
}
let user1_token = live_kit_token::create_token(
&live_kit_key,
&live_kit_secret,
@@ -64,12 +59,14 @@ fn main() {
room2.connect(&live_kit_url, &user2_token).await.unwrap();
cx.add_window(Default::default(), |cx| ScreenCaptureView::new(room2, cx));
let windows = live_kit::list_windows();
let window = windows
.iter()
.find(|w| w.owner_name.as_deref() == Some("Safari"))
let display = live_kit::display_sources()
.await
.unwrap()
.into_iter()
.next()
.unwrap();
let track = LocalVideoTrack::screen_share_for_window(window.id);
let track = LocalVideoTrack::screen_share_for_display(display);
room1.publish_video_track(&track).await.unwrap();
})
.detach();