Created
February 28, 2020 08:43
-
-
Save rocioDEV/c2b23b5dba173a4305df7254de220189 to your computer and use it in GitHub Desktop.
ml5-getUserMedia
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({ | |
video: true | |
}) | |
.then(function(mediaStream) { | |
const video = document.querySelector('video') | |
video.srcObject = mediaStream | |
}) | |
.catch(function(err) { | |
console.warn('Error accessing camera') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment