Exercise unpublish_track
in live_kit_client
This commit is contained in:
parent
773f569385
commit
ed6f482e68
2 changed files with 21 additions and 5 deletions
|
@ -63,17 +63,32 @@ fn main() {
|
||||||
let display = displays.into_iter().next().unwrap();
|
let display = displays.into_iter().next().unwrap();
|
||||||
|
|
||||||
let track_a = LocalVideoTrack::screen_share_for_display(&display);
|
let track_a = LocalVideoTrack::screen_share_for_display(&display);
|
||||||
room_a.publish_video_track(&track_a).await.unwrap();
|
let track_a_publication = room_a.publish_video_track(&track_a).await.unwrap();
|
||||||
|
|
||||||
let next_update = track_changes.next().await.unwrap();
|
if let RemoteVideoTrackUpdate::Subscribed(track) = track_changes.next().await.unwrap() {
|
||||||
|
|
||||||
if let RemoteVideoTrackUpdate::Subscribed(track) = next_update {
|
|
||||||
let remote_tracks = room_b.remote_video_tracks("test-participant-1");
|
let remote_tracks = room_b.remote_video_tracks("test-participant-1");
|
||||||
assert_eq!(remote_tracks.len(), 1);
|
assert_eq!(remote_tracks.len(), 1);
|
||||||
assert_eq!(remote_tracks[0].publisher_id(), "test-participant-1");
|
assert_eq!(remote_tracks[0].publisher_id(), "test-participant-1");
|
||||||
assert_eq!(track.publisher_id(), "test-participant-1");
|
assert_eq!(track.publisher_id(), "test-participant-1");
|
||||||
} else {
|
} else {
|
||||||
panic!("unexpected message")
|
panic!("unexpected message");
|
||||||
|
}
|
||||||
|
|
||||||
|
let remote_track = room_b
|
||||||
|
.remote_video_tracks("test-participant-1")
|
||||||
|
.pop()
|
||||||
|
.unwrap();
|
||||||
|
room_a.unpublish_track(track_a_publication);
|
||||||
|
if let RemoteVideoTrackUpdate::Unsubscribed {
|
||||||
|
publisher_id,
|
||||||
|
track_id,
|
||||||
|
} = track_changes.next().await.unwrap()
|
||||||
|
{
|
||||||
|
assert_eq!(publisher_id, "test-participant-1");
|
||||||
|
assert_eq!(remote_track.sid(), track_id);
|
||||||
|
assert_eq!(room_b.remote_video_tracks("test-participant-1").len(), 0);
|
||||||
|
} else {
|
||||||
|
panic!("unexpected message");
|
||||||
}
|
}
|
||||||
|
|
||||||
cx.platform().quit();
|
cx.platform().quit();
|
||||||
|
|
|
@ -260,6 +260,7 @@ impl RoomDelegate {
|
||||||
if let Some(room) = room.upgrade() {
|
if let Some(room) = room.upgrade() {
|
||||||
room.did_subscribe_to_remote_video_track(track);
|
room.did_subscribe_to_remote_video_track(track);
|
||||||
}
|
}
|
||||||
|
let _ = Weak::into_raw(room);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" fn on_did_unsubscribe_from_remote_video_track(
|
extern "C" fn on_did_unsubscribe_from_remote_video_track(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue