/
fingerprint-reader-demo.html
35 lines (30 loc) · 1.17 KB
/
fingerprint-reader-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
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<meta property="mgo-fingerprint" content="true" />
<title>Fingerprint Reader Demo</title>
</head>
<body>
<h4>Fingerprint Reader Demo</h4>
<button id="bt-start" type="button" class="btn mgo-fingerprint-tg-start">Start</button>
<button id="bt-stop" type="button" class="btn mgo-fingerprint-tg-stop">Stop</button>
<div style="width:150px; height:200px; border: solid 3px #000;">
<img id="fingerprint-image" alt="No fingerprint captured yet" style="width:100%; height:100%;" />
</div>
<script type="text/javascript">
var btn_start = document.getElementById('bt-start');
btn_start.addEventListener('mgo-fingerprint-capture-event', (evt) => {
// evt.detail contains the fingerprint image encoded base64
console.log('Fingerprint base64', evt.detail)
var img = document.getElementById('fingerprint-image');
img.src = 'data:image;base64,' + evt.detail;
});
var btn_stop = document.getElementById('bt-stop');
btn_stop.addEventListener('mgo-fingerprint-stop-event', (evt) => {
// Do something
console.log('Fingerprint reader was stoped')
});
</script>
</body>
</html>