RonnyWeiss / APEX-QR-Code-Scanner

This Region Plug-in is used to scan QR Codes. If any string has been detected an APEX Item can be set, Dynamic Action can be fired or JavaScript can be executed. Login for Demo is: user-demo / 123456@
MIT License
27 stars 11 forks source link

Android Chrome - Uncaught (in promise) DOMException: Could not start video source #14

Open adambadge opened 3 years ago

adambadge commented 3 years ago

Again thank you so much for such a wonderful plugin. It works flawlessly on my desktop. I am however having an issue on mobile. The camera does not appear to start up. It simple spins the loading.

I was able to perform remote debugging and the error message in the remote chrome console reads:

Uncaught (in promise) DOMException: Could not start video source

Environment details APEX-QR_Code-Scanner version: 1.5.1.0 Galaxy Note10+ 5G Android 10 base Android chrome browser: 89.0.4389.105

I have tested this on multiple APEX apps and your example site below and all give the same error.

Any help would be greatly appreciated!

Screen Shot 2021-04-13 at 1 00 10 pm
RonnyWeiss commented 3 years ago

Hello

This occurs only when camera usage is blocked or camera is used by any other app on your computer e.g. zoom, teams or another browser tab. Please clarify this. I will implment a better warning message when this occur in next version.

Kind regards

Ronny

adambadge commented 3 years ago

Thank you for the speedy response, I restarted my phone closed all chrome tabs, closed all apps and reviewed running apps and unfortunately I am still receiving the same error.

I then found a website that allows testing of the camera in the browser and it worked fine.

I'm not sure if this is important but the camera test website I went to gave me a drop down of options to chose the camera:

Is the plugin defaulting to a particular camera? and could an option be added to select a camera?

Many thanks, Adam

RonnyWeiss commented 3 years ago

this is the facing mode! It can be set in configJSON in Plug-in attributes. Could you please check that.

Smartphone cameras made me a heavy life because then have so many cameras and I could not test all phones :-)

adambadge commented 3 years ago

Hi Ronny,

My config.js looks like the below, is there a different value I should change facingMode to test?

{ "height": 340, "scanFrameColor": "rgba(192,0,15,1)", "facingMode": "environment", "mirrorScanner": false }

I'm new to this but reading a couple of StackOverflow posts suggests facingMode "environment" SHOULD work but doesn't appear to always work under some environments.

This post suggests ways to select the camera by ID in Javascript https://stackoverflow.com/questions/59636464/how-to-select-proper-backfacing-camera-in-javascript.

RonnyWeiss commented 3 years ago

could you please try another facing mode in plug-in configuration and recheck if it works. I tried it also on my A70 with Android 11 and latest chrome and it works as it should.

The implementation is cross browser compatible so I think it's a very special problem. hope we can debug it.

I use it like:

https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia

adambadge commented 3 years ago

Hi Ronny,

I testing the facingMode "user" with now change. Reviewing the console error on remote debugging does point to this function.

Screen Shot 2021-04-14 at 6 50 39 am

This might be a Galaxy S10 thing.

RonnyWeiss commented 3 years ago

could you try another browser on your phone or a different phone?

adambadge commented 3 years ago

Yep can do, will provide an update shortly

RonnyWeiss commented 3 years ago

thank you! and thank you so much for your donation! Hope we can fix the problem!

adambadge commented 3 years ago

Hi Ronny,

I was able to test on a different phone and it works great. I have also now for it working on Firefox, it appears to be a unique problem with my Chrome.

RonnyWeiss commented 3 years ago

It annoys me personally that we don't have a solution, but I'm not aware of anything like that that could cause the error. You haven't tried another browser on the S10, have you? Should I close the ticket for now?

RonnyWeiss commented 3 years ago

ah ok, maybe i next release I can add option to set facing mode on runtime so it can be set by page item, would that be an option?

adambadge commented 3 years ago

Hi Ronny,

I think that would be great, and yes I am happy to support this development work with funding if it is going to take up a lot of your time.

Many thanks for your prompt replies and support, Adam

On Thu, Apr 15, 2021 at 7:44 AM Ronny Weiss @.***> wrote:

ah ok, maybe i next release I can add option to set facing mode on runtime so it can be set by page item, would that be an option?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RonnyWeiss/APEX-QR-Code-Scanner/issues/14#issuecomment-819868579, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFMF665CVLLTFGXO7OKXUJLTIYEEXANCNFSM422ONUPQ .

RonnyWeiss commented 1 year ago

Hi there, I released a new version today could you please check if this one works for you? In the new region you can switch the camera on client side