@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/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,77 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.5] - 2024-12-24
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **WebRTC Video Calling** - Full-featured WebRTC integration for peer-to-peer video calls
|
|
14
|
+
- `useWebRTC` hook for managing video calls with local/remote streams
|
|
15
|
+
- `useWebRTCWithDetection` hook combining WebRTC + face detection + eye tracking
|
|
16
|
+
- `WebRTCManager` class for low-level WebRTC control
|
|
17
|
+
- Signaling helpers: `createOffer`, `createAnswer`, `setRemoteDescription`, `addIceCandidate`
|
|
18
|
+
- Media controls: `switchCamera`, `toggleAudio`, `toggleVideo`
|
|
19
|
+
- Call state tracking: `idle`, `connecting`, `connected`, `disconnected`
|
|
20
|
+
|
|
21
|
+
- **WebRTC Types**
|
|
22
|
+
- `ICEServer`, `PeerConnectionConfig` for connection configuration
|
|
23
|
+
- `MediaConstraints`, `VideoConstraints`, `AudioConstraints`
|
|
24
|
+
- `CallState`, `WebRTCConnectionState`, `ICEConnectionState`
|
|
25
|
+
- `SessionDescription`, `ICECandidateEvent` for signaling
|
|
26
|
+
- Default configurations: `DEFAULT_ICE_SERVERS`, `DEFAULT_PEER_CONNECTION_CONFIG`
|
|
27
|
+
|
|
28
|
+
- **Eye Status API** - Updated `useBlinkDetection` hook
|
|
29
|
+
- Returns real-time `eyeStatus` with `leftEye` and `rightEye` open probability
|
|
30
|
+
- User-configurable `eyeClosedThreshold` (default 0.5)
|
|
31
|
+
- `processEyeStatus(faces)` function to process detected faces
|
|
32
|
+
- `onEyeStatusChange` callback for status updates
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
- **Breaking**: `useBlinkDetection` now returns `eyeStatus` instead of `blinkCount`
|
|
36
|
+
- Old: `{ lastBlink, blinkCount, resetCount }`
|
|
37
|
+
- New: `{ eyeStatus, processEyeStatus, reset }`
|
|
38
|
+
- Users implement their own blink counting logic using `onEyeStatusChange`
|
|
39
|
+
|
|
40
|
+
- Updated README with comprehensive WebRTC and eye tracking documentation
|
|
41
|
+
- Example app now includes tabbed interface with Face Detection and Video Call screens
|
|
42
|
+
- Example app integrates with Socket.io signaling server for real video calls
|
|
43
|
+
|
|
44
|
+
### Deprecated
|
|
45
|
+
- `useSmartCameraWebRTC` - Use `useWebRTC` instead
|
|
46
|
+
- `WebRTCBridge` - Use `WebRTCManager` instead
|
|
47
|
+
|
|
48
|
+
## [0.1.4] - 2024-12-24
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
- `useFaceDetector` hook matching `react-native-vision-camera-face-detector` API
|
|
52
|
+
- `useFaceDetectorWithCallback` convenience hook
|
|
53
|
+
- All ML Kit contour types support (LEFT_EYEBROW_TOP, LEFT_EYEBROW_BOTTOM, etc.)
|
|
54
|
+
- `autoMode` option for automatic coordinate scaling
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
57
|
+
- Restructured package as pure React Native module (removed Expo module dependency)
|
|
58
|
+
- Updated native plugin registration for standard React Native autolinking
|
|
59
|
+
- Moved podspec to package root as `react-native-smart-camera.podspec`
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
- Fixed duplicate module registration issues
|
|
63
|
+
- Fixed frame processor plugin registration on Android and iOS
|
|
64
|
+
|
|
65
|
+
## [0.1.3] - 2024-12-24
|
|
66
|
+
|
|
67
|
+
### Added
|
|
68
|
+
- **Real-time face detection frame processor plugin** for VisionCamera
|
|
69
|
+
- Android: `FaceDetectorFrameProcessorPlugin` using ML Kit
|
|
70
|
+
- iOS: `FaceDetectorFrameProcessorPlugin` using ML Kit
|
|
71
|
+
- `isFaceDetectorAvailable()` function to check if the plugin is ready
|
|
72
|
+
|
|
73
|
+
### Changed
|
|
74
|
+
- Updated `detectFaces` to use VisionCamera's `VisionCameraProxy.initFrameProcessorPlugin` API
|
|
75
|
+
- Added VisionCamera and ML Kit dependencies to iOS podspec
|
|
76
|
+
- Added VisionCamera frame processor support to Android build.gradle
|
|
77
|
+
|
|
78
|
+
### Fixed
|
|
79
|
+
- Fixed "Property '__detectFaces' doesn't exist" error by implementing proper frame processor plugin
|
|
80
|
+
|
|
10
81
|
## [0.1.2] - 2024-12-24
|
|
11
82
|
|
|
12
83
|
### Fixed
|
|
@@ -50,9 +121,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
50
121
|
- iOS (requires Expo Dev Client or Bare Workflow)
|
|
51
122
|
- Android (requires Expo Dev Client or Bare Workflow)
|
|
52
123
|
|
|
53
|
-
[Unreleased]: https://github.com/arfuhad/react-native-smart-camera/compare/v0.1.
|
|
124
|
+
[Unreleased]: https://github.com/arfuhad/react-native-smart-camera/compare/v0.1.5...HEAD
|
|
125
|
+
[0.1.5]: https://github.com/arfuhad/react-native-smart-camera/compare/v0.1.4...v0.1.5
|
|
126
|
+
[0.1.4]: https://github.com/arfuhad/react-native-smart-camera/compare/v0.1.3...v0.1.4
|
|
127
|
+
[0.1.3]: https://github.com/arfuhad/react-native-smart-camera/compare/v0.1.2...v0.1.3
|
|
54
128
|
[0.1.2]: https://github.com/arfuhad/react-native-smart-camera/compare/v0.1.1...v0.1.2
|
|
55
129
|
[0.1.1]: https://github.com/arfuhad/react-native-smart-camera/compare/v0.1.0...v0.1.1
|
|
56
130
|
[0.1.0]: https://github.com/arfuhad/react-native-smart-camera/releases/tag/v0.1.0
|
|
57
|
-
|
|
58
|
-
|
package/README.md
CHANGED
|
@@ -1,174 +1,294 @@
|
|
|
1
|
-
# react-native-smart-camera
|
|
1
|
+
# @arfuhad/react-native-smart-camera
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A React Native package providing real-time face detection using VisionCamera + ML Kit, eye tracking for blink detection, and WebRTC video calling capabilities.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Face Detection** - Real-time face detection using Google ML Kit via VisionCamera frame processor
|
|
8
|
+
- **Eye Tracking** - Track eye open/close probability for blink detection
|
|
9
|
+
- **WebRTC Video Calling** - Full-featured WebRTC integration for peer-to-peer video calls
|
|
10
|
+
- **Expo Compatible** - Works with Expo Dev Client and EAS Build
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
- Expo Dev Client (required)
|
|
9
|
-
- EAS Build
|
|
12
|
+
## Requirements
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
- React Native ≥ 0.72
|
|
15
|
+
- Expo SDK ≥ 49 (if using Expo)
|
|
16
|
+
- Expo Dev Client (Expo Go not supported)
|
|
12
17
|
|
|
13
|
-
|
|
|
14
|
-
|
|
15
|
-
| Expo
|
|
16
|
-
| Expo Dev Client | ✅ Yes |
|
|
17
|
-
|
|
|
18
|
+
| Workflow | Supported | Notes |
|
|
19
|
+
|----------|-----------|-------|
|
|
20
|
+
| Expo Go | ❌ No | Requires native modules |
|
|
21
|
+
| Expo Dev Client | ✅ Yes | Recommended |
|
|
22
|
+
| Bare React Native | ✅ Yes | Full native control |
|
|
18
23
|
|
|
19
24
|
## Installation
|
|
20
25
|
|
|
21
26
|
```bash
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
expo run:android
|
|
27
|
-
```
|
|
27
|
+
npm install @arfuhad/react-native-smart-camera
|
|
28
|
+
|
|
29
|
+
# Peer dependencies
|
|
30
|
+
npm install react-native-vision-camera react-native-worklets-core
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
# Optional: For WebRTC video calling
|
|
33
|
+
npm install react-native-webrtc
|
|
34
|
+
```
|
|
30
35
|
|
|
36
|
+
For Expo:
|
|
31
37
|
```bash
|
|
32
|
-
|
|
38
|
+
npx expo prebuild
|
|
39
|
+
npx expo run:ios # or run:android
|
|
33
40
|
```
|
|
34
41
|
|
|
35
|
-
##
|
|
42
|
+
## Quick Start
|
|
36
43
|
|
|
37
|
-
###
|
|
44
|
+
### Face Detection with Eye Tracking
|
|
38
45
|
|
|
39
46
|
```tsx
|
|
40
|
-
import {
|
|
47
|
+
import { Camera, useCameraDevice, useFrameProcessor } from 'react-native-vision-camera';
|
|
48
|
+
import { useRunOnJS } from 'react-native-worklets-core';
|
|
49
|
+
import { useFaceDetector, useBlinkDetection, type Face } from '@arfuhad/react-native-smart-camera';
|
|
50
|
+
|
|
51
|
+
function FaceDetectionScreen() {
|
|
52
|
+
const device = useCameraDevice('front');
|
|
53
|
+
|
|
54
|
+
// Face detector
|
|
55
|
+
const { detectFaces } = useFaceDetector({
|
|
56
|
+
performanceMode: 'fast',
|
|
57
|
+
classificationMode: 'all', // Required for eye tracking
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Eye tracking with custom threshold
|
|
61
|
+
const { eyeStatus, processEyeStatus } = useBlinkDetection({
|
|
62
|
+
eyeClosedThreshold: 0.3, // Eyes considered closed below this value
|
|
63
|
+
onEyeStatusChange: (status) => {
|
|
64
|
+
console.log('Left eye:', status.leftEye.openProbability);
|
|
65
|
+
console.log('Right eye:', status.rightEye.openProbability);
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const handleFaces = useRunOnJS((faces: Face[]) => {
|
|
70
|
+
processEyeStatus(faces);
|
|
71
|
+
}, [processEyeStatus]);
|
|
72
|
+
|
|
73
|
+
const frameProcessor = useFrameProcessor((frame) => {
|
|
74
|
+
'worklet';
|
|
75
|
+
const faces = detectFaces(frame);
|
|
76
|
+
handleFaces(faces);
|
|
77
|
+
}, [detectFaces, handleFaces]);
|
|
41
78
|
|
|
42
|
-
function App() {
|
|
43
79
|
return (
|
|
44
|
-
<
|
|
45
|
-
|
|
80
|
+
<Camera
|
|
81
|
+
device={device}
|
|
82
|
+
isActive={true}
|
|
83
|
+
frameProcessor={frameProcessor}
|
|
46
84
|
style={{ flex: 1 }}
|
|
47
85
|
/>
|
|
48
86
|
);
|
|
49
87
|
}
|
|
50
88
|
```
|
|
51
89
|
|
|
52
|
-
###
|
|
90
|
+
### WebRTC Video Calling
|
|
53
91
|
|
|
54
92
|
```tsx
|
|
55
|
-
import {
|
|
93
|
+
import { useWebRTC } from '@arfuhad/react-native-smart-camera';
|
|
94
|
+
import { RTCView } from 'react-native-webrtc';
|
|
95
|
+
import { io } from 'socket.io-client';
|
|
56
96
|
|
|
57
|
-
function
|
|
58
|
-
const
|
|
59
|
-
|
|
97
|
+
function VideoCallScreen() {
|
|
98
|
+
const socket = io('http://your-signaling-server:3000');
|
|
99
|
+
|
|
100
|
+
const {
|
|
101
|
+
localStream,
|
|
102
|
+
remoteStream,
|
|
103
|
+
callState,
|
|
104
|
+
startLocalStream,
|
|
105
|
+
createPeerConnection,
|
|
106
|
+
createOffer,
|
|
107
|
+
createAnswer,
|
|
108
|
+
setRemoteDescription,
|
|
109
|
+
addIceCandidate,
|
|
110
|
+
onIceCandidate,
|
|
111
|
+
switchCamera,
|
|
112
|
+
toggleAudio,
|
|
113
|
+
toggleVideo,
|
|
114
|
+
cleanup,
|
|
115
|
+
} = useWebRTC({
|
|
116
|
+
config: {
|
|
117
|
+
iceServers: [{ urls: 'stun:stun.l.google.com:19302' }],
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Start a call
|
|
122
|
+
const startCall = async (peerId: string) => {
|
|
123
|
+
await startLocalStream();
|
|
124
|
+
createPeerConnection();
|
|
125
|
+
|
|
126
|
+
onIceCandidate((event) => {
|
|
127
|
+
if (event.candidate) {
|
|
128
|
+
socket.emit('ice-candidate', { candidate: event.candidate, to: peerId });
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const offer = await createOffer();
|
|
133
|
+
socket.emit('offer', { offer, to: peerId });
|
|
60
134
|
};
|
|
61
135
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
136
|
+
// Handle incoming offer
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
socket.on('offer', async ({ offer, from }) => {
|
|
139
|
+
await startLocalStream();
|
|
140
|
+
createPeerConnection();
|
|
141
|
+
await setRemoteDescription(offer);
|
|
142
|
+
const answer = await createAnswer();
|
|
143
|
+
socket.emit('answer', { answer, to: from });
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
socket.on('answer', ({ answer }) => {
|
|
147
|
+
setRemoteDescription(answer);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
socket.on('ice-candidate', ({ candidate }) => {
|
|
151
|
+
addIceCandidate(candidate);
|
|
152
|
+
});
|
|
153
|
+
}, []);
|
|
65
154
|
|
|
66
155
|
return (
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
156
|
+
<View style={{ flex: 1 }}>
|
|
157
|
+
{remoteStream && (
|
|
158
|
+
<RTCView streamURL={remoteStream.toURL()} style={{ flex: 1 }} />
|
|
159
|
+
)}
|
|
160
|
+
{localStream && (
|
|
161
|
+
<RTCView streamURL={localStream.toURL()} style={styles.localVideo} />
|
|
162
|
+
)}
|
|
163
|
+
<View style={styles.controls}>
|
|
164
|
+
<Button onPress={switchCamera} title="Switch Camera" />
|
|
165
|
+
<Button onPress={toggleAudio} title="Mute" />
|
|
166
|
+
<Button onPress={toggleVideo} title="Video Off" />
|
|
167
|
+
</View>
|
|
168
|
+
</View>
|
|
80
169
|
);
|
|
81
170
|
}
|
|
82
171
|
```
|
|
83
172
|
|
|
84
|
-
###
|
|
173
|
+
### Combined: Video Call with Face Detection
|
|
85
174
|
|
|
86
175
|
```tsx
|
|
87
|
-
import {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
176
|
+
import { useWebRTCWithDetection } from '@arfuhad/react-native-smart-camera';
|
|
177
|
+
|
|
178
|
+
function VideoCallWithDetection() {
|
|
179
|
+
const {
|
|
180
|
+
// WebRTC
|
|
181
|
+
localStream,
|
|
182
|
+
remoteStream,
|
|
183
|
+
startLocalStream,
|
|
184
|
+
createPeerConnection,
|
|
185
|
+
// Face detection
|
|
186
|
+
faces,
|
|
187
|
+
detectFaces,
|
|
188
|
+
// Eye tracking
|
|
189
|
+
eyeStatus,
|
|
190
|
+
processFrame,
|
|
191
|
+
} = useWebRTCWithDetection({
|
|
192
|
+
config: { iceServers: [{ urls: 'stun:stun.l.google.com:19302' }] },
|
|
193
|
+
faceDetection: { enabled: true, classificationMode: 'all' },
|
|
194
|
+
eyeTracking: { enabled: true, eyeClosedThreshold: 0.3 },
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// Use VisionCamera for detection + WebRTC for streaming
|
|
104
198
|
}
|
|
105
199
|
```
|
|
106
200
|
|
|
107
201
|
## API Reference
|
|
108
202
|
|
|
109
|
-
###
|
|
203
|
+
### Hooks
|
|
204
|
+
|
|
205
|
+
#### `useFaceDetector(options)`
|
|
206
|
+
|
|
207
|
+
Face detection for VisionCamera frame processor.
|
|
110
208
|
|
|
111
209
|
```tsx
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
// Blink Detection
|
|
122
|
-
blinkDetection?: boolean;
|
|
123
|
-
onBlinkDetected?: (event: BlinkEvent) => void;
|
|
124
|
-
|
|
125
|
-
// Face Detection Callback
|
|
126
|
-
onFaceDetected?: (faces: Face[]) => void;
|
|
127
|
-
|
|
128
|
-
// WebRTC Configuration
|
|
129
|
-
webrtc?: WebRTCConfig;
|
|
130
|
-
}
|
|
210
|
+
const { detectFaces } = useFaceDetector({
|
|
211
|
+
performanceMode: 'fast' | 'accurate',
|
|
212
|
+
landmarkMode: 'none' | 'all',
|
|
213
|
+
contourMode: 'none' | 'all',
|
|
214
|
+
classificationMode: 'none' | 'all', // Required for eye tracking
|
|
215
|
+
trackingEnabled: boolean,
|
|
216
|
+
cameraFacing: 'front' | 'back',
|
|
217
|
+
});
|
|
131
218
|
```
|
|
132
219
|
|
|
133
|
-
|
|
220
|
+
#### `useBlinkDetection(options)`
|
|
134
221
|
|
|
135
|
-
|
|
222
|
+
Eye tracking and status monitoring.
|
|
136
223
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
| `minFaceSize` | Sets the smallest desired face size, expressed as the ratio of the width of the head to width of the image | `0.15` | `number` |
|
|
144
|
-
| `trackingEnabled` | Whether to assign faces an ID to track faces across images. Note: Don't enable with contourMode for best performance | `false` | `boolean` |
|
|
224
|
+
```tsx
|
|
225
|
+
const { eyeStatus, processEyeStatus, reset } = useBlinkDetection({
|
|
226
|
+
enabled: boolean,
|
|
227
|
+
eyeClosedThreshold: number, // 0-1, default 0.5
|
|
228
|
+
onEyeStatusChange: (status: EyeStatusResult) => void,
|
|
229
|
+
});
|
|
145
230
|
|
|
146
|
-
|
|
231
|
+
// EyeStatusResult
|
|
232
|
+
interface EyeStatusResult {
|
|
233
|
+
leftEye: { openProbability: number; isClosed: boolean };
|
|
234
|
+
rightEye: { openProbability: number; isClosed: boolean };
|
|
235
|
+
faceId?: number;
|
|
236
|
+
timestamp: number;
|
|
237
|
+
}
|
|
238
|
+
```
|
|
147
239
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
240
|
+
#### `useWebRTC(options)`
|
|
241
|
+
|
|
242
|
+
WebRTC video calling with signaling helpers.
|
|
243
|
+
|
|
244
|
+
```tsx
|
|
245
|
+
const {
|
|
246
|
+
// Streams
|
|
247
|
+
localStream,
|
|
248
|
+
remoteStream,
|
|
249
|
+
|
|
250
|
+
// State
|
|
251
|
+
callState, // 'idle' | 'connecting' | 'connected' | 'disconnected'
|
|
252
|
+
isAudioEnabled,
|
|
253
|
+
isVideoEnabled,
|
|
254
|
+
currentCamera,
|
|
255
|
+
|
|
256
|
+
// Local stream
|
|
257
|
+
startLocalStream,
|
|
258
|
+
stopLocalStream,
|
|
259
|
+
switchCamera,
|
|
260
|
+
toggleAudio,
|
|
261
|
+
toggleVideo,
|
|
262
|
+
|
|
263
|
+
// Peer connection
|
|
264
|
+
createPeerConnection,
|
|
265
|
+
closePeerConnection,
|
|
266
|
+
|
|
267
|
+
// Signaling (integrate with your server)
|
|
268
|
+
createOffer,
|
|
269
|
+
createAnswer,
|
|
270
|
+
setRemoteDescription,
|
|
271
|
+
addIceCandidate,
|
|
272
|
+
onIceCandidate,
|
|
273
|
+
|
|
274
|
+
// Cleanup
|
|
275
|
+
cleanup,
|
|
276
|
+
} = useWebRTC({
|
|
277
|
+
config: PeerConnectionConfig,
|
|
278
|
+
mediaConstraints: MediaConstraints,
|
|
279
|
+
onCallStateChange: (state) => void,
|
|
280
|
+
onRemoteStream: (stream) => void,
|
|
281
|
+
onError: (error) => void,
|
|
282
|
+
});
|
|
283
|
+
```
|
|
154
284
|
|
|
155
|
-
####
|
|
285
|
+
#### `useWebRTCWithDetection(options)`
|
|
156
286
|
|
|
157
|
-
|
|
158
|
-
|--------|-------------|---------|---------|
|
|
159
|
-
| `image` | Image source for static face detection | - | `number`, `string`, `{ uri: string }` |
|
|
287
|
+
Combined WebRTC + face detection + eye tracking.
|
|
160
288
|
|
|
161
289
|
### Types
|
|
162
290
|
|
|
163
291
|
```tsx
|
|
164
|
-
interface BlinkEvent {
|
|
165
|
-
timestamp: number;
|
|
166
|
-
leftEyeOpen: number; // 0.0 - 1.0
|
|
167
|
-
rightEyeOpen: number; // 0.0 - 1.0
|
|
168
|
-
isBlink: boolean;
|
|
169
|
-
faceId?: number;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
292
|
interface Face {
|
|
173
293
|
bounds: { x: number; y: number; width: number; height: number };
|
|
174
294
|
landmarks?: FaceLandmarks;
|
|
@@ -179,128 +299,61 @@ interface Face {
|
|
|
179
299
|
trackingId?: number;
|
|
180
300
|
}
|
|
181
301
|
|
|
182
|
-
interface
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
302
|
+
interface ICEServer {
|
|
303
|
+
urls: string | string[];
|
|
304
|
+
username?: string;
|
|
305
|
+
credential?: string;
|
|
186
306
|
}
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Static Image Detection
|
|
190
|
-
|
|
191
|
-
```tsx
|
|
192
|
-
import { detectFacesInImage } from 'react-native-smart-camera';
|
|
193
|
-
|
|
194
|
-
const faces = await detectFacesInImage({
|
|
195
|
-
image: require('./photo.jpg'),
|
|
196
|
-
performanceMode: 'accurate',
|
|
197
|
-
landmarkMode: 'all',
|
|
198
|
-
});
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## Hooks
|
|
202
|
-
|
|
203
|
-
### useSmartCamera
|
|
204
|
-
|
|
205
|
-
```tsx
|
|
206
|
-
import { useSmartCamera } from 'react-native-smart-camera';
|
|
207
|
-
|
|
208
|
-
const {
|
|
209
|
-
hasPermission,
|
|
210
|
-
requestPermission,
|
|
211
|
-
device,
|
|
212
|
-
switchCamera,
|
|
213
|
-
} = useSmartCamera();
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### useFaceDetection
|
|
217
|
-
|
|
218
|
-
```tsx
|
|
219
|
-
import { useFaceDetection } from 'react-native-smart-camera';
|
|
220
|
-
|
|
221
|
-
const { faces, isDetecting } = useFaceDetection({
|
|
222
|
-
performanceMode: 'fast',
|
|
223
|
-
classificationMode: 'all',
|
|
224
|
-
});
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
### useBlinkDetection
|
|
228
|
-
|
|
229
|
-
```tsx
|
|
230
|
-
import { useBlinkDetection } from 'react-native-smart-camera';
|
|
231
|
-
|
|
232
|
-
const { lastBlink, blinkCount } = useBlinkDetection({
|
|
233
|
-
debounceMs: 300,
|
|
234
|
-
});
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### useSmartCameraWebRTC
|
|
238
307
|
|
|
239
|
-
|
|
240
|
-
|
|
308
|
+
interface PeerConnectionConfig {
|
|
309
|
+
iceServers?: ICEServer[];
|
|
310
|
+
iceTransportPolicy?: 'all' | 'relay';
|
|
311
|
+
}
|
|
241
312
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
switchCamera,
|
|
247
|
-
} = useSmartCameraWebRTC({
|
|
248
|
-
peerConnection,
|
|
249
|
-
mode: 'call',
|
|
250
|
-
});
|
|
313
|
+
interface SessionDescription {
|
|
314
|
+
type: 'offer' | 'answer';
|
|
315
|
+
sdp: string;
|
|
316
|
+
}
|
|
251
317
|
```
|
|
252
318
|
|
|
253
319
|
## Expo Config Plugin
|
|
254
320
|
|
|
255
|
-
|
|
321
|
+
Add to your `app.json`:
|
|
256
322
|
|
|
257
323
|
```json
|
|
258
324
|
{
|
|
259
325
|
"expo": {
|
|
260
|
-
"plugins": ["react-native-smart-camera"]
|
|
326
|
+
"plugins": ["@arfuhad/react-native-smart-camera"]
|
|
261
327
|
}
|
|
262
328
|
}
|
|
263
329
|
```
|
|
264
330
|
|
|
265
|
-
The plugin automatically
|
|
266
|
-
- Camera
|
|
267
|
-
- Microphone permission (iOS & Android)
|
|
331
|
+
The plugin automatically configures:
|
|
332
|
+
- Camera and microphone permissions (iOS & Android)
|
|
268
333
|
- Required iOS frameworks
|
|
269
334
|
- Android ProGuard rules for ML Kit
|
|
270
335
|
|
|
271
|
-
## Architecture
|
|
272
|
-
|
|
273
|
-
```
|
|
274
|
-
Expo App
|
|
275
|
-
├── SmartCamera (JS Component)
|
|
276
|
-
├── VisionCamera (native camera)
|
|
277
|
-
├── Frame Processor (worklet)
|
|
278
|
-
│ └── ML Kit Face Detection
|
|
279
|
-
├── Native WebRTC Bridge
|
|
280
|
-
│ ├── iOS (Swift)
|
|
281
|
-
│ └── Android (Kotlin)
|
|
282
|
-
└── react-native-webrtc
|
|
283
|
-
```
|
|
284
|
-
|
|
285
336
|
## Peer Dependencies
|
|
286
337
|
|
|
287
|
-
This package requires the following peer dependencies:
|
|
288
|
-
|
|
289
338
|
```json
|
|
290
339
|
{
|
|
291
340
|
"react-native-vision-camera": ">=3.0.0",
|
|
292
|
-
"react-native-
|
|
293
|
-
"react-native-
|
|
341
|
+
"react-native-worklets-core": ">=1.0.0",
|
|
342
|
+
"react-native-webrtc": ">=118.0.0" // Optional, for video calling
|
|
294
343
|
}
|
|
295
344
|
```
|
|
296
345
|
|
|
346
|
+
## Example App
|
|
347
|
+
|
|
348
|
+
See the `smart-camera-example` directory for a complete example with:
|
|
349
|
+
- Face detection with eye tracking
|
|
350
|
+
- WebRTC video calling with Socket.io signaling
|
|
351
|
+
|
|
297
352
|
## Limitations
|
|
298
353
|
|
|
299
354
|
- ❌ Not supported in Expo Go
|
|
300
|
-
- ❌ Requires Expo Dev Client or
|
|
301
|
-
- ❌ Native build required (via `expo run:ios/android` or EAS Build)
|
|
355
|
+
- ❌ Requires native build (Expo Dev Client or bare workflow)
|
|
302
356
|
|
|
303
357
|
## License
|
|
304
358
|
|
|
305
359
|
MIT
|
|
306
|
-
|