Skip to content

Commit

Permalink
Ensure listeners are firing after multiple tracks have unsubscribed
Browse files Browse the repository at this point in the history
We were pre-emptively removing Unsubscribed event listeners for all future unsubscribed events.
  • Loading branch information
davidzhao committed Jan 4, 2022
1 parent 26c01b3 commit 8587af6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 0 additions & 2 deletions src/room/participant/RemoteParticipant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ export default class RemoteParticipant extends Participant {
publication.track = undefined;
}
this.emit(ParticipantEvent.TrackUnsubscribed, track, publication);
this.removeAllListeners(ParticipantEvent.TrackUnsubscribed);
};
this.emit(ParticipantEvent.TrackSubscribed, track, publication);

Expand Down Expand Up @@ -229,7 +228,6 @@ export default class RemoteParticipant extends Participant {
// always send unsubscribed, since apps may rely on this
if (isSubscribed) {
this.emit(ParticipantEvent.TrackUnsubscribed, track, publication);
this.removeAllListeners(ParticipantEvent.TrackUnsubscribed);
}
}
if (sendUnpublish) { this.emit(ParticipantEvent.TrackUnpublished, publication); }
Expand Down
1 change: 1 addition & 0 deletions src/room/track/RemoteTrackPublication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default class RemoteTrackPublication extends TrackPublication {
const sub: UpdateSubscription = {
trackSids: [this.trackSid],
subscribe: this.subscribed,
participantTracks: [],
};
this.emit(TrackEvent.UpdateSubscription, sub);
}
Expand Down

0 comments on commit 8587af6

Please sign in to comment.