Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Length out of range of buffer #96

Open
Helene-Ocode opened this issue Jul 27, 2022 · 0 comments
Open

RangeError: Length out of range of buffer #96

Helene-Ocode opened this issue Jul 27, 2022 · 0 comments

Comments

@Helene-Ocode
Copy link

I'm using BrowserQRCodeReader and i try to scan a QrCode with just a url.
I have this message when i'm scanning on iPhone. It's okay on Android.

Image from iOS

Here my code :
`
const initScanner = () => {
const codeReader = new BrowserQRCodeReader()

	BrowserCodeReader.listVideoInputDevices().then((devices) => {
		const selectedDeviceId = devices[devices.length - 1].deviceId // last one is usually the rear camera

		codeReader
			.decodeFromVideoDevice(
				selectedDeviceId,
				previewAreaRef.current,
				(result, error, controls) => {

					if (result) {
						const text = result.getText()

						onFound && onFound(text)
						controls.stop()
						return
					}
					if (!previewAreaRef.current) {
						controls.stop()
						return
					}

					if (error) {

						if (error instanceof RangeError) {
							controls.stop()
							alert("error", t("scanner.scanError", { ns: "factory" }))
							refreshProcess(START_CREATION)
							return
						}
					}
				}
			)
			.catch((e) => {
				alert("error", t("scanner.scanError", { ns: "factory" }))
			})
	})
}`

Do you have any idea where the problem could come from?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant