scandoc-ai-components 0.0.33 → 0.0.35

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11218,14 +11218,15 @@ class ExtractorVideo {
11218
11218
  DOCUMENT_DETECTOR.isDocumentPresent(video).then(async isPresent => {
11219
11219
  const now_valid = Date.now();
11220
11220
  if (isPresent) {
11221
- if (!this.wasDocumentPreviouslyDetected) {
11222
- this.validationStartTime = Date.now();
11221
+ if (!this.wasDocumentPreviouslyDetected || this.validationStartTime === null) {
11222
+ this.validationStartTime = now_valid;
11223
+ console.log("Document detected. Validation timer started:", this.validationStartTime);
11223
11224
  }
11224
11225
  this.wasDocumentPreviouslyDetected = true;
11225
11226
  console.log("Validation timer:", {
11226
11227
  start: this.validationStartTime,
11227
- now,
11228
- elapsed: now - this.validationStartTime,
11228
+ now: now_valid,
11229
+ elapsed: now_valid - this.validationStartTime,
11229
11230
  limit: cfgValues.VALIDATION_TIMEOUT_MS
11230
11231
  });
11231
11232
  if (this.validationStartTime && now_valid - this.validationStartTime > cfgValues.VALIDATION_TIMEOUT_MS) {
@@ -11294,6 +11295,12 @@ class ExtractorVideo {
11294
11295
  this.validationStartTime = null;
11295
11296
  this.candidateImages = [];
11296
11297
  }
11298
+ } else {
11299
+ if (this.wasDocumentPreviouslyDetected) {
11300
+ console.log("Document lost. Resetting validation timer.");
11301
+ }
11302
+ this.wasDocumentPreviouslyDetected = false;
11303
+ this.validationStartTime = null;
11297
11304
  }
11298
11305
  }).finally(() => {
11299
11306
  setTimeout(() => this.analyzeVideoStream(), ExtractorVideo.FREQUENCY_MS);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "scandoc-ai-components",
3
3
  "author": "ScanDoc-AI",
4
- "version": "0.0.33",
4
+ "version": "0.0.35",
5
5
  "private": false,
6
6
  "description": "Pure JavaScript package for integrating ScanDoc-AI services.",
7
7
  "keywords": [