mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-31 19:05:00 +07:00
Clean up screenshare (#44945)
Release Notes: - Fixed a bug where screen-share tabs would persist after the sender (or receiver) had left the call.
This commit is contained in:
parent
829b1b5661
commit
ee2a4a9d37
2 changed files with 17 additions and 0 deletions
|
|
@ -305,6 +305,7 @@ impl Room {
|
|||
|
||||
pub(crate) fn leave(&mut self, cx: &mut Context<Self>) -> Task<Result<()>> {
|
||||
cx.notify();
|
||||
self.emit_video_track_unsubscribed_events(cx);
|
||||
self.leave_internal(cx)
|
||||
}
|
||||
|
||||
|
|
@ -352,6 +353,14 @@ impl Room {
|
|||
self.maintain_connection.take();
|
||||
}
|
||||
|
||||
fn emit_video_track_unsubscribed_events(&self, cx: &mut Context<Self>) {
|
||||
for participant in self.remote_participants.values() {
|
||||
for sid in participant.video_tracks.keys() {
|
||||
cx.emit(Event::RemoteVideoTrackUnsubscribed { sid: sid.clone() });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn maintain_connection(
|
||||
this: WeakEntity<Self>,
|
||||
client: Arc<Client>,
|
||||
|
|
@ -882,6 +891,9 @@ impl Room {
|
|||
project_id: project.id,
|
||||
});
|
||||
}
|
||||
for sid in participant.video_tracks.keys() {
|
||||
cx.emit(Event::RemoteVideoTrackUnsubscribed { sid: sid.clone() });
|
||||
}
|
||||
false
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ impl SharedScreen {
|
|||
})
|
||||
.detach();
|
||||
|
||||
cx.observe_release(&room, |_, _, cx| {
|
||||
cx.emit(Event::Close);
|
||||
})
|
||||
.detach();
|
||||
|
||||
let view = cx.new(|cx| RemoteVideoTrackView::new(track.clone(), window, cx));
|
||||
cx.subscribe(&view, |_, _, ev, cx| match ev {
|
||||
call::RemoteVideoTrackViewEvent::Close => cx.emit(Event::Close),
|
||||
|
|
|
|||
Loading…
Reference in a new issue