My current setup involves using an Android tablet and GetUserMedia to capture images in my program.
It seems that by default, GetUserMedia uses the front camera. How can I set the rear camera as the default instead?
Below is the code snippet I am using with GetUserMedia:
navigator.getUserMedia({
"audio": false,
"video": {
mandatory: {
minWidth: this.params.dest_width,
minHeight: this.params.dest_height,
//facingMode: "environment",
},
}
},
function(stream) {
// Access granted, linking stream to video
video.src = window.URL.createObjectURL( stream ) || stream;
Webcam.stream = stream;
Webcam.loaded = true;
Webcam.live = true;
Webcam.dispatch('load');
Webcam.dispatch('live');
Webcam.flip();
},
function(err) {
return self.dispatch('error', "Could not access webcam.");
});
I attempted to add facingMode in the "mandatory" section but it did not work as expected.
Your assistance in resolving this issue would be greatly appreciated.