Last active
October 9, 2019 13:40
-
-
Save Rahmanism/7ad12ebc198ff9ea3621ce55bb26a809 to your computer and use it in GitHub Desktop.
View web cam using JavaScript
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="video1" autoplay></video> | |
<script type="text/javascript"> | |
const v = document.getElementById('video1'); | |
function startVideo() { | |
navigator.getUserMedia( | |
{ video: {}, audio: {} }, | |
stream => v.srcObject = stream, | |
err => console.error(err) | |
) | |
} | |
startVideo(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment