34 lines
595 B
HTML
34 lines
595 B
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>getUserMedia Demo 1</title>
|
||
|
<style>
|
||
|
video {
|
||
|
border:5px solid black;
|
||
|
width:480px;
|
||
|
height:360px;
|
||
|
}
|
||
|
button {
|
||
|
font: 18px sans-serif;
|
||
|
padding: 8px;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<video id="vid" autoplay="true"></video>
|
||
|
<br>
|
||
|
<button id="btn" onclick="start()">Start</button>
|
||
|
<script>
|
||
|
video = document.getElementById("vid");
|
||
|
function start() {
|
||
|
navigator.webkitGetUserMedia({video:true}, gotStream, function() {});
|
||
|
btn.disabled = true;
|
||
|
}
|
||
|
function gotStream(stream) {
|
||
|
video.src = webkitURL.createObjectURL(stream);
|
||
|
}
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|
||
|
|