Skip to content

Instantly share code, notes, and snippets.

@shockwaves
Last active January 4, 2017 16:00
Show Gist options
  • Save shockwaves/68b240238eeff68205ddfa5ef9264f51 to your computer and use it in GitHub Desktop.
Save shockwaves/68b240238eeff68205ddfa5ef9264f51 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<style>
html, body, video {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<video autoplay="true" id="video"></video>
<script>
var video = document.querySelector("#video");
navigator.getUserMedia = navigator.getUserMedia
|| navigator.webkitGetUserMedia
|| navigator.mozGetUserMedia
|| navigator.msGetUserMedia
|| navigator.oGetUserMedia;
if (navigator.getUserMedia) {
navigator.getUserMedia({video: true}, function(stream) {
video.src = window.URL.createObjectURL(stream);
}, function() {});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment