Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/room/participant/LocalParticipant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export default class LocalParticipant extends Participant {
track.on(TrackEvent.Muted, this.onTrackMuted);
track.on(TrackEvent.Unmuted, this.onTrackUnmuted);
track.mediaStreamTrack.addEventListener('ended', () => {
this.unpublishTrack(track);
this.unpublishTrack(track, true);
});

// get local track id for use during publishing
Expand Down Expand Up @@ -256,6 +256,7 @@ export default class LocalParticipant extends Participant {

unpublishTrack(
track: LocalTrack | MediaStreamTrack,
sendUnpublish?: boolean,
): LocalTrackPublication | null {
// look through all published tracks to find the right ones
const publication = this.getPublicationForTrack(track);
Expand Down Expand Up @@ -311,6 +312,8 @@ export default class LocalParticipant extends Participant {
break;
}

if (sendUnpublish) this.emit(ParticipantEvent.TrackUnpublished, publication);

return publication;
}

Expand Down