@ekyc_qoobiss/qbs-ect-cmp 4.7.21 → 4.7.23

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.
@@ -533,7 +533,7 @@ const IdAutoCapture = class {
533
533
  this.opencvReady = true;
534
534
  console.log('OpenCV.js loaded. Ready to start detection.');
535
535
  await this.getMedia(); // Get camera media once OpenCV is ready
536
- this.handleStartDetection(); // Start processing video frames
536
+ await this.handleStartDetection(); // Start processing video frames
537
537
  };
538
538
  // Method to start video recording
539
539
  this.startRecording = () => {
@@ -600,7 +600,8 @@ const IdAutoCapture = class {
600
600
  context.drawImage(video, 0, 0, processingCanvas.width, processingCanvas.height);
601
601
  const imageData = context.getImageData(0, 0, processingCanvas.width, processingCanvas.height);
602
602
  // --- OpenCV.js processing starts here ---
603
- let src = cv.matFromImageData(imageData);
603
+ let src = new cv.Mat(processingCanvas.height, processingCanvas.width, cv.CV_8UC4);
604
+ src.data.set(imageData.data);
604
605
  let gray = new cv.Mat();
605
606
  let blurred = new cv.Mat();
606
607
  let edges = new cv.Mat();
@@ -690,7 +691,7 @@ const IdAutoCapture = class {
690
691
  }
691
692
  };
692
693
  // Handler for starting the ID detection process
693
- this.handleStartDetection = () => {
694
+ this.handleStartDetection = async () => {
694
695
  if (!this.mediaStream) {
695
696
  console.log('Camera not ready. Please allow camera access.');
696
697
  return;
@@ -705,6 +706,18 @@ const IdAutoCapture = class {
705
706
  this.recordedChunks = []; // Clear previous video chunks
706
707
  this.recordedVideoUrl = null; // Clear previous video URL
707
708
  this.startRecording();
709
+ if (this.videoElement && this.videoElement.readyState < 3) {
710
+ // Use readyState 3 (HAVE_FUTURE_DATA) or 4 (HAVE_ENOUGH_DATA) for more robust readiness
711
+ console.log('Waiting for video stream to fully load...');
712
+ await new Promise(resolve => {
713
+ const onCanPlayThrough = () => {
714
+ this.videoElement.removeEventListener('canplaythrough', onCanPlayThrough);
715
+ resolve();
716
+ };
717
+ this.videoElement.addEventListener('canplaythrough', onCanPlayThrough);
718
+ });
719
+ console.log('Video stream ready. Starting detection.');
720
+ }
708
721
  this.startFrameProcessing(); // Start the OpenCV frame processing loop
709
722
  };
710
723
  this.verified = false;
@@ -778,7 +791,7 @@ const IdAutoCapture = class {
778
791
  if (TranslationUtils.state.device.isDesktop) {
779
792
  cameraVideoClass = 'cameraVideoSelfieDesk';
780
793
  }
781
- return (index.h("div", { key: '239110026f2b86b4d21a04571130d29d402f273b', class: "container flex center" }, index.h("div", { key: 'd3c882b832b541ac902f01ecd7a79c23e2b22eb1', class: "px-2 w-100" }, index.h("h1", { key: '38452a0b19aa389e83f1a0010d869c9f41cb20e1', class: this.titleStyle, innerHTML: this.titleMesage }), index.h("div", { key: '5f846e0c702d388cc04e3fc305d194bbcae78fdc', hidden: this.verified }, index.h("div", { key: '0201a63cd53a9c7299422486174413f6a15553f0', class: "w-100 h-100 rounded" }, index.h("div", { key: '67f8c00e0ede3cc836f57deb8a15449bc15538e8', class: "camera rounded" }, index.h("video", { key: 'bd20436cc64cd7e0da4b3aee7909906563ae1ce7', id: "video", loop: true, autoplay: true, playsinline: true, muted: true, class: cameraVideoClass, ref: el => (this.videoElement = el) }), index.h("canvas", { key: '9d2910bcc563d1a6df51ad4304efed898f89c4fa', id: "output", ref: el => (this.canvasElement = el), style: { display: 'none' } }), index.h("canvas", { key: '44df5c5e8da34e233deb782443d472536f65b2e7', id: "processingCanvasElement", ref: el => (this.processingCanvasElement = el), style: { display: 'none' } }), index.h("div", { key: '2a35a0c7778e62b36095d56bc715d612ca17c752', class: "id-guide-rectangle" }), this.isCapturing && index.h("div", { key: 'b28c98ed3da1dcf8902f42df3f5758aec5cc8b82', class: "capture-flash-overlay" }), this.countdown > 0 && (index.h("div", { key: 'eafcaa2fb46ba675fd4a600318dd5fe7ba95641e', class: "absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center" }, index.h("span", { key: '6df1640462fb3cd6eb4b17f8feb011d7bdeb35f4', class: "text-white text-9xl font-bold animate-bounce" }, this.countdown)))))), index.h("div", { key: '09ad24e2c403c44db82d2790a39311d1c9120031', class: "footer text-center" }, index.h("img", { key: '6532d116449468609ac82fb2b7ab429f074a3069', src: Cameras.logoOntraceSvg })))));
794
+ return (index.h("div", { key: '32fa99f679fbbc0009608aeb2eeb26645dbadb59', class: "container flex center" }, index.h("div", { key: '08ee0848724b359253d27120fe5e2751372cab1e', class: "px-2 w-100" }, index.h("h1", { key: '570154c491f44b72f5a6794f17b1a19c964a55e5', class: this.titleStyle, innerHTML: this.titleMesage }), index.h("div", { key: '2a626737524f5748e4d6faeb109f3dc59fe3388b', hidden: this.verified }, index.h("div", { key: 'f38962922b06f902790d9d549c3d1c507cafb8b8', class: "w-100 h-100 rounded" }, index.h("div", { key: '7c69f659183dfdfab7ea759c1a5a574af19df679', class: "camera rounded" }, index.h("video", { key: '7f378deee95b9821715add1f9b66e9299b6e4380', id: "video", loop: true, autoplay: true, playsinline: true, muted: true, class: cameraVideoClass, ref: el => (this.videoElement = el) }), index.h("canvas", { key: '8150fbc30e908e011f415b73a0e3f2d8711f2d20', id: "output", ref: el => (this.canvasElement = el), style: { display: 'none' } }), index.h("canvas", { key: '54887d1f9266d32f653760ff6e70971e2d525c0a', id: "processingCanvasElement", ref: el => (this.processingCanvasElement = el), style: { display: 'none' } }), index.h("div", { key: 'cf656641dcb1cf1bf845c28a97630c72f7da8fe6', class: "id-guide-rectangle" }), this.isCapturing && index.h("div", { key: 'eabb935e014eb3966940a27a5aa100477249dbba', class: "capture-flash-overlay" }), this.countdown > 0 && (index.h("div", { key: 'e8a05e21e03673637e0194b3d967ed0044891a01', class: "absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center" }, index.h("span", { key: 'f6996d51686b935aa4aaa6f2abe4062d5782c116', class: "text-white text-9xl font-bold animate-bounce" }, this.countdown)))))), index.h("div", { key: 'd4fc6a0ff5951767a43f9166fcf47f98b4d209a7', class: "footer text-center" }, index.h("img", { key: 'a84cc0c65a6684807abf314d9839babe16768494', src: Cameras.logoOntraceSvg })))));
782
795
  }
783
796
  get el() { return index.getElement(this); }
784
797
  };
@@ -843,7 +856,7 @@ const IdSelection = class {
843
856
  };
844
857
  IdSelection.style = idSelectionCss;
845
858
 
846
- const version$1 = "4.7.21";
859
+ const version$1 = "4.7.23";
847
860
  var packageJson = {
848
861
  version: version$1};
849
862