@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,453 @@
1
+ /**
2
+ * useWebRTC Hook
3
+ *
4
+ * React hook for managing WebRTC video calling with peer connections,
5
+ * local/remote streams, and signaling integration.
6
+ *
7
+ * This hook provides all the functionality needed for 1-to-1 video calls.
8
+ * Users are responsible for implementing their own signaling mechanism
9
+ * (WebSocket, Socket.io, etc.) to exchange SDP offers/answers and ICE candidates.
10
+ */
11
+
12
+ import { useState, useCallback, useRef, useEffect } from 'react';
13
+ import {
14
+ WebRTCManager,
15
+ isWebRTCAvailable,
16
+ } from '../webrtc/WebRTCManager';
17
+ import type {
18
+ UseWebRTCOptions,
19
+ UseWebRTCResult,
20
+ PeerConnectionConfig,
21
+ MediaConstraints,
22
+ SessionDescription,
23
+ ICECandidateEvent,
24
+ CallState,
25
+ WebRTCConnectionState,
26
+ ICEConnectionState,
27
+ } from '../webrtc/types';
28
+
29
+ /**
30
+ * Hook for WebRTC video calling
31
+ *
32
+ * @param options - Configuration options
33
+ * @returns WebRTC controls and state
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * import { useWebRTC } from '@arfuhad/react-native-smart-camera';
38
+ * import { RTCView } from 'react-native-webrtc';
39
+ *
40
+ * function VideoCall() {
41
+ * const {
42
+ * localStream,
43
+ * remoteStream,
44
+ * callState,
45
+ * startLocalStream,
46
+ * createPeerConnection,
47
+ * createOffer,
48
+ * setRemoteDescription,
49
+ * addIceCandidate,
50
+ * onIceCandidate,
51
+ * switchCamera,
52
+ * toggleAudio,
53
+ * toggleVideo,
54
+ * cleanup,
55
+ * } = useWebRTC({
56
+ * config: {
57
+ * iceServers: [{ urls: 'stun:stun.l.google.com:19302' }],
58
+ * },
59
+ * onRemoteStream: (stream) => console.log('Remote stream received'),
60
+ * });
61
+ *
62
+ * // Start a call
63
+ * const startCall = async () => {
64
+ * await startLocalStream();
65
+ * createPeerConnection();
66
+ * const offer = await createOffer();
67
+ * // Send offer via your signaling server
68
+ * socket.emit('offer', offer);
69
+ * };
70
+ *
71
+ * // Handle incoming call
72
+ * useEffect(() => {
73
+ * socket.on('offer', async (offer) => {
74
+ * await startLocalStream();
75
+ * createPeerConnection();
76
+ * await setRemoteDescription(offer);
77
+ * const answer = await createAnswer();
78
+ * socket.emit('answer', answer);
79
+ * });
80
+ *
81
+ * socket.on('ice-candidate', (candidate) => {
82
+ * addIceCandidate(candidate);
83
+ * });
84
+ *
85
+ * onIceCandidate((event) => {
86
+ * if (event.candidate) {
87
+ * socket.emit('ice-candidate', event.candidate);
88
+ * }
89
+ * });
90
+ * }, []);
91
+ *
92
+ * return (
93
+ * <View>
94
+ * {remoteStream && <RTCView streamURL={remoteStream.toURL()} />}
95
+ * {localStream && <RTCView streamURL={localStream.toURL()} />}
96
+ * <Button onPress={switchCamera} title="Switch Camera" />
97
+ * <Button onPress={toggleAudio} title="Mute/Unmute" />
98
+ * </View>
99
+ * );
100
+ * }
101
+ * ```
102
+ */
103
+ export function useWebRTC(options: UseWebRTCOptions = {}): UseWebRTCResult {
104
+ const {
105
+ config,
106
+ mediaConstraints,
107
+ initialCamera = 'front',
108
+ autoStartLocalStream = false,
109
+ onCallStateChange,
110
+ onConnectionStateChange,
111
+ onIceConnectionStateChange,
112
+ onRemoteStream,
113
+ onRemoteStreamRemoved,
114
+ onError,
115
+ } = options;
116
+
117
+ // State
118
+ const [localStream, setLocalStream] = useState<MediaStream | null>(null);
119
+ const [remoteStream, setRemoteStream] = useState<MediaStream | null>(null);
120
+ const [callState, setCallState] = useState<CallState>('idle');
121
+ const [isAudioEnabled, setIsAudioEnabled] = useState(true);
122
+ const [isVideoEnabled, setIsVideoEnabled] = useState(true);
123
+ const [currentCamera, setCurrentCamera] = useState<'front' | 'back'>(initialCamera);
124
+ const [peerConnection, setPeerConnection] = useState<RTCPeerConnection | null>(null);
125
+
126
+ // Refs
127
+ const managerRef = useRef<WebRTCManager | null>(null);
128
+ const isMountedRef = useRef(true);
129
+ const iceCandidateCallbackRef = useRef<((event: ICECandidateEvent) => void) | null>(null);
130
+ const callbacksRef = useRef({
131
+ onCallStateChange,
132
+ onConnectionStateChange,
133
+ onIceConnectionStateChange,
134
+ onRemoteStream,
135
+ onRemoteStreamRemoved,
136
+ onError,
137
+ });
138
+
139
+ // Keep callbacks ref updated
140
+ useEffect(() => {
141
+ callbacksRef.current = {
142
+ onCallStateChange,
143
+ onConnectionStateChange,
144
+ onIceConnectionStateChange,
145
+ onRemoteStream,
146
+ onRemoteStreamRemoved,
147
+ onError,
148
+ };
149
+ }, [
150
+ onCallStateChange,
151
+ onConnectionStateChange,
152
+ onIceConnectionStateChange,
153
+ onRemoteStream,
154
+ onRemoteStreamRemoved,
155
+ onError,
156
+ ]);
157
+
158
+ // Initialize manager
159
+ useEffect(() => {
160
+ if (!isWebRTCAvailable()) {
161
+ console.warn('[useWebRTC] react-native-webrtc is not available');
162
+ return;
163
+ }
164
+
165
+ managerRef.current = new WebRTCManager(config);
166
+
167
+ return () => {
168
+ isMountedRef.current = false;
169
+ managerRef.current?.cleanup();
170
+ };
171
+ }, []);
172
+
173
+ // Auto-start local stream if configured
174
+ useEffect(() => {
175
+ if (autoStartLocalStream && isWebRTCAvailable()) {
176
+ startLocalStream();
177
+ }
178
+ }, [autoStartLocalStream]);
179
+
180
+ // Update call state and notify
181
+ const updateCallState = useCallback((newState: CallState) => {
182
+ if (isMountedRef.current) {
183
+ setCallState(newState);
184
+ callbacksRef.current.onCallStateChange?.(newState);
185
+ }
186
+ }, []);
187
+
188
+ // ==========================================================================
189
+ // Local Stream Controls
190
+ // ==========================================================================
191
+
192
+ /**
193
+ * Start local camera/microphone stream
194
+ */
195
+ const startLocalStream = useCallback(async (): Promise<void> => {
196
+ if (!managerRef.current) {
197
+ throw new Error('WebRTC not initialized');
198
+ }
199
+
200
+ try {
201
+ const constraints: MediaConstraints = {
202
+ video: {
203
+ width: { ideal: 1280 },
204
+ height: { ideal: 720 },
205
+ frameRate: { ideal: 30 },
206
+ facingMode: currentCamera === 'front' ? 'user' : 'environment',
207
+ },
208
+ audio: {
209
+ echoCancellation: true,
210
+ noiseSuppression: true,
211
+ autoGainControl: true,
212
+ },
213
+ ...mediaConstraints,
214
+ };
215
+
216
+ const stream = await managerRef.current.getLocalStream(constraints);
217
+
218
+ if (isMountedRef.current) {
219
+ setLocalStream(stream);
220
+ setIsAudioEnabled(true);
221
+ setIsVideoEnabled(true);
222
+ }
223
+ } catch (error) {
224
+ callbacksRef.current.onError?.(error as Error);
225
+ throw error;
226
+ }
227
+ }, [currentCamera, mediaConstraints]);
228
+
229
+ /**
230
+ * Stop local stream
231
+ */
232
+ const stopLocalStream = useCallback((): void => {
233
+ managerRef.current?.stopLocalStream();
234
+ if (isMountedRef.current) {
235
+ setLocalStream(null);
236
+ }
237
+ }, []);
238
+
239
+ /**
240
+ * Switch between front and back camera
241
+ */
242
+ const switchCamera = useCallback(async (): Promise<void> => {
243
+ try {
244
+ await managerRef.current?.switchCamera();
245
+ if (isMountedRef.current) {
246
+ setCurrentCamera((prev) => (prev === 'front' ? 'back' : 'front'));
247
+ }
248
+ } catch (error) {
249
+ callbacksRef.current.onError?.(error as Error);
250
+ throw error;
251
+ }
252
+ }, []);
253
+
254
+ /**
255
+ * Toggle local audio on/off
256
+ */
257
+ const toggleAudio = useCallback((): void => {
258
+ const newState = !isAudioEnabled;
259
+ managerRef.current?.toggleAudio(newState);
260
+ if (isMountedRef.current) {
261
+ setIsAudioEnabled(newState);
262
+ }
263
+ }, [isAudioEnabled]);
264
+
265
+ /**
266
+ * Toggle local video on/off
267
+ */
268
+ const toggleVideo = useCallback((): void => {
269
+ const newState = !isVideoEnabled;
270
+ managerRef.current?.toggleVideo(newState);
271
+ if (isMountedRef.current) {
272
+ setIsVideoEnabled(newState);
273
+ }
274
+ }, [isVideoEnabled]);
275
+
276
+ // ==========================================================================
277
+ // Peer Connection Management
278
+ // ==========================================================================
279
+
280
+ /**
281
+ * Create a new peer connection
282
+ */
283
+ const createPeerConnection = useCallback((pcConfig?: PeerConnectionConfig): RTCPeerConnection => {
284
+ if (!managerRef.current) {
285
+ throw new Error('WebRTC not initialized');
286
+ }
287
+
288
+ const pc = managerRef.current.createPeerConnection(pcConfig || config);
289
+
290
+ // Setup callbacks
291
+ managerRef.current.onRemoteStream((stream) => {
292
+ if (isMountedRef.current) {
293
+ setRemoteStream(stream);
294
+ updateCallState('connected');
295
+ callbacksRef.current.onRemoteStream?.(stream);
296
+ }
297
+ });
298
+
299
+ managerRef.current.onConnectionStateChange((state) => {
300
+ callbacksRef.current.onConnectionStateChange?.(state);
301
+
302
+ // Update call state based on connection state
303
+ if (state === 'connected') {
304
+ updateCallState('connected');
305
+ } else if (state === 'disconnected' || state === 'failed') {
306
+ updateCallState('disconnected');
307
+ } else if (state === 'connecting') {
308
+ updateCallState('connecting');
309
+ }
310
+ });
311
+
312
+ managerRef.current.onIceConnectionStateChange((state) => {
313
+ callbacksRef.current.onIceConnectionStateChange?.(state);
314
+ });
315
+
316
+ managerRef.current.onIceCandidate((event) => {
317
+ iceCandidateCallbackRef.current?.(event);
318
+ });
319
+
320
+ // Add local stream to peer connection if available
321
+ const stream = managerRef.current.getLocalStreamInstance();
322
+ if (stream) {
323
+ managerRef.current.addLocalStream(stream);
324
+ }
325
+
326
+ if (isMountedRef.current) {
327
+ setPeerConnection(pc);
328
+ updateCallState('connecting');
329
+ }
330
+
331
+ return pc;
332
+ }, [config, updateCallState]);
333
+
334
+ /**
335
+ * Close the peer connection
336
+ */
337
+ const closePeerConnection = useCallback((): void => {
338
+ managerRef.current?.closePeerConnection();
339
+ if (isMountedRef.current) {
340
+ setPeerConnection(null);
341
+ setRemoteStream(null);
342
+ updateCallState('idle');
343
+ callbacksRef.current.onRemoteStreamRemoved?.();
344
+ }
345
+ }, [updateCallState]);
346
+
347
+ // ==========================================================================
348
+ // Signaling Helpers
349
+ // ==========================================================================
350
+
351
+ /**
352
+ * Create an SDP offer
353
+ */
354
+ const createOffer = useCallback(async (): Promise<SessionDescription> => {
355
+ if (!managerRef.current) {
356
+ throw new Error('WebRTC not initialized');
357
+ }
358
+ return managerRef.current.createOffer();
359
+ }, []);
360
+
361
+ /**
362
+ * Create an SDP answer
363
+ */
364
+ const createAnswer = useCallback(async (): Promise<SessionDescription> => {
365
+ if (!managerRef.current) {
366
+ throw new Error('WebRTC not initialized');
367
+ }
368
+ return managerRef.current.createAnswer();
369
+ }, []);
370
+
371
+ /**
372
+ * Set the remote SDP description
373
+ */
374
+ const setRemoteDescription = useCallback(async (description: SessionDescription): Promise<void> => {
375
+ if (!managerRef.current) {
376
+ throw new Error('WebRTC not initialized');
377
+ }
378
+ await managerRef.current.setRemoteDescription(description);
379
+ }, []);
380
+
381
+ /**
382
+ * Add an ICE candidate from remote peer
383
+ */
384
+ const addIceCandidate = useCallback(async (candidate: RTCIceCandidate): Promise<void> => {
385
+ if (!managerRef.current) {
386
+ throw new Error('WebRTC not initialized');
387
+ }
388
+ await managerRef.current.addIceCandidate(candidate);
389
+ }, []);
390
+
391
+ /**
392
+ * Register callback for ICE candidates
393
+ */
394
+ const onIceCandidate = useCallback((callback: (event: ICECandidateEvent) => void): void => {
395
+ iceCandidateCallbackRef.current = callback;
396
+ }, []);
397
+
398
+ // ==========================================================================
399
+ // Cleanup
400
+ // ==========================================================================
401
+
402
+ /**
403
+ * Clean up all resources
404
+ */
405
+ const cleanup = useCallback((): void => {
406
+ managerRef.current?.cleanup();
407
+ if (isMountedRef.current) {
408
+ setLocalStream(null);
409
+ setRemoteStream(null);
410
+ setPeerConnection(null);
411
+ setCallState('idle');
412
+ setIsAudioEnabled(true);
413
+ setIsVideoEnabled(true);
414
+ }
415
+ }, []);
416
+
417
+ return {
418
+ // Streams
419
+ localStream,
420
+ remoteStream,
421
+
422
+ // State
423
+ callState,
424
+ isAudioEnabled,
425
+ isVideoEnabled,
426
+ currentCamera,
427
+ peerConnection,
428
+
429
+ // Local stream controls
430
+ startLocalStream,
431
+ stopLocalStream,
432
+ switchCamera,
433
+ toggleAudio,
434
+ toggleVideo,
435
+
436
+ // Peer connection management
437
+ createPeerConnection,
438
+ closePeerConnection,
439
+
440
+ // Signaling helpers
441
+ createOffer,
442
+ createAnswer,
443
+ setRemoteDescription,
444
+ addIceCandidate,
445
+ onIceCandidate,
446
+
447
+ // Cleanup
448
+ cleanup,
449
+ };
450
+ }
451
+
452
+ export type { UseWebRTCOptions, UseWebRTCResult };
453
+
@@ -0,0 +1,181 @@
1
+ /**
2
+ * useWebRTCWithDetection Hook
3
+ *
4
+ * Combined hook that provides WebRTC video calling functionality
5
+ * alongside face detection and eye tracking capabilities.
6
+ *
7
+ * This hook allows you to:
8
+ * - Make video calls using WebRTC
9
+ * - Detect faces in the local camera feed using VisionCamera
10
+ * - Track eye status for blink detection
11
+ */
12
+
13
+ import { useState, useCallback, useRef, useEffect } from 'react';
14
+ import { useRunOnJS } from 'react-native-worklets-core';
15
+ import type { Frame } from 'react-native-vision-camera';
16
+ import { useWebRTC } from './useWebRTC';
17
+ import { useFaceDetector } from './useFaceDetector';
18
+ import { useBlinkDetection } from './useBlinkDetection';
19
+ import type { Face, EyeStatusResult } from '../types';
20
+ import type {
21
+ UseWebRTCOptions,
22
+ UseWebRTCResult,
23
+ UseWebRTCWithDetectionOptions,
24
+ } from '../webrtc/types';
25
+
26
+ // Re-export the options type
27
+ export type { UseWebRTCWithDetectionOptions } from '../webrtc/types';
28
+
29
+ /**
30
+ * Result type for useWebRTCWithDetection hook
31
+ */
32
+ export interface UseWebRTCWithDetectionResult extends UseWebRTCResult {
33
+ // Face detection
34
+ /** Currently detected faces */
35
+ faces: Face[];
36
+ /** Detect faces in a frame (for use in VisionCamera frame processor) */
37
+ detectFaces: (frame: Frame) => Face[];
38
+
39
+ // Eye tracking
40
+ /** Current eye status */
41
+ eyeStatus: EyeStatusResult | null;
42
+ /** Process faces for eye tracking */
43
+ processEyeStatus: (faces: Face[]) => void;
44
+ /** Reset eye status */
45
+ resetEyeStatus: () => void;
46
+
47
+ // Combined handler for frame processor
48
+ /** Process a frame for both face detection and eye tracking */
49
+ processFrame: (frame: Frame) => void;
50
+ }
51
+
52
+ /**
53
+ * Hook combining WebRTC video calling with face detection and eye tracking
54
+ *
55
+ * @param options - Configuration options
56
+ * @returns Combined WebRTC, face detection, and eye tracking controls
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * import { useWebRTCWithDetection } from '@arfuhad/react-native-smart-camera';
61
+ * import { Camera, useFrameProcessor } from 'react-native-vision-camera';
62
+ * import { RTCView } from 'react-native-webrtc';
63
+ *
64
+ * function VideoCallWithDetection() {
65
+ * const {
66
+ * // WebRTC
67
+ * localStream,
68
+ * remoteStream,
69
+ * callState,
70
+ * startLocalStream,
71
+ * createPeerConnection,
72
+ * // Face detection
73
+ * faces,
74
+ * detectFaces,
75
+ * // Eye tracking
76
+ * eyeStatus,
77
+ * // Combined handler
78
+ * processFrame,
79
+ * } = useWebRTCWithDetection({
80
+ * config: { iceServers: [{ urls: 'stun:stun.l.google.com:19302' }] },
81
+ * faceDetection: { enabled: true, classificationMode: 'all' },
82
+ * eyeTracking: { enabled: true, eyeClosedThreshold: 0.3 },
83
+ * });
84
+ *
85
+ * // Use VisionCamera for local preview + detection
86
+ * // Use RTCView for remote stream
87
+ * const frameProcessor = useFrameProcessor((frame) => {
88
+ * 'worklet';
89
+ * processFrame(frame);
90
+ * }, [processFrame]);
91
+ *
92
+ * return (
93
+ * <View>
94
+ * <Camera
95
+ * device={device}
96
+ * isActive={true}
97
+ * frameProcessor={frameProcessor}
98
+ * />
99
+ * {remoteStream && <RTCView streamURL={remoteStream.toURL()} />}
100
+ * <Text>Faces: {faces.length}</Text>
101
+ * <Text>Left Eye: {eyeStatus?.leftEye.openProbability.toFixed(2)}</Text>
102
+ * </View>
103
+ * );
104
+ * }
105
+ * ```
106
+ */
107
+ export function useWebRTCWithDetection(
108
+ options: UseWebRTCWithDetectionOptions = {}
109
+ ): UseWebRTCWithDetectionResult {
110
+ const {
111
+ faceDetection = {},
112
+ eyeTracking = {},
113
+ ...webrtcOptions
114
+ } = options;
115
+
116
+ // WebRTC hook
117
+ const webrtc = useWebRTC(webrtcOptions);
118
+
119
+ // Face detection state
120
+ const [faces, setFaces] = useState<Face[]>([]);
121
+
122
+ // Face detector hook
123
+ const { detectFaces } = useFaceDetector({
124
+ performanceMode: faceDetection.performanceMode || 'fast',
125
+ landmarkMode: faceDetection.landmarkMode || 'none',
126
+ classificationMode: faceDetection.classificationMode || 'all', // Needed for eye tracking
127
+ trackingEnabled: true,
128
+ });
129
+
130
+ // Blink detection hook
131
+ const {
132
+ eyeStatus,
133
+ processEyeStatus,
134
+ reset: resetEyeStatus,
135
+ } = useBlinkDetection({
136
+ enabled: eyeTracking.enabled !== false,
137
+ eyeClosedThreshold: eyeTracking.eyeClosedThreshold ?? 0.5,
138
+ });
139
+
140
+ // Handle detected faces on JS thread
141
+ const handleFaces = useRunOnJS((detectedFaces: Face[]) => {
142
+ setFaces(detectedFaces);
143
+
144
+ // Process for eye tracking if enabled
145
+ if (eyeTracking.enabled !== false) {
146
+ processEyeStatus(detectedFaces);
147
+ }
148
+ }, [processEyeStatus, eyeTracking.enabled]);
149
+
150
+ // Combined frame processor function
151
+ const processFrame = useCallback((frame: Frame) => {
152
+ 'worklet';
153
+
154
+ if (faceDetection.enabled === false) {
155
+ return;
156
+ }
157
+
158
+ const detectedFaces = detectFaces(frame);
159
+ handleFaces(detectedFaces);
160
+ }, [detectFaces, handleFaces, faceDetection.enabled]);
161
+
162
+ return {
163
+ // WebRTC
164
+ ...webrtc,
165
+
166
+ // Face detection
167
+ faces,
168
+ detectFaces,
169
+
170
+ // Eye tracking
171
+ eyeStatus,
172
+ processEyeStatus,
173
+ resetEyeStatus,
174
+
175
+ // Combined handler
176
+ processFrame,
177
+ };
178
+ }
179
+
180
+ // Types are exported from the interface definition above
181
+