IOS camera returns black screen after leaving pwa

后端 未结 3 513
梦毁少年i
梦毁少年i 2021-01-01 01:55

I\'m using html file input to open camera and take photos for my PWA.



        
相关标签:
3条回答
  • 2021-01-01 02:03

    This was caused by a bug in iOS 13.2 and 13.3.

    You can find the bug report here

    It has been resolved in iOS 13.4 and later. I can personally confirm I could reproduce this issue in 13.3, but not after updating to 13.5.1

    0 讨论(0)
  • 2021-01-01 02:25

    Recently I faced the same problem, the only solution I came up with was to open in the app in browser instead of the standard mode. But only on iOS.

    The trick was to create 2 manifest.json files with different configurations. The normal one and one for everything is Apple manifest-ios.json.

    Step 1: Add id to the manifest link tag:

    <link id="manifest" rel="manifest" href="manifest.json">
    

    Step 2: Added this script to the bottom of the body:

    <script>
        let isIOS = /(ipad|iphone|ipod|mac)/g.test(navigator.userAgent.toLowerCase());
        let manifest = document.getElementById("manifest");
        if (isIOS)
          manifest.href = 'manifest-ios.json'
    </script>
    

    Step 3: in the manifest-ios.json set the display to browser

    {
        "name": "APP",
        "short_name": "app",
        "theme_color": "#0F0",
        "display": "browser", // <----
        ...
    }
    

    Hope it helps you guys!

    0 讨论(0)
  • 2021-01-01 02:26

    Adding this meta tag to index.html, solved it for me!

    Device: iPhone 7 and iPhone X, iOS 13.3.1

    <meta name="apple-mobile-web-app-capable" content="yes">
    
    0 讨论(0)
提交回复
热议问题