serratus / quaggaJS

An advanced barcode-scanner written in JavaScript
https://serratus.github.io/quaggaJS/
MIT License
5.08k stars 978 forks source link

Latest build for quagga.js and quagga.min.js #198

Open sceline opened 7 years ago

sceline commented 7 years ago

Hi

I am using the latest dist for quagga.js and quagga.min.js but with these js , the front camera alone is opening in chrome on android. the rear camera isnt working.

previous version was working for rear camera, the latest build changed something which is not making the rear to work.

sceline commented 7 years ago

Hi christopher,

Since the front camera is working with the latest version. I wanted to push to prod with the latest version if rear camera worked. any suggestion or help to make the rear camera work in android chrome would be appreciated. I have the facingMode as environment but invain.

serratus commented 7 years ago

Hi @sceline

do you use the latest version that is:

The back-facing camera should work with the newest version that is on the master branch. Unfortunately, there have been so many changes in the different browsers, that I cannot really tell if your problem is related to quagga or Chrome.

What version of Chrome have you tested?

sceline commented 7 years ago

Hi Christopher,

Thanks for getting back. I am using the latest version that is available under Master branch,dist folder,(quagga.min.js).

The version of chrome that i am using is 57 on android 4.4.4.

With the previous version of quagga.min way back in Jan i guess, the rear camera is working perfectly and capturing barcodes.

Thanks in advance for your further help!

sceline commented 7 years ago

I tried the latest version just updated today(may25th) and still only the front camera is working in chrome. The version that i have where the rear camera is working has logic for facingMode , if user then front else if environment then rear camera. Also there is additional logic like the below

t = function(t, n) { if (t = JSON.parse(JSON.stringify(t)), t && t.audio && (t.audio = e(t.audio)), t && "object" == typeof t.video) { var o = t.video.facingMode; if (o = o && ("object" == typeof o ? o : { ideal: o }), o && ("user" === o.exact || "environment" === o.exact || "user" === o.ideal || "environment" === o.ideal) && (!navigator.mediaDevices.getSupportedConstraints || !navigator.mediaDevices.getSupportedConstraints().facingMode) && (delete t.video.facingMode, "environment" === o.exact || "environment" === o.ideal)) return navigator.mediaDevices.enumerateDevices().then(function(i) { i = i.filter(function(e) { return "videoinput" === e.kind }); var a = i.find(function(e) { return e.label.toLowerCase().indexOf("back") !== -1 }) || i.length && i[i.length - 1]; return a && (t.video.deviceId = o.exact ? { exact: a.deviceId } : { ideal: a.deviceId }), t.video = e(t.video), r("chrome: " + JSON.stringify(t)), n(t) }); t.video = e(t.video) } return r("chrome: " + JSON.stringify(t)), n(t) },

which is missing in the latest build. Is this code not needed or my understanding is incorrect.

The rear camera working in chrome is critical to me because the web page is totally dependent on rear camera.

Would really appreciate the help/advice.

sceline commented 7 years ago

Hi Christopher

If you can check the differences and update to latest which can be used it would be really appreciable!

sceline commented 7 years ago

People who have faced this issue, please comment on the resolution that worked for you. Current version that is being used is chrome 58.

Wisbell commented 7 years ago

@sceline I just experienced this problem using version '0.12.1'. I reverted back to version '0.11.6' in order to fix my problem. I've been using bower to install quagga.

jeremy447 commented 7 years ago

I have the same problem with latest master. I tried 0.11.6 but the problem was present too. I there a way to fix it or workaround it ?

Thanks !

jeremy447 commented 7 years ago

Well it seem that is not a QuaggaJs problem. I fixed it, at least on my phone, didn't test others, by using facingMode: { exact: "environment" } and updating updater.js.