Skip to content

Commit

Permalink
Mute track if ended event has been fired on underlying mediastreamtra…
Browse files Browse the repository at this point in the history
…ck (#498)

* mute track if ended event has been fired

* remove pauseUpstream on ended

* changeset
  • Loading branch information
lukasIO committed Oct 28, 2022
1 parent 316f7aa commit 9ce03bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-knives-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-client': patch
---

mute track if ended event has been fired on underlying mediastreamtrack
6 changes: 3 additions & 3 deletions src/room/participant/LocalParticipant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ export default class LocalParticipant extends Participant {
});
this.unpublishTrack(track);
} else if (track.isUserProvided) {
await track.pauseUpstream();
await track.mute();
} else if (track instanceof LocalAudioTrack || track instanceof LocalVideoTrack) {
try {
if (isWeb()) {
Expand Down Expand Up @@ -993,8 +993,8 @@ export default class LocalParticipant extends Participant {
log.debug('track ended, attempting to use a different device');
await track.restartTrack();
} catch (e) {
log.warn(`could not restart track, pausing upstream instead`);
await track.pauseUpstream();
log.warn(`could not restart track, muting instead`);
await track.mute();
}
}
};
Expand Down

0 comments on commit 9ce03bc

Please sign in to comment.