Open maheshvartak3 opened 7 years ago
I have the same issue, can somebody help please?
Android device acquiescently select front camera,but rear camera in iOS,Does it support set this property?
After trying a few things out i found a solution to switch cameras:
var cameras = new Array(); //create empty array to later insert available devices navigator.mediaDevices.enumerateDevices() // get the available devices found in the machine .then(function(devices) { devices.forEach(function(device) { var i = 0; if(device.kind=== "videoinput"){ //filter video devices only cameras[i]= device.deviceId; // save the camera id's in the camera array i++; } }); })
Webcam.set( 'constraints', { //set the constraints and initialize camera device (0 or 1 for back and front - varies which is which depending on device) width: 1920, height: 1080, sourceId: cameras[1] } ); Webcam.attach('#my_camera');
Now if u set a button that resets the webcam and alternates between the 2 camera ids u get the swap functionality. Hope it helps :)
I am using this wonderful library to capture images. It really works well on desktop machine. But when accessed website on mobile android device, its selecting front camera by default. Is it possible to default set rear camera specially for mobile devices?