scandoc-ai-components 0.0.31 → 0.0.33
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 +10 -2
- 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,
|
|
11228
|
+
elapsed: now - 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,
|
|
@@ -11235,7 +11242,6 @@ class ExtractorVideo {
|
|
|
11235
11242
|
validationImg: validationImage
|
|
11236
11243
|
});
|
|
11237
11244
|
const images = [...this.candidateImages];
|
|
11238
|
-
const now = Date.now();
|
|
11239
11245
|
if (images.length >= ExtractorVideo.VALIDATION_BATCH_SIZE) {
|
|
11240
11246
|
const [isValidationOk, response] = await (0,_requests_validation__WEBPACK_IMPORTED_MODULE_3__["default"])(images.map(e => e["validationImg"]), this.pastBlurValues, {});
|
|
11241
11247
|
if (isValidationOk) {
|
|
@@ -11322,6 +11328,8 @@ class ExtractorVideo {
|
|
|
11322
11328
|
const serviceConfig = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getScanDocAIConfig)();
|
|
11323
11329
|
await serviceConfig.getAccessToken(true);
|
|
11324
11330
|
} catch (authError) {
|
|
11331
|
+
this.isRunning = false;
|
|
11332
|
+
this.stopVideo();
|
|
11325
11333
|
this.onExtractedResults({
|
|
11326
11334
|
success: false,
|
|
11327
11335
|
code: "004",
|