add instascan QR code Reader
This commit is contained in:
parent
6b422d79cc
commit
2bbc5cd43c
|
@ -41,6 +41,7 @@ foreach ($videos as $v) {
|
||||||
<title>Astro CLUB</title>
|
<title>Astro CLUB</title>
|
||||||
<link rel="stylesheet" href="crowdbunker.css" type="text/css" />
|
<link rel="stylesheet" href="crowdbunker.css" type="text/css" />
|
||||||
<link rel="icon" type="image/png" href="./astrocrowdbunker.png" />
|
<link rel="icon" type="image/png" href="./astrocrowdbunker.png" />
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||||
<script type="text/javascript" src="./instascan.min.js"></script>
|
<script type="text/javascript" src="./instascan.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -52,6 +53,9 @@ foreach ($videos as $v) {
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
|
<video id="preview"></video>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echo '<ul id="videosList">';
|
echo '<ul id="videosList">';
|
||||||
|
|
||||||
|
@ -80,6 +84,21 @@ echo '</ul>';
|
||||||
?>
|
?>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
|
||||||
|
scanner.addListener('scan', function (content) {
|
||||||
|
alert(content);
|
||||||
|
});
|
||||||
|
Instascan.Camera.getCameras().then(function (cameras) {
|
||||||
|
if (cameras.length > 0) {
|
||||||
|
scanner.start(cameras[0]);
|
||||||
|
} else {
|
||||||
|
console.error('No cameras found.');
|
||||||
|
}
|
||||||
|
}).catch(function (e) {
|
||||||
|
console.error(e);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue