@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.
Files changed (265) hide show
  1. package/CHANGELOG.md +75 -3
  2. package/README.md +259 -206
  3. package/android/build.gradle +14 -39
  4. package/android/src/main/java/com/smartcamera/FaceDetectorFrameProcessorPlugin.kt +324 -0
  5. package/android/src/main/java/com/smartcamera/SmartCameraPackage.kt +28 -0
  6. package/build/detection/blinkProcessor.js +2 -1
  7. package/build/detection/blinkProcessor.js.map +1 -1
  8. package/build/detection/faceDetector.d.ts +4 -4
  9. package/build/detection/faceDetector.d.ts.map +1 -1
  10. package/build/detection/faceDetector.js +31 -11
  11. package/build/detection/faceDetector.js.map +1 -1
  12. package/build/detection/index.d.ts +1 -1
  13. package/build/detection/index.d.ts.map +1 -1
  14. package/build/detection/index.js +1 -1
  15. package/build/detection/index.js.map +1 -1
  16. package/build/detection/staticImageDetector.d.ts +11 -11
  17. package/build/detection/staticImageDetector.d.ts.map +1 -1
  18. package/build/detection/staticImageDetector.js +19 -23
  19. package/build/detection/staticImageDetector.js.map +1 -1
  20. package/build/hooks/index.d.ts +6 -0
  21. package/build/hooks/index.d.ts.map +1 -1
  22. package/build/hooks/index.js +8 -0
  23. package/build/hooks/index.js.map +1 -1
  24. package/build/hooks/useBlinkDetection.d.ts +27 -16
  25. package/build/hooks/useBlinkDetection.d.ts.map +1 -1
  26. package/build/hooks/useBlinkDetection.js +63 -37
  27. package/build/hooks/useBlinkDetection.js.map +1 -1
  28. package/build/hooks/useFaceDetection.js +3 -2
  29. package/build/hooks/useFaceDetection.js.map +1 -1
  30. package/build/hooks/useFaceDetector.d.ts +123 -0
  31. package/build/hooks/useFaceDetector.d.ts.map +1 -0
  32. package/build/hooks/useFaceDetector.js +133 -0
  33. package/build/hooks/useFaceDetector.js.map +1 -0
  34. package/build/hooks/useSmartCamera.js.map +1 -1
  35. package/build/hooks/useSmartCameraWebRTC.d.ts +3 -5
  36. package/build/hooks/useSmartCameraWebRTC.d.ts.map +1 -1
  37. package/build/hooks/useSmartCameraWebRTC.js +19 -87
  38. package/build/hooks/useSmartCameraWebRTC.js.map +1 -1
  39. package/build/hooks/useWebRTC.d.ts +88 -0
  40. package/build/hooks/useWebRTC.d.ts.map +1 -0
  41. package/build/hooks/useWebRTC.js +394 -0
  42. package/build/hooks/useWebRTC.js.map +1 -0
  43. package/build/hooks/useWebRTCWithDetection.d.ts +89 -0
  44. package/build/hooks/useWebRTCWithDetection.d.ts.map +1 -0
  45. package/build/hooks/useWebRTCWithDetection.js +131 -0
  46. package/build/hooks/useWebRTCWithDetection.js.map +1 -0
  47. package/build/index.d.ts +24 -10
  48. package/build/index.d.ts.map +1 -1
  49. package/build/index.js +38 -13
  50. package/build/index.js.map +1 -1
  51. package/build/types.d.ts +28 -12
  52. package/build/types.d.ts.map +1 -1
  53. package/build/types.js.map +1 -1
  54. package/build/utils/index.js.map +1 -1
  55. package/build/webrtc/WebRTCBridge.d.ts +3 -0
  56. package/build/webrtc/WebRTCBridge.d.ts.map +1 -1
  57. package/build/webrtc/WebRTCBridge.js +12 -15
  58. package/build/webrtc/WebRTCBridge.js.map +1 -1
  59. package/build/webrtc/WebRTCManager.d.ts +148 -0
  60. package/build/webrtc/WebRTCManager.d.ts.map +1 -0
  61. package/build/webrtc/WebRTCManager.js +383 -0
  62. package/build/webrtc/WebRTCManager.js.map +1 -0
  63. package/build/webrtc/index.d.ts +3 -1
  64. package/build/webrtc/index.d.ts.map +1 -1
  65. package/build/webrtc/index.js +5 -0
  66. package/build/webrtc/index.js.map +1 -1
  67. package/build/webrtc/types.d.ts +212 -4
  68. package/build/webrtc/types.d.ts.map +1 -1
  69. package/build/webrtc/types.js +34 -1
  70. package/build/webrtc/types.js.map +1 -1
  71. package/ios/FaceDetectorFrameProcessorPlugin.m +11 -0
  72. package/ios/FaceDetectorFrameProcessorPlugin.swift +304 -0
  73. package/package.json +11 -11
  74. package/react-native-smart-camera.podspec +32 -0
  75. package/src/detection/blinkProcessor.ts +127 -0
  76. package/src/detection/faceDetector.ts +78 -0
  77. package/src/detection/index.ts +3 -0
  78. package/src/detection/staticImageDetector.ts +53 -0
  79. package/src/hooks/index.ts +26 -0
  80. package/src/hooks/useBlinkDetection.ts +127 -0
  81. package/src/hooks/useFaceDetection.ts +105 -0
  82. package/src/hooks/useFaceDetector.ts +191 -0
  83. package/src/hooks/useSmartCamera.ts +83 -0
  84. package/src/hooks/useSmartCameraWebRTC.ts +120 -0
  85. package/src/hooks/useWebRTC.ts +453 -0
  86. package/src/hooks/useWebRTCWithDetection.ts +181 -0
  87. package/src/index.ts +170 -0
  88. package/src/types.ts +636 -0
  89. package/src/utils/index.ts +355 -0
  90. package/src/webrtc/WebRTCBridge.ts +127 -0
  91. package/src/webrtc/WebRTCManager.ts +453 -0
  92. package/src/webrtc/index.ts +50 -0
  93. package/src/webrtc/types.ts +361 -0
  94. package/android/build/.transforms/e0a0b120a9ccc3a8de4f5784bc36b161/results.bin +0 -1
  95. package/android/build/.transforms/e0a0b120a9ccc3a8de4f5784bc36b161/transformed/classes/classes_dex/classes.dex +0 -0
  96. package/android/build/generated/source/buildConfig/debug/expo/modules/smartcamera/BuildConfig.java +0 -10
  97. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -7
  98. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
  99. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -6
  100. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  101. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  102. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  103. package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -0
  104. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
  105. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
  106. package/android/build/intermediates/java_res/debug/out/META-INF/arfuhad-react-native-smart-camera_debug.kotlin_module +0 -0
  107. package/android/build/intermediates/javac/debug/classes/expo/modules/smartcamera/BuildConfig.class +0 -0
  108. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -2
  109. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -7
  110. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -7
  111. package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
  112. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  113. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1
  114. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  115. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  116. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  117. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  118. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  119. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  120. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  121. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  122. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  123. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  124. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  125. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  126. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  127. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  128. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  129. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  130. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  131. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  132. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  133. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  134. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  135. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  136. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  137. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  138. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  139. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  140. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  141. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  142. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab +0 -0
  143. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream +0 -0
  144. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len +0 -0
  145. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.len +0 -0
  146. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.values.at +0 -0
  147. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i +0 -0
  148. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i.len +0 -0
  149. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  150. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  151. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  152. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  153. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  154. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  155. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  156. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  157. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  158. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  159. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  160. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  161. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  162. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  163. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  164. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  165. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  166. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  167. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  168. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  169. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  170. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  171. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  172. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  173. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  174. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  175. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  176. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  177. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
  178. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  179. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  180. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  181. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  182. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  183. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  184. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  185. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  186. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  187. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  188. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  189. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  190. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  191. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  192. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  193. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  194. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  195. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  196. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  197. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  198. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  199. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  200. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  201. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  202. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -16
  203. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  204. package/android/build/tmp/kotlin-classes/debug/META-INF/arfuhad-react-native-smart-camera_debug.kotlin_module +0 -0
  205. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/DetectedFace.class +0 -0
  206. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceBounds.class +0 -0
  207. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceContoursData.class +0 -0
  208. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceDetectionOptions.class +0 -0
  209. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceLandmarksData.class +0 -0
  210. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/ImageLoader$Companion.class +0 -0
  211. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/ImageLoader$loadImage$2.class +0 -0
  212. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/ImageLoader.class +0 -0
  213. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetector$detectFaces$2$1.class +0 -0
  214. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetector$detectFaces$2$2.class +0 -0
  215. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetector.class +0 -0
  216. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetectorKt$sam$com_google_android_gms_tasks_OnSuccessListener$0.class +0 -0
  217. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetectorKt.class +0 -0
  218. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/PointData.class +0 -0
  219. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$Companion.class +0 -0
  220. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$1$1$1.class +0 -0
  221. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$1$3$1.class +0 -0
  222. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$1$4$1.class +0 -0
  223. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunction$1.class +0 -0
  224. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunction$2.class +0 -0
  225. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunction$3.class +0 -0
  226. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$1.class +0 -0
  227. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$2.class +0 -0
  228. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$3.class +0 -0
  229. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$4.class +0 -0
  230. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$1.class +0 -0
  231. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$2.class +0 -0
  232. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$3.class +0 -0
  233. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$4.class +0 -0
  234. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$FunctionWithoutArgs$1.class +0 -0
  235. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$FunctionWithoutArgs$2.class +0 -0
  236. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$OnActivityEntersBackground$1.class +0 -0
  237. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$OnActivityEntersForeground$1.class +0 -0
  238. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$OnDestroy$1.class +0 -0
  239. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule.class +0 -0
  240. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraView.class +0 -0
  241. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/WebRTCFrameBridge$Companion.class +0 -0
  242. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/WebRTCFrameBridge.class +0 -0
  243. package/android/src/main/java/expo/modules/smartcamera/ImageLoader.kt +0 -106
  244. package/android/src/main/java/expo/modules/smartcamera/MLKitFaceDetector.kt +0 -273
  245. package/android/src/main/java/expo/modules/smartcamera/SmartCameraModule.kt +0 -205
  246. package/android/src/main/java/expo/modules/smartcamera/SmartCameraView.kt +0 -153
  247. package/android/src/main/java/expo/modules/smartcamera/WebRTCFrameBridge.kt +0 -184
  248. package/build/SmartCamera.d.ts +0 -17
  249. package/build/SmartCamera.d.ts.map +0 -1
  250. package/build/SmartCamera.js +0 -270
  251. package/build/SmartCamera.js.map +0 -1
  252. package/build/SmartCameraModule.d.ts +0 -112
  253. package/build/SmartCameraModule.d.ts.map +0 -1
  254. package/build/SmartCameraModule.js +0 -121
  255. package/build/SmartCameraModule.js.map +0 -1
  256. package/build/SmartCameraView.d.ts +0 -8
  257. package/build/SmartCameraView.d.ts.map +0 -1
  258. package/build/SmartCameraView.js +0 -7
  259. package/build/SmartCameraView.js.map +0 -1
  260. package/expo-module.config.json +0 -9
  261. package/ios/MLKitFaceDetector.swift +0 -310
  262. package/ios/SmartCamera.podspec +0 -33
  263. package/ios/SmartCameraModule.swift +0 -225
  264. package/ios/SmartCameraView.swift +0 -146
  265. 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
-
@@ -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"}