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

Camera not working in safari PWA. #122

Open
ilyaqq1999 opened this issue Aug 25, 2023 · 5 comments
Open

Camera not working in safari PWA. #122

ilyaqq1999 opened this issue Aug 25, 2023 · 5 comments

Comments

@ilyaqq1999
Copy link

ilyaqq1999 commented Aug 25, 2023

We are codding the PWA and in browser we hadn't problem. But when you installing site on home screen like PWA, in this application when you open the camera and fast closing app, at the new opening app and camera it's not working. Mb it's coz videostreem not cleared. Testin on iphones 7, 10, 11.

UPD: Camera starts working on 17 IOS version, BUT, it's randomly sizing in video element, regardless of video element size. Works with switching the camera to the front and back.

@alexandertopskiy
Copy link

same bro...

@grahn195
Copy link

same....

@strom-und-spiele
Copy link

strom-und-spiele commented Sep 27, 2023

I did some digging today.
The issue seems to be with the webRTC API of safari (which seems to change after 'installing' a PWA) and not within zxing-js itself.

I was using inspect.dev's intractive console (If you don't know it, think chrome dev console) on an iPhone and simply tired to reproduce BrowserCodeReader.addVideoSource by getting all devices and setting one stream as the srcObj of a video tag. No image was shown.
I did everything in parallel on a chrome locally, where it worked.

Annoyed and hungry, I updated the phone to v17.0.2 and went for lunch.
After the update everything seems to work.

On my collegues iPhones that cannot update beyond v16, the issue still exists.

I would be thankful if anyone could find a way to make this work on older versions of iOS.

@shprink
Copy link

shprink commented Jul 17, 2024

still exists

@wildhart
Copy link

I was getting the same error on iOS 17.6.1. As per this comment I fixed it simply by calling this code before starting the scanner:

const camera = await navigator?.mediaDevices?.getUserMedia({ video: true }).catch((e: any) => ...);

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

6 participants