iphone相机原理_在iPhone上获取HTML5相机和视频

本文介绍了如何在iPhone上通过HTML5元素访问相机和视频功能。使用type为的元素可以实现相机和视频的访问,通过调整属性可以指定上传照片或视频。尽管此方法简单,但适用于大多数开发者和系统。
摘要由CSDN通过智能技术生成

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!

这似乎仍然是上传音频或视频的一种过于基础的方法,但对于大多数开发人员和系统而言,这可能已经足够了。 将来,我们将提供一种更好的方法来获取动态音频和视频,而无需使用丑陋的上传对话框!

翻译自: https://davidwalsh.name/html5-camera-video-iphone

iphone相机原理

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值