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 (livekit#498)

* mute track if ended event has been fired

* remove pauseUpstream on ended

* changeset
  • Loading branch information
lukasIO authored and max-b committed Dec 9, 2022
1 parent 3af19c2 commit 48bcd25
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 @@ -987,7 +987,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 @@ -1016,8 +1016,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 48bcd25

Please sign in to comment.