33 Commits
Author SHA1 Message Date
Daniel 987bbb06c2 Disable native BarcodeDetector on M1/M2 Macs with Ventura
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
2022-11-22 21:01:12 -06:00
Daniel 2714cb9944 Identify scan requests to worker by unique id's
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
2022-02-22 23:27:02 +01:00
Daniel 9a70dd984c Fix type generation for namespaced types
Fixes #147
2022-02-21 14:36:54 +01:00
Daniel 60a2b3b2ce Import worker as dynamic import
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.
2022-02-02 17:42:30 +01:00
Daniel 70335ba5c2 Better handling of internal issues of native BarcodeDetector
Fixes #98
2022-01-28 18:24:20 +01:00
Daniel 8ee8d7a45a Support throttling the scans per second
Closes #93
2022-01-28 18:24:20 +01:00
Daniel 158fbf585b Support providing an external overlay element 2022-01-28 18:24:20 +01:00
Daniel 0d48a807f5 Support highlighting the outline of detected codes 2022-01-28 18:24:13 +01:00
Daniel dea704924f Support highlighting the scan region
Closes #86
2022-01-26 16:43:25 +01:00
Daniel 57b2a52734 Provide more detailed scan results, for now adding qr location
Closes #66
Closes #109
2022-01-25 11:59:08 +01:00
Daniel 954d3e2930 Switch constructor and scanImage to using options objects 2022-01-25 10:21:26 +01:00
Daniel b769540c3b Improve handling of pending actions if scanner was paused or destroyed
- 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 #90
Fixes #139
2022-01-25 10:21:26 +01:00
Daniel a3e87bcf1e Remove limitation to MediaStreams as video srcObject 2022-01-25 10:21:26 +01:00
Daniel ce3189aeb0 Automatically generate type declarations 2022-01-25 10:21:26 +01:00
Daniel 5f13ff064e Merge PR#112 (lafriks-fork:feat/camera_list) with fixes 2021-08-16 14:08:30 +02:00
Daniel 28c43cdbe3 Simplify and improve setCamera
- 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.
2021-08-16 13:40:56 +02:00
Daniel 6a6c593c2d Merge deviceId and preferredFacingMode into preferredCamera
- 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.
2021-08-14 14:13:33 +02:00
Daniel 1e9f6c6598 Refactor listCameras and improve readme wording
- 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
2021-08-13 20:49:59 +02:00
Daniel 5836ac719b Rename fixedCanvasSize to disallowCanvasResizing 2021-07-29 17:26:29 +02:00
TheAppleFreakandSören Schwert 83ed4002c5 Corrected typo in typings 2021-07-21 13:14:35 +02:00
Lauris BH 63f79f97a8 Change setCamera to be async method 2021-06-10 17:31:17 +03:00
Lauris BH 10d86390d6 Add new method definitions 2021-06-04 15:14:02 +03:00
Daniel e8a77dea3f Add option for providing a custom web cam scanning region 2020-07-12 18:57:29 +02:00
Daniel 423101663b Use native BarcodeDetector when supported 2020-07-12 12:30:38 +02:00
Daniel a3fcd4cf69 Fixes and improvements for flashlight support
- Add instructions to readme
- Update _flashOn after the flash was actually turned on or off
- Throw an error when trying to set the flash if not supported
- Make toggleFlash, turnFlashOn, turnFlashOff return a promise
- Throw an error when trying to detect flash support before the
  video stream is available.
2020-07-09 14:31:41 +02:00
Filip ChalupaandDaniel 50adecec26 Flash detection and control
PR #34

Co-authored-by: Daniel <github.danimoh@neverbox.com>
2020-07-09 12:38:31 +02:00
Magnus HenochandDaniel 49ccc1dde9 Allow specifying a preferred facingMode for camera
PR #35

Co-authored-by: Daniel <github.danimoh@neverbox.com>
2020-07-09 11:33:38 +02:00
Daniel 947fb7ebcf Improvements and fixes for continous scanning error handling
- Make change backwards compatible with previous consructor signature
- Fix demo to interpret errors as proper results
- Update types
- Do not report errors when the scanner is inactive
- Update readme
2020-07-07 23:45:49 +02:00
Christopher PfohlandDaniel 5ffcb9f507 Update qr-scanner.d.ts
More accurate callback type in the QrScanner constructor.
2020-07-05 12:29:46 +02:00
Daniel d5a8fe70e8 switch to jsQR library 2019-02-16 22:20:13 -06:00
Yury Kozyrevanddanimoh 540030c81f Update qr-scanner.d.ts 2019-02-13 17:00:35 -06:00
Daniel 2144b169d1 add method for checking whether device has a camera 2019-02-05 09:32:48 -06:00
Daniel 8a1aff3353 add typescript types 2019-02-04 22:16:42 -06:00