cozmo / jsQR

A pure javascript QR code reading library. This library takes in raw images and will locate, extract and parse any QR code found within.
https://cozmo.github.io/jsQR/
Apache License 2.0
3.7k stars 607 forks source link

BLACK CAMERA on iOS - Stopped working #133

Closed Guttz closed 5 years ago

Guttz commented 5 years ago

One week ago I've tested the repo and the demo on different devices and all of them were working. Today all of a suudden, the iOS devices I have access to, get a black camera when accessing the camera.

All the other devices seem to work fine, do we have a workaround for this?

kousu commented 5 years ago

This sounds like a permissions problem. Did you get an update this week?

Can you wipe any of those devices? Maybe there's a cookie or localstorage cached that's messing with things.

Guttz commented 5 years ago

I've tried opening the demo https://cozmo.github.io/jsQR/ with icognito mode to make sure it isn't a cookie problem. It happened on a iPhone X and iPhone 7 at the same time.

The demo https://cozmo.github.io/jsQR/ basically shows a black screen on safari and a "loading camera" forever on chrome.

That's actually a problem with accessing the camera with iOS but I guess there isn't a better place to comment this issue?

inartin commented 5 years ago

on iPhone 6 ios 12.2 works, camera opens, but it is very slow, about 4 fps :D any ideas ?

YouriHugoBos commented 5 years ago

I have had some problems with iOS, i use zebracrossing and jsqr parallel. This is how my video element looks: <video className={classes.scanner} playsInline autoPlay muted ref={this.videoRef} /> Maybe you can try the playsInline, autoPlay and muted attributes @Guttz. You also need to set the contraints for the getUserMedia to video: { facingmode: 'environment' }.

For the lagg on iOS @TheAlexandru i added a timeout of 300ms to the recursive frameRequestCallback function call, this helped some framerate, but not ideal since it now only scans every 0.3 seconds. I hope this helps out a bit...

cozmo commented 5 years ago

A few thoughts

However as mentioned in the README jsQR is designed to have no webcam specific implementation details. Rather the API is designed to take in image data and output any QR codes found within. Handling reading image data from the webcam and passing it to jsQR is the responsibility of the consumer, and as such I can't provide much additional help here and am going to close the issue since it's not a jsQR issue I do not believe. Please comment/re-open if you disagree.