@gueshbzh-perso/scanner 0.8.0 → 0.10.0

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/src/types.ts CHANGED
@@ -23,8 +23,10 @@ export interface Detection {
23
23
  /** Symbology, e.g. `"qr_code"`, `"ean_13"`. */
24
24
  format: BarcodeFormat;
25
25
  /**
26
- * Location of the code. For camera scans: video pixels (`video.videoWidth`
27
- * space). For `scanImage`: pixels of the source image.
26
+ * Location of the code: corners of the symbol (2D codes: their finder
27
+ * points; 1D codes: start-top, end-top, end-bottom, start-bottom). For
28
+ * camera scans: video pixels (`video.videoWidth` space). For `scanImage`:
29
+ * pixels of the source image.
28
30
  */
29
31
  points: Point[];
30
32
  /** Raw payload bytes when the symbology provides them (binary QR codes…). */
@@ -116,6 +118,17 @@ export interface ProcessingOptions {
116
118
  maxDimension?: number;
117
119
  /** Frame pipeline. `'auto'` uses WebGL2 and falls back to Canvas 2D. Default: `'auto'`. */
118
120
  backend?: 'auto' | 'webgl' | 'canvas';
121
+ /**
122
+ * Use the browser's native `BarcodeDetector` (Chrome on Android, macOS and
123
+ * ChromeOS) as the fast pass, when it supports every requested format
124
+ * (`micro_qr` excepted). The engine's fallback strategies keep running on
125
+ * the frames it finds nothing in: hard codes (laser engraving, shadows…)
126
+ * are still read. Codes get the same confirmation and de-duplication.
127
+ * It reads codes whatever their orientation. Elsewhere (Safari, Firefox,
128
+ * Chrome on Windows / Linux), or if it fails, the engine does everything.
129
+ * `'off'`: always the engine alone. Default: `'auto'`.
130
+ */
131
+ nativeDetector?: 'auto' | 'off';
119
132
  }
120
133
 
121
134
  export interface ReaderOptions extends EngineOptions, AssetOptions {
@@ -150,6 +163,10 @@ export interface ReaderStats {
150
163
  worker: boolean;
151
164
  /** Frames decoded in parallel (number of workers, `1` on the main thread). */
152
165
  workers: number;
166
+ /** `true` when the native `BarcodeDetector` does the fast pass (see `processing.nativeDetector`). */
167
+ native: boolean;
168
+ /** Average native detection time, in ms (`0` when not used). */
169
+ nativeMs: number;
153
170
  }
154
171
 
155
172
  export interface ReaderEvents {