idmission-web-sdk 2.3.107 → 2.3.109
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 +6 -0
- package/dist/components/video_signature_capture/VideoSignatureContext.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +69 -99
- 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 +69 -99
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +69 -99
- 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
|
@@ -3,6 +3,10 @@ import { SignatureData } from '../signature_capture/data';
|
|
|
3
3
|
import SignatureCanvas from 'react-signature-canvas';
|
|
4
4
|
export type VideoSignatureMetadata = {
|
|
5
5
|
mimeType?: string;
|
|
6
|
+
browserFeatures?: {
|
|
7
|
+
supportsRequestVideoFrameCallback?: boolean;
|
|
8
|
+
supportsRoundRect?: boolean;
|
|
9
|
+
};
|
|
6
10
|
timingData?: {
|
|
7
11
|
recordingStartRequestedAt?: number;
|
|
8
12
|
recordingStartedAt?: number;
|
|
@@ -31,6 +35,8 @@ export type VideoSignatureState = {
|
|
|
31
35
|
signatureValid: boolean;
|
|
32
36
|
signatureStartedAt?: number;
|
|
33
37
|
signatureEndedAt?: number;
|
|
38
|
+
supportsRequestVideoFrameCallback?: boolean;
|
|
39
|
+
supportsRoundRect?: boolean;
|
|
34
40
|
onSignatureVideoCaptured: OnSignatureVideoCaptured;
|
|
35
41
|
};
|
|
36
42
|
export declare const useVideoSignatureStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<VideoSignatureState>, "setState"> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoSignatureContext.d.ts","sourceRoot":"","sources":["../../../src/components/video_signature_capture/VideoSignatureContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,eAAe,MAAM,wBAAwB,CAAA;AAcpD,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE;QACX,yBAAyB,CAAC,EAAE,MAAM,CAAA;QAClC,kBAAkB,CAAC,EAAE,MAAM,CAAA;QAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAA;QAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAA;QAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAA;QACzB,wBAAwB,CAAC,EAAE,MAAM,CAAA;QACjC,mBAAmB,CAAC,EAAE,MAAM,CAAA;QAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAC5B,CAAA;CACF,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,CACrC,SAAS,EAAE,IAAI,EACf,aAAa,EAAE,aAAa,GAAG,IAAI,EACnC,kBAAkB,EAAE,MAAM,GAAG,IAAI,EACjC,QAAQ,EAAE,sBAAsB,KAC7B,IAAI,CAAA;AAET,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IAChD,aAAa,EAAE,CACb,aAAa,CAAC,EAAE,aAAa,EAC7B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,KAC3B,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,iBAAiB,EAAE,MAAM,IAAI,CAAA;IAE7B,yBAAyB,CAAC,EAAE,MAAM,CAAA;IAClC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAE3B,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,CAAA;IAC9C,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAA;IAEhD,iBAAiB,EAAE,OAAO,CAAA;IAC1B,cAAc,EAAE,OAAO,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"VideoSignatureContext.d.ts","sourceRoot":"","sources":["../../../src/components/video_signature_capture/VideoSignatureContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,eAAe,MAAM,wBAAwB,CAAA;AAcpD,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE;QAChB,iCAAiC,CAAC,EAAE,OAAO,CAAA;QAC3C,iBAAiB,CAAC,EAAE,OAAO,CAAA;KAC5B,CAAA;IACD,UAAU,CAAC,EAAE;QACX,yBAAyB,CAAC,EAAE,MAAM,CAAA;QAClC,kBAAkB,CAAC,EAAE,MAAM,CAAA;QAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAA;QAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAA;QAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAA;QACzB,wBAAwB,CAAC,EAAE,MAAM,CAAA;QACjC,mBAAmB,CAAC,EAAE,MAAM,CAAA;QAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAC5B,CAAA;CACF,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,CACrC,SAAS,EAAE,IAAI,EACf,aAAa,EAAE,aAAa,GAAG,IAAI,EACnC,kBAAkB,EAAE,MAAM,GAAG,IAAI,EACjC,QAAQ,EAAE,sBAAsB,KAC7B,IAAI,CAAA;AAET,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IAChD,aAAa,EAAE,CACb,aAAa,CAAC,EAAE,aAAa,EAC7B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,KAC3B,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,iBAAiB,EAAE,MAAM,IAAI,CAAA;IAE7B,yBAAyB,CAAC,EAAE,MAAM,CAAA;IAClC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAE3B,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,CAAA;IAC9C,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAA;IAEhD,iBAAiB,EAAE,OAAO,CAAA;IAC1B,cAAc,EAAE,OAAO,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,iCAAiC,CAAC,EAAE,OAAO,CAAA;IAC3C,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAE3B,wBAAwB,EAAE,wBAAwB,CAAA;CACnD,CAAA;AAeD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;EA0IlC,CAAA;AA2CD,MAAM,CAAC,OAAO,UAAU,6BAA6B,CAAC,EACpD,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;CACpB,qBA0DA"}
|
|
@@ -236,7 +236,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
236
236
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
237
237
|
};
|
|
238
238
|
|
|
239
|
-
var webSdkVersion = '2.3.
|
|
239
|
+
var webSdkVersion = '2.3.109';
|
|
240
240
|
|
|
241
241
|
function getPlatform() {
|
|
242
242
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -14421,6 +14421,8 @@ var videoSignatureInitialState = {
|
|
|
14421
14421
|
},
|
|
14422
14422
|
signaturePadEmpty: true,
|
|
14423
14423
|
signatureValid: false,
|
|
14424
|
+
supportsRequestVideoFrameCallback: undefined,
|
|
14425
|
+
supportsRoundRect: undefined,
|
|
14424
14426
|
onSignatureVideoCaptured: function onSignatureVideoCaptured() {
|
|
14425
14427
|
return null;
|
|
14426
14428
|
}
|
|
@@ -14467,7 +14469,7 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
14467
14469
|
});
|
|
14468
14470
|
}
|
|
14469
14471
|
};
|
|
14470
|
-
signatureRecorder.start(
|
|
14472
|
+
signatureRecorder.start(250);
|
|
14471
14473
|
set({
|
|
14472
14474
|
recordingStartRequestedAt: performance.now()
|
|
14473
14475
|
});
|
|
@@ -14487,7 +14489,7 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
14487
14489
|
_a.sent();
|
|
14488
14490
|
signatureRecorder.onstop = function () {
|
|
14489
14491
|
return __awaiter(_this, void 0, void 0, function () {
|
|
14490
|
-
var recordingStoppedAt, mimeType, blob, _a, onSignatureVideoCaptured, recordingStartRequestedAt, recordingStartedAt, firstChunkReceivedAt, signatureStartedAt, signatureEndedAt, recordingStopRequestedAt, lastChunkReceivedAt;
|
|
14492
|
+
var recordingStoppedAt, mimeType, blob, _a, onSignatureVideoCaptured, recordingStartRequestedAt, recordingStartedAt, firstChunkReceivedAt, signatureStartedAt, signatureEndedAt, recordingStopRequestedAt, lastChunkReceivedAt, supportsRequestVideoFrameCallback, supportsRoundRect;
|
|
14491
14493
|
return __generator(this, function (_b) {
|
|
14492
14494
|
recordingStoppedAt = performance.now();
|
|
14493
14495
|
set({
|
|
@@ -14499,18 +14501,22 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
14499
14501
|
});
|
|
14500
14502
|
signatureChunks = [];
|
|
14501
14503
|
signatureRecorder = null;
|
|
14502
|
-
_a = get(), onSignatureVideoCaptured = _a.onSignatureVideoCaptured, recordingStartRequestedAt = _a.recordingStartRequestedAt, recordingStartedAt = _a.recordingStartedAt, firstChunkReceivedAt = _a.firstChunkReceivedAt, signatureStartedAt = _a.signatureStartedAt, signatureEndedAt = _a.signatureEndedAt, recordingStopRequestedAt = _a.recordingStopRequestedAt, lastChunkReceivedAt = _a.lastChunkReceivedAt;
|
|
14504
|
+
_a = get(), onSignatureVideoCaptured = _a.onSignatureVideoCaptured, recordingStartRequestedAt = _a.recordingStartRequestedAt, recordingStartedAt = _a.recordingStartedAt, firstChunkReceivedAt = _a.firstChunkReceivedAt, signatureStartedAt = _a.signatureStartedAt, signatureEndedAt = _a.signatureEndedAt, recordingStopRequestedAt = _a.recordingStopRequestedAt, lastChunkReceivedAt = _a.lastChunkReceivedAt, supportsRequestVideoFrameCallback = _a.supportsRequestVideoFrameCallback, supportsRoundRect = _a.supportsRoundRect;
|
|
14503
14505
|
onSignatureVideoCaptured(blob, signatureData !== null && signatureData !== void 0 ? signatureData : null, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, {
|
|
14504
14506
|
mimeType: mimeType,
|
|
14507
|
+
browserFeatures: {
|
|
14508
|
+
supportsRoundRect: supportsRoundRect,
|
|
14509
|
+
supportsRequestVideoFrameCallback: supportsRequestVideoFrameCallback
|
|
14510
|
+
},
|
|
14505
14511
|
timingData: {
|
|
14506
|
-
recordingStartRequestedAt: recordingStartRequestedAt,
|
|
14507
|
-
recordingStartedAt: recordingStartedAt,
|
|
14508
|
-
firstChunkReceivedAt: firstChunkReceivedAt,
|
|
14509
|
-
signatureStartedAt: signatureStartedAt,
|
|
14510
|
-
signatureEndedAt: signatureEndedAt,
|
|
14511
|
-
recordingStopRequestedAt: recordingStopRequestedAt,
|
|
14512
|
-
recordingStoppedAt: recordingStoppedAt,
|
|
14513
|
-
lastChunkReceivedAt: lastChunkReceivedAt
|
|
14512
|
+
recordingStartRequestedAt: recordingStartRequestedAt ? Math.ceil(recordingStartRequestedAt) : 0,
|
|
14513
|
+
recordingStartedAt: recordingStartedAt ? Math.ceil(recordingStartedAt) : 0,
|
|
14514
|
+
firstChunkReceivedAt: firstChunkReceivedAt ? Math.ceil(firstChunkReceivedAt) : 0,
|
|
14515
|
+
signatureStartedAt: signatureStartedAt ? Math.ceil(signatureStartedAt) : 0,
|
|
14516
|
+
signatureEndedAt: signatureEndedAt ? Math.ceil(signatureEndedAt) : 0,
|
|
14517
|
+
recordingStopRequestedAt: recordingStopRequestedAt ? Math.ceil(recordingStopRequestedAt) : 0,
|
|
14518
|
+
recordingStoppedAt: Math.ceil(recordingStoppedAt),
|
|
14519
|
+
lastChunkReceivedAt: lastChunkReceivedAt ? Math.ceil(lastChunkReceivedAt) : 0
|
|
14514
14520
|
}
|
|
14515
14521
|
});
|
|
14516
14522
|
return [2 /*return*/];
|
|
@@ -14528,14 +14534,18 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
14528
14534
|
signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.stop();
|
|
14529
14535
|
signatureRecorder = null;
|
|
14530
14536
|
set({
|
|
14537
|
+
recordingStartRequestedAt: undefined,
|
|
14531
14538
|
recordingStartedAt: undefined,
|
|
14532
14539
|
recordingStoppedAt: undefined,
|
|
14540
|
+
recordingStopRequestedAt: undefined,
|
|
14533
14541
|
firstChunkReceivedAt: undefined,
|
|
14534
14542
|
lastChunkReceivedAt: undefined,
|
|
14535
14543
|
signaturePadEmpty: true,
|
|
14536
14544
|
signatureValid: false,
|
|
14537
14545
|
signatureStartedAt: undefined,
|
|
14538
|
-
signatureEndedAt: undefined
|
|
14546
|
+
signatureEndedAt: undefined,
|
|
14547
|
+
supportsRequestVideoFrameCallback: undefined,
|
|
14548
|
+
supportsRoundRect: undefined
|
|
14539
14549
|
});
|
|
14540
14550
|
}
|
|
14541
14551
|
});
|
|
@@ -14577,8 +14587,7 @@ function waitForOneMoreChunk(delayMs, checkEveryMs, timeoutMs) {
|
|
|
14577
14587
|
});
|
|
14578
14588
|
}
|
|
14579
14589
|
function VideoSignatureContextProvider(_a) {
|
|
14580
|
-
var
|
|
14581
|
-
var _b, _c, _d, _e;
|
|
14590
|
+
var _b, _c;
|
|
14582
14591
|
var children = _a.children;
|
|
14583
14592
|
var videoRef = useCameraStore().videoRef;
|
|
14584
14593
|
var outputCanvas = React.useRef(null);
|
|
@@ -14587,98 +14596,59 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14587
14596
|
outputCanvas: outputCanvas
|
|
14588
14597
|
});
|
|
14589
14598
|
}, []);
|
|
14590
|
-
var signatureVideoRef = React.useRef(null);
|
|
14591
|
-
var frameCheckCanvas = React.useRef(null);
|
|
14592
|
-
var signaturePadEmpty = useVideoSignatureStore().signaturePadEmpty;
|
|
14593
|
-
var blankCheckPassed = React.useRef(false);
|
|
14594
|
-
React.useEffect(function () {
|
|
14595
|
-
if (signaturePadEmpty) blankCheckPassed.current = false;
|
|
14596
|
-
}, [signaturePadEmpty]);
|
|
14597
14599
|
var drawOutputFrame = React.useCallback(function () {
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
}
|
|
14628
|
-
return [2 /*return*/];
|
|
14629
|
-
});
|
|
14600
|
+
if (!outputCanvas.current || !videoRef.current) return;
|
|
14601
|
+
var ctx = outputCanvas.current.getContext('2d');
|
|
14602
|
+
if (!ctx) return;
|
|
14603
|
+
var _a = [videoRef.current.videoWidth, videoRef.current.videoHeight],
|
|
14604
|
+
w = _a[0],
|
|
14605
|
+
h = _a[1];
|
|
14606
|
+
var isPortrait = w < h;
|
|
14607
|
+
outputCanvas.current.width = w;
|
|
14608
|
+
outputCanvas.current.height = h;
|
|
14609
|
+
var rect = [w * (isPortrait ? 0.02 : 0.15),
|
|
14610
|
+
// x
|
|
14611
|
+
h * (isPortrait ? 0.15 : 0.25),
|
|
14612
|
+
// y
|
|
14613
|
+
w * (isPortrait ? 0.96 : 0.7),
|
|
14614
|
+
// width
|
|
14615
|
+
h * (isPortrait ? 0.7 : 0.5) // height
|
|
14616
|
+
];
|
|
14617
|
+
ctx.drawImage(videoRef.current, 0, 0, w, h);
|
|
14618
|
+
ctx.beginPath();
|
|
14619
|
+
ctx.fillStyle = 'rgba(255,255,255,0.5)';
|
|
14620
|
+
var supportsRoundRect = typeof ctx.roundRect === 'function';
|
|
14621
|
+
if (supportsRoundRect) {
|
|
14622
|
+
ctx.roundRect.apply(ctx, __spreadArray(__spreadArray([], rect, false), [16], false));
|
|
14623
|
+
} else if (typeof ctx.rect === 'function') {
|
|
14624
|
+
ctx.rect.apply(ctx, rect);
|
|
14625
|
+
}
|
|
14626
|
+
ctx.fill();
|
|
14627
|
+
useVideoSignatureStore.setState({
|
|
14628
|
+
supportsRoundRect: supportsRoundRect
|
|
14630
14629
|
});
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
|
|
14638
|
-
var _f = useVideoSignatureStore(),
|
|
14639
|
-
signaturePad = _f.signaturePad,
|
|
14640
|
-
recordingStartedAt = _f.recordingStartedAt;
|
|
14641
|
-
React.useEffect(function () {
|
|
14642
|
-
var _a;
|
|
14643
|
-
if (!signaturePad.current || !recordingStartedAt) return;
|
|
14644
|
-
(_a = signatureVideoRef.current).srcObject || (_a.srcObject = signaturePad.current.getCanvas().captureStream(24));
|
|
14645
|
-
}, [recordingStartedAt, signaturePad]);
|
|
14646
|
-
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children, /*#__PURE__*/React__namespace.default.createElement("video", {
|
|
14647
|
-
ref: signatureVideoRef,
|
|
14648
|
-
autoPlay: true,
|
|
14649
|
-
playsInline: true,
|
|
14650
|
-
muted: true,
|
|
14651
|
-
style: {
|
|
14652
|
-
display: 'none'
|
|
14630
|
+
// Always use direct canvas drawing
|
|
14631
|
+
var _b = useVideoSignatureStore.getState(),
|
|
14632
|
+
signaturePad = _b.signaturePad,
|
|
14633
|
+
signaturePadEmpty = _b.signaturePadEmpty;
|
|
14634
|
+
if (signaturePad.current && !signaturePadEmpty) {
|
|
14635
|
+
var signatureCanvas = signaturePad.current.getCanvas();
|
|
14636
|
+
ctx.drawImage.apply(ctx, __spreadArray([signatureCanvas], rect, false));
|
|
14653
14637
|
}
|
|
14654
|
-
}
|
|
14655
|
-
|
|
14638
|
+
}, [videoRef]);
|
|
14639
|
+
useVideoFrameLoop(videoRef, drawOutputFrame);
|
|
14640
|
+
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
14641
|
+
ref: outputCanvas,
|
|
14656
14642
|
width: (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth,
|
|
14657
14643
|
height: (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.videoHeight
|
|
14658
|
-
}), /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
14659
|
-
ref: outputCanvas,
|
|
14660
|
-
width: (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoWidth,
|
|
14661
|
-
height: (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.videoHeight
|
|
14662
14644
|
}));
|
|
14663
14645
|
}
|
|
14664
|
-
function isVideoBlank(video, canvas) {
|
|
14665
|
-
if (!video || !canvas) return true;
|
|
14666
|
-
var ctx2 = canvas.getContext('2d');
|
|
14667
|
-
if (!ctx2) return true;
|
|
14668
|
-
ctx2.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
14669
|
-
return isCanvasBlank(canvas);
|
|
14670
|
-
}
|
|
14671
|
-
function isCanvasBlank(canvas) {
|
|
14672
|
-
var context = canvas.getContext('2d');
|
|
14673
|
-
if (!context) return true;
|
|
14674
|
-
var pixelBuffer = new Uint32Array(context.getImageData(0, 0, canvas.width, canvas.height).data.buffer);
|
|
14675
|
-
var result = !pixelBuffer.some(function (color) {
|
|
14676
|
-
return color !== 0;
|
|
14677
|
-
});
|
|
14678
|
-
return result;
|
|
14679
|
-
}
|
|
14680
14646
|
function requestVideoFrameCallback(video, onFrame) {
|
|
14681
|
-
|
|
14647
|
+
var supportsRequestVideoFrameCallback = typeof (video === null || video === void 0 ? void 0 : video.requestVideoFrameCallback) === 'function';
|
|
14648
|
+
useVideoSignatureStore.setState({
|
|
14649
|
+
supportsRequestVideoFrameCallback: supportsRequestVideoFrameCallback
|
|
14650
|
+
});
|
|
14651
|
+
if (supportsRequestVideoFrameCallback) {
|
|
14682
14652
|
var rafId_1 = video.requestVideoFrameCallback(onFrame);
|
|
14683
14653
|
return function () {
|
|
14684
14654
|
return video.cancelVideoFrameCallback(rafId_1);
|