Skip to content

v0.10.0

Compare
Choose a tag to compare
@serratus serratus released this 31 Mar 19:56
· 89 commits to master since this release

New Features

MediaDevices

Nothing too exciting, but this release added the dependency to adapter.js in order to keep up with the ever changing WebRTC and MediaDevices API. With this in place, some constraints have changed, and some have been added:

constraints: {
  aspectRatio: 640/480, // optional, former minAspectRatio and maxAspectRatio
  facingMode: "environment", // optional, former only facing
  deviceId: "38745983457387598375983759834" // new, let's you specify the camera
},

Frequency

Thanks to #95, @JauernigIT added a configuration for specifying the frequency of scanning the images. In cases where quagga should not eat 100% CPU, this can be used to control the scans per second like this:

const config = {
  // ....
  frequency: 5 // allow a maximum of 5 scans per second
}

Other Updates

In this release, I also took the time to upgrade some of the dependencies to their latest version

  • upgraded to babel 6
  • using webpack 2

These changes now

Migration

Due to the changes present in the constraint config, and the update to webpack 2, some things are important to keep in mind:

Configuration

  • minAspectRatio and maxAspectRatio now become only aspectRatio
  • facing is now defined as facingMode

Importing the Library

Due to the migration to webpack 2, the UMD build is now ES6 compliant and must be therefore used as such:

var Quagga = require('quagga');

now becomes

var Quagga = require('quagga').default;
// or better, use ES6 imports:
import Quagga from 'quagga';

Fixes

Unfortunately, due to some code-refactoring, changes in the configuration did not reflect them during runtime, when using web-workers. This is now fixed in a way that web-workers are always terminated instead of reused. This is necessary, because the initialization happens whenever the worker is created.