forked from Mayank-S05/Deaf-And-Dumb-Assistance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getjs.js
27 lines (22 loc) · 903 Bytes
/
getjs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var video = document.getElementById('video');
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.oGetUserMedia || navigator.msGetUserMedia;
if(navigator.getUserMedia){
navigator.getUserMedia({video:true}, streamWebCam, throwError);
}
function streamWebCam (stream) {
video.src = window.URL.createObjectURL(stream);
video.play();
}
function throwError (e) {
alert(e.name);
}
var video = document.getElementsByTagName("video")[0];
video.setAttribute('height', '600');
video.setAttribute('width', '900');
// function snap () {
// canvas.width = video.clientWidth;
// canvas.height = video.clientHeight;
// context.drawImage(video, 0, 0);
// }