Skip to content

Instantly share code, notes, and snippets.

@iporsut
Created June 5, 2021 04:37
Show Gist options
  • Save iporsut/a5602d5c415d5ef08eb8e9c35642b034 to your computer and use it in GitHub Desktop.
Save iporsut/a5602d5c415d5ef08eb8e9c35642b034 to your computer and use it in GitHub Desktop.
HTML display from camera
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Camera</title>
</head>
<body>
<video id="camera" autoplay playsinline></video>
<script>
const videoElement = document.getElementById("camera");
navigator.mediaDevices
.getUserMedia({
video: {},
})
.then((stream) => {
videoElement.srcObject = stream;
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment