mebjas/html5-qrcode

[Tracking Bug] Compatibility - Webcam access only works for Safari in IOS

mebjas opened this issue · 27 comments

Query camera is not working for Opera, Edge, Firefox and Chrome.

[Fixed] For Safari the query is working but the stream is not realtime.
For chrome

Describe the browser:

  • OS: iOS in Iphone 7 and IPad 9.7
  • Browser: all

Hi, what's the status of this issue? I was wondering when you might be able to fix it. Please let me know. Thanks.

PS. Love this plugin.

Thanks, this is a weird issue and I am afraid it's a limitation of WebKit rendering engine used in IOS Chrome and Firefox - https://stackoverflow.com/questions/51501642/chrome-and-firefox-are-not-able-to-access-iphone-camera

What about Safari?

So I verified that none of the webcam based approach work on any other browsers on IOS other than safari.

As for safari - I verified this to work on IPad, but for IPhone it has another problem, when we get the webcam access and want to stream the webcam feed to a video, it throws this exception and the scanner cannot run:

NotAllowedError: The request is not allowed by the user agent or the platform in the current context, 
possibly because the user denied permission.

This is being tracked in #9

The ios safari issue has been now fixed: 4c28708

Try https://blog.minhazav.dev/research/html5-qrcode for demo. However, I observed another issue: #21

Will try to fix this soon as well.

Awesome, thanks for the quick turnaround. Let me try it out.

@aamirbilvani With this #24 I have added support for scanning local media on device. This implicitly adds scanning using default camera on device.

This can be used as fallback on browsers that do not support inline QR code scanning. Like non Safari browsers on IOS.

https://blog.minhazav.dev/HTML5-QR-Code-scanning-support-for-local-file-and-default-camera/ may be helpful in understanding more about this change.

Hi Mebjas, is there any optimism to fix this bug? Most people now prefer to use chrome on iOS.

This is unfortunately out of my hand. This has been forever open at https://bugs.chromium.org/p/chromium/issues/detail?id=752458

One thing I can try to do is to make the file / device camera based option as the first option when user opens the web page on iOS from browsers other than Safari - would that help @Zaffer

One thing that could push Apple move in the direction to implement this would be as mentioned in comment#39

Apple prioritizes features based on developer interest, so the best way to help us convince them to fix this is to file a bug at https://feedbackassistant.apple.com/

Commenting on the WebKit bug (https://bugs.webkit.org/show_bug.cgi?id=208667) might help somewhat, but not as much as filing at https://feedbackassistant.apple.com/, since the latter is what Apple uses internally for prioritization.

This may practically have no impact, but I tried to raise the concern here as well: https://twitter.com/minhazav/status/1324938828155482113

It's confirmed that WKWebView of newest iOS 14.3 supports WebRTC, so thirt-party browsers can utilize it.

This is awesome, thanks for updating. I'll verify and update the docs.

This is awesome, thanks for updating. I'll verify and update the docs.

This isn’t working for me using WKWebView in iOS 14.3. I get “unable to query supported devices.” after pressing “Request Camera Permissions”, even if I add prior Swift code to request camera authorization. Is there a sample iOS app that should work? If not I’ll create one.

AFAIK, webviews can't access the camera "live" in the way required here. This goes for iOS and Android.

https://stackoverflow.com/questions/56646575/wkwebview-does-not-allow-camera-access-in-application

-JM

Thanks @mebjas, but I thought @georgewei above has confirmed this is now allowed from iOS 14.3. Sorry I didn't reference that explicitly.

He's talking about WebRTC. I don't think that's what's being used here.

-JM

@georgewei Can you share some reference about the new support?

I did get it working within a WKWebView in a Swift app under iOS 14.3. It's barely functional (I found it very difficult to get any QR code to scan) and it isn't pretty but the permissions seem to be solved. Source code here: https://github.com/sjpickup/wkwebview-html5-qrcode

(I didn't yet work out why my main app isn't working.)

@mebjas I've tested this project on iOS 14.3 and it works. It was confirmed by others on webkit.org already, and there is another thread: https://blog.bitsrc.io/ios-14-3-brings-webrtc-to-wkwebview-closing-gap-on-ios-accessibility-90a83fa6bda2

@mebjas
I just check Chrome, Firefox and Edge on iOS 15.1 and everything is working now as expected.
maybe update the README?

I can also confirm on iOS 15.1 using Chrome I was able to successfully use https://scanapp.org/

this is solved in iOS 15.1 and beyond

I just check Chrome, Firefox and Edge on iOS 15.1 and everything is working now as expected.
maybe update the README?

Fantastic :) Let's do it!

What about firefox, opera, edge?

Firefox works since 15.1

Edge for iOS works since 15.1

Chrome (version 102.0.5005.87) for IOS 15.5 not working 😓
Edit: its actually working I had to enable the access to the camera on the app settings 🚀🚀🚀