Created
February 10, 2020 15:26
-
-
Save RuslanHolovko/629c046d27b19cd6f784f2ba7c3ca066 to your computer and use it in GitHub Desktop.
enabled web camera
This file contains hidden or 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
<video id="video" autoplay controls></video> | |
<script> | |
video = document.getElementById("video"); | |
const option = { | |
video: true, | |
audio: false | |
}; | |
// Get image from camera | |
navigator.getUserMedia(option, (stream) => { | |
video.srcObject = stream; // Load as source of video tag | |
video.addEventListener("loadeddata", () => { | |
// ready | |
}); | |
}, (error) => { | |
console.log(error); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment