iphone相机原理
One of the questions I get asked most often via my contact form is how to get access to the camera and video recorder on the iPhone from within the browser. It's a valid question, one that I've not come across in the needs of my own website, but since I get it so often, I thought I'd address it. Of course the camera is an input of the device, but the INPUT
element is the key to camera and video access with HTML5.
我通过联系表最常被问到的问题之一是如何从浏览器中访问iPhone上的相机和录像机。 这是一个有效的问题,我没有遇到自己的网站需求,但是由于我经常得到它,所以我认为我会解决这个问题。 当然,摄像头是设备的输入,但是INPUT
元素是使用HTML5访问摄像头和视频的关键。
HTML5相机 (HTML5 Camera)
In the case of both camera and video, the INPUT
element with a type of file
is necessary:
对于摄像机和视频,必须使用具有file
类型的INPUT
元素:
<input type="file" accept="image/*">
To isolate only a photos as the type to be uploaded, the accept
attribute must match the pattern above.
要仅隔离照片作为要上传的类型, accept
属性必须与上面的模式匹配。
HTML5视频 (HTML5 Video)
If you're looking to be more dynamic and accept video, the accept
attribute will need to change:
如果您希望更具动态性并接受视频,那么accept
属性将需要更改:
<input type="file" accept="video/*;capture=camcorder">
In this case, the upload dialog on the iOS device will allow you to upload either photos or video.
在这种情况下,iOS设备上的上传对话框将允许您上传照片或视频。
This still seems like a far too basic method of uploading audio or video but it is probably good enough for most developers and systems. In the future we'll have a much better method for taking dynamic audio and video without the ugly upload dialog!
这似乎仍然是上传音频或视频的一种过于基础的方法,但对于大多数开发人员和系统而言,这可能已经足够了。 将来,我们将提供一种更好的方法来获取动态音频和视频,而无需使用丑陋的上传对话框!
iphone相机原理