I've been scouring the web and S/O for answers as to why the following code does not work, but so far no dice. It is supposed to simply stream the user's video and audio. I am viewing it in Chrome.
<html>
<body>
<video width="400" height="400" id="userVideo"></video>
<script>
var userStream;
if(navigator.mediaDevices.getUserMedia) {
//both video and audio
navigator.mediaDevices.getUserMedia({
video: true,
audio: true,
}, function(stream) {
console.log("got the stream");
userStream = stream;
document.getElementById("userVideo").srcObject = userStream;
});
}
</script>
</body>
</html>