Updated to 0.6.12

gh-pages
Christoph Oberhofer 10 years ago
parent 681c351020
commit 4234797ead

@ -8187,11 +8187,15 @@ define('camera_access',["html_utils"], function(HtmlUtils) {
* @param {Object} failure Callback * @param {Object} failure Callback
*/ */
function getUserMedia(constraints, success, failure) { function getUserMedia(constraints, success, failure) {
if (typeof navigator.getUserMedia !== 'undefined') {
navigator.getUserMedia(constraints, function (stream) { navigator.getUserMedia(constraints, function (stream) {
streamRef = stream; streamRef = stream;
var videoSrc = (window.URL && window.URL.createObjectURL(stream)) || stream; var videoSrc = (window.URL && window.URL.createObjectURL(stream)) || stream;
success.apply(null, [videoSrc]); success.apply(null, [videoSrc]);
}, failure); }, failure);
} else {
failure(new TypeError("getUserMedia not available"));
}
} }
function loadedData(video, callback) { function loadedData(video, callback) {
@ -8230,7 +8234,7 @@ define('camera_access',["html_utils"], function(HtmlUtils) {
video.addEventListener('loadeddata', loadedDataHandler, false); video.addEventListener('loadeddata', loadedDataHandler, false);
video.play(); video.play();
}, function(e) { }, function(e) {
console.log(e); callback(e);
}); });
} }
@ -8253,7 +8257,7 @@ define('camera_access',["html_utils"], function(HtmlUtils) {
facing: "environment" facing: "environment"
}, config); }, config);
if ( typeof MediaStreamTrack.getSources !== 'undefined') { if ( typeof MediaStreamTrack !== 'undefined' && typeof MediaStreamTrack.getSources !== 'undefined') {
MediaStreamTrack.getSources(function(sourceInfos) { MediaStreamTrack.getSources(function(sourceInfos) {
var videoSourceId; var videoSourceId;
for (var i = 0; i != sourceInfos.length; ++i) { for (var i = 0; i != sourceInfos.length; ++i) {
@ -8473,7 +8477,7 @@ function(Code128Reader,
if (!err) { if (!err) {
_inputStream.trigger("canrecord"); _inputStream.trigger("canrecord");
} else { } else {
console.log(err); return cb(err);
} }
}); });
} }

File diff suppressed because one or more lines are too long

@ -1,7 +1,11 @@
$(function() { $(function() {
var App = { var App = {
init : function() { init : function() {
Quagga.init(this.state, function() { Quagga.init(this.state, function(err) {
if (err) {
console.log(err);
return;
}
App.attachListeners(); App.attachListeners();
Quagga.start(); Quagga.start();
}); });

@ -7,7 +7,7 @@ showInMenu: true
quaggaJS quaggaJS
======== ========
- [Changelog](#changelog) (2015-06-21) - [Changelog](#changelog) (2015-07-06)
## What is QuaggaJS? ## What is QuaggaJS?
@ -86,12 +86,16 @@ version `quagga.min.js` and places both files in the `dist` folder.
You can check out the [examples][github_examples] to get an idea of how to You can check out the [examples][github_examples] to get an idea of how to
use QuaggaJS. Basically the library exposes the following API: use QuaggaJS. Basically the library exposes the following API:
### Quagga.init(config, callback) ### <a name="quaggainit">Quagga.init(config, callback)</a>
This method initializes the library for a given configuration `config` (see This method initializes the library for a given configuration `config` (see
below) and invokes the `callback` when Quagga is ready to start. The below) and invokes the `callback(err)` when Quagga has finished its
initialization process also requests for camera access if real-time detection is bootstrapping phase. The initialization process also requests for camera
configured. access if real-time detection is configured. In case of an error, the `err`
parameter is set and contains information about the cause. A potential cause
may be the `inputStream.type` is set to `LiveStream`, but the browser does
not support this API, or simply if the user denies the permission to use the
camera.
```javascript ```javascript
Quagga.init({ Quagga.init({
@ -102,7 +106,11 @@ Quagga.init({
decoder : { decoder : {
readers : ["code_128_reader"] readers : ["code_128_reader"]
} }
}, function() { }, function(err) {
if (err) {
console.log(err);
return
}
console.log("Initialization finished. Ready to start"); console.log("Initialization finished. Ready to start");
Quagga.start(); Quagga.start();
}); });
@ -362,6 +370,11 @@ on the ``singleChannel`` flag in the configuration when using ``decodeSingle``.
## <a name="changelog">Changelog</a> ## <a name="changelog">Changelog</a>
### 2015-07-06
- Improvements
- Added `err` parameter to [Quagga.init()](#quaggainit) callback
function
### 2015-06-21 ### 2015-06-21
- Features - Features
- Added ``singleChannel`` configuration to ``inputStream`` (in [config] - Added ``singleChannel`` configuration to ``inputStream`` (in [config]

Loading…
Cancel
Save