idmission-web-sdk 2.3.11 → 2.3.12
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/components/video_signature_capture/VideoSignatureContext.d.ts.map +1 -1
- package/dist/lib/camera/useVideoRecorder.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +73 -47
- 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 +73 -47
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +73 -47
- 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
package/dist/sdk2.esm.js
CHANGED
|
@@ -204,7 +204,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
204
204
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
-
var webSdkVersion = '2.3.
|
|
207
|
+
var webSdkVersion = '2.3.12';
|
|
208
208
|
|
|
209
209
|
function getPlatform() {
|
|
210
210
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -13326,14 +13326,29 @@ var Container$4 = styled.div(templateObject_1$c || (templateObject_1$c = __makeT
|
|
|
13326
13326
|
var AcceptBtn$1 = styled(LoaderButton)(templateObject_2$a || (templateObject_2$a = __makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
|
|
13327
13327
|
var templateObject_1$c, templateObject_2$a;
|
|
13328
13328
|
|
|
13329
|
+
var videoRecorder = null;
|
|
13330
|
+
var audioRecorder = null;
|
|
13331
|
+
var videoChunks = [];
|
|
13332
|
+
var audioChunks = [];
|
|
13333
|
+
function getVideoRecorder() {
|
|
13334
|
+
return videoRecorder;
|
|
13335
|
+
}
|
|
13336
|
+
function setVideoRecorder(recorder) {
|
|
13337
|
+
videoRecorder = recorder;
|
|
13338
|
+
}
|
|
13339
|
+
function setAudioRecorder(recorder) {
|
|
13340
|
+
audioRecorder = recorder;
|
|
13341
|
+
}
|
|
13342
|
+
function clearVideoChunks() {
|
|
13343
|
+
videoChunks = [];
|
|
13344
|
+
}
|
|
13345
|
+
function clearAudioChunks() {
|
|
13346
|
+
audioChunks = [];
|
|
13347
|
+
}
|
|
13329
13348
|
var useVideoRecorder = function useVideoRecorder(camera, audioStream, mergeAVStreams) {
|
|
13330
13349
|
if (mergeAVStreams === void 0) {
|
|
13331
13350
|
mergeAVStreams = false;
|
|
13332
13351
|
}
|
|
13333
|
-
var videoRecorder = useRef(null);
|
|
13334
|
-
var audioRecorder = useRef(null);
|
|
13335
|
-
var videoChunks = useRef([]);
|
|
13336
|
-
var audioChunks = useRef([]);
|
|
13337
13352
|
var _a = useState(null),
|
|
13338
13353
|
videoUrl = _a[0],
|
|
13339
13354
|
setVideoUrl = _a[1];
|
|
@@ -13366,45 +13381,48 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream, mergeAVStr
|
|
|
13366
13381
|
return new MediaStream(__spreadArray(__spreadArray([], videoTracks, true), audioTracks, true));
|
|
13367
13382
|
}, [audioStream, camera === null || camera === void 0 ? void 0 : camera.stream, mergeAVStreams]);
|
|
13368
13383
|
var processVideo = useCallback(function () {
|
|
13369
|
-
var videoBlob = new Blob(videoChunks
|
|
13384
|
+
var videoBlob = new Blob(videoChunks, {
|
|
13370
13385
|
type: 'video/mp4'
|
|
13371
13386
|
});
|
|
13372
|
-
videoChunks.current = [];
|
|
13373
13387
|
setVideoUrl(URL.createObjectURL(videoBlob));
|
|
13388
|
+
clearVideoChunks();
|
|
13374
13389
|
setIsRecordingVideo(false);
|
|
13390
|
+
setVideoRecorder(null);
|
|
13375
13391
|
camera === null || camera === void 0 ? void 0 : camera.release();
|
|
13376
13392
|
}, [camera]);
|
|
13377
13393
|
var processAudio = useCallback(function () {
|
|
13378
13394
|
var _a;
|
|
13379
|
-
var audioBlob = new Blob(audioChunks
|
|
13395
|
+
var audioBlob = new Blob(audioChunks, {
|
|
13380
13396
|
type: 'audio/mp4'
|
|
13381
13397
|
});
|
|
13382
|
-
audioChunks.current = [];
|
|
13383
13398
|
setAudioUrl(URL.createObjectURL(audioBlob));
|
|
13399
|
+
clearAudioChunks();
|
|
13384
13400
|
setIsRecordingAudio(false);
|
|
13401
|
+
setAudioRecorder(null);
|
|
13385
13402
|
(_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
|
|
13386
13403
|
}, [audioStream]);
|
|
13387
13404
|
var startRecordingVideo = useCallback(function () {
|
|
13388
13405
|
var videoStream = getVideoStream();
|
|
13389
13406
|
if (!videoStream) return;
|
|
13390
|
-
|
|
13407
|
+
clearVideoChunks();
|
|
13391
13408
|
setIsRecordingVideo(true);
|
|
13392
13409
|
setVideoRecordingStopped(false);
|
|
13393
13410
|
setVideoRecordingIntentionallyStopped(false);
|
|
13394
|
-
videoRecorder
|
|
13411
|
+
var videoRecorder = new MediaRecorder(videoStream, {
|
|
13395
13412
|
videoBitsPerSecond: 270000,
|
|
13396
13413
|
audioBitsPerSecond: 32000
|
|
13397
13414
|
});
|
|
13398
|
-
videoRecorder
|
|
13399
|
-
|
|
13415
|
+
setVideoRecorder(videoRecorder);
|
|
13416
|
+
videoRecorder.ondataavailable = function (e) {
|
|
13417
|
+
videoChunks.push(e.data);
|
|
13400
13418
|
};
|
|
13401
|
-
videoRecorder.
|
|
13419
|
+
videoRecorder.onstop = function () {
|
|
13402
13420
|
setVideoRecordingStopped(true);
|
|
13403
13421
|
};
|
|
13404
|
-
videoRecorder.
|
|
13422
|
+
videoRecorder.start(1000);
|
|
13405
13423
|
setTimeout(function () {
|
|
13406
13424
|
var _a;
|
|
13407
|
-
if (((_a =
|
|
13425
|
+
if (((_a = getVideoRecorder()) === null || _a === void 0 ? void 0 : _a.state) === 'inactive') {
|
|
13408
13426
|
log('media recorder is inactive!');
|
|
13409
13427
|
// TODO: figure out what to do here
|
|
13410
13428
|
}
|
|
@@ -13413,33 +13431,32 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream, mergeAVStr
|
|
|
13413
13431
|
var startRecordingAudio = useCallback(function () {
|
|
13414
13432
|
if (mergeAVStreams) return;
|
|
13415
13433
|
if (!audioStream) return;
|
|
13416
|
-
|
|
13434
|
+
clearAudioChunks();
|
|
13417
13435
|
setIsRecordingAudio(true);
|
|
13418
13436
|
setAudioRecordingStopped(false);
|
|
13419
13437
|
setAudioRecordingIntentionallyStopped(false);
|
|
13420
|
-
audioRecorder
|
|
13438
|
+
var audioRecorder = new MediaRecorder(audioStream, {
|
|
13421
13439
|
audioBitsPerSecond: 32000
|
|
13422
13440
|
});
|
|
13423
|
-
audioRecorder
|
|
13424
|
-
|
|
13441
|
+
setAudioRecorder(audioRecorder);
|
|
13442
|
+
audioRecorder.ondataavailable = function (e) {
|
|
13443
|
+
audioChunks.push(e.data);
|
|
13425
13444
|
};
|
|
13426
|
-
audioRecorder.
|
|
13445
|
+
audioRecorder.onstop = function () {
|
|
13427
13446
|
setAudioRecordingStopped(true);
|
|
13428
13447
|
};
|
|
13429
|
-
audioRecorder.
|
|
13448
|
+
audioRecorder.start(1000);
|
|
13430
13449
|
}, [audioStream, mergeAVStreams]);
|
|
13431
13450
|
var stopRecordingVideo = useCallback(function () {
|
|
13432
|
-
var _a, _b;
|
|
13433
13451
|
setVideoRecordingIntentionallyStopped(true);
|
|
13434
|
-
if ((
|
|
13435
|
-
|
|
13452
|
+
if ((videoRecorder === null || videoRecorder === void 0 ? void 0 : videoRecorder.state) !== 'inactive') {
|
|
13453
|
+
videoRecorder === null || videoRecorder === void 0 ? void 0 : videoRecorder.stop(); // if you call this while state === 'inactive', an exception is thrown.
|
|
13436
13454
|
}
|
|
13437
13455
|
}, []);
|
|
13438
13456
|
var stopRecordingAudio = useCallback(function () {
|
|
13439
|
-
var _a, _b;
|
|
13440
13457
|
setAudioRecordingIntentionallyStopped(true);
|
|
13441
|
-
if ((
|
|
13442
|
-
|
|
13458
|
+
if ((audioRecorder === null || audioRecorder === void 0 ? void 0 : audioRecorder.state) !== 'inactive') {
|
|
13459
|
+
audioRecorder === null || audioRecorder === void 0 ? void 0 : audioRecorder.stop(); // if you call this while state === 'inactive', an exception is thrown.
|
|
13443
13460
|
}
|
|
13444
13461
|
}, []);
|
|
13445
13462
|
useEffect(function () {
|
|
@@ -13453,8 +13470,8 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream, mergeAVStr
|
|
|
13453
13470
|
}
|
|
13454
13471
|
}, [audioRecordingIntentionallyStopped, audioRecordingStopped, processAudio]);
|
|
13455
13472
|
var clearRecordedData = useCallback(function () {
|
|
13456
|
-
|
|
13457
|
-
|
|
13473
|
+
clearVideoChunks();
|
|
13474
|
+
clearAudioChunks();
|
|
13458
13475
|
}, []);
|
|
13459
13476
|
return useMemo(function () {
|
|
13460
13477
|
return {
|
|
@@ -13473,6 +13490,17 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream, mergeAVStr
|
|
|
13473
13490
|
}, [audioRecordingIntentionallyStopped, audioRecordingStopped, audioUrl, clearRecordedData, isRecordingAudio, isRecordingVideo, startRecordingAudio, startRecordingVideo, stopRecordingAudio, stopRecordingVideo, videoRecordingIntentionallyStopped, videoRecordingStopped, videoUrl]);
|
|
13474
13491
|
};
|
|
13475
13492
|
|
|
13493
|
+
var signatureRecorder = null;
|
|
13494
|
+
function getSignatureRecorder() {
|
|
13495
|
+
return signatureRecorder;
|
|
13496
|
+
}
|
|
13497
|
+
function setSignatureRecorder(recorder) {
|
|
13498
|
+
signatureRecorder = recorder;
|
|
13499
|
+
}
|
|
13500
|
+
var signatureChunks = [];
|
|
13501
|
+
function clearSignatureChunks() {
|
|
13502
|
+
signatureChunks = [];
|
|
13503
|
+
}
|
|
13476
13504
|
var videoSignatureInitialState = {
|
|
13477
13505
|
startRecording: function startRecording() {
|
|
13478
13506
|
return null;
|
|
@@ -13491,7 +13519,7 @@ var videoSignatureInitialState = {
|
|
|
13491
13519
|
onAcceptClicked: function onAcceptClicked() {
|
|
13492
13520
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
13493
13521
|
return __generator(this, function (_a) {
|
|
13494
|
-
return [2 /*return
|
|
13522
|
+
return [2 /*return*/];
|
|
13495
13523
|
});
|
|
13496
13524
|
});
|
|
13497
13525
|
}
|
|
@@ -13516,8 +13544,6 @@ function VideoSignatureContextProvider(_a) {
|
|
|
13516
13544
|
var _h = useState(null),
|
|
13517
13545
|
signatureVideoUrl = _h[0],
|
|
13518
13546
|
setSignatureVideoUrl = _h[1];
|
|
13519
|
-
var signatureRecorder = useRef(null);
|
|
13520
|
-
var recordedChunks = useRef([]);
|
|
13521
13547
|
var _j = useCameraStore(),
|
|
13522
13548
|
camera = _j.camera,
|
|
13523
13549
|
videoRef = _j.videoRef,
|
|
@@ -13551,7 +13577,8 @@ function VideoSignatureContextProvider(_a) {
|
|
|
13551
13577
|
};
|
|
13552
13578
|
recordingLock.current = false;
|
|
13553
13579
|
setIsRecording(false);
|
|
13554
|
-
(_a =
|
|
13580
|
+
(_a = getSignatureRecorder()) === null || _a === void 0 ? void 0 : _a.stop();
|
|
13581
|
+
setSignatureRecorder(null);
|
|
13555
13582
|
}, []);
|
|
13556
13583
|
useEffect(function () {
|
|
13557
13584
|
if (!isRecording) return;
|
|
@@ -13559,7 +13586,7 @@ function VideoSignatureContextProvider(_a) {
|
|
|
13559
13586
|
recordingLock.current = true;
|
|
13560
13587
|
(function () {
|
|
13561
13588
|
return __awaiter(_this, void 0, void 0, function () {
|
|
13562
|
-
var stream, tracks, audioTrack;
|
|
13589
|
+
var stream, tracks, audioTrack, signatureRecorder;
|
|
13563
13590
|
var _a;
|
|
13564
13591
|
return __generator(this, function (_b) {
|
|
13565
13592
|
switch (_b.label) {
|
|
@@ -13577,7 +13604,7 @@ function VideoSignatureContextProvider(_a) {
|
|
|
13577
13604
|
_b.sent();
|
|
13578
13605
|
_b.label = 2;
|
|
13579
13606
|
case 2:
|
|
13580
|
-
|
|
13607
|
+
clearSignatureChunks();
|
|
13581
13608
|
clearRecordedVideoData();
|
|
13582
13609
|
startRecordingVideo();
|
|
13583
13610
|
if (captureAudio) startRecordingAudio();
|
|
@@ -13585,24 +13612,23 @@ function VideoSignatureContextProvider(_a) {
|
|
|
13585
13612
|
tracks = [stream.getVideoTracks()[0]];
|
|
13586
13613
|
audioTrack = (_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks()) === null || _a === void 0 ? void 0 : _a[0];
|
|
13587
13614
|
if (audioTrack) tracks.push(audioTrack);
|
|
13588
|
-
signatureRecorder
|
|
13615
|
+
signatureRecorder = new MediaRecorder(new MediaStream(tracks), {
|
|
13589
13616
|
videoBitsPerSecond: 270000,
|
|
13590
13617
|
audioBitsPerSecond: 32000
|
|
13591
13618
|
});
|
|
13592
|
-
signatureRecorder
|
|
13593
|
-
signatureRecorder.
|
|
13594
|
-
|
|
13595
|
-
|
|
13596
|
-
if (((_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.state) === 'recording') {
|
|
13597
|
-
signatureRecorder.current.stop();
|
|
13598
|
-
}
|
|
13619
|
+
setSignatureRecorder(signatureRecorder);
|
|
13620
|
+
signatureRecorder.start();
|
|
13621
|
+
signatureRecorder.ondataavailable = function (event) {
|
|
13622
|
+
signatureChunks.push(event.data);
|
|
13599
13623
|
};
|
|
13600
|
-
signatureRecorder.
|
|
13601
|
-
var blob = new Blob(
|
|
13624
|
+
signatureRecorder.onstop = function () {
|
|
13625
|
+
var blob = new Blob(signatureChunks, {
|
|
13602
13626
|
type: 'video/mp4'
|
|
13603
13627
|
});
|
|
13604
13628
|
setSignatureVideoData(blob);
|
|
13605
13629
|
setSignatureVideoUrl(URL.createObjectURL(blob));
|
|
13630
|
+
clearSignatureChunks();
|
|
13631
|
+
setSignatureRecorder(null);
|
|
13606
13632
|
onRecordingStopped.current();
|
|
13607
13633
|
};
|
|
13608
13634
|
return [2 /*return*/];
|
|
@@ -13661,7 +13687,7 @@ function VideoSignatureContextProvider(_a) {
|
|
|
13661
13687
|
setSignatureData(signatureData);
|
|
13662
13688
|
stopRecordingVideo();
|
|
13663
13689
|
stopRecordingAudio();
|
|
13664
|
-
(_a =
|
|
13690
|
+
(_a = getSignatureRecorder()) === null || _a === void 0 ? void 0 : _a.stop();
|
|
13665
13691
|
return [2 /*return*/];
|
|
13666
13692
|
}
|
|
13667
13693
|
});
|