biometry-react-components 2.0.0 → 2.0.1

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
@@ -7401,7 +7401,21 @@ const useRecorder = (stream, type, onStopRecording, lengthMs = VIDEO_LENGTH_MS)
7401
7401
  }
7402
7402
  };
7403
7403
  return { isRecording, startRecording, stopRecording, cancelRecording };
7404
- };const usePermissions = ({ rectWidth = 1920, rectHeight = 1080 } = {}) => {
7404
+ };// Video constraints are IDEAL-ONLY - never `min` (BM-530).
7405
+ //
7406
+ // Without a deviceId, getUserMedia considers every camera and returns one that
7407
+ // satisfies all required (min/max/exact) constraints. A hard `min` therefore
7408
+ // filters cameras: with `width.min: 1280` a 640x480 laptop webcam is silently
7409
+ // excluded and the browser falls back to whatever passes - typically a virtual
7410
+ // camera (OBS) that accepts any resolution - or, with no such camera, throws
7411
+ // OverconstrainedError, which used to surface as "Camera Permission Required".
7412
+ // Chrome's camera picker for the site is narrowed the same way.
7413
+ //
7414
+ // The old minimums survive as floors on the ideal (`idealSize`): an HD camera
7415
+ // is still steered to at least the same resolution as before, while a weaker
7416
+ // camera is accepted at its best mode instead of being rejected.
7417
+ const idealSize = (requested, floor, cap) => Math.max(floor, Math.min(requested, cap));
7418
+ const usePermissions = ({ rectWidth = 1920, rectHeight = 1080 } = {}) => {
7405
7419
  const [permission, setPermission] = useState(false);
7406
7420
  const [stream, setStream] = useState(null);
7407
7421
  const [isLoading, setIsLoading] = useState(true);
@@ -7434,9 +7448,9 @@ const useRecorder = (stream, type, onStopRecording, lengthMs = VIDEO_LENGTH_MS)
7434
7448
  channelCount: 1 // Mono: the gateway downmixes with -ac 1 and the engine expects mono (BM-446)
7435
7449
  },
7436
7450
  video: {
7437
- width: { ideal: Math.min(rectWidth, 1920), min: 1280 },
7438
- height: { ideal: Math.min(rectHeight, 1080), min: 720 },
7439
- frameRate: { ideal: 30, min: 24 },
7451
+ width: { ideal: idealSize(rectWidth, 1280, 1920) },
7452
+ height: { ideal: idealSize(rectHeight, 720, 1080) },
7453
+ frameRate: { ideal: 30 },
7440
7454
  facingMode: 'user',
7441
7455
  aspectRatio: { ideal: rectWidth / rectHeight }
7442
7456
  }
@@ -7453,9 +7467,9 @@ const useRecorder = (stream, type, onStopRecording, lengthMs = VIDEO_LENGTH_MS)
7453
7467
  channelCount: 1
7454
7468
  },
7455
7469
  video: {
7456
- width: { ideal: Math.min(rectWidth, 1280), min: 640 },
7457
- height: { ideal: Math.min(rectHeight, 720), min: 480 },
7458
- frameRate: { ideal: 24, min: 15 },
7470
+ width: { ideal: idealSize(rectWidth, 640, 1280) },
7471
+ height: { ideal: idealSize(rectHeight, 480, 720) },
7472
+ frameRate: { ideal: 24 },
7459
7473
  facingMode: 'user',
7460
7474
  aspectRatio: { ideal: rectWidth / rectHeight }
7461
7475
  }
@@ -7471,15 +7485,16 @@ const useRecorder = (stream, type, onStopRecording, lengthMs = VIDEO_LENGTH_MS)
7471
7485
  channelCount: 1
7472
7486
  },
7473
7487
  video: {
7474
- width: { ideal: Math.min(rectWidth, 1280), min: 640 },
7475
- height: { ideal: Math.min(rectHeight, 720), min: 480 },
7476
- frameRate: { ideal: 20, min: 15 },
7488
+ width: { ideal: idealSize(rectWidth, 640, 1280) },
7489
+ height: { ideal: idealSize(rectHeight, 480, 720) },
7490
+ frameRate: { ideal: 20 },
7477
7491
  facingMode: 'user',
7478
7492
  aspectRatio: { ideal: rectWidth / rectHeight }
7479
7493
  }
7480
7494
  };
7481
7495
  };
7482
7496
  const requestPermissions = async () => {
7497
+ var _a, _b;
7483
7498
  try {
7484
7499
  setIsLoading(true);
7485
7500
  const constraints = getAdaptiveConstraints();
@@ -7496,7 +7511,10 @@ const useRecorder = (stream, type, onStopRecording, lengthMs = VIDEO_LENGTH_MS)
7496
7511
  setStream(streamData);
7497
7512
  }
7498
7513
  catch (err) {
7499
- console.error('Camera/mic permission denied:', err);
7514
+ // Not every failure is a denied permission: OverconstrainedError names
7515
+ // the failing rule, NotReadableError means the camera is busy.
7516
+ const e = err;
7517
+ console.error('biometry-react-components: getUserMedia failed:', e === null || e === void 0 ? void 0 : e.name, (_a = e === null || e === void 0 ? void 0 : e.constraint) !== null && _a !== void 0 ? _a : '', (_b = e === null || e === void 0 ? void 0 : e.message) !== null && _b !== void 0 ? _b : '');
7500
7518
  if (isMountedRef.current)
7501
7519
  setPermission(false);
7502
7520
  }
package/dist/index.js CHANGED
@@ -7401,7 +7401,21 @@ const useRecorder = (stream, type, onStopRecording, lengthMs = VIDEO_LENGTH_MS)
7401
7401
  }
7402
7402
  };
7403
7403
  return { isRecording, startRecording, stopRecording, cancelRecording };
7404
- };const usePermissions = ({ rectWidth = 1920, rectHeight = 1080 } = {}) => {
7404
+ };// Video constraints are IDEAL-ONLY - never `min` (BM-530).
7405
+ //
7406
+ // Without a deviceId, getUserMedia considers every camera and returns one that
7407
+ // satisfies all required (min/max/exact) constraints. A hard `min` therefore
7408
+ // filters cameras: with `width.min: 1280` a 640x480 laptop webcam is silently
7409
+ // excluded and the browser falls back to whatever passes - typically a virtual
7410
+ // camera (OBS) that accepts any resolution - or, with no such camera, throws
7411
+ // OverconstrainedError, which used to surface as "Camera Permission Required".
7412
+ // Chrome's camera picker for the site is narrowed the same way.
7413
+ //
7414
+ // The old minimums survive as floors on the ideal (`idealSize`): an HD camera
7415
+ // is still steered to at least the same resolution as before, while a weaker
7416
+ // camera is accepted at its best mode instead of being rejected.
7417
+ const idealSize = (requested, floor, cap) => Math.max(floor, Math.min(requested, cap));
7418
+ const usePermissions = ({ rectWidth = 1920, rectHeight = 1080 } = {}) => {
7405
7419
  const [permission, setPermission] = React.useState(false);
7406
7420
  const [stream, setStream] = React.useState(null);
7407
7421
  const [isLoading, setIsLoading] = React.useState(true);
@@ -7434,9 +7448,9 @@ const useRecorder = (stream, type, onStopRecording, lengthMs = VIDEO_LENGTH_MS)
7434
7448
  channelCount: 1 // Mono: the gateway downmixes with -ac 1 and the engine expects mono (BM-446)
7435
7449
  },
7436
7450
  video: {
7437
- width: { ideal: Math.min(rectWidth, 1920), min: 1280 },
7438
- height: { ideal: Math.min(rectHeight, 1080), min: 720 },
7439
- frameRate: { ideal: 30, min: 24 },
7451
+ width: { ideal: idealSize(rectWidth, 1280, 1920) },
7452
+ height: { ideal: idealSize(rectHeight, 720, 1080) },
7453
+ frameRate: { ideal: 30 },
7440
7454
  facingMode: 'user',
7441
7455
  aspectRatio: { ideal: rectWidth / rectHeight }
7442
7456
  }
@@ -7453,9 +7467,9 @@ const useRecorder = (stream, type, onStopRecording, lengthMs = VIDEO_LENGTH_MS)
7453
7467
  channelCount: 1
7454
7468
  },
7455
7469
  video: {
7456
- width: { ideal: Math.min(rectWidth, 1280), min: 640 },
7457
- height: { ideal: Math.min(rectHeight, 720), min: 480 },
7458
- frameRate: { ideal: 24, min: 15 },
7470
+ width: { ideal: idealSize(rectWidth, 640, 1280) },
7471
+ height: { ideal: idealSize(rectHeight, 480, 720) },
7472
+ frameRate: { ideal: 24 },
7459
7473
  facingMode: 'user',
7460
7474
  aspectRatio: { ideal: rectWidth / rectHeight }
7461
7475
  }
@@ -7471,15 +7485,16 @@ const useRecorder = (stream, type, onStopRecording, lengthMs = VIDEO_LENGTH_MS)
7471
7485
  channelCount: 1
7472
7486
  },
7473
7487
  video: {
7474
- width: { ideal: Math.min(rectWidth, 1280), min: 640 },
7475
- height: { ideal: Math.min(rectHeight, 720), min: 480 },
7476
- frameRate: { ideal: 20, min: 15 },
7488
+ width: { ideal: idealSize(rectWidth, 640, 1280) },
7489
+ height: { ideal: idealSize(rectHeight, 480, 720) },
7490
+ frameRate: { ideal: 20 },
7477
7491
  facingMode: 'user',
7478
7492
  aspectRatio: { ideal: rectWidth / rectHeight }
7479
7493
  }
7480
7494
  };
7481
7495
  };
7482
7496
  const requestPermissions = async () => {
7497
+ var _a, _b;
7483
7498
  try {
7484
7499
  setIsLoading(true);
7485
7500
  const constraints = getAdaptiveConstraints();
@@ -7496,7 +7511,10 @@ const useRecorder = (stream, type, onStopRecording, lengthMs = VIDEO_LENGTH_MS)
7496
7511
  setStream(streamData);
7497
7512
  }
7498
7513
  catch (err) {
7499
- console.error('Camera/mic permission denied:', err);
7514
+ // Not every failure is a denied permission: OverconstrainedError names
7515
+ // the failing rule, NotReadableError means the camera is busy.
7516
+ const e = err;
7517
+ console.error('biometry-react-components: getUserMedia failed:', e === null || e === void 0 ? void 0 : e.name, (_a = e === null || e === void 0 ? void 0 : e.constraint) !== null && _a !== void 0 ? _a : '', (_b = e === null || e === void 0 ? void 0 : e.message) !== null && _b !== void 0 ? _b : '');
7500
7518
  if (isMountedRef.current)
7501
7519
  setPermission(false);
7502
7520
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biometry-react-components",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
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",