idmission-web-sdk 1.0.268 → 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.
- package/dist/sdk2.cjs.development.js +56 -42
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +56 -42
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +56 -42
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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.
|
|
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
|
-
|
|
13667
|
-
|
|
13668
|
-
|
|
13669
|
-
|
|
13670
|
-
var stream
|
|
13671
|
-
|
|
13672
|
-
|
|
13673
|
-
|
|
13674
|
-
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
|
|
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
|
-
|
|
13683
|
-
|
|
13684
|
-
|
|
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);
|
|
@@ -13709,26 +13730,19 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
13709
13730
|
if (!ctx) return;
|
|
13710
13731
|
animationFrame.current = requestAnimationFrame(function runFrame() {
|
|
13711
13732
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
13733
|
+
var rect;
|
|
13712
13734
|
return tslib.__generator(this, function (_a) {
|
|
13713
13735
|
if (!signaturePad.current || !videoRef.current || !outputCanvas.current) {
|
|
13714
13736
|
cancelAnimationFrame(animationFrame.current);
|
|
13715
13737
|
return [2 /*return*/];
|
|
13716
13738
|
}
|
|
13717
|
-
|
|
13718
|
-
|
|
13719
|
-
|
|
13720
|
-
|
|
13721
|
-
|
|
13722
|
-
|
|
13723
|
-
|
|
13724
|
-
// ctx.drawImage(videoRef.current, 0, 0, w, h)
|
|
13725
|
-
//
|
|
13726
|
-
// ctx.beginPath()
|
|
13727
|
-
// ctx.fillStyle = 'rgba(255,255,255,0.5)'
|
|
13728
|
-
// ctx.roundRect(...rect, 16)
|
|
13729
|
-
// ctx.fill()
|
|
13730
|
-
//
|
|
13731
|
-
// 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));
|
|
13732
13746
|
animationFrame.current = requestAnimationFrame(runFrame);
|
|
13733
13747
|
return [2 /*return*/];
|
|
13734
13748
|
});
|