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