<input type="file" accept="image/*" capture="camera">
<input type="file" accept="video/*" capture="camcorder">
<input type="file" accept="audio/*" capture="microphone">
/*
accept规定可通过文件上传控件提交的文件类型;
capture表示的是系统所捕获的默认设备,camera:照相机;camcorder:摄像机;microphone:录音。
*/
<input type="file" accept="image/*" >
<input type="file" accept="video/*" >
<input type="file" accept="audio/*" >
/*
如果不加上capture,则只会显示相应的,例如上述三种依次是:拍照或图库,录像或图库,
录像或拍照或图库,加上capture之后不会调用图库。
其中还有一个属性multiple,支持多选,当支持多选时,multiple优先级高于capture,
所以只用写成:<input type="file" accept="image/*" multiple>就可以
使用 capture 属性,capture 的值可以是:
camera 打开摄像头
user 打开前置摄像头
environment 打开后置摄像头
以上几个属性都不能保证设备会按照设置的一样打开前置或后置摄像头,如果设备不支持的话,它会使用默认的调用摄像头的行为。
camcorder 打开录像
microphone 打开录音机