Created
November 17, 2016 15:17
-
-
Save MartinMuzatko/9e40127e7b76020e61f76fc495480772 to your computer and use it in GitHub Desktop.
WebRTC Instant Webcam
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
navigator.mediaDevices.getUserMedia({audio:0,video:1}) | |
.then(function(mediaStream) { | |
document.body.innerHTML='<video>' | |
var video = document.querySelector('video') | |
video.srcObject = mediaStream | |
video.onloadedmetadata = function(e) { | |
video.play() | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment