Page MenuHomePhabricator

Add ability to cite books by scanning their ISBN barcode in mobile web
Open, Needs TriagePublic

Description

Separating from T208134, which is about the same feature in mobile app.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 21 2019, 10:27 PM

I myself am successfully using a JS compilation of zbar: https://github.com/Schnark/barcode-reader/blob/master/js/lib/zbar-worker.js, and IIRC the last time I tested it, it was much faster than quaggaJS, even though it also detects QR codes.
They main problem all these JS's have is that a live input via getUserMedia might not be able to properly focus (according to https://bugs.chromium.org/p/chromium/issues/detail?id=343894 it works in Chrome on Android, but probably still not on iOS), which for normal sized barcodes means that you just can't read them. Instead you have to take a photo with the camara app, select that photo instead of the live stream, repeat these steps if something went wrong, and delete all those photos manually once you are done. That's not very user friendly.
A very experimental (i.e. currently an experiment in Chrome only, might perhaps change sometime in the future) is https://wicg.github.io/shape-detection-api/#barcode-detection-api.
If you only want this feature in the Android app, then you should do the barcode scanning in Java, not in JavaScript.

Mvolz moved this task from Backlog to Extension on the Citoid board.Feb 26 2019, 9:43 AM
JTannerWMF moved this task from To Triage to Q4 on the VisualEditor board.Feb 26 2019, 4:07 PM

Change 493494 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/Citoid@master] WIP DEMO barcode scanning

https://gerrit.wikimedia.org/r/493494

TheDJ awarded a token.Mar 15 2019, 7:01 PM

Video throughput on my iPhoneX seems jittery, but this is an amazing feature.. SHIP IT ! ;)

Mvolz added a subscriber: Mvolz.Mar 30 2019, 5:44 PM

Awesome! There's a slight delay with no loading animation in between when the barcode app closes and when the isbn gets inserted that is just a little too long for no feedback on my phone... is there any way to make that pending? And also, when you press back after denying camera access, you get an empty dialog. But yes ship it :D.

Change 493494 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/Citoid@master] WIP DEMO barcode scanning

https://gerrit.wikimedia.org/r/493494

Awesome! There's a slight delay with no loading animation in between when the barcode app closes and when the isbn gets inserted that is just a little too long for no feedback on my phone... is there any way to make that pending? And also, when you press back after denying camera access, you get an empty dialog. But yes ship it :D.

Can you make a screen recording? The dialog should be closing fairly instantly - if it isn't that could be the shutdown code for the library causes the main thread to hang.

Mvolz added a comment.Apr 6 2019, 3:57 PM

Awesome! There's a slight delay with no loading animation in between when the barcode app closes and when the isbn gets inserted that is just a little too long for no feedback on my phone... is there any way to make that pending? And also, when you press back after denying camera access, you get an empty dialog. But yes ship it :D.

Can you make a screen recording? The dialog should be closing fairly instantly - if it isn't that could be the shutdown code for the library causes the main thread to hang

Done: https://www.dropbox.com/s/wa9x5umn4hhx59v/mobizen_20190404_134118.mp4

I note the small camera icon in the top left of the system tray disappears at the same time as the barcode appears. I would suspect that the camera closing is causes the whole phone to freeze up for a second. Potentially we could emit the barcode detected event before closing the camera so at least the code is there when the phone freezes.

Changing .closed to .closing in the scanner widget appears to fix this, sending the detected code to the widget at the start of the teardown process, instead of the end.

@Mvolz I've pushed this change to the test server.

Mvolz added a comment.Apr 23 2019, 6:10 PM

@Mvolz I've pushed this change to the test server.

Great, that seems to have fixed it.