I currently trying to access phone back camera using js, but phone nowadays got a lot of back camera like macro camera and etc... Here is my code,
navigator.mediaDevices
.getUserMedia({
audio: false,
video: {
width: {
ideal: 1920
},
height: {
ideal: 1080
},
facingMode: "environment"
}
})
.then(function (stream) {
cameraView.srcObject = stream;
})
I tested the code with Chrome on 2 android devices, one of it access Macro camera and another one work fine because it have only 1 back camera. I want it to auto access normal camera what should I add?