Instascan: Invalid asm.js: Type mismatch in assignment [instascan.min.js]:18

Created on 1 Aug 2018  ·  16Comments  ·  Source: schmich/instascan

I can't get my QR code scanner to function properly using another android application webview. This is the issue that displays for me.

Also, when I select to start my camera, I get a Uncaught (in promise) {name: "NotAllowedError", message: "Permission denied", constraint: undefined, toString: ƒ}.

Most helpful comment

I am able to make it work by using the file from the demo page:
https://schmich.github.io/instascan/
Here is the file link:
https://rawgit.com/schmich/instascan-builds/master/instascan.min.js

All 16 comments

I have now the exactly same problem!

Still works fine on Laptop Lenovo ThinkPad, Windows 10, Google Chrome Version 69.0.3497.100 (64-Bit)

Did work fine a few months ago on Google Chrome Android Version ??? @ Sony Xperia Z3 compact Andriod Version 6.0.1

Does NOT work any more on Google Chrome Android Version 69.0.3497.100, problem near to scanner.start:
Invalid asm.js: Type mismatch in assignment
qr.html:1 Uncaught (in promise) {name: "NotAllowedError", message: "Permission denied", constraint: undefined, toString: ƒ}
Promise.then (async)
E.async @ instascan.min.js:7
value @ instascan.min.js:9

Instascan is really cool!
I would highly appreciate if this could be fixed :-)

I used https domain up to now,
Now I tried to explicitely refernce https domain in

Not working on Android Firefox 62.0.1 as well

Working well on Android Opera 47.3.2249.130976
Working well on Android Edge 42.0.0.2549

I think this was a uglifyJS issue, building instascan.min.js new with gulp release seems to fix this.

I think this was a uglifyJS issue, building instascan.min.js new with gulp release seems to fix this.

Thanks! This solved the problem on my mobile phone
Sony Xperia Z3 compact Andriod Version 6.0.1
Google Chrome Android Version 69.0.3497.100
Android Firefox 62.0.1

can anyone share the gulp release minify result :(

I couldn't build it with gulp v4 - some seemingly minor changes would be needed to the gulpfile.js
I could build it with gulp v.3.9.1, but it seems the gulp-uglify still breaks it. I removed the uglify lines from the gulpfile and this error went away, at the cost of a bigger instascan.js file (~+1MB)
But even so, as mentioned in #197, it's still got problems with "createObjectURL"

Edit: Found a file from comment #139 . That worked, even though it still hat the "Invalid asm" error. Thanks also to chrisgunawardena

Thanks chris, but the version you linked to causes the error "Camera is not defined." (all else the same).

You need to wait until its initialized. This is what I use:

const initQrCodeScanner = () => {
  let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
  Instascan.Camera.getCameras().then(cameras => {
    scanner.camera = cameras[cameras.length - 1];
    scanner.start();
  }).catch(console.error);

  scanner.addListener('scan', content => {
    scanner.stop();
    try { window.location.hash = new URL(content).hash } catch (e) { console.log(e) }
  });

};

Hello. Please help a noob. Everything was working for me using the example and release v 1.0.0 and then I closed my computer, opened it up again, and suddenly I was getting the CreateObjectUrl problem.

So then I used the minified file pointed to in this thread, and now I get the "Camera is not defined" error just like mjcapper.

I tried to do what chris-gunawardena did (copied and pasted exactly), and now there are no errors but also there is no video on the camera.

It was working perfectly last night!! (maybe my Chrome browser had an update in the meantime? Dunno).

So I'm very frustrated. Also, for the record, I'm developing on localhost, camera was working before, is this because chrome updated? My version says:

Version 71.0.3578.98 (Official Build) (64-bit)

I also tried on IE and I can't get video. No errors, but also no video.

Help please. :(

It was working on all the browsers (Safari, Chrome on Mac an on Chrome Android).
At the moment it works only on Firefox on Mac.
On Firefox mobile is not working.

I'd like a a step by step info (for noobs) about how to fix using minfy/uglyJs/gulp. Thank you.

EDIT: it doesn't matter anymore. What I said is till true about the example privided in the main page. However the previous posted example https://codepen.io/chris-gunawardena/pen/REGQPR?editors=1111 actually fixes the problem.

I am able to make it work by using the file from the demo page:
https://schmich.github.io/instascan/
Here is the file link:
https://rawgit.com/schmich/instascan-builds/master/instascan.min.js

Working example on chrome: https://codepen.io/chris-gunawardena/pen/REGQPR?editors=1111

do I need an SSL certificate to get this to work?
'coz it works fine in localhost but not in a live webhosting without an SSL certification.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mairh picture mairh  ·  8Comments

harshad5498 picture harshad5498  ·  7Comments

TomRauchenwald picture TomRauchenwald  ·  9Comments

lnhrdt picture lnhrdt  ·  7Comments

schmich picture schmich  ·  4Comments