-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
97 lines (85 loc) · 2.22 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- BarcodeDetector polyfill (fallback, where not available)-->
<script src="https://cdn.jsdelivr.net/npm/@undecaf/[email protected]/dist/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@undecaf/[email protected]/dist/index.js"></script>
<script>
if ('BarcodeDetector' in window) {
console.log('BarcodeDetector supported in platform');
} else {
console.log('BarcodeDetector not supported in platform, using polyfill');
window.BarcodeDetector = barcodeDetectorPolyfill.BarcodeDetectorPolyfill;
}
</script>
</head>
<style>
body {
margin: 0;
height: 100vh;
}
.flex-container {
display: flex;
font-family: sans-serif;
font-optical-sizing: auto;
font-weight: 400;
font-style: normal;
padding-bottom: 100px;
}
.content {
margin: auto;
position: relative;
width: 90%;
max-width: 700px;
}
.col {
display: flex;
flex-direction: column;
gap: 10px;
}
.row {
display: flex;
flex-direction: row;
gap: 10px;
align-items: center
}
button {
min-width: 5.14em;
width: 100%;
text-align: center;
font: inherit;
padding: 0.7em 0.57em;
color: black;
}
</style>
<body>
<div class="flex-container">
<div class="content">
<div class="col">
<div class="row">
<h2>Broadcast Audio URI Scanner</h2>
</div>
<div class="row">
<button id="start_scanner">Start scanner</button>
<button id='stop_scanner'>Stop scanner</button>
</div>
<!-- Broadcast Audio URI scanner element -->
<bau-scanner></bau-scanner>
</div>
</div>
</div>
</body>
<script type="module" src="./bau-scanner.js"></script>
<script>
let scanner;
const init = () => {
const startScan = document.querySelector('#start_scanner');
const stopScan = document.querySelector('#stop_scanner');
scanner = document.querySelector('bau-scanner');
startScan.addEventListener('click', scanner.startCamera);
stopScan.addEventListener('click', scanner.stopCamera);
}
window.addEventListener('load', init);
</script>
</html>