zxing-js / ngx-scanner

Angular QR code, Barcode, DataMatrix, scanner component using ZXing.
https://zxing-js.github.io/ngx-scanner/
MIT License
644 stars 228 forks source link

iPadOS black screen after installation to homescreen, works on safari #560

Open shprink opened 7 months ago

shprink commented 7 months ago

Describe the bug

On the latest iPad version (17.4.1):

reproduction VIDEO: https://photos.app.goo.gl/RkvrR1cjtkzAcgck6

Expected behavior

same as in safari

werthdavid commented 7 months ago

Hey, I tried with my iPad Air 4th gen 17.4.1 and I cannot reproduce it... what's happening on your phone (iOS) if you do the same?

shprink commented 7 months ago

It works on iOS iphone.

I have this iPad version with v17.4.1: https://www.apple.com/fr/ipad-10.9

there is no error on the console unfortunately

shprink commented 4 months ago

OK I know more now.

it seems to be related to WebRTC spec not being usable when installed as a PWA on ios safari: https://github.com/zxing-js/browser/issues/122

When not installed it works correctly

shprink commented 4 months ago

I tried to run the app with webrtc shim https://github.com/webrtc/adapter but so far I could not fix the issue

wildhart commented 2 months ago

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) => ...);