@arfuhad/react-native-smart-camera 0.1.1 → 0.1.5

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.
Files changed (116) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/README.md +259 -206
  3. package/android/build.gradle +15 -33
  4. package/android/src/main/java/com/smartcamera/FaceDetectorFrameProcessorPlugin.kt +324 -0
  5. package/android/src/main/java/com/smartcamera/SmartCameraPackage.kt +28 -0
  6. package/build/detection/blinkProcessor.js +2 -1
  7. package/build/detection/blinkProcessor.js.map +1 -1
  8. package/build/detection/faceDetector.d.ts +4 -4
  9. package/build/detection/faceDetector.d.ts.map +1 -1
  10. package/build/detection/faceDetector.js +31 -11
  11. package/build/detection/faceDetector.js.map +1 -1
  12. package/build/detection/index.d.ts +1 -1
  13. package/build/detection/index.d.ts.map +1 -1
  14. package/build/detection/index.js +1 -1
  15. package/build/detection/index.js.map +1 -1
  16. package/build/detection/staticImageDetector.d.ts +11 -11
  17. package/build/detection/staticImageDetector.d.ts.map +1 -1
  18. package/build/detection/staticImageDetector.js +19 -23
  19. package/build/detection/staticImageDetector.js.map +1 -1
  20. package/build/hooks/index.d.ts +6 -0
  21. package/build/hooks/index.d.ts.map +1 -1
  22. package/build/hooks/index.js +8 -0
  23. package/build/hooks/index.js.map +1 -1
  24. package/build/hooks/useBlinkDetection.d.ts +27 -16
  25. package/build/hooks/useBlinkDetection.d.ts.map +1 -1
  26. package/build/hooks/useBlinkDetection.js +63 -37
  27. package/build/hooks/useBlinkDetection.js.map +1 -1
  28. package/build/hooks/useFaceDetection.js +3 -2
  29. package/build/hooks/useFaceDetection.js.map +1 -1
  30. package/build/hooks/useFaceDetector.d.ts +123 -0
  31. package/build/hooks/useFaceDetector.d.ts.map +1 -0
  32. package/build/hooks/useFaceDetector.js +133 -0
  33. package/build/hooks/useFaceDetector.js.map +1 -0
  34. package/build/hooks/useSmartCamera.js.map +1 -1
  35. package/build/hooks/useSmartCameraWebRTC.d.ts +3 -5
  36. package/build/hooks/useSmartCameraWebRTC.d.ts.map +1 -1
  37. package/build/hooks/useSmartCameraWebRTC.js +19 -87
  38. package/build/hooks/useSmartCameraWebRTC.js.map +1 -1
  39. package/build/hooks/useWebRTC.d.ts +88 -0
  40. package/build/hooks/useWebRTC.d.ts.map +1 -0
  41. package/build/hooks/useWebRTC.js +394 -0
  42. package/build/hooks/useWebRTC.js.map +1 -0
  43. package/build/hooks/useWebRTCWithDetection.d.ts +89 -0
  44. package/build/hooks/useWebRTCWithDetection.d.ts.map +1 -0
  45. package/build/hooks/useWebRTCWithDetection.js +131 -0
  46. package/build/hooks/useWebRTCWithDetection.js.map +1 -0
  47. package/build/index.d.ts +24 -10
  48. package/build/index.d.ts.map +1 -1
  49. package/build/index.js +38 -13
  50. package/build/index.js.map +1 -1
  51. package/build/types.d.ts +28 -12
  52. package/build/types.d.ts.map +1 -1
  53. package/build/types.js.map +1 -1
  54. package/build/utils/index.js.map +1 -1
  55. package/build/webrtc/WebRTCBridge.d.ts +3 -0
  56. package/build/webrtc/WebRTCBridge.d.ts.map +1 -1
  57. package/build/webrtc/WebRTCBridge.js +12 -15
  58. package/build/webrtc/WebRTCBridge.js.map +1 -1
  59. package/build/webrtc/WebRTCManager.d.ts +148 -0
  60. package/build/webrtc/WebRTCManager.d.ts.map +1 -0
  61. package/build/webrtc/WebRTCManager.js +383 -0
  62. package/build/webrtc/WebRTCManager.js.map +1 -0
  63. package/build/webrtc/index.d.ts +3 -1
  64. package/build/webrtc/index.d.ts.map +1 -1
  65. package/build/webrtc/index.js +5 -0
  66. package/build/webrtc/index.js.map +1 -1
  67. package/build/webrtc/types.d.ts +212 -4
  68. package/build/webrtc/types.d.ts.map +1 -1
  69. package/build/webrtc/types.js +34 -1
  70. package/build/webrtc/types.js.map +1 -1
  71. package/ios/FaceDetectorFrameProcessorPlugin.m +11 -0
  72. package/ios/FaceDetectorFrameProcessorPlugin.swift +304 -0
  73. package/package.json +13 -12
  74. package/react-native-smart-camera.podspec +32 -0
  75. package/src/detection/blinkProcessor.ts +127 -0
  76. package/src/detection/faceDetector.ts +78 -0
  77. package/src/detection/index.ts +3 -0
  78. package/src/detection/staticImageDetector.ts +53 -0
  79. package/src/hooks/index.ts +26 -0
  80. package/src/hooks/useBlinkDetection.ts +127 -0
  81. package/src/hooks/useFaceDetection.ts +105 -0
  82. package/src/hooks/useFaceDetector.ts +191 -0
  83. package/src/hooks/useSmartCamera.ts +83 -0
  84. package/src/hooks/useSmartCameraWebRTC.ts +120 -0
  85. package/src/hooks/useWebRTC.ts +453 -0
  86. package/src/hooks/useWebRTCWithDetection.ts +181 -0
  87. package/src/index.ts +170 -0
  88. package/src/types.ts +636 -0
  89. package/src/utils/index.ts +355 -0
  90. package/src/webrtc/WebRTCBridge.ts +127 -0
  91. package/src/webrtc/WebRTCManager.ts +453 -0
  92. package/src/webrtc/index.ts +50 -0
  93. package/src/webrtc/types.ts +361 -0
  94. package/android/src/main/java/expo/modules/smartcamera/ImageLoader.kt +0 -106
  95. package/android/src/main/java/expo/modules/smartcamera/MLKitFaceDetector.kt +0 -273
  96. package/android/src/main/java/expo/modules/smartcamera/SmartCameraModule.kt +0 -205
  97. package/android/src/main/java/expo/modules/smartcamera/SmartCameraView.kt +0 -153
  98. package/android/src/main/java/expo/modules/smartcamera/WebRTCFrameBridge.kt +0 -184
  99. package/build/SmartCamera.d.ts +0 -17
  100. package/build/SmartCamera.d.ts.map +0 -1
  101. package/build/SmartCamera.js +0 -270
  102. package/build/SmartCamera.js.map +0 -1
  103. package/build/SmartCameraModule.d.ts +0 -112
  104. package/build/SmartCameraModule.d.ts.map +0 -1
  105. package/build/SmartCameraModule.js +0 -121
  106. package/build/SmartCameraModule.js.map +0 -1
  107. package/build/SmartCameraView.d.ts +0 -8
  108. package/build/SmartCameraView.d.ts.map +0 -1
  109. package/build/SmartCameraView.js +0 -7
  110. package/build/SmartCameraView.js.map +0 -1
  111. package/expo-module.config.json +0 -9
  112. package/ios/MLKitFaceDetector.swift +0 -310
  113. package/ios/SmartCamera.podspec +0 -33
  114. package/ios/SmartCameraModule.swift +0 -225
  115. package/ios/SmartCameraView.swift +0 -146
  116. package/ios/WebRTCFrameBridge.swift +0 -150
package/src/index.ts ADDED
@@ -0,0 +1,170 @@
1
+ /**
2
+ * @arfuhad/react-native-smart-camera
3
+ *
4
+ * VisionCamera frame processor plugin for face detection, blink detection, and WebRTC streaming.
5
+ * API designed to match react-native-vision-camera-face-detector.
6
+ */
7
+
8
+ // =============================================================================
9
+ // PRIMARY EXPORTS (matching react-native-vision-camera-face-detector API)
10
+ // =============================================================================
11
+
12
+ // Frame processor function - use directly in useFrameProcessor
13
+ export { detectFaces, isFaceDetectorAvailable } from './detection/faceDetector';
14
+
15
+ // Hook for face detection (matches reference package API)
16
+ export {
17
+ useFaceDetector,
18
+ useFaceDetectorWithCallback,
19
+ type UseFaceDetectorOptions,
20
+ type UseFaceDetectorResult,
21
+ type UseFaceDetectorWithCallbackOptions,
22
+ type FaceDetectionCallback,
23
+ } from './hooks/useFaceDetector';
24
+
25
+ // =============================================================================
26
+ // TYPES (matching react-native-vision-camera-face-detector API)
27
+ // =============================================================================
28
+
29
+ export type {
30
+ // Face Detection Options
31
+ PerformanceMode,
32
+ LandmarkMode,
33
+ ContourMode,
34
+ ClassificationMode,
35
+ CameraFacing,
36
+ FaceDetectionOptions,
37
+ FrameProcessorOptions,
38
+ StaticImageOptions,
39
+ FaceDetectionConfig,
40
+
41
+ // Face Detection Results
42
+ Point,
43
+ Bounds,
44
+ FaceLandmarks,
45
+ ContourType,
46
+ FaceContours,
47
+ Face,
48
+
49
+ // Blink/Eye Detection
50
+ BlinkEvent,
51
+ EyeStatus,
52
+ EyeStatusResult,
53
+
54
+ // WebRTC (from main types)
55
+ WebRTCMode,
56
+ VideoConstraints as WebRTCVideoConstraintsLegacy,
57
+ WebRTCConfig,
58
+
59
+ // Component Props
60
+ SmartCameraProps,
61
+
62
+ // Error Handling
63
+ SmartCameraErrorCode,
64
+ SmartCameraError,
65
+
66
+ // Hook Return Types
67
+ UseSmartCameraWebRTCResult,
68
+ UseFaceDetectionResult,
69
+ UseBlinkDetectionResult,
70
+ UseSmartCameraResult,
71
+
72
+ // Camera Device
73
+ CameraDevice,
74
+
75
+ // Orientation
76
+ Orientation,
77
+ OutputOrientation,
78
+ } from './types';
79
+
80
+ // =============================================================================
81
+ // ADDITIONAL FEATURES (our package only)
82
+ // =============================================================================
83
+
84
+ // Blink/Eye detection
85
+ export { useBlinkDetection, type UseBlinkDetectionOptions } from './hooks/useBlinkDetection';
86
+ export { processBlinkFromFaces, resetBlinkStates, getEyeState } from './detection/blinkProcessor';
87
+
88
+ // Camera management hooks
89
+ export { useSmartCamera, getAvailableCameras } from './hooks/useSmartCamera';
90
+ export { useFaceDetection, type UseFaceDetectionOptions } from './hooks/useFaceDetection';
91
+
92
+ // Static image detection
93
+ export { detectFacesInImage } from './detection/staticImageDetector';
94
+
95
+ // Utilities
96
+ export {
97
+ createFpsLimiter,
98
+ debounce,
99
+ throttle,
100
+ createObjectPool,
101
+ createSmartCameraError,
102
+ safeExecute,
103
+ validateFaceDetectionOptions,
104
+ createPerformanceMonitor,
105
+ } from './utils';
106
+
107
+ // =============================================================================
108
+ // WEBRTC VIDEO CALLING (requires react-native-webrtc)
109
+ // =============================================================================
110
+
111
+ // Main WebRTC hook
112
+ export { useWebRTC } from './hooks/useWebRTC';
113
+ export type { UseWebRTCOptions, UseWebRTCResult } from './hooks/useWebRTC';
114
+
115
+ // Combined WebRTC + Face Detection hook
116
+ export { useWebRTCWithDetection } from './hooks/useWebRTCWithDetection';
117
+ export type { UseWebRTCWithDetectionOptions } from './hooks/useWebRTCWithDetection';
118
+ export type { UseWebRTCWithDetectionResult } from './hooks/useWebRTCWithDetection';
119
+
120
+ // WebRTC Manager class
121
+ export {
122
+ WebRTCManager,
123
+ getWebRTCManager,
124
+ createWebRTCManager,
125
+ isWebRTCAvailable,
126
+ } from './webrtc/WebRTCManager';
127
+
128
+ // WebRTC Types
129
+ export type {
130
+ // Core types
131
+ ICEServer,
132
+ PeerConnectionConfig,
133
+ VideoConstraints,
134
+ AudioConstraints,
135
+ MediaConstraints,
136
+
137
+ // State types
138
+ CallState,
139
+ WebRTCConnectionState,
140
+ ICEConnectionState,
141
+ ICEGatheringState,
142
+ SignalingState,
143
+
144
+ // Stream types
145
+ VideoFrameFormat,
146
+ WebRTCVideoSourceConfig,
147
+ WebRTCStreamStats,
148
+ WebRTCQualitySettings,
149
+
150
+ // Event types
151
+ WebRTCStreamEvent,
152
+ ICECandidateEvent,
153
+ SessionDescription,
154
+ } from './webrtc/types';
155
+
156
+ // Default configurations
157
+ export {
158
+ DEFAULT_ICE_SERVERS,
159
+ DEFAULT_PEER_CONNECTION_CONFIG,
160
+ DEFAULT_MEDIA_CONSTRAINTS,
161
+ } from './webrtc/types';
162
+
163
+ // =============================================================================
164
+ // LEGACY EXPORTS (deprecated - kept for backwards compatibility)
165
+ // =============================================================================
166
+
167
+ /** @deprecated Use useWebRTC instead */
168
+ export { useSmartCameraWebRTC, type UseSmartCameraWebRTCOptions } from './hooks/useSmartCameraWebRTC';
169
+ /** @deprecated Use WebRTCManager instead */
170
+ export { WebRTCBridge, getWebRTCBridge } from './webrtc';