Reputation: 5061
I am looking to access mobile back camera from an application I am building on html5/angular. I used
<input type="file" accept="image/*" capture="camera" />
but it always opens the front camera rather then back camera, is there any way to open back camera always?
Upvotes: 14
Views: 46637
Reputation: 14551
There is also ngx-webcam
with nice features:
https://www.npmjs.com/package/ngx-webcam
Upvotes: 3
Reputation: 6652
You should be able to select between the front and rear camera using the capture attribute.
For the rear camera:
<input type="file" accept="image/*" capture="environment">
For the front camera, you should be able to use: capture="user"
or just capture.
You can read a bit more about it here if you'd like: https://developers.google.com/web/fundamentals/media/capturing-images/
Upvotes: 30