Skip to content

Instantly share code, notes, and snippets.

@hyakugei
Last active October 26, 2015 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyakugei/61d6e9bd4b408d9ba6af to your computer and use it in GitHub Desktop.
Save hyakugei/61d6e9bd4b408d9ba6af to your computer and use it in GitHub Desktop.
var body = document.getElementsByTagName("body")[0];
body.innerHTML = 'Hello, World!';
navigator.getMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia);
navigator.getMedia(
// constraints
{video:true, audio:false},
// success callback
function (mediaStream) {
var video = document.getElementsByTagName('video')[0];
video.src = window.URL.createObjectURL(mediaStream);
video.play();
},
//handle error
function (error) {
console.log(error);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment