function getCamera() {
  var cameraSrcId = document.querySelector('select').value;

  // constraints allow us to select a specific video source 
  var constraints = {
    video: {
      optional: [{
        sourceId: cameraSrcId
      }]
    },
    audio:false
  }

  navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia

  navigator.getUserMedia(constraints, function(stream) {
    var videoElm = document.querySelector('video');
    videoElm.src = URL.createObjectURL(stream);

    stream.onended = function() {
      updateButtonState();
    }

    videoElm.onplay = function() {
      if(curStream !== null) {
        // stop previous stream
        curStream.stop();
      }

      curStream = stream;
      updateButtonState();  
    }
  }, function(e) {
    curStream = null;
    console.error(e);
  });
}
Grabs the camera feed from the browser, requesting
video from the selected device. Requires the permissions
for videoCapture to be set in the manifest.

@see http://developer.chrome.com/apps/manifest#permissions