Skip to content

Instantly share code, notes, and snippets.

@bourdakos1
Last active July 27, 2020 08:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bourdakos1/74b205b7da40b8cd6d54eaecad16ee59 to your computer and use it in GitHub Desktop.
Save bourdakos1/74b205b7da40b8cd6d54eaecad16ee59 to your computer and use it in GitHub Desktop.
const video = document.getElementById("video")
navigator.mediaDevices
.getUserMedia({
audio: false,
video: {
facingMode: "user",
width: 600,
height: 500
}
})
.then(stream => {
video.srcObject = stream
video.onloadedmetadata = () => {
video.play()
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment