@arfuhad/react-native-smart-camera 0.1.2 → 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 +75 -3
- package/README.md +259 -206
- package/android/build.gradle +14 -39
- 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 +11 -11
- 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/build/.transforms/e0a0b120a9ccc3a8de4f5784bc36b161/results.bin +0 -1
- package/android/build/.transforms/e0a0b120a9ccc3a8de4f5784bc36b161/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/generated/source/buildConfig/debug/expo/modules/smartcamera/BuildConfig.java +0 -10
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -7
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
- package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -6
- package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
- package/android/build/intermediates/java_res/debug/out/META-INF/arfuhad-react-native-smart-camera_debug.kotlin_module +0 -0
- package/android/build/intermediates/javac/debug/classes/expo/modules/smartcamera/BuildConfig.class +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -2
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -7
- package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -7
- package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -16
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/META-INF/arfuhad-react-native-smart-camera_debug.kotlin_module +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/DetectedFace.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceBounds.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceContoursData.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceDetectionOptions.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceLandmarksData.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/ImageLoader$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/ImageLoader$loadImage$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/ImageLoader.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetector$detectFaces$2$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetector$detectFaces$2$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetector.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetectorKt$sam$com_google_android_gms_tasks_OnSuccessListener$0.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetectorKt.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/PointData.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$1$1$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$1$3$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$1$4$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunction$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunction$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunction$3.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$3.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$4.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$3.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$4.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$FunctionWithoutArgs$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$FunctionWithoutArgs$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$OnActivityEntersBackground$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$OnActivityEntersForeground$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$OnDestroy$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraView.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/WebRTCFrameBridge$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/WebRTCFrameBridge.class +0 -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/build/SmartCamera.js
DELETED
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useMemo, useState } from 'react';
|
|
2
|
-
import { StyleSheet, View, AppState, useWindowDimensions } from 'react-native';
|
|
3
|
-
import { Camera, useCameraDevice, useCameraPermission, useFrameProcessor, } from 'react-native-vision-camera';
|
|
4
|
-
import { useSharedValue, useRunOnJS } from 'react-native-worklets-core';
|
|
5
|
-
import { detectFaces } from './detection/faceDetector';
|
|
6
|
-
// Default values for face detection options
|
|
7
|
-
const DEFAULT_FACE_DETECTION_OPTIONS = {
|
|
8
|
-
performanceMode: 'fast',
|
|
9
|
-
landmarkMode: 'none',
|
|
10
|
-
contourMode: 'none',
|
|
11
|
-
classificationMode: 'none',
|
|
12
|
-
minFaceSize: 0.15,
|
|
13
|
-
trackingEnabled: false,
|
|
14
|
-
cameraFacing: 'front',
|
|
15
|
-
autoMode: false,
|
|
16
|
-
windowWidth: 1.0,
|
|
17
|
-
windowHeight: 1.0,
|
|
18
|
-
};
|
|
19
|
-
// Minimum time between blink detections (ms)
|
|
20
|
-
const BLINK_DEBOUNCE_MS = 300;
|
|
21
|
-
// Eye open probability threshold for blink detection
|
|
22
|
-
const EYE_CLOSED_THRESHOLD = 0.3;
|
|
23
|
-
const EYE_OPEN_THRESHOLD = 0.7;
|
|
24
|
-
/**
|
|
25
|
-
* SmartCamera component - A camera component with face detection,
|
|
26
|
-
* blink detection, and WebRTC streaming capabilities.
|
|
27
|
-
*
|
|
28
|
-
* Features:
|
|
29
|
-
* - VisionCamera integration with frame processing
|
|
30
|
-
* - Real-time face detection with ML Kit
|
|
31
|
-
* - Blink detection with debouncing
|
|
32
|
-
* - App lifecycle management (background/foreground)
|
|
33
|
-
* - Orientation handling
|
|
34
|
-
* - WebRTC streaming support
|
|
35
|
-
*/
|
|
36
|
-
export function SmartCamera({ camera = 'front', fps = 30, style, faceDetection, blinkDetection = false, onBlinkDetected, onFaceDetected, webrtc, isActive = true, onReady, onError, }) {
|
|
37
|
-
// Camera permission
|
|
38
|
-
const { hasPermission, requestPermission } = useCameraPermission();
|
|
39
|
-
// Camera device
|
|
40
|
-
const device = useCameraDevice(camera);
|
|
41
|
-
// Window dimensions for autoMode
|
|
42
|
-
const { width: windowWidth, height: windowHeight } = useWindowDimensions();
|
|
43
|
-
// App state for lifecycle management
|
|
44
|
-
const [appState, setAppState] = useState(AppState.currentState);
|
|
45
|
-
const [isCameraActive, setIsCameraActive] = useState(isActive);
|
|
46
|
-
// Track if component is mounted
|
|
47
|
-
const isMounted = useRef(true);
|
|
48
|
-
// Blink state tracking
|
|
49
|
-
const blinkState = useRef({
|
|
50
|
-
lastLeftEyeOpen: 1,
|
|
51
|
-
lastRightEyeOpen: 1,
|
|
52
|
-
lastBlinkTime: 0,
|
|
53
|
-
});
|
|
54
|
-
// Shared values for frame processor communication
|
|
55
|
-
const detectedFaces = useSharedValue([]);
|
|
56
|
-
// Camera ref for imperative operations
|
|
57
|
-
const cameraRef = useRef(null);
|
|
58
|
-
// Frame count for FPS limiting
|
|
59
|
-
const frameCount = useRef(0);
|
|
60
|
-
const lastFrameTime = useRef(Date.now());
|
|
61
|
-
// Merge face detection options with defaults and window dimensions
|
|
62
|
-
const faceDetectionOptions = useMemo(() => ({
|
|
63
|
-
...DEFAULT_FACE_DETECTION_OPTIONS,
|
|
64
|
-
...faceDetection,
|
|
65
|
-
cameraFacing: camera,
|
|
66
|
-
// Enable classification mode if blink detection is enabled
|
|
67
|
-
classificationMode: blinkDetection ? 'all' : faceDetection?.classificationMode ?? 'none',
|
|
68
|
-
// Auto-populate window dimensions if autoMode is enabled
|
|
69
|
-
windowWidth: faceDetection?.autoMode ? (faceDetection.windowWidth ?? windowWidth) : 1.0,
|
|
70
|
-
windowHeight: faceDetection?.autoMode ? (faceDetection.windowHeight ?? windowHeight) : 1.0,
|
|
71
|
-
}), [faceDetection, camera, blinkDetection, windowWidth, windowHeight]);
|
|
72
|
-
// Handle app state changes (background/foreground)
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
const subscription = AppState.addEventListener('change', (nextAppState) => {
|
|
75
|
-
if (!isMounted.current)
|
|
76
|
-
return;
|
|
77
|
-
setAppState(nextAppState);
|
|
78
|
-
// Deactivate camera when app goes to background
|
|
79
|
-
if (nextAppState === 'background' || nextAppState === 'inactive') {
|
|
80
|
-
setIsCameraActive(false);
|
|
81
|
-
}
|
|
82
|
-
else if (nextAppState === 'active' && isActive) {
|
|
83
|
-
// Reactivate camera when app comes to foreground
|
|
84
|
-
setIsCameraActive(true);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
return () => {
|
|
88
|
-
subscription.remove();
|
|
89
|
-
};
|
|
90
|
-
}, [isActive]);
|
|
91
|
-
// Sync camera active state with prop
|
|
92
|
-
useEffect(() => {
|
|
93
|
-
if (appState === 'active') {
|
|
94
|
-
setIsCameraActive(isActive);
|
|
95
|
-
}
|
|
96
|
-
}, [isActive, appState]);
|
|
97
|
-
// Cleanup on unmount
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
isMounted.current = true;
|
|
100
|
-
return () => {
|
|
101
|
-
isMounted.current = false;
|
|
102
|
-
// Reset blink state
|
|
103
|
-
blinkState.current = {
|
|
104
|
-
lastLeftEyeOpen: 1,
|
|
105
|
-
lastRightEyeOpen: 1,
|
|
106
|
-
lastBlinkTime: 0,
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
}, []);
|
|
110
|
-
// Request camera permission on mount
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
if (!hasPermission) {
|
|
113
|
-
requestPermission().then((granted) => {
|
|
114
|
-
if (!granted && onError && isMounted.current) {
|
|
115
|
-
onError({
|
|
116
|
-
code: 'PERMISSION_DENIED',
|
|
117
|
-
message: 'Camera permission was denied',
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
}, [hasPermission, requestPermission, onError]);
|
|
123
|
-
// Handle device not available
|
|
124
|
-
useEffect(() => {
|
|
125
|
-
if (!device && onError && isMounted.current) {
|
|
126
|
-
onError({
|
|
127
|
-
code: 'CAMERA_UNAVAILABLE',
|
|
128
|
-
message: `${camera} camera is not available on this device`,
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}, [device, camera, onError]);
|
|
132
|
-
// Process blink detection
|
|
133
|
-
const processBlink = useCallback((faces) => {
|
|
134
|
-
if (!blinkDetection || !onBlinkDetected || faces.length === 0) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
const face = faces[0]; // Use the first detected face
|
|
138
|
-
const leftEyeOpen = face.leftEyeOpenProbability ?? 1;
|
|
139
|
-
const rightEyeOpen = face.rightEyeOpenProbability ?? 1;
|
|
140
|
-
const now = Date.now();
|
|
141
|
-
const state = blinkState.current;
|
|
142
|
-
// Detect blink: eyes were open, now closed, or were closed, now open
|
|
143
|
-
const wasLeftEyeOpen = state.lastLeftEyeOpen > EYE_OPEN_THRESHOLD;
|
|
144
|
-
const wasRightEyeOpen = state.lastRightEyeOpen > EYE_OPEN_THRESHOLD;
|
|
145
|
-
const isLeftEyeClosed = leftEyeOpen < EYE_CLOSED_THRESHOLD;
|
|
146
|
-
const isRightEyeClosed = rightEyeOpen < EYE_CLOSED_THRESHOLD;
|
|
147
|
-
const isBlink = (wasLeftEyeOpen && isLeftEyeClosed) ||
|
|
148
|
-
(wasRightEyeOpen && isRightEyeClosed);
|
|
149
|
-
// Check debounce
|
|
150
|
-
if (isBlink && now - state.lastBlinkTime > BLINK_DEBOUNCE_MS) {
|
|
151
|
-
const blinkEvent = {
|
|
152
|
-
timestamp: now,
|
|
153
|
-
leftEyeOpen,
|
|
154
|
-
rightEyeOpen,
|
|
155
|
-
isBlink: true,
|
|
156
|
-
faceId: face.trackingId,
|
|
157
|
-
};
|
|
158
|
-
onBlinkDetected(blinkEvent);
|
|
159
|
-
state.lastBlinkTime = now;
|
|
160
|
-
}
|
|
161
|
-
// Update state
|
|
162
|
-
state.lastLeftEyeOpen = leftEyeOpen;
|
|
163
|
-
state.lastRightEyeOpen = rightEyeOpen;
|
|
164
|
-
}, [blinkDetection, onBlinkDetected]);
|
|
165
|
-
// Handle face detection results
|
|
166
|
-
const handleFacesDetected = useCallback((faces) => {
|
|
167
|
-
if (!isMounted.current)
|
|
168
|
-
return;
|
|
169
|
-
if (onFaceDetected) {
|
|
170
|
-
onFaceDetected(faces);
|
|
171
|
-
}
|
|
172
|
-
processBlink(faces);
|
|
173
|
-
}, [onFaceDetected, processBlink]);
|
|
174
|
-
// Create a worklet-callable version of handleFacesDetected
|
|
175
|
-
const handleFacesDetectedWorklet = useRunOnJS(handleFacesDetected, [handleFacesDetected]);
|
|
176
|
-
// Frame processor for face detection
|
|
177
|
-
const frameProcessor = useFrameProcessor((frame) => {
|
|
178
|
-
'worklet';
|
|
179
|
-
// Skip if face detection is not enabled
|
|
180
|
-
if (!faceDetection?.enabled && !blinkDetection) {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
// FPS limiting - process every N frames based on target FPS
|
|
184
|
-
// VisionCamera typically runs at 30fps, so we may want to skip frames
|
|
185
|
-
const targetFps = faceDetection?.performanceMode === 'accurate' ? 15 : 30;
|
|
186
|
-
const skipFrames = Math.max(1, Math.floor(30 / targetFps));
|
|
187
|
-
// Simple frame skipping
|
|
188
|
-
const currentFrame = Date.now();
|
|
189
|
-
const frameInterval = 1000 / targetFps;
|
|
190
|
-
// Call native face detection
|
|
191
|
-
try {
|
|
192
|
-
const faces = detectFaces(frame, faceDetectionOptions);
|
|
193
|
-
handleFacesDetectedWorklet(faces);
|
|
194
|
-
}
|
|
195
|
-
catch (error) {
|
|
196
|
-
// Silently handle errors in worklet context
|
|
197
|
-
}
|
|
198
|
-
}, [faceDetection?.enabled, blinkDetection, faceDetectionOptions, handleFacesDetectedWorklet]);
|
|
199
|
-
// Handle camera ready
|
|
200
|
-
const handleCameraReady = useCallback(() => {
|
|
201
|
-
if (isMounted.current) {
|
|
202
|
-
onReady?.();
|
|
203
|
-
}
|
|
204
|
-
}, [onReady]);
|
|
205
|
-
// Handle camera error
|
|
206
|
-
const handleCameraError = useCallback((error) => {
|
|
207
|
-
if (isMounted.current) {
|
|
208
|
-
onError?.({
|
|
209
|
-
code: 'UNKNOWN_ERROR',
|
|
210
|
-
message: error.message,
|
|
211
|
-
nativeError: error,
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
}, [onError]);
|
|
215
|
-
// Render loading state if no permission
|
|
216
|
-
if (!hasPermission) {
|
|
217
|
-
return (<View style={[styles.container, style]}>
|
|
218
|
-
<View style={styles.placeholder}/>
|
|
219
|
-
</View>);
|
|
220
|
-
}
|
|
221
|
-
// Render placeholder if no device
|
|
222
|
-
if (!device) {
|
|
223
|
-
return (<View style={[styles.container, style]}>
|
|
224
|
-
<View style={styles.placeholder}/>
|
|
225
|
-
</View>);
|
|
226
|
-
}
|
|
227
|
-
// Determine orientation based on device orientation
|
|
228
|
-
// In VisionCamera v4, OutputOrientation is 'device' | 'preview'
|
|
229
|
-
const getOutputOrientation = () => {
|
|
230
|
-
// 'device' follows the device's physical orientation
|
|
231
|
-
return 'device';
|
|
232
|
-
};
|
|
233
|
-
// Camera props with full configuration
|
|
234
|
-
const cameraProps = {
|
|
235
|
-
style: StyleSheet.absoluteFill,
|
|
236
|
-
device,
|
|
237
|
-
isActive: isCameraActive,
|
|
238
|
-
fps,
|
|
239
|
-
onInitialized: handleCameraReady,
|
|
240
|
-
onError: handleCameraError,
|
|
241
|
-
// Enable photo/video for potential future features
|
|
242
|
-
photo: false,
|
|
243
|
-
video: webrtc?.enabled ?? false,
|
|
244
|
-
audio: webrtc?.enabled ?? false,
|
|
245
|
-
// Orientation handling
|
|
246
|
-
outputOrientation: getOutputOrientation(),
|
|
247
|
-
// Performance optimizations
|
|
248
|
-
enableZoomGesture: false,
|
|
249
|
-
exposure: 0,
|
|
250
|
-
};
|
|
251
|
-
// Add frame processor if face/blink detection is enabled
|
|
252
|
-
if (faceDetection?.enabled || blinkDetection) {
|
|
253
|
-
cameraProps.frameProcessor = frameProcessor;
|
|
254
|
-
}
|
|
255
|
-
return (<View style={[styles.container, style]}>
|
|
256
|
-
<Camera ref={cameraRef} {...cameraProps}/>
|
|
257
|
-
</View>);
|
|
258
|
-
}
|
|
259
|
-
const styles = StyleSheet.create({
|
|
260
|
-
container: {
|
|
261
|
-
flex: 1,
|
|
262
|
-
backgroundColor: '#000',
|
|
263
|
-
},
|
|
264
|
-
placeholder: {
|
|
265
|
-
flex: 1,
|
|
266
|
-
backgroundColor: '#1a1a1a',
|
|
267
|
-
},
|
|
268
|
-
});
|
|
269
|
-
export default SmartCamera;
|
|
270
|
-
//# sourceMappingURL=SmartCamera.js.map
|
package/build/SmartCamera.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SmartCamera.js","sourceRoot":"","sources":["../src/SmartCamera.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAuB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EACL,MAAM,EACN,eAAe,EACf,mBAAmB,EACnB,iBAAiB,GAElB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AASxE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,4CAA4C;AAC5C,MAAM,8BAA8B,GAA0B;IAC5D,eAA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AAC,CAAC,IAAI,WAAW,CAAC,EAC1C;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;QACP,eAAe,EAAE,MAAM;KACxB;IACD,WAAW,EAAE;QACX,IAAI,EAAE,CAAC;QACP,eAAe,EAAE,SAAS;KAC3B;CACF,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import React, { useCallback, useEffect, useRef, useMemo, useState } from 'react';\nimport { StyleSheet, View, AppState, type AppStateStatus, useWindowDimensions } from 'react-native';\nimport {\n Camera,\n useCameraDevice,\n useCameraPermission,\n useFrameProcessor,\n type CameraProps,\n} from 'react-native-vision-camera';\nimport { useSharedValue, useRunOnJS } from 'react-native-worklets-core';\n\nimport type {\n SmartCameraProps,\n Face,\n BlinkEvent,\n FrameProcessorOptions,\n SmartCameraError,\n} from './types';\nimport { detectFaces } from './detection/faceDetector';\n\n// Default values for face detection options\nconst DEFAULT_FACE_DETECTION_OPTIONS: FrameProcessorOptions = {\n performanceMode: 'fast',\n landmarkMode: 'none',\n contourMode: 'none',\n classificationMode: 'none',\n minFaceSize: 0.15,\n trackingEnabled: false,\n cameraFacing: 'front',\n autoMode: false,\n windowWidth: 1.0,\n windowHeight: 1.0,\n};\n\n// Blink detection state\ninterface BlinkState {\n lastLeftEyeOpen: number;\n lastRightEyeOpen: number;\n lastBlinkTime: number;\n}\n\n// Minimum time between blink detections (ms)\nconst BLINK_DEBOUNCE_MS = 300;\n\n// Eye open probability threshold for blink detection\nconst EYE_CLOSED_THRESHOLD = 0.3;\nconst EYE_OPEN_THRESHOLD = 0.7;\n\n/**\n * SmartCamera component - A camera component with face detection,\n * blink detection, and WebRTC streaming capabilities.\n * \n * Features:\n * - VisionCamera integration with frame processing\n * - Real-time face detection with ML Kit\n * - Blink detection with debouncing\n * - App lifecycle management (background/foreground)\n * - Orientation handling\n * - WebRTC streaming support\n */\nexport function SmartCamera({\n camera = 'front',\n fps = 30,\n style,\n faceDetection,\n blinkDetection = false,\n onBlinkDetected,\n onFaceDetected,\n webrtc,\n isActive = true,\n onReady,\n onError,\n}: SmartCameraProps) {\n // Camera permission\n const { hasPermission, requestPermission } = useCameraPermission();\n\n // Camera device\n const device = useCameraDevice(camera);\n\n // Window dimensions for autoMode\n const { width: windowWidth, height: windowHeight } = useWindowDimensions();\n\n // App state for lifecycle management\n const [appState, setAppState] = useState<AppStateStatus>(AppState.currentState);\n const [isCameraActive, setIsCameraActive] = useState(isActive);\n\n // Track if component is mounted\n const isMounted = useRef(true);\n\n // Blink state tracking\n const blinkState = useRef<BlinkState>({\n lastLeftEyeOpen: 1,\n lastRightEyeOpen: 1,\n lastBlinkTime: 0,\n });\n\n // Shared values for frame processor communication\n const detectedFaces = useSharedValue<Face[]>([]);\n\n // Camera ref for imperative operations\n const cameraRef = useRef<Camera>(null);\n\n // Frame count for FPS limiting\n const frameCount = useRef(0);\n const lastFrameTime = useRef(Date.now());\n\n // Merge face detection options with defaults and window dimensions\n const faceDetectionOptions = useMemo<FrameProcessorOptions>(() => ({\n ...DEFAULT_FACE_DETECTION_OPTIONS,\n ...faceDetection,\n cameraFacing: camera,\n // Enable classification mode if blink detection is enabled\n classificationMode: blinkDetection ? 'all' : faceDetection?.classificationMode ?? 'none',\n // Auto-populate window dimensions if autoMode is enabled\n windowWidth: faceDetection?.autoMode ? (faceDetection.windowWidth ?? windowWidth) : 1.0,\n windowHeight: faceDetection?.autoMode ? (faceDetection.windowHeight ?? windowHeight) : 1.0,\n }), [faceDetection, camera, blinkDetection, windowWidth, windowHeight]);\n\n // Handle app state changes (background/foreground)\n useEffect(() => {\n const subscription = AppState.addEventListener('change', (nextAppState: AppStateStatus) => {\n if (!isMounted.current) return;\n\n setAppState(nextAppState);\n\n // Deactivate camera when app goes to background\n if (nextAppState === 'background' || nextAppState === 'inactive') {\n setIsCameraActive(false);\n } else if (nextAppState === 'active' && isActive) {\n // Reactivate camera when app comes to foreground\n setIsCameraActive(true);\n }\n });\n\n return () => {\n subscription.remove();\n };\n }, [isActive]);\n\n // Sync camera active state with prop\n useEffect(() => {\n if (appState === 'active') {\n setIsCameraActive(isActive);\n }\n }, [isActive, appState]);\n\n // Cleanup on unmount\n useEffect(() => {\n isMounted.current = true;\n\n return () => {\n isMounted.current = false;\n // Reset blink state\n blinkState.current = {\n lastLeftEyeOpen: 1,\n lastRightEyeOpen: 1,\n lastBlinkTime: 0,\n };\n };\n }, []);\n\n // Request camera permission on mount\n useEffect(() => {\n if (!hasPermission) {\n requestPermission().then((granted) => {\n if (!granted && onError && isMounted.current) {\n onError({\n code: 'PERMISSION_DENIED',\n message: 'Camera permission was denied',\n });\n }\n });\n }\n }, [hasPermission, requestPermission, onError]);\n\n // Handle device not available\n useEffect(() => {\n if (!device && onError && isMounted.current) {\n onError({\n code: 'CAMERA_UNAVAILABLE',\n message: `${camera} camera is not available on this device`,\n });\n }\n }, [device, camera, onError]);\n\n // Process blink detection\n const processBlink = useCallback((faces: Face[]) => {\n if (!blinkDetection || !onBlinkDetected || faces.length === 0) {\n return;\n }\n\n const face = faces[0]; // Use the first detected face\n const leftEyeOpen = face.leftEyeOpenProbability ?? 1;\n const rightEyeOpen = face.rightEyeOpenProbability ?? 1;\n\n const now = Date.now();\n const state = blinkState.current;\n\n // Detect blink: eyes were open, now closed, or were closed, now open\n const wasLeftEyeOpen = state.lastLeftEyeOpen > EYE_OPEN_THRESHOLD;\n const wasRightEyeOpen = state.lastRightEyeOpen > EYE_OPEN_THRESHOLD;\n const isLeftEyeClosed = leftEyeOpen < EYE_CLOSED_THRESHOLD;\n const isRightEyeClosed = rightEyeOpen < EYE_CLOSED_THRESHOLD;\n\n const isBlink =\n (wasLeftEyeOpen && isLeftEyeClosed) ||\n (wasRightEyeOpen && isRightEyeClosed);\n\n // Check debounce\n if (isBlink && now - state.lastBlinkTime > BLINK_DEBOUNCE_MS) {\n const blinkEvent: BlinkEvent = {\n timestamp: now,\n leftEyeOpen,\n rightEyeOpen,\n isBlink: true,\n faceId: face.trackingId,\n };\n\n onBlinkDetected(blinkEvent);\n state.lastBlinkTime = now;\n }\n\n // Update state\n state.lastLeftEyeOpen = leftEyeOpen;\n state.lastRightEyeOpen = rightEyeOpen;\n }, [blinkDetection, onBlinkDetected]);\n\n // Handle face detection results\n const handleFacesDetected = useCallback((faces: Face[]) => {\n if (!isMounted.current) return;\n\n if (onFaceDetected) {\n onFaceDetected(faces);\n }\n processBlink(faces);\n }, [onFaceDetected, processBlink]);\n\n // Create a worklet-callable version of handleFacesDetected\n const handleFacesDetectedWorklet = useRunOnJS(handleFacesDetected, [handleFacesDetected]);\n\n // Frame processor for face detection\n const frameProcessor = useFrameProcessor((frame) => {\n 'worklet';\n\n // Skip if face detection is not enabled\n if (!faceDetection?.enabled && !blinkDetection) {\n return;\n }\n\n // FPS limiting - process every N frames based on target FPS\n // VisionCamera typically runs at 30fps, so we may want to skip frames\n const targetFps = faceDetection?.performanceMode === 'accurate' ? 15 : 30;\n const skipFrames = Math.max(1, Math.floor(30 / targetFps));\n \n // Simple frame skipping\n const currentFrame = Date.now();\n const frameInterval = 1000 / targetFps;\n \n // Call native face detection\n try {\n const faces = detectFaces(frame, faceDetectionOptions);\n handleFacesDetectedWorklet(faces);\n } catch (error) {\n // Silently handle errors in worklet context\n }\n }, [faceDetection?.enabled, blinkDetection, faceDetectionOptions, handleFacesDetectedWorklet]);\n\n // Handle camera ready\n const handleCameraReady = useCallback(() => {\n if (isMounted.current) {\n onReady?.();\n }\n }, [onReady]);\n\n // Handle camera error\n const handleCameraError = useCallback((error: Error) => {\n if (isMounted.current) {\n onError?.({\n code: 'UNKNOWN_ERROR',\n message: error.message,\n nativeError: error,\n });\n }\n }, [onError]);\n\n // Render loading state if no permission\n if (!hasPermission) {\n return (\n <View style={[styles.container, style]}>\n <View style={styles.placeholder} />\n </View>\n );\n }\n\n // Render placeholder if no device\n if (!device) {\n return (\n <View style={[styles.container, style]}>\n <View style={styles.placeholder} />\n </View>\n );\n }\n\n // Determine orientation based on device orientation\n // In VisionCamera v4, OutputOrientation is 'device' | 'preview'\n const getOutputOrientation = (): 'device' | 'preview' => {\n // 'device' follows the device's physical orientation\n return 'device';\n };\n\n // Camera props with full configuration\n const cameraProps: CameraProps = {\n style: StyleSheet.absoluteFill,\n device,\n isActive: isCameraActive,\n fps,\n onInitialized: handleCameraReady,\n onError: handleCameraError,\n // Enable photo/video for potential future features\n photo: false,\n video: webrtc?.enabled ?? false,\n audio: webrtc?.enabled ?? false,\n // Orientation handling\n outputOrientation: getOutputOrientation(),\n // Performance optimizations\n enableZoomGesture: false,\n exposure: 0,\n };\n\n // Add frame processor if face/blink detection is enabled\n if (faceDetection?.enabled || blinkDetection) {\n cameraProps.frameProcessor = frameProcessor;\n }\n\n return (\n <View style={[styles.container, style]}>\n <Camera ref={cameraRef} {...cameraProps} />\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: '#000',\n },\n placeholder: {\n flex: 1,\n backgroundColor: '#1a1a1a',\n },\n});\n\nexport default SmartCamera;\n"]}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import type { Face, StaticImageOptions, VideoConstraints } from './types';
|
|
2
|
-
interface SmartCameraModuleInterface {
|
|
3
|
-
detectFacesInImage(options: StaticImageOptions): Promise<Face[]>;
|
|
4
|
-
updateFaceDetectionOptions(options: Record<string, unknown>): void;
|
|
5
|
-
initializeWebRTC(): Promise<boolean>;
|
|
6
|
-
startWebRTCStream(constraints: VideoConstraints): Promise<boolean>;
|
|
7
|
-
stopWebRTCStream(): void;
|
|
8
|
-
pushWebRTCFrame(frameData: Record<string, unknown>): void;
|
|
9
|
-
isWebRTCStreaming(): boolean;
|
|
10
|
-
readonly PI: number;
|
|
11
|
-
readonly DEFAULT_MIN_FACE_SIZE: number;
|
|
12
|
-
readonly EYE_CLOSED_THRESHOLD: number;
|
|
13
|
-
readonly EYE_OPEN_THRESHOLD: number;
|
|
14
|
-
__expo_module_name__?: string;
|
|
15
|
-
startObserving?: () => void;
|
|
16
|
-
stopObserving?: () => void;
|
|
17
|
-
addListener?: unknown;
|
|
18
|
-
removeListeners?: unknown;
|
|
19
|
-
[key: string]: unknown;
|
|
20
|
-
}
|
|
21
|
-
declare const SmartCameraModule: SmartCameraModuleInterface;
|
|
22
|
-
/**
|
|
23
|
-
* Detect faces in a static image
|
|
24
|
-
* @param options - Static image options including the image source and detection settings
|
|
25
|
-
* @returns Promise resolving to an array of detected faces
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```tsx
|
|
29
|
-
* const faces = await detectFacesInImage({
|
|
30
|
-
* image: { uri: 'https://example.com/photo.jpg' },
|
|
31
|
-
* performanceMode: 'accurate',
|
|
32
|
-
* landmarkMode: 'all',
|
|
33
|
-
* });
|
|
34
|
-
* console.log(`Detected ${faces.length} faces`);
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare function detectFacesInImage(options: StaticImageOptions): Promise<Face[]>;
|
|
38
|
-
/**
|
|
39
|
-
* Update face detection options at runtime
|
|
40
|
-
* @param options - New face detection options
|
|
41
|
-
*/
|
|
42
|
-
export declare function updateFaceDetectionOptions(options: Record<string, unknown>): void;
|
|
43
|
-
/**
|
|
44
|
-
* Initialize WebRTC for streaming
|
|
45
|
-
* Must be called before startWebRTCStream
|
|
46
|
-
* @returns Promise resolving to true if initialized successfully
|
|
47
|
-
*/
|
|
48
|
-
export declare function initializeWebRTC(): Promise<boolean>;
|
|
49
|
-
/**
|
|
50
|
-
* Start WebRTC video streaming
|
|
51
|
-
* @param constraints - Video constraints (width, height, frameRate)
|
|
52
|
-
* @returns Promise resolving to true if started successfully
|
|
53
|
-
*/
|
|
54
|
-
export declare function startWebRTCStream(constraints: VideoConstraints): Promise<boolean>;
|
|
55
|
-
/**
|
|
56
|
-
* Stop WebRTC video streaming
|
|
57
|
-
*/
|
|
58
|
-
export declare function stopWebRTCStream(): void;
|
|
59
|
-
/**
|
|
60
|
-
* Push a frame to the WebRTC stream
|
|
61
|
-
* @param frameData - Frame data to push
|
|
62
|
-
*/
|
|
63
|
-
export declare function pushWebRTCFrame(frameData: Record<string, unknown>): void;
|
|
64
|
-
/**
|
|
65
|
-
* Check if WebRTC is currently streaming
|
|
66
|
-
* @returns true if streaming, false otherwise
|
|
67
|
-
*/
|
|
68
|
-
export declare function isWebRTCStreaming(): boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Subscribe to face detection events from native module
|
|
71
|
-
* @param listener - Callback function for face detection events
|
|
72
|
-
* @returns Subscription object with remove method
|
|
73
|
-
*/
|
|
74
|
-
export declare function addFaceDetectionListener(listener: (faces: Face[]) => void): import("expo-modules-core").Subscription;
|
|
75
|
-
/**
|
|
76
|
-
* Subscribe to blink detection events from native module
|
|
77
|
-
* @param listener - Callback function for blink events
|
|
78
|
-
* @returns Subscription object with remove method
|
|
79
|
-
*/
|
|
80
|
-
export declare function addBlinkDetectionListener(listener: (event: {
|
|
81
|
-
leftEyeOpen: number;
|
|
82
|
-
rightEyeOpen: number;
|
|
83
|
-
isBlink: boolean;
|
|
84
|
-
}) => void): import("expo-modules-core").Subscription;
|
|
85
|
-
/**
|
|
86
|
-
* Subscribe to error events from native module
|
|
87
|
-
* @param listener - Callback function for error events
|
|
88
|
-
* @returns Subscription object with remove method
|
|
89
|
-
*/
|
|
90
|
-
export declare function addErrorListener(listener: (error: {
|
|
91
|
-
code: string;
|
|
92
|
-
message: string;
|
|
93
|
-
}) => void): import("expo-modules-core").Subscription;
|
|
94
|
-
/**
|
|
95
|
-
* Subscribe to WebRTC state change events
|
|
96
|
-
* @param listener - Callback function for WebRTC state changes
|
|
97
|
-
* @returns Subscription object with remove method
|
|
98
|
-
*/
|
|
99
|
-
export declare function addWebRTCStateChangeListener(listener: (state: {
|
|
100
|
-
isStreaming: boolean;
|
|
101
|
-
}) => void): import("expo-modules-core").Subscription;
|
|
102
|
-
/**
|
|
103
|
-
* Module constants
|
|
104
|
-
*/
|
|
105
|
-
export declare const Constants: {
|
|
106
|
-
PI: number;
|
|
107
|
-
DEFAULT_MIN_FACE_SIZE: number;
|
|
108
|
-
EYE_CLOSED_THRESHOLD: number;
|
|
109
|
-
EYE_OPEN_THRESHOLD: number;
|
|
110
|
-
};
|
|
111
|
-
export default SmartCameraModule;
|
|
112
|
-
//# sourceMappingURL=SmartCameraModule.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SmartCameraModule.d.ts","sourceRoot":"","sources":["../src/SmartCameraModule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG1E,UAAU,0BAA0B;IAElC,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAGjE,0BAA0B,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAGnE,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC,iBAAiB,CAAC,WAAW,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,gBAAgB,IAAI,IAAI,CAAC;IACzB,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1D,iBAAiB,IAAI,OAAO,CAAC;IAG7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IAGpC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MA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AE,KAAK,IAAI,4CAE5F;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,4CAE/F;AAMD;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;CAKrB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { requireNativeModule, EventEmitter } from 'expo-modules-core';
|
|
2
|
-
// Require the native module
|
|
3
|
-
const SmartCameraModule = requireNativeModule('SmartCameraModule');
|
|
4
|
-
// Create an event emitter for native events
|
|
5
|
-
const emitter = new EventEmitter(SmartCameraModule);
|
|
6
|
-
// ============================================================================
|
|
7
|
-
// Face Detection Functions
|
|
8
|
-
// ============================================================================
|
|
9
|
-
/**
|
|
10
|
-
* Detect faces in a static image
|
|
11
|
-
* @param options - Static image options including the image source and detection settings
|
|
12
|
-
* @returns Promise resolving to an array of detected faces
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* const faces = await detectFacesInImage({
|
|
17
|
-
* image: { uri: 'https://example.com/photo.jpg' },
|
|
18
|
-
* performanceMode: 'accurate',
|
|
19
|
-
* landmarkMode: 'all',
|
|
20
|
-
* });
|
|
21
|
-
* console.log(`Detected ${faces.length} faces`);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export async function detectFacesInImage(options) {
|
|
25
|
-
return SmartCameraModule.detectFacesInImage(options);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Update face detection options at runtime
|
|
29
|
-
* @param options - New face detection options
|
|
30
|
-
*/
|
|
31
|
-
export function updateFaceDetectionOptions(options) {
|
|
32
|
-
SmartCameraModule.updateFaceDetectionOptions(options);
|
|
33
|
-
}
|
|
34
|
-
// ============================================================================
|
|
35
|
-
// WebRTC Functions
|
|
36
|
-
// ============================================================================
|
|
37
|
-
/**
|
|
38
|
-
* Initialize WebRTC for streaming
|
|
39
|
-
* Must be called before startWebRTCStream
|
|
40
|
-
* @returns Promise resolving to true if initialized successfully
|
|
41
|
-
*/
|
|
42
|
-
export async function initializeWebRTC() {
|
|
43
|
-
return SmartCameraModule.initializeWebRTC();
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Start WebRTC video streaming
|
|
47
|
-
* @param constraints - Video constraints (width, height, frameRate)
|
|
48
|
-
* @returns Promise resolving to true if started successfully
|
|
49
|
-
*/
|
|
50
|
-
export async function startWebRTCStream(constraints) {
|
|
51
|
-
return SmartCameraModule.startWebRTCStream(constraints);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Stop WebRTC video streaming
|
|
55
|
-
*/
|
|
56
|
-
export function stopWebRTCStream() {
|
|
57
|
-
SmartCameraModule.stopWebRTCStream();
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Push a frame to the WebRTC stream
|
|
61
|
-
* @param frameData - Frame data to push
|
|
62
|
-
*/
|
|
63
|
-
export function pushWebRTCFrame(frameData) {
|
|
64
|
-
SmartCameraModule.pushWebRTCFrame(frameData);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Check if WebRTC is currently streaming
|
|
68
|
-
* @returns true if streaming, false otherwise
|
|
69
|
-
*/
|
|
70
|
-
export function isWebRTCStreaming() {
|
|
71
|
-
return SmartCameraModule.isWebRTCStreaming();
|
|
72
|
-
}
|
|
73
|
-
// ============================================================================
|
|
74
|
-
// Event Listeners
|
|
75
|
-
// ============================================================================
|
|
76
|
-
/**
|
|
77
|
-
* Subscribe to face detection events from native module
|
|
78
|
-
* @param listener - Callback function for face detection events
|
|
79
|
-
* @returns Subscription object with remove method
|
|
80
|
-
*/
|
|
81
|
-
export function addFaceDetectionListener(listener) {
|
|
82
|
-
return emitter.addListener('onFacesDetected', listener);
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Subscribe to blink detection events from native module
|
|
86
|
-
* @param listener - Callback function for blink events
|
|
87
|
-
* @returns Subscription object with remove method
|
|
88
|
-
*/
|
|
89
|
-
export function addBlinkDetectionListener(listener) {
|
|
90
|
-
return emitter.addListener('onBlinkDetected', listener);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Subscribe to error events from native module
|
|
94
|
-
* @param listener - Callback function for error events
|
|
95
|
-
* @returns Subscription object with remove method
|
|
96
|
-
*/
|
|
97
|
-
export function addErrorListener(listener) {
|
|
98
|
-
return emitter.addListener('onError', listener);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Subscribe to WebRTC state change events
|
|
102
|
-
* @param listener - Callback function for WebRTC state changes
|
|
103
|
-
* @returns Subscription object with remove method
|
|
104
|
-
*/
|
|
105
|
-
export function addWebRTCStateChangeListener(listener) {
|
|
106
|
-
return emitter.addListener('onWebRTCStateChange', listener);
|
|
107
|
-
}
|
|
108
|
-
// ============================================================================
|
|
109
|
-
// Constants
|
|
110
|
-
// ============================================================================
|
|
111
|
-
/**
|
|
112
|
-
* Module constants
|
|
113
|
-
*/
|
|
114
|
-
export const Constants = {
|
|
115
|
-
PI: SmartCameraModule.PI,
|
|
116
|
-
DEFAULT_MIN_FACE_SIZE: SmartCameraModule.DEFAULT_MIN_FACE_SIZE ?? 0.15,
|
|
117
|
-
EYE_CLOSED_THRESHOLD: SmartCameraModule.EYE_CLOSED_THRESHOLD ?? 0.3,
|
|
118
|
-
EYE_OPEN_THRESHOLD: SmartCameraModule.EYE_OPEN_THRESHOLD ?? 0.7,
|
|
119
|
-
};
|
|
120
|
-
export default SmartCameraModule;
|
|
121
|
-
//# sourceMappingURL=SmartCameraModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SmartCameraModule.js","sourceRoot":"","sources":["../src/SmartCameraModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAkCtE,4BA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C1D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAA0F;IAE1F,OAAO,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;AAC1D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAA4D;IAC3F,OAAO,OAAO,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAAC,QAAmD;IAC9F,OAAO,OAAO,CAAC,WAAW,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;AAC9D,CAAC;AAED,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,EAAE,EAAE,iBAAiB,CAAC,EAAE;IACxB,qBAAqB,EAAE,iBAAiB,CAAC,qBAAqB,IAAI,IAAI;IACtE,oBAAoB,EAAE,iBAAiB,CAAC,oBAAoB,IAAI,GAAG;IACnE,kBAAkB,EAAE,iBAAiB,CAAC,kBAAkB,IAAI,GAAG;CAChE,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { requireNativeModule, EventEmitter } from 'expo-modules-core';\n\nimport type { Face, StaticImageOptions, VideoConstraints } from './types';\n\n// Define the native module interface\ninterface SmartCameraModuleInterface {\n // Face detection in static images\n detectFacesInImage(options: StaticImageOptions): Promise<Face[]>;\n\n // Update face detection options\n updateFaceDetectionOptions(options: Record<string, unknown>): void;\n\n // WebRTC functions\n initializeWebRTC(): Promise<boolean>;\n startWebRTCStream(constraints: VideoConstraints): Promise<boolean>;\n stopWebRTCStream(): void;\n pushWebRTCFrame(frameData: Record<string, unknown>): void;\n isWebRTCStreaming(): boolean;\n\n // Native module constants\n readonly PI: number;\n readonly DEFAULT_MIN_FACE_SIZE: number;\n readonly EYE_CLOSED_THRESHOLD: number;\n readonly EYE_OPEN_THRESHOLD: number;\n\n // Allow additional properties from NativeModule\n __expo_module_name__?: string;\n startObserving?: () => void;\n stopObserving?: () => void;\n addListener?: unknown;\n removeListeners?: unknown;\n [key: string]: unknown;\n}\n\n// Require the native module\nconst SmartCameraModule = requireNativeModule<SmartCameraModuleInterface>('SmartCameraModule');\n\n// Create an event emitter for native events\nconst emitter = new EventEmitter(SmartCameraModule);\n\n// ============================================================================\n// Face Detection Functions\n// ============================================================================\n\n/**\n * Detect faces in a static image\n * @param options - Static image options including the image source and detection settings\n * @returns Promise resolving to an array of detected faces\n * \n * @example\n * ```tsx\n * const faces = await detectFacesInImage({\n * image: { uri: 'https://example.com/photo.jpg' },\n * performanceMode: 'accurate',\n * landmarkMode: 'all',\n * });\n * console.log(`Detected ${faces.length} faces`);\n * ```\n */\nexport async function detectFacesInImage(options: StaticImageOptions): Promise<Face[]> {\n return SmartCameraModule.detectFacesInImage(options);\n}\n\n/**\n * Update face detection options at runtime\n * @param options - New face detection options\n */\nexport function updateFaceDetectionOptions(options: Record<string, unknown>): void {\n SmartCameraModule.updateFaceDetectionOptions(options);\n}\n\n// ============================================================================\n// WebRTC Functions\n// ============================================================================\n\n/**\n * Initialize WebRTC for streaming\n * Must be called before startWebRTCStream\n * @returns Promise resolving to true if initialized successfully\n */\nexport async function initializeWebRTC(): Promise<boolean> {\n return SmartCameraModule.initializeWebRTC();\n}\n\n/**\n * Start WebRTC video streaming\n * @param constraints - Video constraints (width, height, frameRate)\n * @returns Promise resolving to true if started successfully\n */\nexport async function startWebRTCStream(constraints: VideoConstraints): Promise<boolean> {\n return SmartCameraModule.startWebRTCStream(constraints);\n}\n\n/**\n * Stop WebRTC video streaming\n */\nexport function stopWebRTCStream(): void {\n SmartCameraModule.stopWebRTCStream();\n}\n\n/**\n * Push a frame to the WebRTC stream\n * @param frameData - Frame data to push\n */\nexport function pushWebRTCFrame(frameData: Record<string, unknown>): void {\n SmartCameraModule.pushWebRTCFrame(frameData);\n}\n\n/**\n * Check if WebRTC is currently streaming\n * @returns true if streaming, false otherwise\n */\nexport function isWebRTCStreaming(): boolean {\n return SmartCameraModule.isWebRTCStreaming();\n}\n\n// ============================================================================\n// Event Listeners\n// ============================================================================\n\n/**\n * Subscribe to face detection events from native module\n * @param listener - Callback function for face detection events\n * @returns Subscription object with remove method\n */\nexport function addFaceDetectionListener(listener: (faces: Face[]) => void) {\n return emitter.addListener('onFacesDetected', listener);\n}\n\n/**\n * Subscribe to blink detection events from native module\n * @param listener - Callback function for blink events\n * @returns Subscription object with remove method\n */\nexport function addBlinkDetectionListener(\n listener: (event: { leftEyeOpen: number; rightEyeOpen: number; isBlink: boolean }) => void\n) {\n return emitter.addListener('onBlinkDetected', listener);\n}\n\n/**\n * Subscribe to error events from native module\n * @param listener - Callback function for error events\n * @returns Subscription object with remove method\n */\nexport function addErrorListener(listener: (error: { code: string; message: string }) => void) {\n return emitter.addListener('onError', listener);\n}\n\n/**\n * Subscribe to WebRTC state change events\n * @param listener - Callback function for WebRTC state changes\n * @returns Subscription object with remove method\n */\nexport function addWebRTCStateChangeListener(listener: (state: { isStreaming: boolean }) => void) {\n return emitter.addListener('onWebRTCStateChange', listener);\n}\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/**\n * Module constants\n */\nexport const Constants = {\n PI: SmartCameraModule.PI,\n DEFAULT_MIN_FACE_SIZE: SmartCameraModule.DEFAULT_MIN_FACE_SIZE ?? 0.15,\n EYE_CLOSED_THRESHOLD: SmartCameraModule.EYE_CLOSED_THRESHOLD ?? 0.3,\n EYE_OPEN_THRESHOLD: SmartCameraModule.EYE_OPEN_THRESHOLD ?? 0.7,\n};\n\nexport default SmartCameraModule;\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { ViewProps } from 'react-native';
|
|
3
|
-
export interface SmartCameraViewProps extends ViewProps {
|
|
4
|
-
cameraFacing?: 'front' | 'back';
|
|
5
|
-
isActive?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function SmartCameraView(props: SmartCameraViewProps): React.JSX.Element;
|
|
8
|
-
//# sourceMappingURL=SmartCameraView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SmartCameraView.d.ts","sourceRoot":"","sources":["../src/SmartCameraView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAID,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAE1D"}
|
package/build/SmartCameraView.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { requireNativeViewManager } from 'expo-modules-core';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
const NativeView = requireNativeViewManager('SmartCameraView');
|
|
4
|
-
export function SmartCameraView(props) {
|
|
5
|
-
return <NativeView {...props}/>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=SmartCameraView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SmartCameraView.js","sourceRoot":"","sources":["../src/SmartCameraView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,UAAU,GAAG,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;AAE/D,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACnC,CAAC","sourcesContent":["import { requireNativeViewManager } from 'expo-modules-core';\nimport * as React from 'react';\nimport type { ViewProps } from 'react-native';\n\nexport interface SmartCameraViewProps extends ViewProps {\n cameraFacing?: 'front' | 'back';\n isActive?: boolean;\n}\n\nconst NativeView = requireNativeViewManager('SmartCameraView');\n\nexport function SmartCameraView(props: SmartCameraViewProps) {\n return <NativeView {...props} />;\n}\n\n"]}
|