biometry-react-components 1.2.14 → 1.2.15
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/README.md +7 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +5 -5
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,17 +91,17 @@ Records video with facial guidance overlay and displays 10 random numbers (0-9)
|
|
|
91
91
|
import { FaceRecorder } from 'biometry-react-components';
|
|
92
92
|
|
|
93
93
|
function FaceRecorder() {
|
|
94
|
-
const
|
|
95
|
-
console.log('
|
|
96
|
-
console.log('
|
|
94
|
+
const handleConfirm = (video: File, audio: File, phrase: string) => {
|
|
95
|
+
console.log('Confirmed video:', video);
|
|
96
|
+
console.log('Confirmed audio:', audio);
|
|
97
97
|
console.log('Phrase:', phrase);
|
|
98
98
|
// Send files to your endpoint that will process the biometric data
|
|
99
|
-
// or
|
|
100
99
|
// const response = await sdk.processVideo(video, phrase, userFullName);
|
|
100
|
+
// or
|
|
101
101
|
// const voiceResponse = await sdk.enrollVoice(audio, userFullName);
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
return <FaceRecorder
|
|
104
|
+
return <FaceRecorder onConfirmRecording={handleConfirm} />;
|
|
105
105
|
}
|
|
106
106
|
```
|
|
107
107
|
|
|
@@ -109,7 +109,8 @@ function FaceRecorder() {
|
|
|
109
109
|
|
|
110
110
|
| Prop | Type | Default | Description |
|
|
111
111
|
|------|------|---------|-------------|
|
|
112
|
-
| `
|
|
112
|
+
| `onConfirmRecording` | `(video: File, audio: File, phrase: string) => void` | **required** | Triggered when the user confirms they want to use the recorded video. Provides both media files and the spoken phrase. |
|
|
113
|
+
| `onRecordingComplete` | `(video: File, audio: File, phrase: string) => void` | - | Triggered automatically right after recording finishes. Useful for pre-uploading or background processing. *Optional* |
|
|
113
114
|
| `rectWidth` | `number` | `360` | Width of camera area |
|
|
114
115
|
| `rectHeight` | `number` | `576` | Height of camera area |
|
|
115
116
|
| `className` | `string` | - | Custom CSS class |
|
package/dist/index.d.ts
CHANGED
|
@@ -23,8 +23,8 @@ declare const FaceCapture: React.FC<FaceCaptureProps>;
|
|
|
23
23
|
interface FaceRecorderProps {
|
|
24
24
|
rectWidth?: number;
|
|
25
25
|
rectHeight?: number;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
onConfirmRecording: (file: File, audio: File, phrase: string) => void;
|
|
27
|
+
onRecordingComplete?: (video: File, audio: File, phrase: string) => void;
|
|
28
28
|
className?: string;
|
|
29
29
|
style?: React.CSSProperties;
|
|
30
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,
|
|
7282
|
+
const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onConfirmRecording, onRecordingComplete, 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);
|
|
@@ -7316,11 +7316,11 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, onRecorded
|
|
|
7316
7316
|
: new Blob(['dummy audio data'], { type: 'audio/webm' });
|
|
7317
7317
|
setAudioBlob(finalAudioBlob);
|
|
7318
7318
|
// Ensure we have both blobs before triggering new callback
|
|
7319
|
-
if (videoBlob && finalAudioBlob &&
|
|
7319
|
+
if (videoBlob && finalAudioBlob && onRecordingComplete) {
|
|
7320
7320
|
const videoFile = new File([videoBlob], 'face-video.webm', { type: videoBlob.type });
|
|
7321
7321
|
const audioFile = new File([finalAudioBlob], 'face-audio.webm', { type: finalAudioBlob.type });
|
|
7322
7322
|
const phrase = numbersToPhrase(digits);
|
|
7323
|
-
|
|
7323
|
+
onRecordingComplete(videoFile, audioFile, phrase);
|
|
7324
7324
|
}
|
|
7325
7325
|
// Only show result when both recordings are done
|
|
7326
7326
|
// Video callback will be called first, then audio
|
|
@@ -7414,8 +7414,8 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, onRecorded
|
|
|
7414
7414
|
// Create file objects
|
|
7415
7415
|
const videoFile = new File([videoBlob], 'face-video.webm', { type: videoBlob.type });
|
|
7416
7416
|
const audioFile = new File([audioBlob], 'face-audio.webm', { type: audioBlob.type });
|
|
7417
|
-
//
|
|
7418
|
-
|
|
7417
|
+
// required callback in parent app
|
|
7418
|
+
onConfirmRecording(videoFile, audioFile, numbersToPhrase(digits));
|
|
7419
7419
|
// Clean up and reset state
|
|
7420
7420
|
if (videoUrl)
|
|
7421
7421
|
URL.revokeObjectURL(videoUrl);
|
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,
|
|
7282
|
+
const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onConfirmRecording, onRecordingComplete, 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);
|
|
@@ -7316,11 +7316,11 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, onRecorded
|
|
|
7316
7316
|
: new Blob(['dummy audio data'], { type: 'audio/webm' });
|
|
7317
7317
|
setAudioBlob(finalAudioBlob);
|
|
7318
7318
|
// Ensure we have both blobs before triggering new callback
|
|
7319
|
-
if (videoBlob && finalAudioBlob &&
|
|
7319
|
+
if (videoBlob && finalAudioBlob && onRecordingComplete) {
|
|
7320
7320
|
const videoFile = new File([videoBlob], 'face-video.webm', { type: videoBlob.type });
|
|
7321
7321
|
const audioFile = new File([finalAudioBlob], 'face-audio.webm', { type: finalAudioBlob.type });
|
|
7322
7322
|
const phrase = numbersToPhrase(digits);
|
|
7323
|
-
|
|
7323
|
+
onRecordingComplete(videoFile, audioFile, phrase);
|
|
7324
7324
|
}
|
|
7325
7325
|
// Only show result when both recordings are done
|
|
7326
7326
|
// Video callback will be called first, then audio
|
|
@@ -7414,8 +7414,8 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, onRecorded
|
|
|
7414
7414
|
// Create file objects
|
|
7415
7415
|
const videoFile = new File([videoBlob], 'face-video.webm', { type: videoBlob.type });
|
|
7416
7416
|
const audioFile = new File([audioBlob], 'face-audio.webm', { type: audioBlob.type });
|
|
7417
|
-
//
|
|
7418
|
-
|
|
7417
|
+
// required callback in parent app
|
|
7418
|
+
onConfirmRecording(videoFile, audioFile, numbersToPhrase(digits));
|
|
7419
7419
|
// Clean up and reset state
|
|
7420
7420
|
if (videoUrl)
|
|
7421
7421
|
URL.revokeObjectURL(videoUrl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "biometry-react-components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.15",
|
|
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",
|