mozmorris / react-webcam

Webcam component
https://codepen.io/mozmorris/pen/JLZdoP
MIT License
1.66k stars 283 forks source link

It's always the camera with the wide angle that opens with android device #365

Open armin-shareid opened 1 year ago

armin-shareid commented 1 year ago

When I use React-Webcam on Chrome with an Android device that has multiple rear-facing cameras, such as Samsung Galaxy S10, it's always the camera with the wide angle that opens when I specify the "facingMode: environment".

Is it possible to ensure that it is always the basic rear camera that opens regardless of the device used?

schonee commented 1 year ago

You need to also specify the facingMode on the getUserMedia API. const constraints = { video: { facingMode: { ideal: "environment", }, },

susantak697 commented 3 months ago

I have tried adding the "environment" in Webcam component as well as in getUserMedia but it is not working on some android devices (Samsung mobiles). Still its opening wide angle camera instead of Normal

<Webcam
  videoConstraints ={{
     height:720,
width:1280,
facingMode: { ideal: "environment"},
aspectRatio:1
  }} 
/> 
and in 
.getUserMedia({ video: { facingMode: { ideal: "environment", }, })