如何在 iOS11 主屏幕 Web 应用上访问相机? [英] How to access camera on iOS11 home screen web app?

查看:24
本文介绍了如何在 iOS11 主屏幕 Web 应用上访问相机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们无法使用 WebRTC 或文件输入从 iOS11(公开发布)主屏幕 Web 应用程序访问相机,详情如下.请问我们的用户如何才能继续使用相机?

We cannot access camera from an iOS11 (public release) home screen web app using either WebRTC or the file input, details below. How can our users continue to access the camera please?

我们通过 https 提供网页应用页面.

We are serving the web app page over https.

4 月更新

iOS 11.3 的公开发布似乎已经解决了这个问题,并且文件输入摄像头访问再次正常工作!

Update, April

The public release of iOS 11.3 seems to have fixed the issue and file input camera access is working again!

3 月更新

正如这里的人们所说,Apple 文档建议网络应用程序的摄像头功能将与服务人员一起在 11.3 中返回.这很好,但我们还不确定是否要让每个人都重新安装,直到我们可以在 11.3GM 上进行彻底测试.

As people here have said the Apple docs advise web app camera function is returning in 11.3 along with service workers. This is good but we are not sure yet if we want to everyone to to reinstall again until we can thoroughly test on 11.3GM.

解决方案,11 月

我们失去了苹果想要解决这个问题的希望并继续前进.修改了我们的网络应用程序以删除 iOS添加到主屏幕"功能,并要求受影响的用户删除任何以前的主屏幕图标.

Solution, November

We lost hope Apple want to fix this and moved forward. Modified our web app to remove the iOS "Add to home screen" function and asked affected users to remove any previous home screen icon.

12 月 6 日更新

iOS 11.2 和 iOS 11.1.2 无法修复.

iOS 11.2 and iOS 11.1.2 don't fix.

解决方法,9 月 21 日

似乎我们可以询问网络应用的现有客户

Seems we could ask existing customers of the web app

  • 不升级到 iOS11 - 祝你好运 :)
  • 在 iOS 相机中拍照,然后在网络应用中重新选择它们
  • 等待下一个 iOS 测试版
  • 重新安装为 Safari 浏览器内页面(在我们删除 ATHS 逻辑之后)
  • 切换到安卓

我们当前的生产代码使用的文件输入在 iOS 10 及更早版本上运行良好多年.在 iOS11 上,它作为 Safari 选项卡工作,但不能来自主屏幕应用程序.在后一种情况下,打开相机,只显示黑屏,因此无法使用.

Our current production code uses a file input which has worked fine for years with iOS 10 and older. On iOS11 it works as a Safari tab but not from the home screen app. In the latter case the camera is opened and only a black screen is shown, hence it is unusable.

   <meta name="apple-mobile-web-app-capable" content="yes">
   ...
   <input type="file" accept="image/*">

WebRTC

iOS11 上的 Safari 11 提供 WebRTC 媒体捕获 这很棒.

我们可以根据 此处链接的示例代码.

当我们将页面添加到 iPad 或 iPhone 主屏幕时,navigator.mediaDevices 变为 undefined 并且无法使用.

When we add the page to iPad or iPhone home screen, navigator.mediaDevices becomes undefined and unusable.

    <meta name="apple-mobile-web-app-capable" content="yes">
    ...
    // for some reason safari on mac can debug ios safari page but not ios home screen web apps 
    var d = 'typeof navigator : ' + typeof navigator; //object
    d += 'typeof navigator.mediaDevices : ' + typeof navigator.mediaDevices; // undefined
    // try alternates
    d += 'typeof navigator.getUserMedia  : ' + typeof navigator.getUserMedia; // undefined
    d += 'typeof navigator.webkitGetUserMedia  : ' + typeof navigator.webkitGetUserMedia; // undefined
    status1.innerHTML = d;

推荐答案

我们有非常相似的问题.到目前为止,我们能够做的唯一解决方法是删除元标记,使其具有apple-mobile-web-app-capable",并让用户在 Safari 中打开它,一切似乎都正常工作.

We have quite similar problem. So far the only workaround we were able to do is to remove the meta tag for it to be "apple-mobile-web-app-capable" and let users to open it in Safari, where everything seems to work normally.

这篇关于如何在 iOS11 主屏幕 Web 应用上访问相机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆