Webcam doesn’t display

<!DOCTYPE html>
<html>
<head>
	<title>cam</title>
	<meta charset="utf-8">
	<meta http-equiv="x-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="widthdvice-width, initial-scale=1.0">
</head>


<style type="text/css">
	
h1 {

	font-family: sans-serif;
	color: green;
}

body{
	margin: 50px;
}

#container {

	margin: 0px;
	width: 500px;
	height: 375px;
	border: 10px #333 solid;
}

#videoElement{
	width: 500px;
	height: 375px;
	background-color: #666; 
}

</style>

<body>
<h1>Display webcam</h1>
<div id="container">
	
<video autoplay="true" id="videoElement">

</video>

</div>

<script >

let video = document.querySelector("#videoElement");

if (navigator.mediaDevices.getUserMedia) 
{

navigator.mediaDevices.getUserMedia({ video: true })
.then(function (stream)
{
	video.srcObject = stream;
})

.catch (function (error){

console.log("Something went wrong!");
})
   }

else {
	console.log("getUserMedia not supported");
}

</script>

</body>
</html>