idmission-web-sdk 1.0.271 → 1.0.273

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.
@@ -51,7 +51,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
51
51
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
52
52
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
53
53
 
54
- var webSdkVersion = '1.0.271';
54
+ var webSdkVersion = '1.0.273';
55
55
 
56
56
  function getPlatform() {
57
57
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -13638,7 +13638,7 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
13638
13638
  height = _l.height;
13639
13639
  var signaturePad = React.useRef(null);
13640
13640
  var signatureRecorder = React.useRef(null);
13641
- // const recordedChunks = useRef<BlobPart[]>([])
13641
+ var recordedChunks = React.useRef([]);
13642
13642
  var onPredictionMade = React.useContext(HighPerformanceSelfieGuidanceModelsContext).onPredictionMade;
13643
13643
  var _m = useVideoRecorder(cameraRef.current),
13644
13644
  isRecording = _m.isRecording,
@@ -13651,8 +13651,8 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
13651
13651
  signatureDataUrl = _p[0],
13652
13652
  setSignatureDataUrl = _p[1];
13653
13653
  var _q = React.useState(null),
13654
- signatureVideoData = _q[0];
13655
- _q[1];
13654
+ signatureVideoData = _q[0],
13655
+ setSignatureVideoData = _q[1];
13656
13656
  colors.guidanceMessageBackgroundColor || (colors.guidanceMessageBackgroundColor = '#ccc');
13657
13657
  colors.guidanceMessageTextColor || (colors.guidanceMessageTextColor = 'black');
13658
13658
  var verbiage = useTranslations(rawVerbiage, {
@@ -13667,6 +13667,7 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
13667
13667
  recordingLock.current = true;
13668
13668
  (function () {
13669
13669
  return tslib.__awaiter(void 0, void 0, void 0, function () {
13670
+ var stream;
13670
13671
  return tslib.__generator(this, function (_a) {
13671
13672
  switch (_a.label) {
13672
13673
  case 0:
@@ -13684,6 +13685,24 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
13684
13685
  _a.label = 2;
13685
13686
  case 2:
13686
13687
  startRecording();
13688
+ stream = outputCanvas.current.captureStream(24 /* fps */);
13689
+ signatureRecorder.current = new MediaRecorder(stream, {
13690
+ videoBitsPerSecond: 270000
13691
+ });
13692
+ signatureRecorder.current.start();
13693
+ signatureRecorder.current.ondataavailable = function (event) {
13694
+ var _a;
13695
+ recordedChunks.current.push(event.data);
13696
+ if (((_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.state) === 'recording') {
13697
+ signatureRecorder.current.stop();
13698
+ }
13699
+ };
13700
+ signatureRecorder.current.onstop = function () {
13701
+ var blob = new Blob(recordedChunks.current, {
13702
+ type: 'video/mp4'
13703
+ });
13704
+ setSignatureVideoData(blob);
13705
+ };
13687
13706
  return [2 /*return*/];
13688
13707
  }
13689
13708
  });
@@ -13711,26 +13730,19 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
13711
13730
  if (!ctx) return;
13712
13731
  animationFrame.current = requestAnimationFrame(function runFrame() {
13713
13732
  return tslib.__awaiter(this, void 0, void 0, function () {
13733
+ var rect;
13714
13734
  return tslib.__generator(this, function (_a) {
13715
13735
  if (!signaturePad.current || !videoRef.current || !outputCanvas.current) {
13716
13736
  cancelAnimationFrame(animationFrame.current);
13717
13737
  return [2 /*return*/];
13718
13738
  }
13719
- // const rect: [number, number, number, number] = [
13720
- // w * (isPortrait ? 0.02 : 0.15),
13721
- // h * (isPortrait ? 0.15 : 0.25),
13722
- // w * (isPortrait ? 0.96 : 0.7),
13723
- // h * (isPortrait ? 0.7 : 0.5),
13724
- // ]
13725
- //
13726
- // ctx.drawImage(videoRef.current, 0, 0, w, h)
13727
- //
13728
- // ctx.beginPath()
13729
- // ctx.fillStyle = 'rgba(255,255,255,0.5)'
13730
- // ctx.roundRect(...rect, 16)
13731
- // ctx.fill()
13732
- //
13733
- // ctx.drawImage(signaturePad.current.getCanvas(), ...rect)
13739
+ rect = [w * (isPortrait ? 0.02 : 0.15), h * (isPortrait ? 0.15 : 0.25), w * (isPortrait ? 0.96 : 0.7), h * (isPortrait ? 0.7 : 0.5)];
13740
+ ctx.drawImage(videoRef.current, 0, 0, w, h);
13741
+ ctx.beginPath();
13742
+ ctx.fillStyle = 'rgba(255,255,255,0.5)';
13743
+ ctx.roundRect.apply(ctx, tslib.__spreadArray(tslib.__spreadArray([], rect, false), [16], false));
13744
+ ctx.fill();
13745
+ ctx.drawImage.apply(ctx, tslib.__spreadArray([signaturePad.current.getCanvas()], rect, false));
13734
13746
  animationFrame.current = requestAnimationFrame(runFrame);
13735
13747
  return [2 /*return*/];
13736
13748
  });