On Macs with an M1/M2 processor and macOS Ventura (macOS version 13), the BarcodeDetector
is broken in Chromium based browsers, regardless of the version. For that constellation,
the BarcodeDetector does not error but does not detect QR codes. Macs without an M1/M2 or
before Ventura are fine. See https://bugs.chromium.org/p/chromium/issues/detail?id=1382442.
Fixes#209
This avoids that parallel scans on the same worker instance ALL interpret
the first incoming scan result as their result. Instead, now each scan
request to the worker waits for their individual response.
Fixes#149
Create a new worker instance on each call to createQrEngine instead of
using a singleton worker instance. Sharing a singleton instance resulted
in problems when destroying the worker, for example in a call to
QrScanner.scanImage, while it was still needed in a scanner instance or
further calls to scanImage.
Building as es module doesn't make too much sense as browser support for
es modules is lower as for es6 generally, and anyone who would import the
legacy build via es import, could already pretty much use the regular build.
Also improves on documentation for legacy build.
Closes#143
Doed now not import the worker as a separate worker script via the Worker
constructor which required copying over the worker script and specifying
QrScanner.WORKER_PATH. Instead, the dynamic import will now be handled
automatically by bundlers like Rollup or Webpack.
- Avoid starting camera stream if scanner was paused in the meantime
- Be lenient on fails to .start() if the scanner was paused in the meantime
- Disallow starting the stream or flash if the scanner was destroyed
- Await video.play calls
Fixes#90Fixes#139
- Use .pause instead of copying the code
- Remove the unnecessary 300ms delay
- Avoid overwriting _offTimeout if another pause call happened shortly
before.
- Don't start the stream if is was paused.
- Merge deviceId and preferredFacingMode options into a single
option preferredCamera. Also previously, the deviceId took
precedence over the preferredFacingMode.
- .setCamera now also allows setting a preferred facingMode
instead of a deviceId.
Additinal fixes to PR#112:
- Correctly fallback to not applying any constraints in .start if
the preferredCamera (previously deviceId and preferredFacingMode)
is not available. Previously, if neither for the deviceId nor
the preferredFacingMode contraint a camera was found, no attempt
without a constraint was attempted.
- A add missing documentation for deviceId support in the constructor
to the Readme and generally adapt Readme for merged preferredCamera
option.
- Fix missing type for deviceId (now merged into preferredCamera) in
the constructor type definitions and generally adapt the types for
merged preferredCamera option.
- rename the method from getCameraList to listCameras
- make requesting labels (and the required camera permission) optional
- refactor hasCamera using listCameras
Additinal fixes to PR#112:
- add fallback labels for when no exact labels were requested
- remove unnecessary outer Promise
- make sure the created stream is always destroyed in a finally
Especially with the following changes:
- Attempt to fix Safari RangeError exceptions
- Support "structured append" qr codes
- Binarizer: adapt blackBias for slightly higher detection rate
- round scan region to whole pixel positions to avoid blurry
drawing at sub-pixel positions
- avoid clearing the canvas by resetting the canvas width or
height when they actually didn't change.