-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
62 lines (59 loc) · 2.11 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<title>WebRTC: QR Code Scanner</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="main.css" type="text/css" media="all" />
<base href="https://evanburg.github.io/qrcode-template/">
</base>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/onsenui-core.min.css" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/onsenui.min.css" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/onsen-css-components.min.css" />
<link rel="manifest" href="manifest.json" />
</head>
<body>
<ons-navigator swipeable id="navigator" page="index.html"></ons-navigator>
<template id="index.html">
<ons-page id="home">
<ons-toolbar>
<div class="center">QR Code Scanner</div>
</ons-toolbar>
<div class="container">
<div class="camera-container">
<div class="animate-switch"></div>
<ons-fab id="download">
<ons-icon icon="md-download"></ons-icon>
</ons-fab>
<ons-fab id="switch-camera">
<ons-icon icon="md-camera-switch"></ons-icon>
</ons-fab>
<div class="camera">
<video id="video" autoplay>Video stream not available.</video>
</div>
<div class="output">
<img id="photo" alt="The screen capture will appear in this box." />
</div>
<ons-button modifier="large" id="start">Take Photo</ons-button>
<ons-button modifier="outline large" id="restart">Try Again</ons-button>
</div>
<canvas id="canvas"></canvas>
</div>
</ons-page>
</template>
</body>
<script type="text/javascript">
const registerSW = async () => {
if ('serviceWorker' in navigator) {
try {
await navigator.serviceWorker.register(`${window.location.href}sw.js`);
console.log('Service Worker Registered');
} catch (e) {
console.error('Error registering Service Worker...', e);
}
}
};
registerSW();
</script>
<script src="https://unpkg.com/[email protected]/js/onsenui.min.js"></script>
<script src="capture.js"></script>
</html>