use camera as barcode/QR scanner in slower devices

0 favourites
  • 13 posts
  • I am trying to make a scanner with the QR CODE plugin from Sparsha,

    the thing is that in devices that use a poor GPU (as mali 400) it takes 4 seconds to make an snapshot (from User Media, Canvas Snapshot or even DrawingCanvas "save image")...so it makes imposible to deploy a feature with such times.

    Does anyone know how to obtain a uri of the canvas, user media or so on... in a much faster way?

    in C2 with paster was insanely fast...

    Thanks in advance

  • I can see that the use of "user media" plugin is "one of the reasons" causing those huge delays (3/4 seconds) when making the snap shot...

  • You may be experiencing this problem:

    github.com/Scirra/Construct-3-bugs/issues/3480

    Check Ashley's comments there.

    Also, have you tried the official "Camera input" template? Does it also have a 4 second delay when taking snapshots?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Also, I think I found some sort of bug.

    If on camera start, QR Code scanned successfully, then its alright.

    But if on camera start, the QR Code Scanner fails to identify a QR Pattern, it stops scanning anymore. For example, in real life, usually your device would be facing towards somewhere else. Then, slowly, you will bring your phone with your hands to make the camera face towards the QR Code. But within that time, if it fails to Decode even once, the Scanner wont work anymore for some reason. Even pressing the "Decode" button doesn't seem to work in this case and then I had to reload the app to make it work again.

  • Other than this bug, I don't see any delay in the C3 version of the scanner compared to the source-library scanner used for building this plugin.

    I used the source code of this QR Scanner: webqr.com

  • Hi dop2000

    You may be experiencing this problem:

    https://github.com/Scirra/Construct-3-bugs/issues/3480

    Check Ashley's comments there.

    --> I forgot to mention that the problem occurs in android phones on chrome, and not in android webView that its already always a headache :))

    Also, have you tried the official "Camera input" template? Does it also have a 4 second delay when taking snapshots?

    --> just tried, 4.5 seconds in making the snapshot...

    also the drawing canvas save image is way tooo slow in the devices with very little and very slow graphical memory.

    I know we are not in canvas2c but miss everyday more our big friend paster... although the drawing canvas got much better still have this "things" that you can not access the data instantly (as per 4 seconds seems for me not usable)

  • Other than this bug, I don't see any delay in the C3 version of the scanner compared to the source-library scanner used for building this plugin.

    I used the source code of this QR Scanner: webqr.com

    Yes Sparsha I am not blaming on your plugin, it only takes 50-100ms to decode on this slow devices, and I have really to thank you for your work and effort...

    THANK YOU VERY MUCH, REALLY!!!

    its really stable plugin, even with the bug you mention, I just start the camera and make the person to press a buton to take an screenshot, then decode it: this way it never stop working.

    about the library take a look at two ones, I tried... not enough skills, even that there is one that look so simple (just uses jQuery and I got stuck on this and C3):

    1) one is instascan... such simple that just make a html with this simple one file - html code:

    https://drive.google.com/file/d/118aCIbX9OPuPL6NmQi1yaisoOED3EFAR/view?usp=sharing

    ... so simple, but didn´t figure out how to implement in C3

    (also there is a different demo https://schmich.github.io/instascan/ all from https://github.com/schmich/instascan)

    2) nimiq from https://github.com/nimiq/qr-scanner#readme

    this one is very very realtime in any device!

    maybe you could take a look and see if something can be done!

    thanks again!!

  • hugone you can try to test run this: webqr.com on your phone and tell us how the performance is on your phone.

    if it doesnt perform well, then that means your phone can't handle this library.

  • Sparsha its not your plugin... your plugin is working very good, I tested a lot in many devices... it codes and decode as a charm.. problem is in the way C3 works with snapshot and drawing canvas...

    (answering your question, I tried and it works good from webqr)

  • Thanks I bookmarked the libraries. Seems pretty interesting.

    I am bit of short on time right now, but I will try to make plugin for those when I get some days off.

  • Sparsha its not your plugin... your plugin is working very good, I tested a lot in many devices... it codes and decode as a charm.. problem is in the way C3 works with snapshot and drawing canvas...

    Oh I see...

  • Thanks I bookmarked the libraries. Seems pretty interesting.

    I am bit of short on time right now, but I will try to make plugin for those when I get some days off.

    woow, will be great you know what? I was trying to make it work through the iframe plugin.. and got really close:

    imagine that the QR Capture window is an iFrame, as to implement this libraries is very simple in regular html...

    then this page will capture and decode and just have to add a way to send it to the parent window as shown here:

    1) https://howtoconstructdemos.com/communicating-with-an-iframe-in-construct/

    from Dop200

    2) and also here: https://www.construct.net/en/forum/construct-3/how-do-i-8/call-c3-function-application-154512#forumPost1019612

    so that maybe could be a very interesting way to do it!

  • Hi hugone, if you think snapshot "from User Media, Canvas Snapshot or DrawingCanvas-save image" is causing problems for you, I dont think I can help you with that.

    User Media in an iframe is not supported in all platforms as you suggested.

    I will still use the original UserMedia plugin from C3.

    I wont be making a new plugin for UserMedia, as developing that will require creating dependencies for support in other platforms. And afterall, I would end up developing a similar plugin like the original ones.

    Your request is too much customized and I would suggest you to try to do it yourself.

    Or you can ask the developers of C3 for more insight into this problem.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)