Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle errors from the BrowserMultiFormatReader? #624

Open
Laurenz-M opened this issue Oct 28, 2024 · 0 comments
Open

How to handle errors from the BrowserMultiFormatReader? #624

Laurenz-M opened this issue Oct 28, 2024 · 0 comments
Labels

Comments

@Laurenz-M
Copy link

I'm having trouble to receive any errors or results in the callback of "decodeFromVideoDevice".
This is a simplification of my code:
const reader = new BrowserMultiFormatReader(); const deviceId = '[valid device id here]' reader.decodeFromVideoDevice(deviceId, 'video', (result, err) => { console.log('test', err); if (!result) return; })
The whole code works, when the camera does not emit any errors and i can successfully scan items.

My issue is with the error-handling, as the console log with "test" does never trigger, when there is an error.
To test this, I triggered errors for "NotAllowedError: Permission denied", "NotAllowedError: Permission dismissed" and "NotReadableError: Device in use", which are all correctly recognized and logged in the console by the library code itself, but are not returned in the error callback.

My understanding is that the errors happen before the actual initialization and are this not returned.

It would be great if someone could assist me in this matter.
Thanks a lot! :)
Screenshot 2024-10-28 120909

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant