New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: clear inactive streams when participant connection is closed #3410
Conversation
const audio = this.remote_media_streams.audio; | ||
|
||
video(video().filter(stream => !streamIds.includes(stream.id))); | ||
audio(audio().filter(stream => !streamIds.includes(stream.id))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are in the scope of observable arrays. You can just do:
const streamIds = streams.map(stream => stream.id);
this.remote_media_streams.audio.remove(stream => streamIds.includes(stream.id));
this.remote_media_streams.video.remove(stream => streamIds.includes(stream.id));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh true 👍
66fde13
to
013575e
Compare
013575e
to
67d9cf3
Compare
} else { | ||
connectionMediaStreamTracks = peerConnection | ||
.getRemoteStreams() | ||
.reduce((tracks, stream) => tracks.concat(stream.getTracks()), []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const connectionMediaStreamTracks = peerConnection.getReceivers
? peerConnection.getReceivers().map(receiver => receiver.track)
: peerConnection.getRemoteStreams().reduce((tracks, stream) => tracks.concat(stream.getTracks()), []);
No description provided.