Skip to content

Commit

Permalink
android, ios: remove track from remoteTracks in onRemoveTrack
Browse files Browse the repository at this point in the history
  • Loading branch information
davidliu committed Mar 28, 2024
1 parent f30620a commit aa5738e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,8 @@ public void onRemoveTrack(RtpReceiver receiver) {
params.putInt("pcId", this.id);
params.putString("receiverId", receiver.id());

remoteTracks.remove(receiver.id());

webRTCModule.sendEvent("peerConnectionOnRemoveTrack", params);
});
};
Expand Down
2 changes: 2 additions & 0 deletions ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,8 @@ - (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
params[@"pcId"] = peerConnection.reactTag;
params[@"receiverId"] = rtpReceiver.receiverId;

[peerConnection.remoteTracks removeObjectForKey:rtpReceiver.receiverId];

[self sendEventWithName:kEventPeerConnectionOnRemoveTrack body:params];
});
}
Expand Down

0 comments on commit aa5738e

Please sign in to comment.