1<!DOCTYPE html>
2<html>
3<head>
4
5<script type="text/javascript">
6
7function enter() {
8
9    if (navigator.mozGetUserMedia) { 
10       navigator.myGetMedia=navigator.mozGetUserMedia;
11       navigator.myGetMedia({video: true}, connect, error); 
12    } 
13    else {
14       alert("NO");
15    }
16
17    function connect(stream) {
18
19        var video = document.getElementById("my_video");
20            video.src = window.URL ? window.URL.createObjectURL(stream) : stream;
21            video.play();
22
23        var canvas = document.getElementById("c"); 
24    }
25
26    function error(e) { console.log(e); }
27
28}
29
30</script>
31
32</head>    
33<body>
34    <canvas width="640" height="480" id="c"></canvas>
35    <input type="button" value="RECORD" onClick="enter()"/>
36    <input type="button" value="SAVE" />
37    <video id="my_video" width="640" height="480"/>
38</body>
39</html>