idmission-web-sdk 1.0.267 → 1.0.269

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.267';
54
+ var webSdkVersion = '1.0.269';
55
55
 
56
56
  function getPlatform() {
57
57
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -13643,8 +13643,7 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
13643
13643
  var _m = useVideoRecorder(cameraRef.current),
13644
13644
  isRecording = _m.isRecording,
13645
13645
  startRecording = _m.startRecording,
13646
- stopRecording = _m.stopRecording,
13647
- videoUrl = _m.videoUrl;
13646
+ stopRecording = _m.stopRecording;
13648
13647
  var _o = React.useState(null),
13649
13648
  signatureData = _o[0],
13650
13649
  setSignatureData = _o[1];
@@ -13662,32 +13661,54 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
13662
13661
  clearBtnText: 'Clear'
13663
13662
  });
13664
13663
  var outputCanvas = React.useRef(null);
13664
+ var recordingLock = React.useRef(false);
13665
13665
  React.useEffect(function () {
13666
- // delay 100ms to make sure outputCanvas has rendered.
13667
- setTimeout(function () {
13668
- if (!isRecording && !videoUrl && !!outputCanvas.current) {
13669
- startRecording();
13670
- var stream = outputCanvas.current.captureStream(25 /* fps */);
13671
- signatureRecorder.current = new MediaRecorder(stream, {
13672
- videoBitsPerSecond: 270000
13673
- });
13674
- signatureRecorder.current.start();
13675
- signatureRecorder.current.ondataavailable = function (event) {
13676
- var _a;
13677
- recordedChunks.current.push(event.data);
13678
- if (((_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.state) === 'recording') {
13679
- signatureRecorder.current.stop();
13666
+ if (recordingLock.current) return;
13667
+ recordingLock.current = true;
13668
+ (function () {
13669
+ return tslib.__awaiter(void 0, void 0, void 0, function () {
13670
+ var stream;
13671
+ return tslib.__generator(this, function (_a) {
13672
+ switch (_a.label) {
13673
+ case 0:
13674
+ if (!!outputCanvas.current) return [3 /*break*/, 2];
13675
+ return [4 /*yield*/, new Promise(function (resolve) {
13676
+ var interval = setInterval(function () {
13677
+ if (outputCanvas.current) {
13678
+ clearInterval(interval);
13679
+ resolve(null);
13680
+ }
13681
+ }, 10);
13682
+ })];
13683
+ case 1:
13684
+ _a.sent();
13685
+ _a.label = 2;
13686
+ case 2:
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
+ };
13706
+ return [2 /*return*/];
13680
13707
  }
13681
- };
13682
- signatureRecorder.current.onstop = function () {
13683
- var blob = new Blob(recordedChunks.current, {
13684
- type: 'video/mp4'
13685
- });
13686
- setSignatureVideoData(blob);
13687
- };
13688
- }
13689
- }, 100);
13690
- }, [isRecording, startRecording, videoUrl]);
13708
+ });
13709
+ });
13710
+ })();
13711
+ }, [startRecording]);
13691
13712
  React.useEffect(function () {
13692
13713
  if (signatureVideoData && signatureData && signatureDataUrl) {
13693
13714
  onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(signatureVideoData, signatureData, signatureDataUrl);