Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instascan is working well on local host but not working on server. #257

Open
rajentrivedi opened this issue Oct 10, 2020 · 4 comments
Open

Comments

@rajentrivedi
Copy link

i have implemented instascan for my webapp. Its working fine on localhost but not working(not showing camera) on server even though i m running on HTTPS.

also modal is not hiding on error.

plz guide me.

thanx.

my code is as below:

<script type="text/javascript"> var url = {!! json_encode(url('/')) !!}; function scanActivity(e){ e.preventDefault(); $('#scanBill').modal('show'); let scanner = new Instascan.Scanner({ video: document.getElementById('preview') }); scanner.addListener('scan', function (content) { if(content.length != 14){ $('#scanBill').modal('hide'); toastr["warning"]("Invalid QR Code!","", { "positionClass": "toast-bottom-center" }); return; } else { $.ajax({ type: 'GET', url: url + '/admin/loading-qrcode-scan/' + content, success: function(data) { if (data.result = 'success') { alert(data.result); $('#scanBill').modal('hide'); location.reload(); } else { alert(data.result); $('#scanBill').modal('hide'); location.reload(); } } }); } }); Instascan.Camera.getCameras().then(function (cameras) { if (cameras.length > 0) { scanner.start(cameras[1]); } else { $('#scanBill').modal('hide'); toastr["error"]("No Camera Found for Scanning on this device!!!", "Error",{ "positionClass": "toast-bottom-center" }); return; } }).catch(function (err) { console.error(err); $('#scanBill').modal('hide'); toastr["error"]("Requested Device is not appropriate for scanning!!!", "Error",{ "positionClass": "toast-bottom-center" }); }); </script>
@marwinxtra
Copy link

I have the same problem

@jvsteiner
Copy link

me too

@jvsteiner
Copy link

for me, it seems that on a laptop, it works, but on a mobile device (iphone 10S and 11) it does not. On mobile, I just get a black box and no video. I can confirm this problem exists even on the example page: https://schmich.github.io/instascan/

@koropati
Copy link

me to, please someone help us

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants