ngx-scanner icon indicating copy to clipboard operation
ngx-scanner copied to clipboard

iPadOS black screen after installation to homescreen, works on safari

Open shprink opened this issue 1 year ago • 5 comments
trafficstars

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

shprink avatar Apr 25 '24 10:04 shprink

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?

werthdavid avatar Apr 29 '24 07:04 werthdavid

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 avatar Apr 29 '24 09:04 shprink

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 avatar Jul 18 '24 12:07 shprink

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

shprink avatar Jul 18 '24 13:07 shprink

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

wildhart avatar Sep 20 '24 01:09 wildhart