@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
@@ -0,0 +1,355 @@
1
+ /**
2
+ * SmartCamera utility functions
3
+ */
4
+
5
+ // ============================================================================
6
+ // FPS Limiter
7
+ // ============================================================================
8
+
9
+ /**
10
+ * Creates an FPS limiter for frame processing
11
+ *
12
+ * @param targetFps - Target frames per second
13
+ * @returns Object with shouldProcess function
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const limiter = createFpsLimiter(15);
18
+ *
19
+ * const frameProcessor = useFrameProcessor((frame) => {
20
+ * if (!limiter.shouldProcess()) return;
21
+ * // Process frame...
22
+ * }, []);
23
+ * ```
24
+ */
25
+ export function createFpsLimiter(targetFps: number) {
26
+ const frameInterval = 1000 / targetFps;
27
+ let lastFrameTime = 0;
28
+
29
+ return {
30
+ shouldProcess: (): boolean => {
31
+ const now = Date.now();
32
+ if (now - lastFrameTime >= frameInterval) {
33
+ lastFrameTime = now;
34
+ return true;
35
+ }
36
+ return false;
37
+ },
38
+ reset: () => {
39
+ lastFrameTime = 0;
40
+ },
41
+ setTargetFps: (fps: number) => {
42
+ // Note: This creates a new interval but doesn't update the closure
43
+ // Consider using a ref if dynamic FPS changes are needed
44
+ },
45
+ };
46
+ }
47
+
48
+ // ============================================================================
49
+ // Debounce
50
+ // ============================================================================
51
+
52
+ /**
53
+ * Creates a debounced function
54
+ *
55
+ * @param fn - Function to debounce
56
+ * @param delay - Delay in milliseconds
57
+ * @returns Debounced function
58
+ */
59
+ export function debounce<T extends (...args: unknown[]) => unknown>(
60
+ fn: T,
61
+ delay: number
62
+ ): (...args: Parameters<T>) => void {
63
+ let timeoutId: ReturnType<typeof setTimeout> | null = null;
64
+
65
+ return (...args: Parameters<T>) => {
66
+ if (timeoutId) {
67
+ clearTimeout(timeoutId);
68
+ }
69
+ timeoutId = setTimeout(() => {
70
+ fn(...args);
71
+ timeoutId = null;
72
+ }, delay);
73
+ };
74
+ }
75
+
76
+ // ============================================================================
77
+ // Throttle
78
+ // ============================================================================
79
+
80
+ /**
81
+ * Creates a throttled function
82
+ *
83
+ * @param fn - Function to throttle
84
+ * @param limit - Minimum time between calls in milliseconds
85
+ * @returns Throttled function
86
+ */
87
+ export function throttle<T extends (...args: unknown[]) => unknown>(
88
+ fn: T,
89
+ limit: number
90
+ ): (...args: Parameters<T>) => void {
91
+ let lastCall = 0;
92
+
93
+ return (...args: Parameters<T>) => {
94
+ const now = Date.now();
95
+ if (now - lastCall >= limit) {
96
+ lastCall = now;
97
+ fn(...args);
98
+ }
99
+ };
100
+ }
101
+
102
+ // ============================================================================
103
+ // Memory Pool for Face Objects
104
+ // ============================================================================
105
+
106
+ interface PooledObject<T> {
107
+ data: T;
108
+ inUse: boolean;
109
+ }
110
+
111
+ /**
112
+ * Creates an object pool for reducing garbage collection
113
+ *
114
+ * @param factory - Factory function to create new objects
115
+ * @param initialSize - Initial pool size
116
+ * @param maxSize - Maximum pool size
117
+ */
118
+ export function createObjectPool<T>(
119
+ factory: () => T,
120
+ initialSize: number = 10,
121
+ maxSize: number = 100
122
+ ) {
123
+ const pool: PooledObject<T>[] = [];
124
+
125
+ // Pre-populate pool
126
+ for (let i = 0; i < initialSize; i++) {
127
+ pool.push({ data: factory(), inUse: false });
128
+ }
129
+
130
+ return {
131
+ acquire: (): T => {
132
+ // Find an available object
133
+ const available = pool.find((obj) => !obj.inUse);
134
+ if (available) {
135
+ available.inUse = true;
136
+ return available.data;
137
+ }
138
+
139
+ // Create new if pool not at max
140
+ if (pool.length < maxSize) {
141
+ const newObj = { data: factory(), inUse: true };
142
+ pool.push(newObj);
143
+ return newObj.data;
144
+ }
145
+
146
+ // Pool exhausted, create temporary object
147
+ return factory();
148
+ },
149
+
150
+ release: (obj: T): void => {
151
+ const pooledObj = pool.find((p) => p.data === obj);
152
+ if (pooledObj) {
153
+ pooledObj.inUse = false;
154
+ }
155
+ },
156
+
157
+ clear: (): void => {
158
+ pool.length = 0;
159
+ },
160
+
161
+ getStats: () => ({
162
+ size: pool.length,
163
+ inUse: pool.filter((p) => p.inUse).length,
164
+ available: pool.filter((p) => !p.inUse).length,
165
+ }),
166
+ };
167
+ }
168
+
169
+ // ============================================================================
170
+ // Error Utilities
171
+ // ============================================================================
172
+
173
+ import type { SmartCameraError, SmartCameraErrorCode } from '../types';
174
+
175
+ /**
176
+ * Creates a SmartCameraError from an unknown error
177
+ *
178
+ * @param error - The original error
179
+ * @param defaultCode - Default error code if not determinable
180
+ * @returns SmartCameraError
181
+ */
182
+ export function createSmartCameraError(
183
+ error: unknown,
184
+ defaultCode: SmartCameraErrorCode = 'UNKNOWN_ERROR'
185
+ ): SmartCameraError {
186
+ if (error instanceof Error) {
187
+ // Check for specific error types
188
+ const message = error.message.toLowerCase();
189
+
190
+ let code: SmartCameraErrorCode = defaultCode;
191
+ if (message.includes('permission')) {
192
+ code = 'PERMISSION_DENIED';
193
+ } else if (message.includes('camera') && message.includes('unavailable')) {
194
+ code = 'CAMERA_UNAVAILABLE';
195
+ } else if (message.includes('webrtc')) {
196
+ code = 'WEBRTC_ERROR';
197
+ } else if (message.includes('mlkit') || message.includes('face detection')) {
198
+ code = 'ML_KIT_ERROR';
199
+ } else if (message.includes('frame processor')) {
200
+ code = 'FRAME_PROCESSOR_ERROR';
201
+ }
202
+
203
+ return {
204
+ code,
205
+ message: error.message,
206
+ nativeError: error,
207
+ };
208
+ }
209
+
210
+ return {
211
+ code: defaultCode,
212
+ message: String(error),
213
+ };
214
+ }
215
+
216
+ /**
217
+ * Safely execute a function and return a SmartCameraError on failure
218
+ */
219
+ export async function safeExecute<T>(
220
+ fn: () => Promise<T>,
221
+ errorCode: SmartCameraErrorCode = 'UNKNOWN_ERROR'
222
+ ): Promise<{ data: T; error: null } | { data: null; error: SmartCameraError }> {
223
+ try {
224
+ const data = await fn();
225
+ return { data, error: null };
226
+ } catch (error) {
227
+ return { data: null, error: createSmartCameraError(error, errorCode) };
228
+ }
229
+ }
230
+
231
+ // ============================================================================
232
+ // Validation Utilities
233
+ // ============================================================================
234
+
235
+ /**
236
+ * Validates face detection options
237
+ */
238
+ export function validateFaceDetectionOptions(options: Record<string, unknown>): string[] {
239
+ const errors: string[] = [];
240
+
241
+ if (options.minFaceSize !== undefined) {
242
+ const minFaceSize = options.minFaceSize as number;
243
+ if (typeof minFaceSize !== 'number' || minFaceSize < 0 || minFaceSize > 1) {
244
+ errors.push('minFaceSize must be a number between 0 and 1');
245
+ }
246
+ }
247
+
248
+ if (options.performanceMode !== undefined) {
249
+ const mode = options.performanceMode as string;
250
+ if (mode !== 'fast' && mode !== 'accurate') {
251
+ errors.push('performanceMode must be "fast" or "accurate"');
252
+ }
253
+ }
254
+
255
+ if (options.landmarkMode !== undefined) {
256
+ const mode = options.landmarkMode as string;
257
+ if (mode !== 'none' && mode !== 'all') {
258
+ errors.push('landmarkMode must be "none" or "all"');
259
+ }
260
+ }
261
+
262
+ if (options.contourMode !== undefined) {
263
+ const mode = options.contourMode as string;
264
+ if (mode !== 'none' && mode !== 'all') {
265
+ errors.push('contourMode must be "none" or "all"');
266
+ }
267
+ }
268
+
269
+ if (options.classificationMode !== undefined) {
270
+ const mode = options.classificationMode as string;
271
+ if (mode !== 'none' && mode !== 'all') {
272
+ errors.push('classificationMode must be "none" or "all"');
273
+ }
274
+ }
275
+
276
+ // Warn about contourMode + trackingEnabled combination
277
+ if (options.contourMode === 'all' && options.trackingEnabled === true) {
278
+ errors.push(
279
+ 'Warning: Using contourMode="all" with trackingEnabled=true is not recommended. ' +
280
+ 'Contour detection only works on the most prominent face, making tracking less useful.'
281
+ );
282
+ }
283
+
284
+ return errors;
285
+ }
286
+
287
+ // ============================================================================
288
+ // Performance Monitoring
289
+ // ============================================================================
290
+
291
+ interface PerformanceMetrics {
292
+ frameCount: number;
293
+ averageProcessingTime: number;
294
+ minProcessingTime: number;
295
+ maxProcessingTime: number;
296
+ droppedFrames: number;
297
+ }
298
+
299
+ /**
300
+ * Creates a performance monitor for frame processing
301
+ */
302
+ export function createPerformanceMonitor(windowSize: number = 30) {
303
+ const processingTimes: number[] = [];
304
+ let frameCount = 0;
305
+ let droppedFrames = 0;
306
+ let lastFrameTime = 0;
307
+ const targetFrameTime = 1000 / 30; // 30 FPS target
308
+
309
+ return {
310
+ startFrame: (): number => {
311
+ return Date.now();
312
+ },
313
+
314
+ endFrame: (startTime: number): void => {
315
+ const processingTime = Date.now() - startTime;
316
+ processingTimes.push(processingTime);
317
+
318
+ // Keep only last N samples
319
+ if (processingTimes.length > windowSize) {
320
+ processingTimes.shift();
321
+ }
322
+
323
+ frameCount++;
324
+
325
+ // Check for dropped frames
326
+ const now = Date.now();
327
+ if (lastFrameTime > 0) {
328
+ const frameGap = now - lastFrameTime;
329
+ if (frameGap > targetFrameTime * 2) {
330
+ droppedFrames += Math.floor(frameGap / targetFrameTime) - 1;
331
+ }
332
+ }
333
+ lastFrameTime = now;
334
+ },
335
+
336
+ getMetrics: (): PerformanceMetrics => {
337
+ const times = processingTimes.length > 0 ? processingTimes : [0];
338
+ return {
339
+ frameCount,
340
+ averageProcessingTime: times.reduce((a, b) => a + b, 0) / times.length,
341
+ minProcessingTime: Math.min(...times),
342
+ maxProcessingTime: Math.max(...times),
343
+ droppedFrames,
344
+ };
345
+ },
346
+
347
+ reset: (): void => {
348
+ processingTimes.length = 0;
349
+ frameCount = 0;
350
+ droppedFrames = 0;
351
+ lastFrameTime = 0;
352
+ },
353
+ };
354
+ }
355
+
@@ -0,0 +1,127 @@
1
+ import type {
2
+ WebRTCVideoSourceConfig,
3
+ WebRTCStreamStats,
4
+ WebRTCQualitySettings,
5
+ } from './types';
6
+
7
+ /**
8
+ * WebRTC Bridge for SmartCamera
9
+ *
10
+ * NOTE: This is a stub implementation. WebRTC functionality is not yet implemented.
11
+ * This class provides the interface for future WebRTC integration.
12
+ *
13
+ * This class provides a bridge between VisionCamera frames and WebRTC,
14
+ * allowing camera frames to be streamed via WebRTC peer connections.
15
+ */
16
+ export class WebRTCBridge {
17
+ private isInitialized = false;
18
+ private isStreaming = false;
19
+ private config: WebRTCVideoSourceConfig | null = null;
20
+
21
+ /**
22
+ * Initialize the WebRTC bridge
23
+ *
24
+ * This must be called before starting streaming.
25
+ */
26
+ async initialize(): Promise<void> {
27
+ if (this.isInitialized) {
28
+ return;
29
+ }
30
+
31
+ console.warn('[WebRTCBridge] WebRTC is not yet implemented');
32
+ this.isInitialized = true;
33
+ }
34
+
35
+ /**
36
+ * Start streaming camera frames via WebRTC
37
+ *
38
+ * @param config - Video source configuration
39
+ */
40
+ async startStreaming(config: WebRTCVideoSourceConfig): Promise<void> {
41
+ if (!this.isInitialized) {
42
+ await this.initialize();
43
+ }
44
+
45
+ if (this.isStreaming) {
46
+ console.warn('[WebRTCBridge] Already streaming, stopping first');
47
+ await this.stopStreaming();
48
+ }
49
+
50
+ console.warn('[WebRTCBridge] WebRTC streaming is not yet implemented');
51
+ this.config = config;
52
+ this.isStreaming = true;
53
+ }
54
+
55
+ /**
56
+ * Stop streaming
57
+ */
58
+ async stopStreaming(): Promise<void> {
59
+ if (!this.isStreaming) {
60
+ return;
61
+ }
62
+
63
+ this.isStreaming = false;
64
+ this.config = null;
65
+ }
66
+
67
+ /**
68
+ * Check if currently streaming
69
+ */
70
+ getIsStreaming(): boolean {
71
+ return this.isStreaming;
72
+ }
73
+
74
+ /**
75
+ * Get current configuration
76
+ */
77
+ getConfig(): WebRTCVideoSourceConfig | null {
78
+ return this.config;
79
+ }
80
+
81
+ /**
82
+ * Update quality settings (if supported)
83
+ *
84
+ * @param settings - Quality settings to apply
85
+ */
86
+ async updateQuality(settings: WebRTCQualitySettings): Promise<void> {
87
+ console.log('[WebRTCBridge] Updating quality:', settings);
88
+ }
89
+
90
+ /**
91
+ * Get current stream statistics
92
+ */
93
+ async getStats(): Promise<WebRTCStreamStats | null> {
94
+ if (!this.isStreaming) {
95
+ return null;
96
+ }
97
+
98
+ return {
99
+ frameRate: this.config?.frameRate ?? 0,
100
+ framesSent: 0,
101
+ framesDropped: 0,
102
+ bytesSent: 0,
103
+ bitrate: 0,
104
+ };
105
+ }
106
+
107
+ /**
108
+ * Cleanup and release resources
109
+ */
110
+ async destroy(): Promise<void> {
111
+ await this.stopStreaming();
112
+ this.isInitialized = false;
113
+ }
114
+ }
115
+
116
+ // Singleton instance for convenience
117
+ let bridgeInstance: WebRTCBridge | null = null;
118
+
119
+ /**
120
+ * Get the shared WebRTC bridge instance
121
+ */
122
+ export function getWebRTCBridge(): WebRTCBridge {
123
+ if (!bridgeInstance) {
124
+ bridgeInstance = new WebRTCBridge();
125
+ }
126
+ return bridgeInstance;
127
+ }