diff --git a/crates/call/src/room.rs b/crates/call/src/room.rs index d1d2c5433e..6787a072f3 100644 --- a/crates/call/src/room.rs +++ b/crates/call/src/room.rs @@ -318,28 +318,32 @@ impl Room { }); } - this.remote_participants.insert( - peer_id, - RemoteParticipant { - user: user.clone(), - projects: participant.projects, - location: ParticipantLocation::from_proto(participant.location) - .unwrap_or(ParticipantLocation::External), - tracks: Default::default(), - }, - ); + let location = ParticipantLocation::from_proto(participant.location) + .unwrap_or(ParticipantLocation::External); + if let Some(remote_participant) = this.remote_participants.get_mut(&peer_id) + { + remote_participant.projects = participant.projects; + remote_participant.location = location; + } else { + this.remote_participants.insert( + peer_id, + RemoteParticipant { + user: user.clone(), + projects: participant.projects, + location, + tracks: Default::default(), + }, + ); - if let Some((room, _)) = this.live_kit_room.as_ref() { - println!("getting video tracks for peer id {}", peer_id.0.to_string()); - let tracks = room.remote_video_tracks(&peer_id.0.to_string()); - dbg!(tracks.len()); - for track in tracks { - dbg!(track.sid(), track.publisher_id()); - this.remote_video_track_updated( - RemoteVideoTrackUpdate::Subscribed(track), - cx, - ) - .log_err(); + if let Some((room, _)) = this.live_kit_room.as_ref() { + let tracks = room.remote_video_tracks(&peer_id.0.to_string()); + for track in tracks { + this.remote_video_track_updated( + RemoteVideoTrackUpdate::Subscribed(track), + cx, + ) + .log_err(); + } } } } diff --git a/crates/live_kit_client/LiveKitBridge/Sources/LiveKitBridge/LiveKitBridge.swift b/crates/live_kit_client/LiveKitBridge/Sources/LiveKitBridge/LiveKitBridge.swift index 80032752a9..1c49109fc5 100644 --- a/crates/live_kit_client/LiveKitBridge/Sources/LiveKitBridge/LiveKitBridge.swift +++ b/crates/live_kit_client/LiveKitBridge/Sources/LiveKitBridge/LiveKitBridge.swift @@ -15,13 +15,13 @@ class LKRoomDelegate: RoomDelegate { func room(_ room: Room, participant: RemoteParticipant, didSubscribe publication: RemoteTrackPublication, track: Track) { if track.kind == .video { - self.onDidSubscribeToRemoteVideoTrack(self.data, participant.identity as CFString, track.id as CFString, Unmanaged.passUnretained(track).toOpaque()) + self.onDidSubscribeToRemoteVideoTrack(self.data, participant.identity as CFString, track.sid! as CFString, Unmanaged.passUnretained(track).toOpaque()) } } func room(_ room: Room, participant: RemoteParticipant, didUnsubscribe publication: RemoteTrackPublication, track: Track) { if track.kind == .video { - self.onDidUnsubscribeFromRemoteVideoTrack(self.data, participant.sid as CFString, track.id as CFString) + self.onDidUnsubscribeFromRemoteVideoTrack(self.data, participant.identity as CFString, track.sid! as CFString) } } }