Skip to content

Commit

Permalink
Keep measuring a call feed's volume after a stream replacement (#3361)
Browse files Browse the repository at this point in the history
  • Loading branch information
robintown authored May 13, 2023
1 parent 9e586ab commit aaae557
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/webrtc/callFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ export class CallFeed extends TypedEventEmitter<CallFeedEvent, EventHandlerMap>
private updateStream(oldStream: MediaStream | null, newStream: MediaStream): void {
if (newStream === oldStream) return;

const wasMeasuringVolumeActivity = this.measuringVolumeActivity;

if (oldStream) {
oldStream.removeEventListener("addtrack", this.onAddTrack);
this.measureVolumeActivity(false);
Expand All @@ -145,6 +147,7 @@ export class CallFeed extends TypedEventEmitter<CallFeedEvent, EventHandlerMap>

if (this.hasAudioTrack) {
this.initVolumeMeasuring();
if (wasMeasuringVolumeActivity) this.measureVolumeActivity(true);
} else {
this.measureVolumeActivity(false);
}
Expand Down

0 comments on commit aaae557

Please sign in to comment.