Created
February 10, 2014 14:40
-
-
Save luckyruby/8917100 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!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