title: Turn ON/OFF Webcam using AngularJS
body: <p>I'm using <a href="https://github.com/jonashartmann/webcam-directive" rel="nofollow noreferrer"><code>webcam</code></a> directive for capturing photos. I'm able to turn OFF the camera. But I'm not able ON it again. Any help would be appreciated.</p>
  
  <p>Here is my current code to stop the camera.</p>
  
  <pre><code>var mStream = null;
  
  $scope.onStream = function (stream) {
      // You could do something manually with the stream.
      mStream = stream;
  };
  $scope.stopCamera = function() {
      // mStream.stop();  didn't work.
      mStream.getTracks()[0].stop();
  };
  $scope.startCamera = function() {
      // mStream.play(); didn't work
      // ToDo
  };
  </code></pre>
  
  <p>Thank you</p>