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

Width and height constraints swapped in mobile devices #488

Open
lampsbr opened this issue Feb 23, 2023 · 3 comments
Open

Width and height constraints swapped in mobile devices #488

lampsbr opened this issue Feb 23, 2023 · 3 comments

Comments

@lampsbr
Copy link

lampsbr commented Feb 23, 2023

I'm new to Quagga2, just met the project and I'm already able to read some barcodes in my Vuejs 2 project. Thank you for this!

That said, I noticed that the init.inputStream.constraints might be swapped in some situations. Is this some noob mistake I'm making?
I always initialize my inputStream.constraints width and height with the following values: this.$refs.innerCard.clientWidth - 40 and this.$refs.innerCard.clientHeight - 32. It means I grab the size of a wrapper, already rendered in my screen, and I put the Quagga live stream in there.

It runs perfectly in my desktops (all running ubuntu and chrome). But this week I started testing in a real android phone and in an emulated pixel phone, and the livestream is rendered with swapped dimensions! I mean, if my wrapper html component is 1920 x 1080 px (a fullhd landscape screen), the livestream gets rendered in a 1080 x 1920 px tag, breaking my poor layout apart.

So I tested the opposite, swapping width and height myself, and now the code runs fine in mobile devices, but broken in my desktops.

For now I'll add some check to see if I'm running in a mobile device, and choose if I swap the dimensions or not, but I would like to know if I'm doing something terribly wrong or if it's a current bug in the project. My package.json says I'm running version ^1.8.2

@github-actions
Copy link

Thank you for filing an issue! Please be patient. :-)

@Davidas-98
Copy link

I have the same issue in portrait on a mobile device, on landscape it works as expected.

@ericblade
Copy link
Owner

ericblade commented Jul 8, 2023

I haven't currently classified this as a "bug" per se, more a "It's Chrome on Android acting stupid" problem. When I was messing with this (admittedly, a very long time ago now) previously, only Chrome on Android had this specific problem, and it acts opposite from Chrome on Desktop, even when emulating a phone.

I don't think the constraints are backwards (although i don't use constraints to attempt to select the camera) as that just tells the browser which camera device capabilities you need. My experimentation was that the Video tag in Android operates incorrectly, swapping height and width.

If we could narrow it down a little more as to exactly what the problem is, I could probably make an attempt to account for it, or at least document it.

Also, my apologies for not seeing this until now, I apparently missed several things github had sent me some months ago, and just came across it when digging through my notifications.

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

No branches or pull requests

3 participants