@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.
- package/CHANGELOG.md +130 -0
- package/README.md +259 -206
- package/android/build.gradle +15 -33
- package/android/src/main/java/com/smartcamera/FaceDetectorFrameProcessorPlugin.kt +324 -0
- package/android/src/main/java/com/smartcamera/SmartCameraPackage.kt +28 -0
- package/build/detection/blinkProcessor.js +2 -1
- package/build/detection/blinkProcessor.js.map +1 -1
- package/build/detection/faceDetector.d.ts +4 -4
- package/build/detection/faceDetector.d.ts.map +1 -1
- package/build/detection/faceDetector.js +31 -11
- package/build/detection/faceDetector.js.map +1 -1
- package/build/detection/index.d.ts +1 -1
- package/build/detection/index.d.ts.map +1 -1
- package/build/detection/index.js +1 -1
- package/build/detection/index.js.map +1 -1
- package/build/detection/staticImageDetector.d.ts +11 -11
- package/build/detection/staticImageDetector.d.ts.map +1 -1
- package/build/detection/staticImageDetector.js +19 -23
- package/build/detection/staticImageDetector.js.map +1 -1
- package/build/hooks/index.d.ts +6 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +8 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/useBlinkDetection.d.ts +27 -16
- package/build/hooks/useBlinkDetection.d.ts.map +1 -1
- package/build/hooks/useBlinkDetection.js +63 -37
- package/build/hooks/useBlinkDetection.js.map +1 -1
- package/build/hooks/useFaceDetection.js +3 -2
- package/build/hooks/useFaceDetection.js.map +1 -1
- package/build/hooks/useFaceDetector.d.ts +123 -0
- package/build/hooks/useFaceDetector.d.ts.map +1 -0
- package/build/hooks/useFaceDetector.js +133 -0
- package/build/hooks/useFaceDetector.js.map +1 -0
- package/build/hooks/useSmartCamera.js.map +1 -1
- package/build/hooks/useSmartCameraWebRTC.d.ts +3 -5
- package/build/hooks/useSmartCameraWebRTC.d.ts.map +1 -1
- package/build/hooks/useSmartCameraWebRTC.js +19 -87
- package/build/hooks/useSmartCameraWebRTC.js.map +1 -1
- package/build/hooks/useWebRTC.d.ts +88 -0
- package/build/hooks/useWebRTC.d.ts.map +1 -0
- package/build/hooks/useWebRTC.js +394 -0
- package/build/hooks/useWebRTC.js.map +1 -0
- package/build/hooks/useWebRTCWithDetection.d.ts +89 -0
- package/build/hooks/useWebRTCWithDetection.d.ts.map +1 -0
- package/build/hooks/useWebRTCWithDetection.js +131 -0
- package/build/hooks/useWebRTCWithDetection.js.map +1 -0
- package/build/index.d.ts +24 -10
- package/build/index.d.ts.map +1 -1
- package/build/index.js +38 -13
- package/build/index.js.map +1 -1
- package/build/types.d.ts +28 -12
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/build/utils/index.js.map +1 -1
- package/build/webrtc/WebRTCBridge.d.ts +3 -0
- package/build/webrtc/WebRTCBridge.d.ts.map +1 -1
- package/build/webrtc/WebRTCBridge.js +12 -15
- package/build/webrtc/WebRTCBridge.js.map +1 -1
- package/build/webrtc/WebRTCManager.d.ts +148 -0
- package/build/webrtc/WebRTCManager.d.ts.map +1 -0
- package/build/webrtc/WebRTCManager.js +383 -0
- package/build/webrtc/WebRTCManager.js.map +1 -0
- package/build/webrtc/index.d.ts +3 -1
- package/build/webrtc/index.d.ts.map +1 -1
- package/build/webrtc/index.js +5 -0
- package/build/webrtc/index.js.map +1 -1
- package/build/webrtc/types.d.ts +212 -4
- package/build/webrtc/types.d.ts.map +1 -1
- package/build/webrtc/types.js +34 -1
- package/build/webrtc/types.js.map +1 -1
- package/ios/FaceDetectorFrameProcessorPlugin.m +11 -0
- package/ios/FaceDetectorFrameProcessorPlugin.swift +304 -0
- package/package.json +13 -12
- package/react-native-smart-camera.podspec +32 -0
- package/src/detection/blinkProcessor.ts +127 -0
- package/src/detection/faceDetector.ts +78 -0
- package/src/detection/index.ts +3 -0
- package/src/detection/staticImageDetector.ts +53 -0
- package/src/hooks/index.ts +26 -0
- package/src/hooks/useBlinkDetection.ts +127 -0
- package/src/hooks/useFaceDetection.ts +105 -0
- package/src/hooks/useFaceDetector.ts +191 -0
- package/src/hooks/useSmartCamera.ts +83 -0
- package/src/hooks/useSmartCameraWebRTC.ts +120 -0
- package/src/hooks/useWebRTC.ts +453 -0
- package/src/hooks/useWebRTCWithDetection.ts +181 -0
- package/src/index.ts +170 -0
- package/src/types.ts +636 -0
- package/src/utils/index.ts +355 -0
- package/src/webrtc/WebRTCBridge.ts +127 -0
- package/src/webrtc/WebRTCManager.ts +453 -0
- package/src/webrtc/index.ts +50 -0
- package/src/webrtc/types.ts +361 -0
- package/android/src/main/java/expo/modules/smartcamera/ImageLoader.kt +0 -106
- package/android/src/main/java/expo/modules/smartcamera/MLKitFaceDetector.kt +0 -273
- package/android/src/main/java/expo/modules/smartcamera/SmartCameraModule.kt +0 -205
- package/android/src/main/java/expo/modules/smartcamera/SmartCameraView.kt +0 -153
- package/android/src/main/java/expo/modules/smartcamera/WebRTCFrameBridge.kt +0 -184
- package/build/SmartCamera.d.ts +0 -17
- package/build/SmartCamera.d.ts.map +0 -1
- package/build/SmartCamera.js +0 -270
- package/build/SmartCamera.js.map +0 -1
- package/build/SmartCameraModule.d.ts +0 -112
- package/build/SmartCameraModule.d.ts.map +0 -1
- package/build/SmartCameraModule.js +0 -121
- package/build/SmartCameraModule.js.map +0 -1
- package/build/SmartCameraView.d.ts +0 -8
- package/build/SmartCameraView.d.ts.map +0 -1
- package/build/SmartCameraView.js +0 -7
- package/build/SmartCameraView.js.map +0 -1
- package/expo-module.config.json +0 -9
- package/ios/MLKitFaceDetector.swift +0 -310
- package/ios/SmartCamera.podspec +0 -33
- package/ios/SmartCameraModule.swift +0 -225
- package/ios/SmartCameraView.swift +0 -146
- 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';
|