Skip to content

Instantly share code, notes, and snippets.

@bramus
Created October 18, 2013 09:26
Show Gist options
  • Select an option

  • Save bramus/7038963 to your computer and use it in GitHub Desktop.

Select an option

Save bramus/7038963 to your computer and use it in GitHub Desktop.
getUserMedia with video element
// @url http://www.html5rocks.com/en/tutorials/getusermedia/intro/
window.URL = window.URL || window.webkitURL;
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
if (navigator.getUserMedia) {
navigator.getUserMedia({audio: true, video: true}, function(stream) {
document.querySelector('video').src = window.URL.createObjectURL(stream);
}, function(e) {
console.log(e);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment