-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
46 lines (37 loc) · 1.2 KB
/
demo.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>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>camera-capture Demo</title>
<script src="../platform/platform.js"></script>
<link rel="import" href="camera-capture.html">
<style type="text/css">
#video {
transform: rotateY(-180deg);
}
</style>
</head>
<body unresolved>
<button id="start">Start capturing</button>
<button id="stop">Stop capturing</button>
<video src="" id="video" autoplay></video>
<camera-capture id="camera" autocapture></camera-capture>
<script>
window.addEventListener('load', function() {
'use strict';
var camera = document.querySelector('#camera');
var start = document.querySelector('#start');
var stop = document.querySelector('#stop');
var video = document.querySelector('#video');
camera.addEventListener('start', function (evt) {
video.src = evt.detail;
});
camera.addEventListener('error', function (evt) {
console.log(evt);
});
start.addEventListener('click', camera.start.bind(camera));
stop.addEventListener('click', camera.stop.bind(camera));
});
</script>
</body>
</html>