scandoc-ai-components 0.0.32 → 0.0.34
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/dist/index.js +13 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11216,12 +11216,19 @@ class ExtractorVideo {
|
|
|
11216
11216
|
const fullImage = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.videoImgToBase64)(video, canvas, video.videoWidth, video.videoHeight, false);
|
|
11217
11217
|
const validationImage = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.videoImgToBase64)(video, canvas, ExtractorVideo.VALIDATION_IMG_WIDTH, ExtractorVideo.VALIDATION_IMG_HEIGHT, true);
|
|
11218
11218
|
DOCUMENT_DETECTOR.isDocumentPresent(video).then(async isPresent => {
|
|
11219
|
+
const now_valid = Date.now();
|
|
11219
11220
|
if (isPresent) {
|
|
11220
11221
|
if (!this.wasDocumentPreviouslyDetected) {
|
|
11221
11222
|
this.validationStartTime = Date.now();
|
|
11222
11223
|
}
|
|
11223
11224
|
this.wasDocumentPreviouslyDetected = true;
|
|
11224
|
-
|
|
11225
|
+
console.log("Validation timer:", {
|
|
11226
|
+
start: this.validationStartTime,
|
|
11227
|
+
now_valid,
|
|
11228
|
+
elapsed: now_valid - this.validationStartTime,
|
|
11229
|
+
limit: cfgValues.VALIDATION_TIMEOUT_MS
|
|
11230
|
+
});
|
|
11231
|
+
if (this.validationStartTime && now_valid - this.validationStartTime > cfgValues.VALIDATION_TIMEOUT_MS) {
|
|
11225
11232
|
this.stopVideo();
|
|
11226
11233
|
this.onExtractedResults({
|
|
11227
11234
|
success: false,
|
|
@@ -11287,6 +11294,9 @@ class ExtractorVideo {
|
|
|
11287
11294
|
this.validationStartTime = null;
|
|
11288
11295
|
this.candidateImages = [];
|
|
11289
11296
|
}
|
|
11297
|
+
} else {
|
|
11298
|
+
this.wasDocumentPreviouslyDetected = false;
|
|
11299
|
+
this.validationStartTime = null;
|
|
11290
11300
|
}
|
|
11291
11301
|
}).finally(() => {
|
|
11292
11302
|
setTimeout(() => this.analyzeVideoStream(), ExtractorVideo.FREQUENCY_MS);
|
|
@@ -11321,6 +11331,8 @@ class ExtractorVideo {
|
|
|
11321
11331
|
const serviceConfig = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getScanDocAIConfig)();
|
|
11322
11332
|
await serviceConfig.getAccessToken(true);
|
|
11323
11333
|
} catch (authError) {
|
|
11334
|
+
this.isRunning = false;
|
|
11335
|
+
this.stopVideo();
|
|
11324
11336
|
this.onExtractedResults({
|
|
11325
11337
|
success: false,
|
|
11326
11338
|
code: "004",
|