问题描述
我有一个具有PWA功能的网页。
I have a webpage with PWA capabilities.
在iOS Safari中,我确实得到了通常的操作系统对话框,询问我是否要拍照或上传照片照片库:
On iOS safari I do get the usual OS dialog asking me if I want to take a photo or upload a picture from the photo library:
安装后它通过菜单添加到主屏幕按钮并通过主屏幕启动它作为PWA,我仍然得到相同的选项,从库中选择仍然有效,但当选择拍照时,iOS相机应用程序打开,如预期,但保持完全黑。
After "installing" it as an PWA via the menu "Add to Homescreen" button and starting it via homescreen, I still get the same options, "choose from library" still works, but when choosing "take a photo", the iOS camera app opens, as expected, but stays completely black.
html:
<head>
<meta charset="utf-8">
<title>dingsda user interface 2</title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes">
<link rel="manifest" href="manifest.json">
(...)
<label class="fileContainer ui-btn">
<input type="file" accept="image/jpeg" id="photo_upload" multiple data-role="none"/>
</label>
仅限javascript连接:
only javascript connected:
document.getElementById("photo_upload").addEventListener("change",
function(){
console.log("got pic, will resize now:");
resizeBase64image(document.getElementById("photo_upload"),
function(base64img){
console.log("resized pic. will add it to src");
document.getElementById("addPhoto").src = base64img;
});
});
我没有任何想法,也没有找到任何有关限制的线索。另外:它似乎不应该提示对话框或照片应用程序。
我很高兴任何建议。用HTML文件输入或(如果可能的话)替代方法修复它。
I have no ideas, nor did I find any clues about limitations. Also: it seems like it should not prompt the dialog nor the photo app anyhow.I am happy for any suggestions. either to fix it with HTML file-input or (if possible) alternatives.
推荐答案
添加捕获(摄像机,摄像机或文件系统)输入文件
Add capture (camera, camcorder or filesystem) to input file
< label class =fileContainer ui-btn>
< input type =fileaccept =image / jpegid =photo_uploadmultiple data-
role =nonecapture =camera/>
< / label>
这篇关于为什么通过相机上传图像在移动设备上运行而不是iOS PWA?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!