@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
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
package expo.modules.smartcamera
|
|
2
|
-
|
|
3
|
-
import android.graphics.Bitmap
|
|
4
|
-
import android.graphics.BitmapFactory
|
|
5
|
-
import android.util.Log
|
|
6
|
-
import expo.modules.kotlin.Promise
|
|
7
|
-
import expo.modules.kotlin.modules.Module
|
|
8
|
-
import expo.modules.kotlin.modules.ModuleDefinition
|
|
9
|
-
import kotlinx.coroutines.CoroutineScope
|
|
10
|
-
import kotlinx.coroutines.Dispatchers
|
|
11
|
-
import kotlinx.coroutines.SupervisorJob
|
|
12
|
-
import kotlinx.coroutines.cancel
|
|
13
|
-
import kotlinx.coroutines.launch
|
|
14
|
-
import kotlinx.coroutines.withContext
|
|
15
|
-
import java.net.URL
|
|
16
|
-
|
|
17
|
-
class SmartCameraModule : Module() {
|
|
18
|
-
companion object {
|
|
19
|
-
private const val TAG = "SmartCameraModule"
|
|
20
|
-
private const val DEFAULT_MIN_FACE_SIZE = 0.15
|
|
21
|
-
private const val EYE_CLOSED_THRESHOLD = 0.3
|
|
22
|
-
private const val EYE_OPEN_THRESHOLD = 0.7
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Coroutine scope for async operations
|
|
26
|
-
private val moduleScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
|
|
27
|
-
|
|
28
|
-
// Face detector instance
|
|
29
|
-
private val faceDetector = MLKitFaceDetector()
|
|
30
|
-
|
|
31
|
-
// WebRTC bridge instance
|
|
32
|
-
private val webRTCBridge = WebRTCFrameBridge()
|
|
33
|
-
|
|
34
|
-
// Image loader
|
|
35
|
-
private val imageLoader = ImageLoader()
|
|
36
|
-
|
|
37
|
-
// WebRTC state
|
|
38
|
-
private var isWebRTCInitialized = false
|
|
39
|
-
|
|
40
|
-
override fun definition() = ModuleDefinition {
|
|
41
|
-
// Module name exposed to JavaScript
|
|
42
|
-
Name("SmartCameraModule")
|
|
43
|
-
|
|
44
|
-
// Module constants
|
|
45
|
-
Constants(
|
|
46
|
-
"PI" to Math.PI,
|
|
47
|
-
"DEFAULT_MIN_FACE_SIZE" to DEFAULT_MIN_FACE_SIZE,
|
|
48
|
-
"EYE_CLOSED_THRESHOLD" to EYE_CLOSED_THRESHOLD,
|
|
49
|
-
"EYE_OPEN_THRESHOLD" to EYE_OPEN_THRESHOLD
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
// Events that can be sent to JavaScript
|
|
53
|
-
Events("onFacesDetected", "onBlinkDetected", "onError", "onWebRTCStateChange")
|
|
54
|
-
|
|
55
|
-
// MARK: - Face Detection Functions
|
|
56
|
-
|
|
57
|
-
// Detect faces in a static image
|
|
58
|
-
AsyncFunction("detectFacesInImage") { options: Map<String, Any>, promise: Promise ->
|
|
59
|
-
moduleScope.launch {
|
|
60
|
-
try {
|
|
61
|
-
// Parse options
|
|
62
|
-
val faceOptions = parseFaceDetectionOptions(options)
|
|
63
|
-
faceDetector.updateOptions(faceOptions)
|
|
64
|
-
|
|
65
|
-
// Get image source
|
|
66
|
-
val imageSource = options["image"]
|
|
67
|
-
?: throw IllegalArgumentException("Image source is required")
|
|
68
|
-
|
|
69
|
-
// Load image
|
|
70
|
-
val bitmap = imageLoader.loadImage(imageSource)
|
|
71
|
-
|
|
72
|
-
// Detect faces
|
|
73
|
-
val faces = faceDetector.detectFaces(bitmap)
|
|
74
|
-
|
|
75
|
-
// Convert to maps
|
|
76
|
-
val faceMaps = faces.map { it.toMap() }
|
|
77
|
-
promise.resolve(faceMaps)
|
|
78
|
-
} catch (e: Exception) {
|
|
79
|
-
Log.e(TAG, "Face detection error", e)
|
|
80
|
-
promise.reject("FACE_DETECTION_ERROR", e.message ?: "Unknown error", e)
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Update face detection options
|
|
86
|
-
Function("updateFaceDetectionOptions") { options: Map<String, Any> ->
|
|
87
|
-
val faceOptions = parseFaceDetectionOptions(options)
|
|
88
|
-
faceDetector.updateOptions(faceOptions)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// MARK: - WebRTC Functions
|
|
92
|
-
|
|
93
|
-
// Initialize WebRTC
|
|
94
|
-
AsyncFunction("initializeWebRTC") { promise: Promise ->
|
|
95
|
-
moduleScope.launch {
|
|
96
|
-
try {
|
|
97
|
-
webRTCBridge.initialize()
|
|
98
|
-
isWebRTCInitialized = true
|
|
99
|
-
promise.resolve(true)
|
|
100
|
-
} catch (e: Exception) {
|
|
101
|
-
Log.e(TAG, "WebRTC init error", e)
|
|
102
|
-
promise.reject("WEBRTC_INIT_ERROR", e.message ?: "Unknown error", e)
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Start WebRTC stream
|
|
108
|
-
AsyncFunction("startWebRTCStream") { constraints: Map<String, Any>, promise: Promise ->
|
|
109
|
-
moduleScope.launch {
|
|
110
|
-
try {
|
|
111
|
-
if (!isWebRTCInitialized) {
|
|
112
|
-
throw IllegalStateException("WebRTC not initialized. Call initializeWebRTC first.")
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
val width = (constraints["width"] as? Number)?.toInt() ?: 1280
|
|
116
|
-
val height = (constraints["height"] as? Number)?.toInt() ?: 720
|
|
117
|
-
val frameRate = (constraints["frameRate"] as? Number)?.toInt() ?: 30
|
|
118
|
-
|
|
119
|
-
webRTCBridge.startStream(width, height, frameRate)
|
|
120
|
-
|
|
121
|
-
sendEvent("onWebRTCStateChange", mapOf("isStreaming" to true))
|
|
122
|
-
promise.resolve(true)
|
|
123
|
-
} catch (e: Exception) {
|
|
124
|
-
Log.e(TAG, "WebRTC start error", e)
|
|
125
|
-
promise.reject("WEBRTC_START_ERROR", e.message ?: "Unknown error", e)
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Stop WebRTC stream
|
|
131
|
-
Function("stopWebRTCStream") {
|
|
132
|
-
webRTCBridge.stopStream()
|
|
133
|
-
sendEvent("onWebRTCStateChange", mapOf("isStreaming" to false))
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Push frame to WebRTC
|
|
137
|
-
Function("pushWebRTCFrame") { frameData: Map<String, Any> ->
|
|
138
|
-
webRTCBridge.pushFrame(frameData)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Get WebRTC stream status
|
|
142
|
-
Function("isWebRTCStreaming") {
|
|
143
|
-
webRTCBridge.isStreaming()
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// MARK: - Lifecycle
|
|
147
|
-
|
|
148
|
-
// Called when module is destroyed
|
|
149
|
-
OnDestroy {
|
|
150
|
-
cleanup()
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// Called when activity enters background
|
|
154
|
-
OnActivityEntersBackground {
|
|
155
|
-
Log.d(TAG, "App entered background")
|
|
156
|
-
// Optionally pause processing
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Called when activity enters foreground
|
|
160
|
-
OnActivityEntersForeground {
|
|
161
|
-
Log.d(TAG, "App entered foreground")
|
|
162
|
-
// Optionally resume processing
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// MARK: - Helper Methods
|
|
167
|
-
|
|
168
|
-
private fun parseFaceDetectionOptions(options: Map<String, Any>): FaceDetectionOptions {
|
|
169
|
-
return FaceDetectionOptions(
|
|
170
|
-
performanceMode = options["performanceMode"] as? String ?: "fast",
|
|
171
|
-
landmarkMode = options["landmarkMode"] as? String ?: "none",
|
|
172
|
-
contourMode = options["contourMode"] as? String ?: "none",
|
|
173
|
-
classificationMode = options["classificationMode"] as? String ?: "none",
|
|
174
|
-
minFaceSize = (options["minFaceSize"] as? Number)?.toDouble() ?: DEFAULT_MIN_FACE_SIZE,
|
|
175
|
-
trackingEnabled = options["trackingEnabled"] as? Boolean ?: false
|
|
176
|
-
)
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
private fun cleanup() {
|
|
180
|
-
Log.d(TAG, "Cleaning up module...")
|
|
181
|
-
|
|
182
|
-
// Stop WebRTC
|
|
183
|
-
webRTCBridge.destroy()
|
|
184
|
-
isWebRTCInitialized = false
|
|
185
|
-
|
|
186
|
-
// Close face detector
|
|
187
|
-
faceDetector.close()
|
|
188
|
-
|
|
189
|
-
// Cancel coroutines
|
|
190
|
-
moduleScope.cancel()
|
|
191
|
-
|
|
192
|
-
Log.d(TAG, "Cleanup completed")
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// MARK: - Face Detection Options
|
|
197
|
-
|
|
198
|
-
data class FaceDetectionOptions(
|
|
199
|
-
val performanceMode: String = "fast",
|
|
200
|
-
val landmarkMode: String = "none",
|
|
201
|
-
val contourMode: String = "none",
|
|
202
|
-
val classificationMode: String = "none",
|
|
203
|
-
val minFaceSize: Double = 0.15,
|
|
204
|
-
val trackingEnabled: Boolean = false
|
|
205
|
-
)
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
package expo.modules.smartcamera
|
|
2
|
-
|
|
3
|
-
import android.content.Context
|
|
4
|
-
import android.util.Size
|
|
5
|
-
import android.view.ViewGroup
|
|
6
|
-
import androidx.camera.core.CameraSelector
|
|
7
|
-
import androidx.camera.core.Preview
|
|
8
|
-
import androidx.camera.lifecycle.ProcessCameraProvider
|
|
9
|
-
import androidx.camera.view.PreviewView
|
|
10
|
-
import androidx.core.content.ContextCompat
|
|
11
|
-
import androidx.lifecycle.LifecycleOwner
|
|
12
|
-
import expo.modules.kotlin.AppContext
|
|
13
|
-
import expo.modules.kotlin.views.ExpoView
|
|
14
|
-
import java.util.concurrent.ExecutorService
|
|
15
|
-
import java.util.concurrent.Executors
|
|
16
|
-
|
|
17
|
-
class SmartCameraView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
|
|
18
|
-
// MARK: - Properties
|
|
19
|
-
|
|
20
|
-
private var previewView: PreviewView? = null
|
|
21
|
-
private var cameraProvider: ProcessCameraProvider? = null
|
|
22
|
-
private var cameraExecutor: ExecutorService = Executors.newSingleThreadExecutor()
|
|
23
|
-
|
|
24
|
-
private var currentCameraFacing: Int = CameraSelector.LENS_FACING_FRONT
|
|
25
|
-
private var isActive: Boolean = true
|
|
26
|
-
|
|
27
|
-
// MARK: - Initialization
|
|
28
|
-
|
|
29
|
-
init {
|
|
30
|
-
setupPreviewView()
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
private fun setupPreviewView() {
|
|
34
|
-
previewView = PreviewView(context).apply {
|
|
35
|
-
layoutParams = ViewGroup.LayoutParams(
|
|
36
|
-
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
37
|
-
ViewGroup.LayoutParams.MATCH_PARENT
|
|
38
|
-
)
|
|
39
|
-
scaleType = PreviewView.ScaleType.FILL_CENTER
|
|
40
|
-
}
|
|
41
|
-
addView(previewView)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// MARK: - Camera Setup
|
|
45
|
-
|
|
46
|
-
private fun startCamera() {
|
|
47
|
-
val cameraProviderFuture = ProcessCameraProvider.getInstance(context)
|
|
48
|
-
|
|
49
|
-
cameraProviderFuture.addListener({
|
|
50
|
-
try {
|
|
51
|
-
cameraProvider = cameraProviderFuture.get()
|
|
52
|
-
bindCameraUseCases()
|
|
53
|
-
} catch (e: Exception) {
|
|
54
|
-
android.util.Log.e("SmartCameraView", "Failed to get camera provider", e)
|
|
55
|
-
}
|
|
56
|
-
}, ContextCompat.getMainExecutor(context))
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
private fun bindCameraUseCases() {
|
|
60
|
-
val provider = cameraProvider ?: return
|
|
61
|
-
val preview = previewView ?: return
|
|
62
|
-
|
|
63
|
-
// Unbind all use cases before rebinding
|
|
64
|
-
provider.unbindAll()
|
|
65
|
-
|
|
66
|
-
if (!isActive) {
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
// Build camera selector
|
|
72
|
-
val cameraSelector = CameraSelector.Builder()
|
|
73
|
-
.requireLensFacing(currentCameraFacing)
|
|
74
|
-
.build()
|
|
75
|
-
|
|
76
|
-
// Build preview use case
|
|
77
|
-
val previewUseCase = Preview.Builder()
|
|
78
|
-
.setTargetResolution(Size(1280, 720))
|
|
79
|
-
.build()
|
|
80
|
-
.also {
|
|
81
|
-
it.setSurfaceProvider(preview.surfaceProvider)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Get lifecycle owner
|
|
85
|
-
val lifecycleOwner = getLifecycleOwner() ?: return
|
|
86
|
-
|
|
87
|
-
// Bind use cases to camera
|
|
88
|
-
provider.bindToLifecycle(
|
|
89
|
-
lifecycleOwner,
|
|
90
|
-
cameraSelector,
|
|
91
|
-
previewUseCase
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
} catch (e: Exception) {
|
|
95
|
-
android.util.Log.e("SmartCameraView", "Camera binding failed", e)
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
private fun getLifecycleOwner(): LifecycleOwner? {
|
|
100
|
-
var ctx = context
|
|
101
|
-
while (ctx != null) {
|
|
102
|
-
if (ctx is LifecycleOwner) {
|
|
103
|
-
return ctx
|
|
104
|
-
}
|
|
105
|
-
ctx = if (ctx is android.content.ContextWrapper) {
|
|
106
|
-
ctx.baseContext
|
|
107
|
-
} else {
|
|
108
|
-
null
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return null
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// MARK: - Public Methods
|
|
115
|
-
|
|
116
|
-
fun setCameraFacing(facing: String) {
|
|
117
|
-
val newFacing = when (facing) {
|
|
118
|
-
"front" -> CameraSelector.LENS_FACING_FRONT
|
|
119
|
-
"back" -> CameraSelector.LENS_FACING_BACK
|
|
120
|
-
else -> CameraSelector.LENS_FACING_FRONT
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (newFacing != currentCameraFacing) {
|
|
124
|
-
currentCameraFacing = newFacing
|
|
125
|
-
bindCameraUseCases()
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
fun setIsActive(active: Boolean) {
|
|
130
|
-
if (active != isActive) {
|
|
131
|
-
isActive = active
|
|
132
|
-
if (isActive) {
|
|
133
|
-
bindCameraUseCases()
|
|
134
|
-
} else {
|
|
135
|
-
cameraProvider?.unbindAll()
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// MARK: - Lifecycle
|
|
141
|
-
|
|
142
|
-
override fun onAttachedToWindow() {
|
|
143
|
-
super.onAttachedToWindow()
|
|
144
|
-
startCamera()
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
override fun onDetachedFromWindow() {
|
|
148
|
-
super.onDetachedFromWindow()
|
|
149
|
-
cameraProvider?.unbindAll()
|
|
150
|
-
cameraExecutor.shutdown()
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
package expo.modules.smartcamera
|
|
2
|
-
|
|
3
|
-
import android.graphics.Bitmap
|
|
4
|
-
import android.os.Handler
|
|
5
|
-
import android.os.HandlerThread
|
|
6
|
-
import android.util.Log
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* WebRTC Frame Bridge for Android
|
|
10
|
-
*
|
|
11
|
-
* Note: This is a placeholder implementation.
|
|
12
|
-
* In production, you would integrate with WebRTC's VideoSource and VideoCapturer.
|
|
13
|
-
*/
|
|
14
|
-
class WebRTCFrameBridge {
|
|
15
|
-
// MARK: - Properties
|
|
16
|
-
|
|
17
|
-
private var isInitialized = false
|
|
18
|
-
private var isStreaming = false
|
|
19
|
-
|
|
20
|
-
private var streamWidth: Int = 1280
|
|
21
|
-
private var streamHeight: Int = 720
|
|
22
|
-
private var streamFrameRate: Int = 30
|
|
23
|
-
|
|
24
|
-
private var frameThread: HandlerThread? = null
|
|
25
|
-
private var frameHandler: Handler? = null
|
|
26
|
-
|
|
27
|
-
private var lastFrameTime: Long = 0
|
|
28
|
-
private var frameInterval: Long = 33 // ~30fps
|
|
29
|
-
|
|
30
|
-
companion object {
|
|
31
|
-
private const val TAG = "WebRTCFrameBridge"
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// MARK: - Initialization
|
|
35
|
-
|
|
36
|
-
fun initialize() {
|
|
37
|
-
if (isInitialized) {
|
|
38
|
-
return
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Initialize WebRTC
|
|
42
|
-
// In production: PeerConnectionFactory.initialize(...)
|
|
43
|
-
|
|
44
|
-
frameThread = HandlerThread("WebRTCFrameThread").apply {
|
|
45
|
-
start()
|
|
46
|
-
}
|
|
47
|
-
frameHandler = Handler(frameThread!!.looper)
|
|
48
|
-
|
|
49
|
-
isInitialized = true
|
|
50
|
-
Log.d(TAG, "Initialized")
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// MARK: - Streaming
|
|
54
|
-
|
|
55
|
-
fun startStream(width: Int, height: Int, frameRate: Int) {
|
|
56
|
-
if (!isInitialized) {
|
|
57
|
-
throw IllegalStateException("WebRTC not initialized")
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (isStreaming) {
|
|
61
|
-
Log.w(TAG, "Already streaming, stopping first")
|
|
62
|
-
stopStream()
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
streamWidth = width
|
|
66
|
-
streamHeight = height
|
|
67
|
-
streamFrameRate = frameRate
|
|
68
|
-
frameInterval = (1000 / frameRate).toLong()
|
|
69
|
-
|
|
70
|
-
// In production:
|
|
71
|
-
// 1. Create VideoSource
|
|
72
|
-
// 2. Create VideoTrack
|
|
73
|
-
// 3. Add track to PeerConnection
|
|
74
|
-
|
|
75
|
-
isStreaming = true
|
|
76
|
-
Log.d(TAG, "Started streaming: ${width}x${height}@${frameRate}fps")
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
fun stopStream() {
|
|
80
|
-
if (!isStreaming) {
|
|
81
|
-
return
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// In production:
|
|
85
|
-
// 1. Remove track from PeerConnection
|
|
86
|
-
// 2. Dispose VideoTrack
|
|
87
|
-
// 3. Dispose VideoSource
|
|
88
|
-
|
|
89
|
-
isStreaming = false
|
|
90
|
-
Log.d(TAG, "Stopped streaming")
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// MARK: - Frame Processing
|
|
94
|
-
|
|
95
|
-
fun pushFrame(frameData: Map<String, Any>) {
|
|
96
|
-
if (!isStreaming) {
|
|
97
|
-
return
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Rate limiting
|
|
101
|
-
val currentTime = System.currentTimeMillis()
|
|
102
|
-
if (currentTime - lastFrameTime < frameInterval) {
|
|
103
|
-
return
|
|
104
|
-
}
|
|
105
|
-
lastFrameTime = currentTime
|
|
106
|
-
|
|
107
|
-
frameHandler?.post {
|
|
108
|
-
processFrame(frameData)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
fun pushBitmap(bitmap: Bitmap, timestampNs: Long) {
|
|
113
|
-
if (!isStreaming) {
|
|
114
|
-
return
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Rate limiting
|
|
118
|
-
val currentTime = System.currentTimeMillis()
|
|
119
|
-
if (currentTime - lastFrameTime < frameInterval) {
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
lastFrameTime = currentTime
|
|
123
|
-
|
|
124
|
-
frameHandler?.post {
|
|
125
|
-
processBitmap(bitmap, timestampNs)
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
private fun processFrame(frameData: Map<String, Any>) {
|
|
130
|
-
// In production:
|
|
131
|
-
// 1. Convert frame data to VideoFrame
|
|
132
|
-
// 2. Push to VideoSource
|
|
133
|
-
|
|
134
|
-
// Placeholder - log frame info
|
|
135
|
-
val width = frameData["width"]
|
|
136
|
-
val height = frameData["height"]
|
|
137
|
-
// Log.d(TAG, "Processing frame: ${width}x${height}")
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
private fun processBitmap(bitmap: Bitmap, timestampNs: Long) {
|
|
141
|
-
// In production:
|
|
142
|
-
// 1. Convert Bitmap to I420 buffer
|
|
143
|
-
// 2. Create VideoFrame
|
|
144
|
-
// 3. Push to VideoSource via CapturerObserver
|
|
145
|
-
|
|
146
|
-
// Example conversion (pseudo-code):
|
|
147
|
-
/*
|
|
148
|
-
val i420Buffer = JavaI420Buffer.allocate(bitmap.width, bitmap.height)
|
|
149
|
-
// ... convert bitmap pixels to I420 ...
|
|
150
|
-
|
|
151
|
-
val rotation = 0
|
|
152
|
-
val frame = VideoFrame(i420Buffer, rotation, timestampNs)
|
|
153
|
-
|
|
154
|
-
capturerObserver?.onFrameCaptured(frame)
|
|
155
|
-
frame.release()
|
|
156
|
-
*/
|
|
157
|
-
|
|
158
|
-
// Log.d(TAG, "Processing bitmap: ${bitmap.width}x${bitmap.height}")
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// MARK: - Utilities
|
|
162
|
-
|
|
163
|
-
fun getCurrentStreamConfig(): Triple<Int, Int, Int>? {
|
|
164
|
-
return if (isStreaming) {
|
|
165
|
-
Triple(streamWidth, streamHeight, streamFrameRate)
|
|
166
|
-
} else {
|
|
167
|
-
null
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
fun isStreaming(): Boolean = isStreaming
|
|
172
|
-
|
|
173
|
-
// MARK: - Cleanup
|
|
174
|
-
|
|
175
|
-
fun destroy() {
|
|
176
|
-
stopStream()
|
|
177
|
-
frameThread?.quitSafely()
|
|
178
|
-
frameThread = null
|
|
179
|
-
frameHandler = null
|
|
180
|
-
isInitialized = false
|
|
181
|
-
Log.d(TAG, "Destroyed")
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
package/build/SmartCamera.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { SmartCameraProps } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* SmartCamera component - A camera component with face detection,
|
|
5
|
-
* blink detection, and WebRTC streaming capabilities.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - VisionCamera integration with frame processing
|
|
9
|
-
* - Real-time face detection with ML Kit
|
|
10
|
-
* - Blink detection with debouncing
|
|
11
|
-
* - App lifecycle management (background/foreground)
|
|
12
|
-
* - Orientation handling
|
|
13
|
-
* - WebRTC streaming support
|
|
14
|
-
*/
|
|
15
|
-
export declare function SmartCamera({ camera, fps, style, faceDetection, blinkDetection, onBlinkDetected, onFaceDetected, webrtc, isActive, onReady, onError, }: SmartCameraProps): React.JSX.Element;
|
|
16
|
-
export default SmartCamera;
|
|
17
|
-
//# sourceMappingURL=SmartCamera.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SmartCamera.d.ts","sourceRoot":"","sources":["../src/SmartCamera.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAWjF,OAAO,KAAK,EACV,gBAAgB,EAKjB,MAAM,SAAS,CAAC;AA+BjB;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAgB,EAChB,GAAQ,EACR,KAAK,EACL,aAAa,EACb,cAAsB,EACtB,eAAe,EACf,cAAc,EACd,MAAM,EACN,QAAe,EACf,OAAO,EACP,OAAO,GACR,EAAE,gBAAgB,qBA2QlB;AAaD,eAAe,WAAW,CAAC"}
|