ngx-scanner icon indicating copy to clipboard operation
ngx-scanner copied to clipboard

Rear Camera opening issue with different iOS Versions

Open manish-raana opened this issue 5 years ago • 6 comments

Describe the bug I am trying to implement a qr code scanner, earlier it was working fine but after update, I'm getting some unexpected results, it is opening front camera for some ios versions and back camera for some other ios versions, How can I deal with this issue?

manish-raana avatar Dec 11 '19 16:12 manish-raana

You can use the camerasFound property to get a list of all found cameras, select the camera you want to scan with and then set the device property with the desired camera.

odahcam avatar Jan 11 '20 21:01 odahcam

Not working

deepender87 avatar Mar 06 '20 16:03 deepender87

@deepender87 do you want me to fix it for you?

odahcam avatar Apr 08 '20 14:04 odahcam

I noticed that the labels of the cameras can be language-dependent. For me (in Germany). iOS 12.4.6, it was "Rückkamera" (= German for rear camera). Maybe this is the reason, why the front camera is used by default on my iPhone.

Knowing this, I wanted to switch to the right MediaDeviceInfo, however setting it using the device-property of the angular component had no effect!

Xenoage avatar Apr 30 '20 20:04 Xenoage

Try changing the device in the camerasFound hook:

  <zxing-scanner [(device)]="currentDevice"
    (camerasFound)="onCamerasFound($event)"></zxing-scanner>
{
  onCamerasFound($event) {
    this.currentDevice = /* choose your camera from $event */
  }
}

Maybe that helps.

odahcam avatar Apr 30 '20 21:04 odahcam

Not really. Opening another issue for this.

Xenoage avatar Apr 30 '20 21:04 Xenoage