browser icon indicating copy to clipboard operation
browser copied to clipboard

iPhone Safari IndexSizeError: The index is not in the allowed range

Open dennis-8 opened this issue 3 years ago • 1 comments

Hello,

I'm using @zxing-js/browser library together with react-webcam like this: image

In onUserMedia handler I'm getting a list of devices (skipped in screenshot). This is done because on iPhone I can get the list of devices only after the user accepted to use the camera.

Everything works fine, but on iPhone somethimes there is a bug when I switch between cameras.

Here are some screenshots with errors:

IMG_0002

IMG_0005

IMG_0006

dennis-8 avatar Apr 23 '21 18:04 dennis-8

Also, is this a good practice to create a BrowserMultiFormatReader instance and configure it to decodeOnceFromStream each time when the camera is changed?

What is actually happening with the old decodeOnceFromStream call, when a new camera is selected?

In zxing-js/library there is a reset method, but what about zxing-js/browser? Do we need to reset the reader when a new camera is selected?

dennis-8 avatar Apr 23 '21 18:04 dennis-8