-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convencience API for iterating frames
- Loading branch information
1 parent
1689545
commit 3a93b61
Showing
9 changed files
with
210 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use livekit::prelude::{RoomEvent, Track, TrackSource}; | ||
use tokio::sync::mpsc; | ||
|
||
use super::room::FfiParticipant; | ||
|
||
pub async fn track_changed_trigger( | ||
participant: FfiParticipant, | ||
track_source: TrackSource, | ||
track_tx: mpsc::Sender<Track>, | ||
) { | ||
for track_pub in participant.participant.track_publications().values() { | ||
if track_pub.source() == track_source.into() { | ||
let track = track_pub.track(); | ||
match track { | ||
Some(track) => { | ||
track_tx.send(track).await; | ||
} | ||
_ => {} | ||
} | ||
} | ||
} | ||
let room = &participant.room.room; | ||
let mut room_event_rx = room.subscribe(); | ||
while let Some(event) = room_event_rx.recv().await { | ||
match event { | ||
RoomEvent::TrackPublished { publication, participant: p } => { | ||
if participant.participant.identity() != p.identity() { | ||
continue; | ||
} | ||
if publication.source() == track_source.into() { | ||
let track = publication.track(); | ||
match track { | ||
Some(track) => { | ||
track_tx.send(track.into()).await; | ||
} | ||
_ => {} | ||
} | ||
} | ||
} | ||
RoomEvent::ParticipantDisconnected(participant) => { | ||
if participant.identity() == participant.identity() { | ||
break; | ||
} | ||
} | ||
RoomEvent::Disconnected { reason: _ } => { | ||
break; | ||
} | ||
_ => {} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule protocol
updated
49 files