@hexar/biometric-identity-sdk-react-native 1.0.21 → 1.0.22

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.
@@ -1 +1 @@
1
- {"version":3,"file":"VideoRecorder.d.ts","sourceRoot":"","sources":["../../src/components/VideoRecorder.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;AAaxE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,iBAAiB,EAAmC,MAAM,oCAAoC,CAAC;AAE1I,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wCAAwC;IACxC,UAAU,EAAE,CAAC,SAAS,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACtD,iCAAiC;IACjC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,oB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CACtD;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA8CD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAo0BtD,CAAC;AA4OF,eAAe,aAAa,CAAC"}
@@ -330,6 +330,8 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
330
330
  if (cameraRef.current && device) {
331
331
  biometric_identity_sdk_core_1.logger.info('Starting frame capture');
332
332
  framesRef.current = [];
333
+ let consecutiveErrors = 0;
334
+ const maxConsecutiveErrors = 5;
333
335
  frameCaptureInterval.current = setInterval(async () => {
334
336
  if (!isRecordingRef.current) {
335
337
  if (frameCaptureInterval.current) {
@@ -343,6 +345,7 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
343
345
  flash: 'off',
344
346
  });
345
347
  if (photo) {
348
+ consecutiveErrors = 0;
346
349
  try {
347
350
  const RNFS = require('react-native-fs');
348
351
  const base64 = await RNFS.readFile(photo.path, 'base64');
@@ -356,7 +359,7 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
356
359
  });
357
360
  }
358
361
  catch (fsError) {
359
- biometric_identity_sdk_core_1.logger.warn('Could not read photo file, using path:', fsError);
362
+ biometric_identity_sdk_core_1.logger.warn('Could not read photo file, using path');
360
363
  setFrames(prev => {
361
364
  const newFrames = prev.length < 100 ? [...prev, photo.path] : prev;
362
365
  framesRef.current = newFrames;
@@ -366,7 +369,17 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
366
369
  }
367
370
  }
368
371
  catch (error) {
369
- biometric_identity_sdk_core_1.logger.warn('Frame capture error:', error);
372
+ consecutiveErrors++;
373
+ if (consecutiveErrors === 1) {
374
+ biometric_identity_sdk_core_1.logger.warn('Frame capture error:', error?.message || error);
375
+ }
376
+ if (consecutiveErrors >= maxConsecutiveErrors) {
377
+ biometric_identity_sdk_core_1.logger.error('Frame capture failing repeatedly, stopping capture attempts');
378
+ if (frameCaptureInterval.current) {
379
+ clearInterval(frameCaptureInterval.current);
380
+ frameCaptureInterval.current = null;
381
+ }
382
+ }
370
383
  }
371
384
  }, 100);
372
385
  }
@@ -613,7 +626,7 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
613
626
  }
614
627
  return (react_1.default.createElement(react_native_1.View, { style: styles.container },
615
628
  react_1.default.createElement(react_native_1.View, { style: styles.cameraContainer },
616
- react_1.default.createElement(react_native_vision_camera_1.Camera, { ref: cameraRef, style: react_native_1.StyleSheet.absoluteFill, device: device, isActive: phase === 'recording' || phase === 'countdown', video: true, audio: false }),
629
+ react_1.default.createElement(react_native_vision_camera_1.Camera, { ref: cameraRef, style: react_native_1.StyleSheet.absoluteFill, device: device, isActive: phase === 'recording' || phase === 'countdown', video: true, photo: true, audio: false }),
617
630
  react_1.default.createElement(react_native_1.View, { style: styles.overlay },
618
631
  react_1.default.createElement(react_native_1.View, { style: [
619
632
  styles.faceOval,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexar/biometric-identity-sdk-react-native",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "React Native wrapper for Biometric Identity SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -397,6 +397,9 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
397
397
  if (cameraRef.current && device) {
398
398
  logger.info('Starting frame capture');
399
399
  framesRef.current = [];
400
+ let consecutiveErrors = 0;
401
+ const maxConsecutiveErrors = 5;
402
+
400
403
  frameCaptureInterval.current = setInterval(async () => {
401
404
  if (!isRecordingRef.current) {
402
405
  if (frameCaptureInterval.current) {
@@ -412,6 +415,7 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
412
415
  });
413
416
 
414
417
  if (photo) {
418
+ consecutiveErrors = 0;
415
419
  try {
416
420
  const RNFS = require('react-native-fs');
417
421
  const base64 = await RNFS.readFile(photo.path, 'base64');
@@ -424,7 +428,7 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
424
428
  return newFrames;
425
429
  });
426
430
  } catch (fsError) {
427
- logger.warn('Could not read photo file, using path:', fsError);
431
+ logger.warn('Could not read photo file, using path');
428
432
  setFrames(prev => {
429
433
  const newFrames = prev.length < 100 ? [...prev, photo.path] : prev;
430
434
  framesRef.current = newFrames;
@@ -432,8 +436,18 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
432
436
  });
433
437
  }
434
438
  }
435
- } catch (error) {
436
- logger.warn('Frame capture error:', error);
439
+ } catch (error: any) {
440
+ consecutiveErrors++;
441
+ if (consecutiveErrors === 1) {
442
+ logger.warn('Frame capture error:', error?.message || error);
443
+ }
444
+ if (consecutiveErrors >= maxConsecutiveErrors) {
445
+ logger.error('Frame capture failing repeatedly, stopping capture attempts');
446
+ if (frameCaptureInterval.current) {
447
+ clearInterval(frameCaptureInterval.current);
448
+ frameCaptureInterval.current = null;
449
+ }
450
+ }
437
451
  }
438
452
  }, 100);
439
453
  } else {
@@ -766,6 +780,7 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
766
780
  device={device}
767
781
  isActive={phase === 'recording' || phase === 'countdown'}
768
782
  video={true}
783
+ photo={true}
769
784
  audio={false}
770
785
  />
771
786