Initial Room

Switching computer
This commit is contained in:
Théo Monnom
2022-10-29 00:11:10 +02:00
parent 2ecae706a9
commit 3630e93054
47 changed files with 1783 additions and 980 deletions
+2
View File
@@ -472,6 +472,7 @@ dependencies = [
"futures-util",
"lazy_static",
"livekit-webrtc",
"parking_lot",
"prost",
"prost-build",
"prost-types",
@@ -931,6 +932,7 @@ dependencies = [
name = "simple_room"
version = "0.1.0"
dependencies = [
"futures",
"livekit",
"tokio",
"tracing",
+2 -1
View File
@@ -7,4 +7,5 @@ edition = "2021"
tokio = { version = "1", features = ["full"] }
tracing = "0.1"
tracing-subscriber = "0.3"
livekit = { path = "../.." }
livekit = { path = "../.." }
futures = "0.3"
+8 -11
View File
@@ -1,7 +1,6 @@
use std::time::Duration;
use tokio::time::sleep;
use livekit::proto::data_packet;
use livekit::room;
use livekit::room::Room;
use std::sync::{Arc, Mutex};
use tracing::{info, trace};
const URL: &str = "ws://localhost:7880";
const TOKEN : &str = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjIzODQ4MDY0NzMsImlzcyI6IkFQSXpLYkFTaUNWYWtnSiIsIm5hbWUiOiJuYXRpdmUiLCJuYmYiOjE2NjQ4MDY0NzMsInN1YiI6Im5hdGl2ZSIsInZpZGVvIjp7InJvb21DcmVhdGUiOnRydWUsInJvb21Kb2luIjp0cnVlfX0.BgVdBnq3XFD3_BQHoe1azqjifYysubgFl6Qlzu9IQGI";
@@ -9,14 +8,12 @@ const TOKEN : &str = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjIzODQ4MDY0N
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjIzODQ4MDY3MzAsImlzcyI6IkFQSXpLYkFTaUNWYWtnSiIsIm5hbWUiOiJ3ZWIiLCJuYmYiOjE2NjQ4MDY3MzAsInN1YiI6IndlYiIsInZpZGVvIjp7InJvb21DcmVhdGUiOnRydWUsInJvb21Kb2luIjp0cnVlfX0.VbDoULjX1CVGZu2sPy3SvWYlVZUBXxQVPmdB9BnmlN4
#[tokio::main]
async fn main() -> Result<(), room::RoomError> {
async fn main() {
tracing_subscriber::fmt::init();
let mut room = room::connect(URL, TOKEN).await?;
room.local_participant()
.publish_data(b"some data", data_packet::Kind::Reliable)
.await?;
let room = Room::new();
room.on_participant_connected(async |participant| {
sleep(Duration::from_secs(120)).await;
Ok(())
})
}