怎么在H5页面使用input标签实现开启摄像头等功能

832

常见的一般都是APP端,调用原生的方法即可实现,也可以在H5中用input标签来实现,如下:

   capture 属性:在webapp上使用 input 的 file 属性,指定 capture 属性可以调用系统默认相机、摄像和录音功能。

capture表示,可以捕获到系统默认设备的媒体信息,如下:

capture="camera" 相机

capture="camcorder" 摄像机

capture="microphone" 录音

例如:
    <input type="file" accept="image/*" capture="camera">
    <input type="file" accept="video/*" capture="camcorder">
    <input type="file" accept="audio/*" capture="microphone">
    
注意在PC端不生效,只有在移动端生效