forked from mohansun/getUserMedia-Opera-12-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
47 lines (45 loc) · 1.36 KB
/
index.html
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html lang="en">
<head>
<title>HTML5 Webcam Demo - Opera 12 alpha</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=yes">
<style type="text/css">
video {
position:absolute;
left:100px;
top:100px;
border-radius:20px;
box-shadow: 10px 10px 10px rgba(68,68,68,0.6);
}
</style>
<script>
window.onload = function() {
var video = document.getElementById('sourcevid');
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
if (navigator.getUserMedia) {
navigator.getUserMedia('video', successCallback, errorCallback);
function successCallback(stream) {
if(window.webkitURL){
video.src = window.webkitURL.createObjectURL(stream);
console.log('video stream for Chrome success!');
}else{
video.src = stream;
console.log('video stream for Opera12 success!');
}
}
function errorCallback(error) {
console.error('An error occurred: [CODE ' + error.code + ']');
return;
}
}
else {
alert('No support for getUserMedia in your browser')
}
}
</script>
</head>
<body>
<video id="sourcevid" autoplay="true">NO SUPPORT FOR VIDEO </video>
</body>
</html>