Created
December 6, 2011 16:44
Revisions
-
tomayac revised this gist
Dec 6, 2011 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,9 @@ <h1>See yourself?</h1> If your browser supports <span style="font-family:monospace;">navigator.getUserMedia()</span> you should see yourself below. If you don't see yourself, try downloading the <a href="http://labs.opera.com/news/2011/10/19/">Opera Labs</a> browser. <div> <video id="sourcevid" autoplay controls></video> </div> -
There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ <html> <head> <title>navigator.getUserMedia() Demo</title> </head> <body> <h1>See yourself?</h1> If your browser supports <span style="font-family:monospace;">navigator.getUserMedia()</span> you should see yourself below. <div> <video id="sourcevid" autoplay controls></video> </div> <script type="application/javascript"> (function() { // Assign the <video> element to a variable var video = document.getElementById('sourcevid'); // Replace the source of the video element with the stream from the camera if (navigator.getUserMedia) { navigator.getUserMedia('video', successCallback, errorCallback); function successCallback(stream) { video.src = stream; } function errorCallback(error) { console.error('An error occurred: [CODE ' + error.code + ']'); return; } } else { console.log('Native web camera streaming (getUserMedia) is not ' + 'supported in this browser.'); return; } })(); </script> </body> </html>