ngx-scanner
ngx-scanner copied to clipboard
Tripple lens shooter - wide angle
Hi sir,
While testing my web app in Samsung S10, ngx-scanner takes tripple lens camera. could you please explain it? and please help me to solve this issue.
Hello mister, isn't this the same as #245 ?
Have you take a look at the demo application code to see how device changing is implemented?
Yes sir, I have downloaded and build zxing scanner demo application and checked out... Actually vivo y17 is tripple camera mobile, in that mobile scanner Working fine but in Samsung s10 it takes wide angle camera.. I have checked with remote debugging and console the available devices.. it is showing back and front camera only... Please help me to get rid of this issue sir..
Have you tried getMediaDevices? As you said in your other issue (#245), I think the mentioned method may not be returning all the cameras. That's something we need to investigate, since this lib was never designed to deal with something like that.
No, I didn't.. i am using 'this.scanner.camerasFound'..
this.scanner.camerasFound.subscribe((devices: MediaDeviceInfo[]) => {
this.availableDevices = devices;
for (const device of devices) {
if (/back|rear|environment/gi.test(device.label)) {
this.scanner.changeDevice(device);
this.currentDevice = device;
break;
}
}
});
it returns 2 cameras in vivo y17. i am not sure that wide angle is a type of camera or it is applying as a daemon to the cameras.
You should try the native navigator.mediaDevices.getUserMedia() API to see if it is a problem with the library or not. Could you do that?
I've tried today on Samsung A70 wich has 3 back lens, and navigator.mediaDevices.enumerateDevices return only 2 cameras:
InputDeviceInfo {deviceId: "b8fd73051c640574041b0b43b4cb57bdf72de6dedf35a7aaae82b4299b65fd3b", kind: "videoinput", label: "camera2 1, facing front", groupId: "63944bd4fa471d2d257a4afecc099e4012cd6b79a8f13782fbb645e02cf18c5e"} 1: InputDeviceInfo {deviceId: "85a986d622b736e890fe3cfc1c319a3bd3d315b7fb5c30e55395f352f8866036", kind: "videoinput", label: "camera2 0, facing back", groupId: "b814b91b101fe554ce18004af74f863bd82...
What about the other ones? Any idea please?
No ideas, the browser abstracts all the hardware access we have. The "environment facing" cameras seems to be the "same camera" with just different lens, so all I think you could do to select different lens in the camera is to play a bit with the device media constraints to try to receive streams from different lens or even try to play with the media stream tracks and try to apply some constraints in them to see if the Android selects different lens for each constraint.