Skip to content

Instantly share code, notes, and snippets.

@RuslanHolovko
Created February 10, 2020 15:26
Show Gist options
  • Save RuslanHolovko/629c046d27b19cd6f784f2ba7c3ca066 to your computer and use it in GitHub Desktop.
Save RuslanHolovko/629c046d27b19cd6f784f2ba7c3ca066 to your computer and use it in GitHub Desktop.
enabled web camera
<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