Initial downstream tracks

This commit is contained in:
Théo Monnom
2022-11-22 17:59:55 +01:00
parent 82ec808dee
commit ae776f04d0
49 changed files with 1910 additions and 406 deletions
+16 -4
View File
@@ -1,6 +1,7 @@
use livekit::room::Room;
use livekit::room::track::TrackTrait;
use livekit::room::{track::remote_track::RemoteTrackHandle, Room};
use std::sync::{Arc, Mutex};
use tracing::{info, trace};
use tracing::{event_enabled, info, trace};
const URL: &str = "ws://localhost:7880";
const TOKEN : &str = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjIzODQ4MDY0NzMsImlzcyI6IkFQSXpLYkFTaUNWYWtnSiIsIm5hbWUiOiJuYXRpdmUiLCJuYmYiOjE2NjQ4MDY0NzMsInN1YiI6Im5hdGl2ZSIsInZpZGVvIjp7InJvb21DcmVhdGUiOnRydWUsInJvb21Kb2luIjp0cnVlfX0.BgVdBnq3XFD3_BQHoe1azqjifYysubgFl6Qlzu9IQGI";
@@ -12,8 +13,19 @@ async fn main() {
tracing_subscriber::fmt::init();
let room = Room::new();
room.on_participant_connected(async |participant| {
room.events()
.on_participant_connected(|event| async move {});
room.events().on_track_subscribed(|event| async move {
let track = event.publication.track().unwrap();
if let RemoteTrackHandle::Video(video_track) = track {
let rtc_track = video_track.rtc_track();
rtc_track.on_frame(Box::new(|frame| { Box::pin(async move {
})
}) }))
}
});
}