title: Stop video with getUserMedia
body: <p>I'm trying to learn more about streaming webcams and i'm stuck at stopping the video I hope someone can help me with stopping the video</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var videoDiv = $("#video"),
   vendorUrl = window.URL || window.webkitURL;
   navigator.getMedia =  navigator.getUserMedia ||
         navigator.webkitGetUserMedia ||
         navigator.mozGetUserMedia ||
         navigator.oGetUserMedia ||
         navigator.msGetUserMedia;
  
  function captureWebcam(video, audio){
   navigator.getMedia({
    video: video,
    audio: audio
   }, function(stream){
    localStream = stream;
    videoDiv.attr("src", vendorUrl.createObjectURL(localStream))
   }, function(error){
    // An error occured
    // error.code
    console.log(error)
   }); 
  }  
  $("#stop").on("click", function(){
  
   videoDiv.attr("src", "") 
   //captureWebcam(false, false)
      // Stop the video
  }); 
  $("#start").on("click", function(){
   captureWebcam(true, false)
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;video id="video" width="400" height="300"&gt;&lt;/video&gt;
  &lt;button id="start"&gt;START!&lt;/button&gt;
  &lt;button id="stop"&gt;STOP!&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>