我正在使用
<input type="file" accept="image/*;capture=camera">
需要从用户的相机中获取图像输入。这似乎是旧方法,但这就是他们想要的。
有没有办法指定使用前置(或后置)摄像头?如果需要,用户仍然可以切换摄像头,但默认摄像头将在html中设置(可能作为属性)。
我只需要在Android上的Chrome中实现,因此跨浏览器不是问题。
Media Capture文档说用户应该能够选择哪个摄像头,但它对开发者没有任何说明:
Similarly, the user agent should allow the user:
-to select the exact media capture device to be used if there exists multiple devices of the same type (e.g. a front-facing camera in addition to a primary camera).