Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Webcam.prototype.componentWillUnmount = function componentWillUnmount() {
var index = Webcam.mountedInstances.indexOf(this);
Webcam.mountedInstances.splice(index, 1);
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.prototype.componentWillUnmount = function componentWillUnmount() {
var index = Webcam.mountedInstances.indexOf(this);
Webcam.mountedInstances.splice(index, 1);
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);
import _ from 'lodash'
import $ from 'jquery'
import React from 'react'
import ReactDOM from 'react-dom'
import Spinner from 'react-spinner'
import classnames from 'classnames'
import Webcam from 'react-webcam'
import Imgur from 'content/lib/imgur'
import { mountReactComponent } from 'content/commands/mount'
import 'react-spinner/react-spinner.css'
import styles from './Selfie.scss'
import * as Types from 'content/types'
import Container from 'content/components/Container'
Webcam.prototype.componentWillUnmount = function componentWillUnmount() {
var index = Webcam.mountedInstances.indexOf(this);
Webcam.mountedInstances.splice(index, 1);
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()
}
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);
}
};