How to use react-webcam - 4 common examples

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