Skip to content

Instantly share code, notes, and snippets.

@diegogurgel
Created May 12, 2013 20:37
Show Gist options
  • Save diegogurgel/5564833 to your computer and use it in GitHub Desktop.
Save diegogurgel/5564833 to your computer and use it in GitHub Desktop.
Webcam Javascript
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Acesso a webcam via javaScript</title>
<link rel="stylesheet" href="css/style.css">
<link rel="author" href="humans.txt">
</head>
<body>
<video autoplay></video>
<script src="js/script.js"></script>
</body>
</html>
window.onload=function(){
window.navigator.webkitGetUserMedia({video: true}, function(midia_local) {
console.log(midia_local);
var video = document.querySelector('video');
video.src = window.webkitURL.createObjectURL(midia_local);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment