idmission-web-sdk 2.3.97 → 2.3.99

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.
@@ -211,7 +211,7 @@
211
211
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
212
  };
213
213
 
214
- var webSdkVersion = '2.3.97';
214
+ var webSdkVersion = '2.3.99';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -24251,9 +24251,8 @@
24251
24251
  if (!camera) throw new Error('Camera not found');
24252
24252
  // set our flag and clear whatever we have recorded so far.
24253
24253
  signatureChunks = [];
24254
- var outputCanvas = get().outputCanvas;
24255
24254
  // start recording from the output canvas to capture the signature
24256
- var outputStream = (_a = outputCanvas.current) === null || _a === void 0 ? void 0 : _a.captureStream(24);
24255
+ var outputStream = (_a = get().outputCanvas.current) === null || _a === void 0 ? void 0 : _a.captureStream(24);
24257
24256
  if (!outputStream) throw new Error('outputStream not found');
24258
24257
  var tracks = [outputStream.getVideoTracks()[0]];
24259
24258
  if (captureAudio) {
@@ -24460,37 +24459,12 @@
24460
24459
  });
24461
24460
  });
24462
24461
  }, [videoRef, outputCanvas]);
24463
- React.useEffect(function () {
24464
- if (!signatureVideoRef.current) return;
24465
- var video = signatureVideoRef.current;
24466
- function onFrame() {
24467
- blankCheckPassed.current || (blankCheckPassed.current = !isVideoBlank(signatureVideoRef.current, frameCheckCanvas.current));
24468
- drawOutputFrame();
24469
- video.requestVideoFrameCallback(onFrame);
24470
- }
24471
- function onPlay() {
24472
- video.requestVideoFrameCallback(onFrame);
24473
- }
24474
- video.addEventListener('play', onPlay);
24475
- return function () {
24476
- video.removeEventListener('play', onPlay);
24477
- };
24478
- }, [drawOutputFrame]);
24479
- React.useEffect(function () {
24480
- if (!videoRef.current) return;
24481
- var video = videoRef.current;
24482
- function onFrame() {
24483
- drawOutputFrame();
24484
- video.requestVideoFrameCallback(onFrame);
24485
- }
24486
- function onPlay() {
24487
- video.requestVideoFrameCallback(onFrame);
24488
- }
24489
- video.addEventListener('play', onPlay);
24490
- return function () {
24491
- video.removeEventListener('play', onPlay);
24492
- };
24493
- }, [drawOutputFrame, videoRef]);
24462
+ var checkBlankAndDrawOutputFrame = React.useCallback(function () {
24463
+ blankCheckPassed.current || (blankCheckPassed.current = !isVideoBlank(signatureVideoRef.current, frameCheckCanvas.current));
24464
+ drawOutputFrame();
24465
+ }, [drawOutputFrame, signatureVideoRef]);
24466
+ useVideoFrameLoop(signatureVideoRef, checkBlankAndDrawOutputFrame);
24467
+ useVideoFrameLoop(videoRef, drawOutputFrame);
24494
24468
  var _g = useVideoSignatureStore(),
24495
24469
  signaturePad = _g.signaturePad,
24496
24470
  recordingStartedAt = _g.recordingStartedAt;
@@ -24533,6 +24507,32 @@
24533
24507
  });
24534
24508
  return result;
24535
24509
  }
24510
+ function requestVideoFrameCallback(video, onFrame) {
24511
+ if (typeof (video === null || video === void 0 ? void 0 : video.requestVideoFrameCallback) === 'function') {
24512
+ video.requestVideoFrameCallback(onFrame);
24513
+ } else {
24514
+ requestAnimationFrame(onFrame);
24515
+ }
24516
+ }
24517
+ function videoFrameLoop(video, onFrame) {
24518
+ if (!video) return;
24519
+ function onFrameRecursive() {
24520
+ onFrame();
24521
+ requestVideoFrameCallback(video, onFrameRecursive);
24522
+ }
24523
+ function onPlay() {
24524
+ requestVideoFrameCallback(video, onFrameRecursive);
24525
+ }
24526
+ video.addEventListener('play', onPlay);
24527
+ return function () {
24528
+ video.removeEventListener('play', onPlay);
24529
+ };
24530
+ }
24531
+ function useVideoFrameLoop(ref, onFrame) {
24532
+ React.useEffect(function () {
24533
+ return videoFrameLoop(ref.current, onFrame);
24534
+ }, [onFrame, ref]);
24535
+ }
24536
24536
 
24537
24537
  function VideoSignaturePad(_a) {
24538
24538
  var onAcceptBtnClicked = _a.onAcceptBtnClicked,