-
-
Save jbubriski/9599409 to your computer and use it in GitHub Desktop.
This file contains 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
body { | |
margin: 0px; | |
padding: 0px; | |
} | |
#player { | |
width: 100%; | |
height: 100%; | |
} |
This file contains 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>WebRTC WebCam</title> | |
<link rel="stylesheet" href="webcam.css"/> | |
<script src="webcam.js"></script> | |
</head> | |
<video id="player" autoplay="true"></video> | |
</html> |
This file contains 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
(function(){ | |
var mediaOptions = { audio: false, video: true }; | |
if (!navigator.getUserMedia) { | |
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia; | |
} | |
if (!navigator.getUserMedia){ | |
return alert('getUserMedia not supported in this browser.'); | |
} | |
navigator.getUserMedia(mediaOptions, success, function(e) { | |
console.log(e); | |
}); | |
function success(stream){ | |
var video = document.querySelector("#player"); | |
video.src = window.URL.createObjectURL(stream); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment