ngx-scanner
ngx-scanner copied to clipboard
iPadOS black screen after installation to homescreen, works on safari
Describe the bug
On the latest iPad version (17.4.1):
- open https://zxing-js.github.io/ngx-scanner on safari: Both cameras WORKS
- add to homescreen
- Open the app: blackscreen
reproduction VIDEO: https://photos.app.goo.gl/RkvrR1cjtkzAcgck6
Expected behavior
same as in safari
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?
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
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
I tried to run the app with webrtc shim https://github.com/webrtc/adapter but so far I could not fix the issue
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) => ...);