Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammad-usman-anwar committed Apr 15, 2022
1 parent db71daa commit 20c6dc6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/modules/webcam/webcam/webcam.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export class WebcamComponent implements AfterViewInit, OnDestroy {
public ngOnDestroy(): void {
this.stopMediaTracks();
this.unsubscribeFromSubscriptions();
this.mediaStream = null;
}

/**
Expand Down Expand Up @@ -395,7 +396,10 @@ export class WebcamComponent implements AfterViewInit, OnDestroy {

// getTracks() returns all media tracks (video+audio)
this.mediaStream.getTracks()
.forEach((track: MediaStreamTrack) => track.stop());
.forEach((track: MediaStreamTrack) => {
track.stop();
this.mediaStream.removeTrack(track);
});
}
}

Expand Down

1 comment on commit 20c6dc6

@kamilhawdziejuk
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Please sign in to comment.