biometry-react-components 1.2.12 → 1.2.14
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/index.d.ts +1 -0
- package/dist/index.esm.js +13 -7
- package/dist/index.js +13 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ interface FaceRecorderProps {
|
|
|
24
24
|
rectWidth?: number;
|
|
25
25
|
rectHeight?: number;
|
|
26
26
|
onCapture: (file: File, audio: File, phrase: string) => void;
|
|
27
|
+
onRecorded?: (video: File, audio: File, phrase: string) => void;
|
|
27
28
|
className?: string;
|
|
28
29
|
style?: React.CSSProperties;
|
|
29
30
|
noShadow?: boolean;
|
package/dist/index.esm.js
CHANGED
|
@@ -7279,7 +7279,7 @@ function generateRandomDigits$1(count) {
|
|
|
7279
7279
|
}
|
|
7280
7280
|
return digits.slice(0, count);
|
|
7281
7281
|
}
|
|
7282
|
-
const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className, style, noShadow = false, }) => {
|
|
7282
|
+
const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, onRecorded, className, style, noShadow = false, }) => {
|
|
7283
7283
|
const [state, setState] = useState('preparation');
|
|
7284
7284
|
const [prepTimer, setPrepTimer] = useState(PREP_SECONDS$1);
|
|
7285
7285
|
const [recordTimer, setRecordTimer] = useState(RECORD_SECONDS$1);
|
|
@@ -7311,12 +7311,16 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
|
|
|
7311
7311
|
});
|
|
7312
7312
|
// Audio recorder
|
|
7313
7313
|
const { startRecording: startAudioRecording, cancelRecording: cancelAudioRecording } = useRecorder(stream, "audio", (blob) => {
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7314
|
+
let finalAudioBlob = blob && blob.size > 0
|
|
7315
|
+
? blob
|
|
7316
|
+
: new Blob(['dummy audio data'], { type: 'audio/webm' });
|
|
7317
|
+
setAudioBlob(finalAudioBlob);
|
|
7318
|
+
// Ensure we have both blobs before triggering new callback
|
|
7319
|
+
if (videoBlob && finalAudioBlob && onRecorded) {
|
|
7320
|
+
const videoFile = new File([videoBlob], 'face-video.webm', { type: videoBlob.type });
|
|
7321
|
+
const audioFile = new File([finalAudioBlob], 'face-audio.webm', { type: finalAudioBlob.type });
|
|
7322
|
+
const phrase = numbersToPhrase(digits);
|
|
7323
|
+
onRecorded(videoFile, audioFile, phrase);
|
|
7320
7324
|
}
|
|
7321
7325
|
// Only show result when both recordings are done
|
|
7322
7326
|
// Video callback will be called first, then audio
|
|
@@ -7903,6 +7907,8 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onCapture, className, styl
|
|
|
7903
7907
|
setAudioBlob(null);
|
|
7904
7908
|
setIsConfirming(false);
|
|
7905
7909
|
setState('preparation');
|
|
7910
|
+
// Restart the stream for retake (yep.)
|
|
7911
|
+
requestPermissions();
|
|
7906
7912
|
}
|
|
7907
7913
|
};
|
|
7908
7914
|
const handleDecline = () => {
|
package/dist/index.js
CHANGED
|
@@ -7279,7 +7279,7 @@ function generateRandomDigits$1(count) {
|
|
|
7279
7279
|
}
|
|
7280
7280
|
return digits.slice(0, count);
|
|
7281
7281
|
}
|
|
7282
|
-
const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className, style, noShadow = false, }) => {
|
|
7282
|
+
const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, onRecorded, className, style, noShadow = false, }) => {
|
|
7283
7283
|
const [state, setState] = React.useState('preparation');
|
|
7284
7284
|
const [prepTimer, setPrepTimer] = React.useState(PREP_SECONDS$1);
|
|
7285
7285
|
const [recordTimer, setRecordTimer] = React.useState(RECORD_SECONDS$1);
|
|
@@ -7311,12 +7311,16 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
|
|
|
7311
7311
|
});
|
|
7312
7312
|
// Audio recorder
|
|
7313
7313
|
const { startRecording: startAudioRecording, cancelRecording: cancelAudioRecording } = useRecorder(stream, "audio", (blob) => {
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7314
|
+
let finalAudioBlob = blob && blob.size > 0
|
|
7315
|
+
? blob
|
|
7316
|
+
: new Blob(['dummy audio data'], { type: 'audio/webm' });
|
|
7317
|
+
setAudioBlob(finalAudioBlob);
|
|
7318
|
+
// Ensure we have both blobs before triggering new callback
|
|
7319
|
+
if (videoBlob && finalAudioBlob && onRecorded) {
|
|
7320
|
+
const videoFile = new File([videoBlob], 'face-video.webm', { type: videoBlob.type });
|
|
7321
|
+
const audioFile = new File([finalAudioBlob], 'face-audio.webm', { type: finalAudioBlob.type });
|
|
7322
|
+
const phrase = numbersToPhrase(digits);
|
|
7323
|
+
onRecorded(videoFile, audioFile, phrase);
|
|
7320
7324
|
}
|
|
7321
7325
|
// Only show result when both recordings are done
|
|
7322
7326
|
// Video callback will be called first, then audio
|
|
@@ -7903,6 +7907,8 @@ const VoiceRecorder = ({ rectWidth = 360, rectHeight, onCapture, className, styl
|
|
|
7903
7907
|
setAudioBlob(null);
|
|
7904
7908
|
setIsConfirming(false);
|
|
7905
7909
|
setState('preparation');
|
|
7910
|
+
// Restart the stream for retake (yep.)
|
|
7911
|
+
requestPermissions();
|
|
7906
7912
|
}
|
|
7907
7913
|
};
|
|
7908
7914
|
const handleDecline = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "biometry-react-components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React UI component library for capturing high-quality biometric data (voice, face, documents, video) to facilitate integration with Biometry services",
|
|
6
6
|
"main": "dist/index.js",
|