@ericblade/quagga2 1.8.1 → 1.8.3

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 CHANGED
@@ -1,5 +1,4 @@
1
- quagga2
2
- =======
1
+ # quagga2
3
2
 
4
3
  [![Rolling Versions](https://img.shields.io/badge/Rolling%20Versions-Enabled-brightgreen)](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](CHANGELOG.md)
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](#usingexternalreaders)
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,6 +33,10 @@ 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
42
  QuaggaJS is a barcode-scanner entirely written in JavaScript supporting real-
@@ -76,7 +80,6 @@ of the used Web-APIs for each mode:
76
80
 
77
81
  The following APIs need to be implemented in your browser:
78
82
 
79
- - [webworkers](http://caniuse.com/#feat=webworkers)
80
83
  - [canvas](http://caniuse.com/#feat=canvas)
81
84
  - [typedarrays](http://caniuse.com/#feat=typedarrays)
82
85
  - [bloburls](http://caniuse.com/#feat=bloburls)
@@ -151,11 +154,11 @@ You can get the `quagga.js` file in the following ways:
151
154
 
152
155
  By [installing the npm module](https://github.com/ericblade/quagga2#npm) and copying the `quagga.js` file from the `dist` folder.
153
156
 
154
- <p align="center">(OR)</p>
157
+ (OR)
155
158
 
156
159
  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
160
 
158
- <p align="center">(OR)</p>
161
+ (OR)
159
162
 
160
163
  You can include the following script tags with CDN links:
161
164
 
@@ -209,7 +212,7 @@ You can build the library yourself by simply cloning the repo and typing:
209
212
  or using Docker:
210
213
 
211
214
  ```console
212
- > docker build --tag quagg2/build .
215
+ > docker build --tag quagga2/build .
213
216
  > docker run -v $(pwd):/quagga2 quagga2/build npm install
214
217
  > docker run -v $(pwd):/quagga2 quagga2/build npm run build
215
218
  ```
@@ -235,13 +238,13 @@ file any more.
235
238
  If you are working on a project that includes quagga, but you need to use a development version of
236
239
  quagga, then you can run from the quagga directory:
237
240
 
238
- ```
241
+ ```bash
239
242
  npm install && npm run build && npm link
240
243
  ```
241
244
 
242
245
  then from the other project directory that needs this quagga, do
243
246
 
244
- ```
247
+ ```bash
245
248
  npm link @ericblade/quagga2
246
249
  ```
247
250
 
@@ -410,6 +413,45 @@ empty.
410
413
  }
411
414
  ```
412
415
 
416
+ ## <a name="cameraaccess-api">CameraAccess API</a>
417
+
418
+ Quagga2 exposes a CameraAccess API that is available for performing some shortcut access to commonly
419
+ used camera functions. This API is available as `Quagga.CameraAccess` and is documented below.
420
+
421
+ ## CameraAccess.request(HTMLVideoElement | null, MediaTrackConstraints?)
422
+
423
+ Will attempt to initialize the camera and start playback given the specified video element. Camera
424
+ is selected by the browser based on the MediaTrackConstraints supplied. If no video element is
425
+ supplied, the camera will be initialized but invisible. This is mostly useful for probing that the
426
+ camera is available, or probing to make sure that permissions are granted by the user.
427
+ This function will return a Promise that resolves when completed, or rejects on error.
428
+
429
+ ## CameraAccess.release()
430
+
431
+ If a video element is known to be running, this will pause the video element, then return a Promise
432
+ that when resolved will have stopped all tracks in the video element, and released all resources.
433
+
434
+ ## CameraAccess.enumerateVideoDevices()
435
+
436
+ This will send out a call to navigator.mediaDevices.enumerateDevices(), filter out any mediadevices
437
+ that do not have a kind of 'videoinput', and resolve the promise with an array of MediaDeviceInfo.
438
+
439
+ ## CameraAccess.getActiveStreamLabel()
440
+
441
+ Returns the label for the active video track
442
+
443
+ ## CameraAccess.getActiveTrack()
444
+
445
+ Returns the MediaStreamTrack for the active video track
446
+
447
+ ## CameraAccess.disableTorch()
448
+
449
+ 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.
450
+
451
+ ## CameraAccess
452
+
453
+ 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.
454
+
413
455
  ## <a name="configobject">Configuration</a>
414
456
 
415
457
  The configuration that ships with QuaggaJS covers the default use-cases and can
@@ -420,7 +462,6 @@ high-level properties:
420
462
 
421
463
  ```javascript
422
464
  {
423
- numOfWorkers: 4,
424
465
  locate: true,
425
466
  inputStream: {...},
426
467
  frequency: 10,
@@ -430,21 +471,6 @@ high-level properties:
430
471
  }
431
472
  ```
432
473
 
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
474
  ### locate
449
475
 
450
476
  One of the main features of QuaggaJS is its ability to locate a barcode in a
@@ -702,7 +728,7 @@ A growing collection of tips & tricks to improve the various aspects of Quagga.
702
728
  ### Working with Cordova / PhoneGap?
703
729
 
704
730
  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][https://github.com/serratus/quaggaJS/issues/94#issuecomment-571478711]
731
+ here: [Original Repo Issue #94 Comment][issue-94-comment]
706
732
 
707
733
  ```javascript
708
734
  let permissions = cordova.plugins.permissions; permissions.checkPermission(permissions.CAMERA,
@@ -858,3 +884,4 @@ on the ``singleChannel`` flag in the configuration when using ``decodeSingle``.
858
884
  [i2of5_wiki]: https://en.wikipedia.org/wiki/Interleaved_2_of_5
859
885
  [enumerateDevices]: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices
860
886
  [reactExample]: https://github.com/ericblade/quagga2-react-example
887
+ [issue-94-comment]: https://github.com/serratus/quaggajs/issues/94#issuecomment-571478711