简体   繁体   English

在 PWA 中使用 Ionic 原生相机插件

[英]Using Ionic native camera plugin in PWA

I developed a simple app which makes users to capture a picture and I save the image in a folder based on image captured date.我开发了一个简单的应用程序,它可以让用户捕捉图片,然后根据图像捕捉日期将图像保存在一个文件夹中。 Everything is working good and now I want to use the same app as a PWA.一切正常,现在我想使用与 PWA 相同的应用程序。

If I run ionic cordova run browser -l and access the app in mobile browser and click on camera icon to capture image it is throwing error.如果我运行ionic cordova run browser -l并在移动浏览器中访问该应用程序并单击相机图标以捕获图像,则会引发错误。 My question is it possible to use the ionic native plugin to capture and save image in mobile device when opened app from mobile browser?我的问题是,当从移动浏览器打开应用程序时,是否可以使用 ionic 本机插件在移动设备中捕获和保存图像? If not what are the alternative steps needed to achieve the same functionality?如果不是,实现相同功能所需的替代步骤是什么?

the ionic cordova run browser -l will not work for PWA, currently exists some approaches to let users use the device camera on PWA's using the html5 capabilities for that like <input type="file" accept="image/*" capture="camera" /> but, with some limitations related with the browsers compatibility and the support to this feature, currently (at July 2018) if you get that this work, an issue knew appears when you add the pwa to home screen on iOS for example. ionic cordova run browser -l 不适用于 PWA,目前存在一些方法让用户使用 html5 功能在 PWA 上使用设备摄像头,例如<input type="file" accept="image/*" capture="camera" />但是,由于浏览器兼容性和对此功能的支持存在一些限制,目前(2018 年 7 月)如果您获得此功能,则当您将 pwa 添加到 iOS 的主屏幕时会出现一个问题,例如. More info about this on: How to access camera on iOS11 home screen web app?有关此内容的更多信息: 如何在 iOS11 主屏幕 Web 应用程序上访问相机?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM