biometry-react-components 1.2.3 → 1.2.4

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.esm.js CHANGED
@@ -7060,7 +7060,23 @@ function numberToWord(num) {
7060
7060
  }
7061
7061
  function numbersToPhrase(numbers) {
7062
7062
  return numbers.map(numberToWord).join(' ');
7063
- }const useRecorder = (stream, type, onStopRecording) => {
7063
+ }
7064
+ const VIDEO_READY_STATES = {
7065
+ // 0 means the video element is not ready
7066
+ // 1 means the video element is ready
7067
+ // 2 means the video element is loading
7068
+ // 3 means the video element is ended
7069
+ // 4 means the video element is seeking
7070
+ // 5 means the video element is paused
7071
+ // 6 means the video element is playing
7072
+ 0: 'not ready',
7073
+ 1: 'ready',
7074
+ 2: 'loading',
7075
+ 3: 'ended',
7076
+ 4: 'seeking',
7077
+ 5: 'paused',
7078
+ 6: 'playing'
7079
+ };const useRecorder = (stream, type, onStopRecording) => {
7064
7080
  const [isRecording, setIsRecording] = useState(false);
7065
7081
  const recorderRef = useRef(null);
7066
7082
  const timeoutRef = useRef(null);
@@ -7233,6 +7249,7 @@ function numbersToPhrase(numbers) {
7233
7249
  setIsLoading(true);
7234
7250
  const constraints = getAdaptiveConstraints();
7235
7251
  const streamData = await navigator.mediaDevices.getUserMedia(constraints);
7252
+ console.log('Media stream obtained, active:', streamData.active);
7236
7253
  setPermission(true);
7237
7254
  setStream(streamData);
7238
7255
  }
@@ -7361,6 +7378,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7361
7378
  const [faceImageBlob, setFaceImageBlob] = useState(null);
7362
7379
  const [isConfirming, setIsConfirming] = useState(false);
7363
7380
  const [faceCaptured, setFaceCaptured] = useState(false);
7381
+ const [isReinitializing, setIsReinitializing] = useState(false);
7364
7382
  const videoRef = useRef(null);
7365
7383
  const previewRef = useRef(null);
7366
7384
  const canvasRef = useRef(null);
@@ -7416,16 +7434,67 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7416
7434
  if (!isConfirming && state !== 'result' && stream) {
7417
7435
  console.log('Setting up video element with stream');
7418
7436
  if (videoRef.current && isMounted) {
7419
- videoRef.current.srcObject = stream;
7420
- videoRef.current.onloadedmetadata = () => {
7421
- var _a;
7437
+ const videoElement = videoRef.current;
7438
+ console.log('Video element ready state:', VIDEO_READY_STATES[videoElement.readyState]);
7439
+ videoElement.srcObject = stream;
7440
+ const handleLoadedMetadata = () => {
7422
7441
  console.log('Video metadata loaded, playing...');
7423
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
7442
+ if (videoElement) {
7443
+ videoElement.play().catch(err => {
7444
+ console.error('Failed to play video:', err);
7445
+ });
7446
+ }
7447
+ };
7448
+ const handleCanPlay = () => {
7449
+ console.log('Video can play');
7450
+ if (videoElement && videoElement.paused) {
7451
+ videoElement.play().catch(err => {
7452
+ console.error('Failed to play video on canplay:', err);
7453
+ });
7454
+ }
7455
+ };
7456
+ videoElement.onloadedmetadata = handleLoadedMetadata;
7457
+ videoElement.oncanplay = handleCanPlay;
7458
+ // Also try to play immediately if the stream is already ready
7459
+ if (stream.active) {
7460
+ console.log('Stream is active, attempting immediate play');
7461
+ // Ensure video element is ready
7462
+ if (videoElement.readyState >= 1) {
7463
+ videoElement.play().catch(err => {
7464
+ console.error('Failed to play video immediately:', err);
7465
+ });
7466
+ }
7467
+ else {
7468
+ console.log('Video element not ready yet, waiting for metadata');
7469
+ }
7470
+ }
7471
+ // Fallback: try to play after a short delay if not already playing
7472
+ const fallbackTimer = setTimeout(() => {
7473
+ if (videoElement && videoElement.paused) {
7474
+ console.log('Fallback: attempting to play video after delay');
7475
+ videoElement.play().catch(err => {
7476
+ console.error('Failed to play video in fallback:', err);
7477
+ });
7478
+ }
7479
+ }, 1000);
7480
+ return () => {
7481
+ clearTimeout(fallbackTimer);
7482
+ if (videoElement) {
7483
+ videoElement.onloadedmetadata = null;
7484
+ videoElement.oncanplay = null;
7485
+ }
7424
7486
  };
7425
7487
  }
7426
7488
  console.log('Stream ref set successfully');
7427
7489
  }
7428
7490
  }, [isConfirming, state, stream]);
7491
+ // Auto-start countdown when streams become available after reinitialization
7492
+ useEffect(() => {
7493
+ if (state === 'preparation' && stream && audioStream && !isConfirming && isReinitializing) {
7494
+ console.log('Streams reinitialized, ready for next recording');
7495
+ setIsReinitializing(false);
7496
+ }
7497
+ }, [state, stream, audioStream, isConfirming, isReinitializing]);
7429
7498
  // Preparation countdown
7430
7499
  useEffect(() => {
7431
7500
  console.log('Countdown useEffect - state:', state, 'prepTimer:', prepTimer);
@@ -7435,13 +7504,20 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7435
7504
  return () => clearTimeout(t);
7436
7505
  }
7437
7506
  else {
7507
+ // Ensure streams are available before starting recording
7508
+ if (!stream || !audioStream) {
7509
+ console.error('Streams not available for recording, resetting to preparation');
7510
+ setState('preparation');
7511
+ setPrepTimer(PREP_SECONDS$1);
7512
+ return;
7513
+ }
7438
7514
  setState('recording');
7439
7515
  setPrepTimer(PREP_SECONDS$1);
7440
7516
  startVideoRecording();
7441
7517
  startAudioRecording();
7442
7518
  }
7443
7519
  }
7444
- }, [state, prepTimer, startVideoRecording, startAudioRecording]);
7520
+ }, [state, prepTimer, startVideoRecording, startAudioRecording, stream, audioStream]);
7445
7521
  // Recording timer
7446
7522
  useEffect(() => {
7447
7523
  if (state === 'recording') {
@@ -7461,6 +7537,26 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7461
7537
  }
7462
7538
  }, [state, recordTimer]);
7463
7539
  const startRecording = async () => {
7540
+ // Don't start if streams are being reinitialized
7541
+ if (isReinitializing) {
7542
+ console.log('Streams are being reinitialized, please wait...');
7543
+ return;
7544
+ }
7545
+ // Ensure streams are available before starting
7546
+ if (!stream || !audioStream) {
7547
+ console.log('Streams not available, requesting permissions...');
7548
+ setIsReinitializing(true);
7549
+ await requestPermissions();
7550
+ await requestAudioPermissions();
7551
+ // Wait a bit for streams to initialize
7552
+ await new Promise(resolve => setTimeout(resolve, 500));
7553
+ // Check again after waiting
7554
+ if (!stream || !audioStream) {
7555
+ console.error('Streams still not available after requesting permissions');
7556
+ setIsReinitializing(false);
7557
+ return;
7558
+ }
7559
+ }
7464
7560
  setDigits(generateRandomDigits$1(10));
7465
7561
  setRecordTimer(RECORD_SECONDS$1);
7466
7562
  setFaceCaptured(false);
@@ -7496,6 +7592,10 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7496
7592
  setFaceCaptured(false);
7497
7593
  setIsConfirming(false);
7498
7594
  setState('preparation');
7595
+ setIsReinitializing(true);
7596
+ // Reinitialize streams after confirming
7597
+ requestPermissions();
7598
+ requestAudioPermissions();
7499
7599
  }
7500
7600
  };
7501
7601
  const handleDecline = () => {
@@ -7544,7 +7644,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7544
7644
  transform: 'translateX(-50%)',
7545
7645
  width: '72%',
7546
7646
  height: '68%',
7547
- zIndex: 2,
7647
+ zIndex: 3,
7548
7648
  display: 'flex',
7549
7649
  flexDirection: 'column',
7550
7650
  alignItems: 'center',
@@ -7604,7 +7704,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7604
7704
  fontWeight: 600,
7605
7705
  borderRadius: 8,
7606
7706
  padding: '4px 14px',
7607
- zIndex: 10,
7707
+ zIndex: 4,
7608
7708
  transition: 'all 0.3s',
7609
7709
  letterSpacing: 1.5,
7610
7710
  };
@@ -7617,7 +7717,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7617
7717
  fontSize: 64,
7618
7718
  fontWeight: 700,
7619
7719
  textShadow: '0 2px 12px rgba(0,0,0,0.25)',
7620
- zIndex: 20,
7720
+ zIndex: 4,
7621
7721
  transition: 'all 0.3s',
7622
7722
  pointerEvents: 'none',
7623
7723
  };
@@ -7662,7 +7762,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7662
7762
  transition: 'background 0.2s',
7663
7763
  margin: '0 8px',
7664
7764
  };
7665
- if (isLoading || audioIsLoading) {
7765
+ if (isLoading || audioIsLoading || isReinitializing) {
7666
7766
  return (jsx("div", { className: className, style: wrapperStyle, children: jsxs("div", { style: { textAlign: 'center', padding: '20px' }, children: [jsx("div", { style: {
7667
7767
  width: 48,
7668
7768
  height: 48,
@@ -7671,7 +7771,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7671
7771
  borderRadius: '50%',
7672
7772
  animation: 'spin 1s linear infinite',
7673
7773
  margin: '0 auto 16px auto',
7674
- } }), jsx("h3", { children: "Initializing Camera & Microphone..." }), jsx("p", { children: "Please wait while we set up your camera and microphone." })] }) }));
7774
+ } }), jsx("h3", { children: isReinitializing ? 'Reinitializing Camera & Microphone...' : 'Initializing Camera & Microphone...' }), jsx("p", { children: "Please wait while we set up your camera and microphone." })] }) }));
7675
7775
  }
7676
7776
  if (!permission || !audioPermission) {
7677
7777
  return (jsx("div", { className: className, style: wrapperStyle, children: jsxs("div", { style: { textAlign: 'center', padding: '20px' }, children: [jsx("h3", { children: "Camera & Microphone Permission Required" }), jsx("p", { children: "Please allow camera and microphone access to use this component." }), jsx("button", { type: "button", style: actionButton, onClick: () => {
@@ -7684,15 +7784,15 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7684
7784
  height: rectHeight - 40,
7685
7785
  objectFit: 'cover',
7686
7786
  borderRadius: noShadow ? 0 : 8,
7687
- zIndex: 0,
7688
- }, playsInline: true, muted: true, autoPlay: true }), jsx("div", { className: "facerecorder-dark-overlay", style: {
7787
+ zIndex: 1,
7788
+ }, playsInline: true, muted: true, autoPlay: true, onLoadStart: () => console.log('Video load started'), onLoadedData: () => console.log('Video loaded data'), onCanPlay: () => console.log('Video can play event'), onError: (e) => console.error('Video error:', e) }), jsx("div", { className: "facerecorder-dark-overlay", style: {
7689
7789
  position: 'absolute',
7690
7790
  top: 0,
7691
7791
  left: 0,
7692
7792
  width: '100%',
7693
7793
  height: '100%',
7694
7794
  background: 'rgba(0,0,0,0.4)',
7695
- zIndex: 1,
7795
+ zIndex: 2,
7696
7796
  borderRadius: noShadow ? 0 : 8,
7697
7797
  } }), jsxs("div", { className: "facerecorder-oval-area", style: ovalArea, children: [jsx("span", { className: "facerecorder-guidance-text", style: guidanceText, children: "Place your face in the oval" }), jsx("div", { className: "facerecorder-oval-dashed", style: ovalDashed })] }), state === 'countdown' && (jsx("div", { style: prepTimerStyle, children: prepTimer })), state === 'recording' && (jsx("div", { style: timerStyle, children: recordTimer }))] }), jsx("div", { style: numberRow, children: (state === 'recording' ? digits : Array(10).fill('*')).map((num, i) => (jsx("div", { style: numberBox, children: num }, i))) }), state === 'preparation' && (jsx("button", { type: "button", style: actionButton, onClick: startRecording, children: "Start recording" })), state === 'recording' && (jsx("button", { type: "button", style: { ...actionButton, background: '#d32f2f' }, onClick: handleCancel, children: "Cancel" }))] })), state === 'processing' && (jsx(Fragment, { children: jsx("div", { className: "facerecorder-processing", style: preview, children: jsxs("div", { style: {
7698
7798
  display: 'flex',
package/dist/index.js CHANGED
@@ -7060,7 +7060,23 @@ function numberToWord(num) {
7060
7060
  }
7061
7061
  function numbersToPhrase(numbers) {
7062
7062
  return numbers.map(numberToWord).join(' ');
7063
- }const useRecorder = (stream, type, onStopRecording) => {
7063
+ }
7064
+ const VIDEO_READY_STATES = {
7065
+ // 0 means the video element is not ready
7066
+ // 1 means the video element is ready
7067
+ // 2 means the video element is loading
7068
+ // 3 means the video element is ended
7069
+ // 4 means the video element is seeking
7070
+ // 5 means the video element is paused
7071
+ // 6 means the video element is playing
7072
+ 0: 'not ready',
7073
+ 1: 'ready',
7074
+ 2: 'loading',
7075
+ 3: 'ended',
7076
+ 4: 'seeking',
7077
+ 5: 'paused',
7078
+ 6: 'playing'
7079
+ };const useRecorder = (stream, type, onStopRecording) => {
7064
7080
  const [isRecording, setIsRecording] = react.useState(false);
7065
7081
  const recorderRef = react.useRef(null);
7066
7082
  const timeoutRef = react.useRef(null);
@@ -7233,6 +7249,7 @@ function numbersToPhrase(numbers) {
7233
7249
  setIsLoading(true);
7234
7250
  const constraints = getAdaptiveConstraints();
7235
7251
  const streamData = await navigator.mediaDevices.getUserMedia(constraints);
7252
+ console.log('Media stream obtained, active:', streamData.active);
7236
7253
  setPermission(true);
7237
7254
  setStream(streamData);
7238
7255
  }
@@ -7361,6 +7378,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7361
7378
  const [faceImageBlob, setFaceImageBlob] = react.useState(null);
7362
7379
  const [isConfirming, setIsConfirming] = react.useState(false);
7363
7380
  const [faceCaptured, setFaceCaptured] = react.useState(false);
7381
+ const [isReinitializing, setIsReinitializing] = react.useState(false);
7364
7382
  const videoRef = react.useRef(null);
7365
7383
  const previewRef = react.useRef(null);
7366
7384
  const canvasRef = react.useRef(null);
@@ -7416,16 +7434,67 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7416
7434
  if (!isConfirming && state !== 'result' && stream) {
7417
7435
  console.log('Setting up video element with stream');
7418
7436
  if (videoRef.current && isMounted) {
7419
- videoRef.current.srcObject = stream;
7420
- videoRef.current.onloadedmetadata = () => {
7421
- var _a;
7437
+ const videoElement = videoRef.current;
7438
+ console.log('Video element ready state:', VIDEO_READY_STATES[videoElement.readyState]);
7439
+ videoElement.srcObject = stream;
7440
+ const handleLoadedMetadata = () => {
7422
7441
  console.log('Video metadata loaded, playing...');
7423
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
7442
+ if (videoElement) {
7443
+ videoElement.play().catch(err => {
7444
+ console.error('Failed to play video:', err);
7445
+ });
7446
+ }
7447
+ };
7448
+ const handleCanPlay = () => {
7449
+ console.log('Video can play');
7450
+ if (videoElement && videoElement.paused) {
7451
+ videoElement.play().catch(err => {
7452
+ console.error('Failed to play video on canplay:', err);
7453
+ });
7454
+ }
7455
+ };
7456
+ videoElement.onloadedmetadata = handleLoadedMetadata;
7457
+ videoElement.oncanplay = handleCanPlay;
7458
+ // Also try to play immediately if the stream is already ready
7459
+ if (stream.active) {
7460
+ console.log('Stream is active, attempting immediate play');
7461
+ // Ensure video element is ready
7462
+ if (videoElement.readyState >= 1) {
7463
+ videoElement.play().catch(err => {
7464
+ console.error('Failed to play video immediately:', err);
7465
+ });
7466
+ }
7467
+ else {
7468
+ console.log('Video element not ready yet, waiting for metadata');
7469
+ }
7470
+ }
7471
+ // Fallback: try to play after a short delay if not already playing
7472
+ const fallbackTimer = setTimeout(() => {
7473
+ if (videoElement && videoElement.paused) {
7474
+ console.log('Fallback: attempting to play video after delay');
7475
+ videoElement.play().catch(err => {
7476
+ console.error('Failed to play video in fallback:', err);
7477
+ });
7478
+ }
7479
+ }, 1000);
7480
+ return () => {
7481
+ clearTimeout(fallbackTimer);
7482
+ if (videoElement) {
7483
+ videoElement.onloadedmetadata = null;
7484
+ videoElement.oncanplay = null;
7485
+ }
7424
7486
  };
7425
7487
  }
7426
7488
  console.log('Stream ref set successfully');
7427
7489
  }
7428
7490
  }, [isConfirming, state, stream]);
7491
+ // Auto-start countdown when streams become available after reinitialization
7492
+ react.useEffect(() => {
7493
+ if (state === 'preparation' && stream && audioStream && !isConfirming && isReinitializing) {
7494
+ console.log('Streams reinitialized, ready for next recording');
7495
+ setIsReinitializing(false);
7496
+ }
7497
+ }, [state, stream, audioStream, isConfirming, isReinitializing]);
7429
7498
  // Preparation countdown
7430
7499
  react.useEffect(() => {
7431
7500
  console.log('Countdown useEffect - state:', state, 'prepTimer:', prepTimer);
@@ -7435,13 +7504,20 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7435
7504
  return () => clearTimeout(t);
7436
7505
  }
7437
7506
  else {
7507
+ // Ensure streams are available before starting recording
7508
+ if (!stream || !audioStream) {
7509
+ console.error('Streams not available for recording, resetting to preparation');
7510
+ setState('preparation');
7511
+ setPrepTimer(PREP_SECONDS$1);
7512
+ return;
7513
+ }
7438
7514
  setState('recording');
7439
7515
  setPrepTimer(PREP_SECONDS$1);
7440
7516
  startVideoRecording();
7441
7517
  startAudioRecording();
7442
7518
  }
7443
7519
  }
7444
- }, [state, prepTimer, startVideoRecording, startAudioRecording]);
7520
+ }, [state, prepTimer, startVideoRecording, startAudioRecording, stream, audioStream]);
7445
7521
  // Recording timer
7446
7522
  react.useEffect(() => {
7447
7523
  if (state === 'recording') {
@@ -7461,6 +7537,26 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7461
7537
  }
7462
7538
  }, [state, recordTimer]);
7463
7539
  const startRecording = async () => {
7540
+ // Don't start if streams are being reinitialized
7541
+ if (isReinitializing) {
7542
+ console.log('Streams are being reinitialized, please wait...');
7543
+ return;
7544
+ }
7545
+ // Ensure streams are available before starting
7546
+ if (!stream || !audioStream) {
7547
+ console.log('Streams not available, requesting permissions...');
7548
+ setIsReinitializing(true);
7549
+ await requestPermissions();
7550
+ await requestAudioPermissions();
7551
+ // Wait a bit for streams to initialize
7552
+ await new Promise(resolve => setTimeout(resolve, 500));
7553
+ // Check again after waiting
7554
+ if (!stream || !audioStream) {
7555
+ console.error('Streams still not available after requesting permissions');
7556
+ setIsReinitializing(false);
7557
+ return;
7558
+ }
7559
+ }
7464
7560
  setDigits(generateRandomDigits$1(10));
7465
7561
  setRecordTimer(RECORD_SECONDS$1);
7466
7562
  setFaceCaptured(false);
@@ -7496,6 +7592,10 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7496
7592
  setFaceCaptured(false);
7497
7593
  setIsConfirming(false);
7498
7594
  setState('preparation');
7595
+ setIsReinitializing(true);
7596
+ // Reinitialize streams after confirming
7597
+ requestPermissions();
7598
+ requestAudioPermissions();
7499
7599
  }
7500
7600
  };
7501
7601
  const handleDecline = () => {
@@ -7544,7 +7644,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7544
7644
  transform: 'translateX(-50%)',
7545
7645
  width: '72%',
7546
7646
  height: '68%',
7547
- zIndex: 2,
7647
+ zIndex: 3,
7548
7648
  display: 'flex',
7549
7649
  flexDirection: 'column',
7550
7650
  alignItems: 'center',
@@ -7604,7 +7704,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7604
7704
  fontWeight: 600,
7605
7705
  borderRadius: 8,
7606
7706
  padding: '4px 14px',
7607
- zIndex: 10,
7707
+ zIndex: 4,
7608
7708
  transition: 'all 0.3s',
7609
7709
  letterSpacing: 1.5,
7610
7710
  };
@@ -7617,7 +7717,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7617
7717
  fontSize: 64,
7618
7718
  fontWeight: 700,
7619
7719
  textShadow: '0 2px 12px rgba(0,0,0,0.25)',
7620
- zIndex: 20,
7720
+ zIndex: 4,
7621
7721
  transition: 'all 0.3s',
7622
7722
  pointerEvents: 'none',
7623
7723
  };
@@ -7662,7 +7762,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7662
7762
  transition: 'background 0.2s',
7663
7763
  margin: '0 8px',
7664
7764
  };
7665
- if (isLoading || audioIsLoading) {
7765
+ if (isLoading || audioIsLoading || isReinitializing) {
7666
7766
  return (jsxRuntime.jsx("div", { className: className, style: wrapperStyle, children: jsxRuntime.jsxs("div", { style: { textAlign: 'center', padding: '20px' }, children: [jsxRuntime.jsx("div", { style: {
7667
7767
  width: 48,
7668
7768
  height: 48,
@@ -7671,7 +7771,7 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7671
7771
  borderRadius: '50%',
7672
7772
  animation: 'spin 1s linear infinite',
7673
7773
  margin: '0 auto 16px auto',
7674
- } }), jsxRuntime.jsx("h3", { children: "Initializing Camera & Microphone..." }), jsxRuntime.jsx("p", { children: "Please wait while we set up your camera and microphone." })] }) }));
7774
+ } }), jsxRuntime.jsx("h3", { children: isReinitializing ? 'Reinitializing Camera & Microphone...' : 'Initializing Camera & Microphone...' }), jsxRuntime.jsx("p", { children: "Please wait while we set up your camera and microphone." })] }) }));
7675
7775
  }
7676
7776
  if (!permission || !audioPermission) {
7677
7777
  return (jsxRuntime.jsx("div", { className: className, style: wrapperStyle, children: jsxRuntime.jsxs("div", { style: { textAlign: 'center', padding: '20px' }, children: [jsxRuntime.jsx("h3", { children: "Camera & Microphone Permission Required" }), jsxRuntime.jsx("p", { children: "Please allow camera and microphone access to use this component." }), jsxRuntime.jsx("button", { type: "button", style: actionButton, onClick: () => {
@@ -7684,15 +7784,15 @@ const FaceRecorder = ({ rectWidth = 360, rectHeight = 576, onCapture, className,
7684
7784
  height: rectHeight - 40,
7685
7785
  objectFit: 'cover',
7686
7786
  borderRadius: noShadow ? 0 : 8,
7687
- zIndex: 0,
7688
- }, playsInline: true, muted: true, autoPlay: true }), jsxRuntime.jsx("div", { className: "facerecorder-dark-overlay", style: {
7787
+ zIndex: 1,
7788
+ }, playsInline: true, muted: true, autoPlay: true, onLoadStart: () => console.log('Video load started'), onLoadedData: () => console.log('Video loaded data'), onCanPlay: () => console.log('Video can play event'), onError: (e) => console.error('Video error:', e) }), jsxRuntime.jsx("div", { className: "facerecorder-dark-overlay", style: {
7689
7789
  position: 'absolute',
7690
7790
  top: 0,
7691
7791
  left: 0,
7692
7792
  width: '100%',
7693
7793
  height: '100%',
7694
7794
  background: 'rgba(0,0,0,0.4)',
7695
- zIndex: 1,
7795
+ zIndex: 2,
7696
7796
  borderRadius: noShadow ? 0 : 8,
7697
7797
  } }), jsxRuntime.jsxs("div", { className: "facerecorder-oval-area", style: ovalArea, children: [jsxRuntime.jsx("span", { className: "facerecorder-guidance-text", style: guidanceText, children: "Place your face in the oval" }), jsxRuntime.jsx("div", { className: "facerecorder-oval-dashed", style: ovalDashed })] }), state === 'countdown' && (jsxRuntime.jsx("div", { style: prepTimerStyle, children: prepTimer })), state === 'recording' && (jsxRuntime.jsx("div", { style: timerStyle, children: recordTimer }))] }), jsxRuntime.jsx("div", { style: numberRow, children: (state === 'recording' ? digits : Array(10).fill('*')).map((num, i) => (jsxRuntime.jsx("div", { style: numberBox, children: num }, i))) }), state === 'preparation' && (jsxRuntime.jsx("button", { type: "button", style: actionButton, onClick: startRecording, children: "Start recording" })), state === 'recording' && (jsxRuntime.jsx("button", { type: "button", style: { ...actionButton, background: '#d32f2f' }, onClick: handleCancel, children: "Cancel" }))] })), state === 'processing' && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", { className: "facerecorder-processing", style: preview, children: jsxRuntime.jsxs("div", { style: {
7698
7798
  display: 'flex',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biometry-react-components",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
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",