<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Video</title>
<style>
.booth{
width: 400px;
background: #eee;
border: 10px solid red;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="booth">
<video id="video" width="400px" height="300px" autoplay></video>
</div>
<script>
(function(){
var video = document.getElementById('video'),
vendorUrl = window.URL || window.webkitURL;
navigator.getMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mediaDevices.getUserMedia ||
navigator.msGetUserMedia;
//capture video
navigator.getMedia({
video: true,
audio: true
}, function(stream){
//console.log(stream);
video.srcObject = stream;
video.play();
}, function(error){
// an error
//error.code
});
})();
</script>
</body>
</html>
Comments
Post a Comment