title: Webcam Does Not Turn Off When Leaving React Component
body: <p>I am currently taking pictures from my webcam in a React App. When I leave the component however, the green light continues to stay on and I do not seem able to close my webcam. Here is the code I use to use the webcam. </p>
  
  <pre><code>  navigator.webkitGetUserMedia({ video: true, audio: false }, function(stream) {
      video.srcObject = stream;
      window.localstream = stream;
      video.play();
    }, function (e) {
      console.log(e);
    })
  </code></pre>
  
  <p>Later, in my componentWillUnmount lifecycle handler, I run the following code: </p>
  
  <pre><code>video.pause();
  video.srcObject = null;
  window.localstream.getTracks()[0].stop();
  var list = document.getElementById("video"); 
  list.removeChild(list.childNodes[0])
  </code></pre>
  
  <p>My webcam does not turn off however when I console.log the MediaStreamTrack's readyState = "ended" and enabled is equal to false. Is there any way I can force my webcam to turn off? </p>