Skip to content

Instantly share code, notes, and snippets.

@franciscojsc
Created July 4, 2021 04:09
Show Gist options
  • Save franciscojsc/12378b30801e6659951ebf631a2027b4 to your computer and use it in GitHub Desktop.
Save franciscojsc/12378b30801e6659951ebf631a2027b4 to your computer and use it in GitHub Desktop.
WebCam Web 📷
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>WebCam Web</title>
</head>
<body>
<video id="video" autoplay muted></video>
<script>
const addVideoStream = (stream) => {
document.querySelector('#video').srcObject = stream;
}
navigator.mediaDevices.getUserMedia({
video: true
}).then(addVideoStream);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment