@ericblade/quagga2 1.8.2 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -30
- package/dist/quagga.js +729 -716
- package/dist/quagga.min.js +3 -3
- package/lib/quagga.js +737 -724
- package/package.json +28 -26
package/README.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
quagga2
|
|
2
|
-
=======
|
|
1
|
+
# quagga2
|
|
3
2
|
|
|
4
3
|
[](https://rollingversions.com/ericblade/quagga2)
|
|
5
4
|
|
|
@@ -11,13 +10,14 @@ This is a fork of the original QuaggaJS library, that will be maintained until s
|
|
|
11
10
|
original author and maintainer returns, or it has been completely replaced by built-in browser and
|
|
12
11
|
node functionality.
|
|
13
12
|
|
|
14
|
-
- [Changelog](
|
|
13
|
+
- [Changelog](https://github.com/ericblade/quagga2/releases)
|
|
15
14
|
- [Browser Support](#browser-support)
|
|
16
15
|
- [Installing](#installing)
|
|
17
16
|
- [Getting Started](#gettingstarted)
|
|
18
17
|
- [Using with React](#usingwithreact)
|
|
19
|
-
- [Using External Readers](#
|
|
18
|
+
- [Using External Readers](#usingwithexternalreaders)
|
|
20
19
|
- [API](#api)
|
|
20
|
+
- [CameraAccess API](#cameraaccess-api)
|
|
21
21
|
- [Configuration](#configobject)
|
|
22
22
|
- [Tips & Tricks](#tipsandtricks)
|
|
23
23
|
|
|
@@ -33,10 +33,13 @@ Please see <https://github.com/julienboulay/ngx-barcode-scanner> or <https://git
|
|
|
33
33
|
|
|
34
34
|
Please see <https://github.com/ptc-iot-sharing/ThingworxBarcodeScannerWidget>
|
|
35
35
|
|
|
36
|
+
## Using Vue?
|
|
37
|
+
|
|
38
|
+
Please see <https://github.com/DevinNorgarb/vue-quagga-2>
|
|
39
|
+
|
|
36
40
|
## What is QuaggaJS?
|
|
37
41
|
|
|
38
|
-
QuaggaJS is a barcode-scanner entirely written in JavaScript supporting real-
|
|
39
|
-
time localization and decoding of various types of barcodes such as __EAN__,
|
|
42
|
+
QuaggaJS is a barcode-scanner entirely written in JavaScript supporting real-time localization and decoding of various types of barcodes such as __EAN__,
|
|
40
43
|
__CODE 128__, __CODE 39__, __EAN 8__, __UPC-A__, __UPC-C__, __I2of5__,
|
|
41
44
|
__2of5__, __CODE 93__, __CODE 32__ and __CODABAR__. The library is also capable of using
|
|
42
45
|
`getUserMedia` to get direct access to the user's camera stream. Although the
|
|
@@ -76,7 +79,6 @@ of the used Web-APIs for each mode:
|
|
|
76
79
|
|
|
77
80
|
The following APIs need to be implemented in your browser:
|
|
78
81
|
|
|
79
|
-
- [webworkers](http://caniuse.com/#feat=webworkers)
|
|
80
82
|
- [canvas](http://caniuse.com/#feat=canvas)
|
|
81
83
|
- [typedarrays](http://caniuse.com/#feat=typedarrays)
|
|
82
84
|
- [bloburls](http://caniuse.com/#feat=bloburls)
|
|
@@ -151,11 +153,11 @@ You can get the `quagga.js` file in the following ways:
|
|
|
151
153
|
|
|
152
154
|
By [installing the npm module](https://github.com/ericblade/quagga2#npm) and copying the `quagga.js` file from the `dist` folder.
|
|
153
155
|
|
|
154
|
-
|
|
156
|
+
(OR)
|
|
155
157
|
|
|
156
158
|
You can also build the library yourself and copy `quagga.js` file from the `dist` folder(refer to the [building](https://github.com/ericblade/quagga2#building) section for more details)
|
|
157
159
|
|
|
158
|
-
|
|
160
|
+
(OR)
|
|
159
161
|
|
|
160
162
|
You can include the following script tags with CDN links:
|
|
161
163
|
|
|
@@ -209,7 +211,7 @@ You can build the library yourself by simply cloning the repo and typing:
|
|
|
209
211
|
or using Docker:
|
|
210
212
|
|
|
211
213
|
```console
|
|
212
|
-
> docker build --tag
|
|
214
|
+
> docker build --tag quagga2/build .
|
|
213
215
|
> docker run -v $(pwd):/quagga2 quagga2/build npm install
|
|
214
216
|
> docker run -v $(pwd):/quagga2 quagga2/build npm run build
|
|
215
217
|
```
|
|
@@ -235,13 +237,13 @@ file any more.
|
|
|
235
237
|
If you are working on a project that includes quagga, but you need to use a development version of
|
|
236
238
|
quagga, then you can run from the quagga directory:
|
|
237
239
|
|
|
238
|
-
```
|
|
240
|
+
```bash
|
|
239
241
|
npm install && npm run build && npm link
|
|
240
242
|
```
|
|
241
243
|
|
|
242
244
|
then from the other project directory that needs this quagga, do
|
|
243
245
|
|
|
244
|
-
```
|
|
246
|
+
```bash
|
|
245
247
|
npm link @ericblade/quagga2
|
|
246
248
|
```
|
|
247
249
|
|
|
@@ -410,6 +412,45 @@ empty.
|
|
|
410
412
|
}
|
|
411
413
|
```
|
|
412
414
|
|
|
415
|
+
## <a name="cameraaccess-api">CameraAccess API</a>
|
|
416
|
+
|
|
417
|
+
Quagga2 exposes a CameraAccess API that is available for performing some shortcut access to commonly
|
|
418
|
+
used camera functions. This API is available as `Quagga.CameraAccess` and is documented below.
|
|
419
|
+
|
|
420
|
+
## CameraAccess.request(HTMLVideoElement | null, MediaTrackConstraints?)
|
|
421
|
+
|
|
422
|
+
Will attempt to initialize the camera and start playback given the specified video element. Camera
|
|
423
|
+
is selected by the browser based on the MediaTrackConstraints supplied. If no video element is
|
|
424
|
+
supplied, the camera will be initialized but invisible. This is mostly useful for probing that the
|
|
425
|
+
camera is available, or probing to make sure that permissions are granted by the user.
|
|
426
|
+
This function will return a Promise that resolves when completed, or rejects on error.
|
|
427
|
+
|
|
428
|
+
## CameraAccess.release()
|
|
429
|
+
|
|
430
|
+
If a video element is known to be running, this will pause the video element, then return a Promise
|
|
431
|
+
that when resolved will have stopped all tracks in the video element, and released all resources.
|
|
432
|
+
|
|
433
|
+
## CameraAccess.enumerateVideoDevices()
|
|
434
|
+
|
|
435
|
+
This will send out a call to navigator.mediaDevices.enumerateDevices(), filter out any mediadevices
|
|
436
|
+
that do not have a kind of 'videoinput', and resolve the promise with an array of MediaDeviceInfo.
|
|
437
|
+
|
|
438
|
+
## CameraAccess.getActiveStreamLabel()
|
|
439
|
+
|
|
440
|
+
Returns the label for the active video track
|
|
441
|
+
|
|
442
|
+
## CameraAccess.getActiveTrack()
|
|
443
|
+
|
|
444
|
+
Returns the MediaStreamTrack for the active video track
|
|
445
|
+
|
|
446
|
+
## CameraAccess.disableTorch()
|
|
447
|
+
|
|
448
|
+
Turns off Torch. (Camera Flash) Resolves when complete, throws on error. Does not work on iOS devices of at least version 16.4 and earlier. May or may not work on later versions.
|
|
449
|
+
|
|
450
|
+
## CameraAccess
|
|
451
|
+
|
|
452
|
+
Turns on Torch. (Camera Flash) Resolves when complete, throws on error. Does not work on iOS devices of at least version 16.4 and earlier. May or may not work on later versions.
|
|
453
|
+
|
|
413
454
|
## <a name="configobject">Configuration</a>
|
|
414
455
|
|
|
415
456
|
The configuration that ships with QuaggaJS covers the default use-cases and can
|
|
@@ -420,7 +461,6 @@ high-level properties:
|
|
|
420
461
|
|
|
421
462
|
```javascript
|
|
422
463
|
{
|
|
423
|
-
numOfWorkers: 4,
|
|
424
464
|
locate: true,
|
|
425
465
|
inputStream: {...},
|
|
426
466
|
frequency: 10,
|
|
@@ -430,21 +470,6 @@ high-level properties:
|
|
|
430
470
|
}
|
|
431
471
|
```
|
|
432
472
|
|
|
433
|
-
### numOfWorkers
|
|
434
|
-
|
|
435
|
-
NOTE: As of quagga2 v0.0.13, numOfWorkers has been *disabled*. The library needs a major restructuring
|
|
436
|
-
to properly handle Worker threads, and that restructuring is on-going at the moment, to solve other
|
|
437
|
-
problems as well. It will be re-enabled in the future. As a result, the numOfWorkers setting is ALWAYS 0.
|
|
438
|
-
|
|
439
|
-
~~QuaggaJS supports web-workers out of the box and runs with `4` workers in its
|
|
440
|
-
default configuration. The number should align with the number of cores
|
|
441
|
-
available in your targeted devices.~~
|
|
442
|
-
|
|
443
|
-
~~In case you don't know the number upfront, or if the variety of devices is
|
|
444
|
-
too big, you can either use `navigator.hardwareConcurrency` (see
|
|
445
|
-
[here](https://wiki.whatwg.org/wiki/Navigator_HW_Concurrency)) where available
|
|
446
|
-
or make use of [core-estimator](https://github.com/oftn/core-estimator).~~
|
|
447
|
-
|
|
448
473
|
### locate
|
|
449
474
|
|
|
450
475
|
One of the main features of QuaggaJS is its ability to locate a barcode in a
|
|
@@ -519,7 +544,7 @@ CPU power are of concern.
|
|
|
519
544
|
|
|
520
545
|
QuaggaJS usually runs in a two-stage manner (`locate` is set to `true`) where,
|
|
521
546
|
after the barcode is located, the decoding process starts. Decoding is the
|
|
522
|
-
process of converting the bars into
|
|
547
|
+
process of converting the bars into their true meaning. Most of the configuration
|
|
523
548
|
options within the `decoder` are for debugging/visualization purposes only.
|
|
524
549
|
|
|
525
550
|
```javascript
|
|
@@ -702,7 +727,7 @@ A growing collection of tips & tricks to improve the various aspects of Quagga.
|
|
|
702
727
|
### Working with Cordova / PhoneGap?
|
|
703
728
|
|
|
704
729
|
If you're having issues getting a mobile device to run Quagga using Cordova, you might try the code
|
|
705
|
-
here: [Original Repo Issue #94 Comment][
|
|
730
|
+
here: [Original Repo Issue #94 Comment][issue-94-comment]
|
|
706
731
|
|
|
707
732
|
```javascript
|
|
708
733
|
let permissions = cordova.plugins.permissions; permissions.checkPermission(permissions.CAMERA,
|
|
@@ -858,3 +883,4 @@ on the ``singleChannel`` flag in the configuration when using ``decodeSingle``.
|
|
|
858
883
|
[i2of5_wiki]: https://en.wikipedia.org/wiki/Interleaved_2_of_5
|
|
859
884
|
[enumerateDevices]: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices
|
|
860
885
|
[reactExample]: https://github.com/ericblade/quagga2-react-example
|
|
886
|
+
[issue-94-comment]: https://github.com/serratus/quaggajs/issues/94#issuecomment-571478711
|