html5调用本地摄像头

THE CURRENT STATE OF HTML5 FORMS

The accept Attribute

<input type="file" accept="image/*"> (images only)

Live Demo

Firefox
3.6+
Safari
7+
Safari Mobile
5+
Chrome
17
Opera
10.6
IE
10+
Android
2.3+
Supported Supported Supported Supported Supported Supported Supported

Android modal for accept=videoAndroid 4.2, accept="video/*;capture=camcorder"

The Low Down

The accept attribute takes a comma-separated list of unique content types of files that are acceptable values for the file input type only. The comma separated values can inclue file extensions, MIME types without extensions, and, new in HTML5, audio/* for sound files video/* for video files and image/* for image files.

  • Attribute is only valid for <input type="file">
  • The attribute provides a hint of what file types the server is able to accept.
  • On mobile devices, including Mobile: Android 3+, Chrome 16+, Safari 6+, Firefox 10+, Blackberry 10+, while not part of the specifications, the camera and microphone can be accessed:
    <input type="file" accept="image/*;capture=camera">
    <input type="file" accept="video/*;capture=camcorder">
    <input type="file" accept="audio/*;capture=microphone">
  • The capture attribute can be included as a separate attribute in HTML5.
  • While the attribute helps in getting users to select the right file type, you must still validate server side.
  • Older versions of iOS did not support file input type, therefore this attribute was irrelevant until iOS enabled it in iOS7


参考地址 html5 调用  摄像头 http://www.wufoo.com/html5/attributes/20-accept.html
关于html5 调用摄像头的文章 , 在网上看了很多, 大多都是getUserMedia() 进行调用的,然而这种方式存在很大的问题,在input 属性中给我们提供了一种简单的调用摄像头录像的方式


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值