Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (Webcam.mountedInstances.length === 0 && this.state.hasUserMedia) {
if (this.stream.stop) {
this.stream.stop();
} else {
if (this.stream.getVideoTracks) {
for (let track of this.stream.getVideoTracks()) {
track.stop()
}
}
if (this.stream.getAudioTracks) {
for (let track of this.stream.getAudioTracks()) {
track.stop()
}
}
}
Webcam.userMediaRequested = false;
window.URL.revokeObjectURL(this.state.src);
}
};