从 HTML/Angular 应用程序访问移动相机
Access mobile camera from HTML/Angular application
我希望从我在 html5/angular 上构建的应用程序访问移动后置摄像头。我用了
<input type="file" accept="image/*" capture="camera" />
但是总是开前置摄像头不开后置摄像头,请问有什么办法可以一直开后置摄像头吗?
您应该可以 select 使用捕获属性在前后摄像头之间切换。
对于后置摄像头:
<input type="file" accept="image/*" capture="environment">
对于前置摄像头,您应该可以使用:capture="user"
或直接拍摄。
如果您愿意,可以在这里阅读更多相关信息:https://developers.google.com/web/fundamentals/media/capturing-images/
还有 ngx-webcam
具有不错的功能:
我希望从我在 html5/angular 上构建的应用程序访问移动后置摄像头。我用了
<input type="file" accept="image/*" capture="camera" />
但是总是开前置摄像头不开后置摄像头,请问有什么办法可以一直开后置摄像头吗?
您应该可以 select 使用捕获属性在前后摄像头之间切换。
对于后置摄像头:
<input type="file" accept="image/*" capture="environment">
对于前置摄像头,您应该可以使用:capture="user"
或直接拍摄。
如果您愿意,可以在这里阅读更多相关信息:https://developers.google.com/web/fundamentals/media/capturing-images/
还有 ngx-webcam
具有不错的功能: