Javascript 您可以从 Mobile Safari 访问 iPhone 相机吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2607067/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can you access the iPhone camera from Mobile Safari?
提问by kim3er
Is there a JavaScript API for accessing the the iPhone's camera from Mobile Safari?
是否有用于从 Mobile Safari 访问 iPhone 相机的 JavaScript API?
回答by Simon Arnold
Since iOS6, you can use
从iOS6 开始,您可以使用
<input type="file" accept="image/*" capture="camera">
<input type="file" accept="video/*" capture="camera">
It will act like a regular file upload, but instead, it will open the iPhone camera and upload a picture or a video.
它的作用类似于常规文件上传,但它会打开 iPhone 相机并上传图片或视频。
Hope this help someone.
希望这有助于某人。
回答by Mihir Mehta
Sorry, but there isn't any...
对不起,但没有任何...
UPDATE:
更新:
Now it's possible. See Simon Arnold's answer.
现在有可能。请参阅西蒙·阿诺德的回答。
回答by Mason
You can via http://picupapp.com/
您可以通过http://picupapp.com/
It is a Free iPhone App and JS that can convert an upload box into a button that requests the app, along with instructions to the App on where to post the image...
它是一个免费的 iPhone 应用程序和 JS,可以将上传框转换为请求应用程序的按钮,以及应用程序关于在哪里发布图像的说明......
This thing should get an award.
这东西应该得奖。
Now if only we could get them to also make it work perfect with Android and Blackberry.
现在,如果我们能让他们也让它与 Android 和 Blackberry 完美配合就好了。
回答by James Westgate
There is a specification from the W3C which would allow this, although to my knowledge none has implemented it yet: http://www.w3.org/TR/2010/WD-html-media-capture-20100928/
W3C 有一个规范允许这样做,尽管据我所知还没有实现它:http: //www.w3.org/TR/2010/WD-html-media-capture-20100928/
回答by Raj
Chrome and Safari on iOS7 can access the Camera and the Camera Roll without any special markup and can perform both AJAX POST and synchronous form POST operations just like a desktop browser.
iOS7 上的 Chrome 和 Safari 无需任何特殊标记即可访问相机和相机胶卷,并且可以像桌面浏览器一样执行 AJAX POST 和同步表单 POST 操作。

