Created
April 29, 2020 18:00
-
-
Save vinooniv/f551249042b45e9b6d192810c3afd9d6 to your computer and use it in GitHub Desktop.
WebRTC video stream
This file contains 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
<html> | |
<body> | |
<video id="video" width="480" height="320" autoplay playsinline></video> | |
<script> | |
const videoElement = document.getElementById('video'); | |
navigator.mediaDevices.getUserMedia({ video: true, audio: false }) | |
.then(stream => { | |
videoElement.srcObject = stream; | |
videoElement.play(); | |
}) | |
.catch(err => { | |
alert(`Following error occured: ${err}`); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment