Skip to content

Instantly share code, notes, and snippets.

@MartinMuzatko
Created November 17, 2016 15:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinMuzatko/9e40127e7b76020e61f76fc495480772 to your computer and use it in GitHub Desktop.
Save MartinMuzatko/9e40127e7b76020e61f76fc495480772 to your computer and use it in GitHub Desktop.
WebRTC Instant Webcam
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