question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

QR Not Show in UMD Javascript

See original GitHub issue

Describe the bug QR scanner not showing in UMD Javascript but camera indicator is on. Last used was yesterday

Expected behavior Scanner QR show with indicator camera on.

Screenshots image

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome
  • Version 107

Smartphone (please complete the following information):

  • Device: Xiaomi 4X
  • OS: Android 7.1
  • Browser Chrome
  • Version 98

Additional context qr.blade.php

@section(‘content’)

<div class="fl scanner">
      <div id="reader" maxWidth="600px" MaxHeight="600px" width="100%"></div>
</div>

@edsection

@section(‘js’)

<script src="https://unpkg.com/html5-qrcode" type="text/javascript"></script>
<script type="text/javascript">
   // function onScanSuccess(decodedText, decodedResult) {
   //    // handle the scanned code as you like, for example:
   //    console.log(`Code matched = ${decodedText}`, decodedResult);
      
   //    document.querySelector('#idPartner').value = decodedText;
      
   //    document.querySelector('.form-scan').style.display = 'inline';
   //    document.querySelector('.scanner').style.display = 'none';
   // }

       
   // let config = {
   //    fps: 10,
   //    qrbox : { width: 400, height: 300 },
   //    rememberLastUsedCamera: true,
   //    // Only support camera scan type.
   //    supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_CAMERA]
   // };
       
   // let html5QrcodeScanner = new Html5QrcodeScanner(
   //    "reader", config, /* verbose= */ false);
   // html5QrcodeScanner.render(onScanSuccess);
   const formatsToSupport = [
      Html5QrcodeSupportedFormats.QR_CODE
   ];
   const html5QrCode = new Html5Qrcode("reader");
   const qrCodeSuccessCallback = (decodedText, decodedResult) => {
      /* handle success */
      console.log(`Code matched = ${decodedText}`, decodedResult);
      
      document.querySelector('#idPartner').value = decodedText;
      
      document.querySelector('.form-scan').style.display = 'inline';
      document.querySelector('.scanner').style.display = 'none';
   };
   const config = { fps: 10, qrbox: { width: 250, height: 250, formatsToSupport: formatsToSupport} };
   html5QrCode.start({ facingMode: "environment" }, config, qrCodeSuccessCallback);
</script>

@endsection

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
khoirulbadscommented, Nov 24, 2022

please help us, Khalid Perwira is my Dev team, this apps built by Laravel. so html 5 works in blade, a few days ago this is worked, but i dont know yesterday camera not opened

0reactions
khalidperwiracommented, Dec 1, 2022

Hello Mebjas, Thank you for your attention. We tried your first solution. It helped us a lot. We tracked down the problem and found out that problem was with a div with the class fl scanner. We don’t know why it happened. It seems like a dumb mistake.

By the way, the first solution was a simple way to make a back camera-first scanner, right? I will post our code below.

Once again, thank you very much for your attention, and keep up the best work.

qr.blade.php

@section('content')
<div style="max-height: 400px;max-width: 400px;">
      <div id="reader"></div>
</div>
@endsection
@section('js')
<script src="https://unpkg.com/html5-qrcode" type="text/javascript"></script>
<script type="text/javascript">
   const qrCodeSuccessCallback = (decodedText, decodedResult) => {
      /* handle success */
      console.log(`Code matched = ${decodedText}`, decodedResult);
   };
   const formatsToSupport = [
      Html5QrcodeSupportedFormats.QR_CODE
   ];

   const html5QrCode = new Html5Qrcode("reader", {formatsToSupport: formatsToSupport});
   const config = { fps: 10, qrbox: { width: 250, height: 250} };
   html5QrCode.start({ facingMode: "environment" }, config, qrCodeSuccessCallback);
</script>
@endsection
Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - ZXing Library will decode QR code but not barcode
Save this question. Show activity on this post. I am using ZXing library to decode QR codes and barcodes in a HTML /...
Read more >
QR Code scanner using HTML and Javascript | by Minhaz
To stop scanning, use stop() method​​ // QR Code scanning is stopped. // Stop failed, handle it. console.
Read more >
html5-qrcode - npm
Html5-QRCode. Lightweight & cross platform QR Code and Bar code scanning library for the web. Use this lightweight library to easily ...
Read more >
Multi-Factor Authentication (MFA) - UMD
Either a mobile device, a hardware token, a phone that can receive voice calls, or a one-time use code (this video playlist shows...
Read more >
UMD Ento Student Organization (@umdeso) / Twitter
@umdeso. We are the Entomology students of University of Maryland, College Park ... Don't let your membership benefits slip away! ... Show this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found