Created
December 26, 2014 16:09
-
-
Save szolotykh/933f8009aae9fb86b161 to your computer and use it in GitHub Desktop.
HTML5 Camera test
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
<html> | |
<script> | |
var errorCallback = function(e) { | |
console.log('Rejected', e); | |
}; | |
function init(){ | |
navigator.getUserMedia = navigator.getUserMedia || | |
navigator.webkitGetUserMedia || | |
navigator.mozGetUserMedia || | |
navigator.msGetUserMedia; | |
var video = document.querySelector('video'); | |
if (navigator.getUserMedia) { | |
navigator.getUserMedia({audio: true, video: true}, function(stream) { | |
video.src = window.URL.createObjectURL(stream); | |
}, errorCallback); | |
} else { | |
alert('getUserMedia() is not supported in your browser'); | |
} | |
} | |
</script> | |
<head> | |
</head> | |
<body onload = "init()"> | |
<video autoplay></video> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment