How to use the react-webcam.userMediaRequested function in react-webcam

To help you get started, we’ve selected a few react-webcam examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jessepollak / command / src / content / commands / Selfie / Selfie.jsx View on Github external
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);
  }
};

react-webcam

React webcam component

MIT
Latest version published 1 year ago

Package Health Score

62 / 100
Full package analysis