paulb72

Lurker
Apr 26, 2022
1
1
15
A shot in the dark here, hope a developer can help. I am helping one of our developers who has a little trouble communicating (I am not a developer). We want our web app to open the stock Front camera, but it opens the rear camera instead, but not on all devices, some older devices running Android 9 open the front camera. I suspect this has something to do with the changes in Android 10, but I'm looking for a work around.
Here is the code snippet of how he is opening the camera, please help me get the front camera to open across multiple android devices (mostly using Chrome browser for the web app). Any help is GREATLY appreciated.

var stockCamElem = document.createElement("input");

stockCamElem.id = 'stock_camera_capture';
stockCamElem.setAttribute("type", 'file');
stockCamElem.setAttribute("accept", "image/*");
stockCamElem.setAttribute("capture", "environment");
// set onchange event to call callback when user has selected file

$("#mainContainer").append(stockCamElem);
$("#stock_camera_capture").hide();
$("#stock_camera_capture").click();
$("#stock_camera_capture").change(function() {
readIdDocFileUploadUrl($("#stock_camera_capture")[0]);
});
 
  • Like
Reactions: mikedt