Skip to content

Instantly share code, notes, and snippets.

@luckyruby
Created February 10, 2014 14:40
Show Gist options
  • Select an option

  • Save luckyruby/8917100 to your computer and use it in GitHub Desktop.

Select an option

Save luckyruby/8917100 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Prototype</title>
<style>
h1 {
text-align: center;
}
#main_container {
height: 480px;
width: 640px;
margin: auto;
border: 1px solid black;
}
</style>
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function() {
navigator.getMedia = (navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia);
var video = document.querySelector('video');
var constraints = {
audio: true,
video: true
}
var successCallback = function(stream) {
video.src = window.URL.createObjectURL(stream);
};
var errorCallback = function(err) {
console.log("Error: " + err);
};
navigator.getMedia(constraints, successCallback, errorCallback);
});
</script>
</head
<body>
<h1>Enderbox</h1>
<div id="main_container">
<video autoplay muted></video>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment