@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
+ * WebRTC Manager for SmartCamera
3
+ *
4
+ * This class provides utilities for managing WebRTC peer connections,
5
+ * media streams, and video calling functionality.
6
+ *
7
+ * Requires react-native-webrtc to be installed in the app.
8
+ */
9
+
10
+ import type {
11
+ PeerConnectionConfig,
12
+ MediaConstraints,
13
+ SessionDescription,
14
+ ICECandidateEvent,
15
+ WebRTCConnectionState,
16
+ ICEConnectionState,
17
+ CallState,
18
+ DEFAULT_PEER_CONNECTION_CONFIG,
19
+ DEFAULT_MEDIA_CONSTRAINTS,
20
+ } from './types';
21
+
22
+ // Import from react-native-webrtc (peer dependency)
23
+ let RTCPeerConnection: any;
24
+ let RTCSessionDescription: any;
25
+ let RTCIceCandidate: any;
26
+ let mediaDevices: any;
27
+
28
+ // Lazy load react-native-webrtc to avoid errors when not installed
29
+ function loadWebRTC(): boolean {
30
+ if (RTCPeerConnection) return true;
31
+
32
+ try {
33
+ const webrtc = require('react-native-webrtc');
34
+ RTCPeerConnection = webrtc.RTCPeerConnection;
35
+ RTCSessionDescription = webrtc.RTCSessionDescription;
36
+ RTCIceCandidate = webrtc.RTCIceCandidate;
37
+ mediaDevices = webrtc.mediaDevices;
38
+ return true;
39
+ } catch (error) {
40
+ console.error(
41
+ '[WebRTCManager] react-native-webrtc is not installed. ' +
42
+ 'Please install it: npm install react-native-webrtc'
43
+ );
44
+ return false;
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Check if WebRTC is available
50
+ */
51
+ export function isWebRTCAvailable(): boolean {
52
+ return loadWebRTC();
53
+ }
54
+
55
+ /**
56
+ * WebRTC Manager class for handling peer connections and media streams
57
+ */
58
+ export class WebRTCManager {
59
+ private peerConnection: RTCPeerConnection | null = null;
60
+ private localStream: MediaStream | null = null;
61
+ private remoteStream: MediaStream | null = null;
62
+ private config: PeerConnectionConfig;
63
+ private iceCandidateCallback: ((event: ICECandidateEvent) => void) | null = null;
64
+ private remoteStreamCallback: ((stream: MediaStream) => void) | null = null;
65
+ private connectionStateCallback: ((state: WebRTCConnectionState) => void) | null = null;
66
+ private iceConnectionStateCallback: ((state: ICEConnectionState) => void) | null = null;
67
+
68
+ constructor(config?: PeerConnectionConfig) {
69
+ this.config = config || {
70
+ iceServers: [
71
+ { urls: 'stun:stun.l.google.com:19302' },
72
+ { urls: 'stun:stun1.l.google.com:19302' },
73
+ ],
74
+ iceTransportPolicy: 'all',
75
+ bundlePolicy: 'balanced',
76
+ };
77
+ }
78
+
79
+ // ==========================================================================
80
+ // Local Stream Management
81
+ // ==========================================================================
82
+
83
+ /**
84
+ * Get local media stream (camera + microphone)
85
+ *
86
+ * @param constraints - Media constraints for video/audio
87
+ * @returns Promise resolving to MediaStream
88
+ */
89
+ async getLocalStream(constraints?: MediaConstraints): Promise<MediaStream> {
90
+ if (!loadWebRTC()) {
91
+ throw new Error('react-native-webrtc is not available');
92
+ }
93
+
94
+ const defaultConstraints: MediaConstraints = {
95
+ video: {
96
+ width: { ideal: 1280 },
97
+ height: { ideal: 720 },
98
+ frameRate: { ideal: 30 },
99
+ facingMode: 'user',
100
+ },
101
+ audio: {
102
+ echoCancellation: true,
103
+ noiseSuppression: true,
104
+ autoGainControl: true,
105
+ },
106
+ };
107
+
108
+ const mergedConstraints = {
109
+ ...defaultConstraints,
110
+ ...constraints,
111
+ };
112
+
113
+ try {
114
+ const stream = await mediaDevices.getUserMedia(mergedConstraints);
115
+ this.localStream = stream;
116
+ return stream;
117
+ } catch (error) {
118
+ console.error('[WebRTCManager] Failed to get local stream:', error);
119
+ throw error;
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Stop the local media stream
125
+ */
126
+ stopLocalStream(): void {
127
+ if (this.localStream) {
128
+ this.localStream.getTracks().forEach((track: any) => {
129
+ track.stop();
130
+ });
131
+ this.localStream = null;
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Get the current local stream
137
+ */
138
+ getLocalStreamInstance(): MediaStream | null {
139
+ return this.localStream;
140
+ }
141
+
142
+ /**
143
+ * Switch between front and back camera
144
+ */
145
+ async switchCamera(): Promise<void> {
146
+ if (!this.localStream) {
147
+ throw new Error('No local stream available');
148
+ }
149
+
150
+ const videoTrack = this.localStream.getVideoTracks()[0];
151
+ if (videoTrack && typeof (videoTrack as any)._switchCamera === 'function') {
152
+ (videoTrack as any)._switchCamera();
153
+ } else {
154
+ throw new Error('Camera switch not supported');
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Toggle video track on/off
160
+ *
161
+ * @param enabled - Whether video should be enabled
162
+ */
163
+ toggleVideo(enabled: boolean): void {
164
+ if (this.localStream) {
165
+ this.localStream.getVideoTracks().forEach((track: any) => {
166
+ track.enabled = enabled;
167
+ });
168
+ }
169
+ }
170
+
171
+ /**
172
+ * Toggle audio track on/off
173
+ *
174
+ * @param enabled - Whether audio should be enabled
175
+ */
176
+ toggleAudio(enabled: boolean): void {
177
+ if (this.localStream) {
178
+ this.localStream.getAudioTracks().forEach((track: any) => {
179
+ track.enabled = enabled;
180
+ });
181
+ }
182
+ }
183
+
184
+ // ==========================================================================
185
+ // Peer Connection Management
186
+ // ==========================================================================
187
+
188
+ /**
189
+ * Create a new peer connection
190
+ *
191
+ * @param config - Optional peer connection configuration
192
+ * @returns The created RTCPeerConnection
193
+ */
194
+ createPeerConnection(config?: PeerConnectionConfig): RTCPeerConnection {
195
+ if (!loadWebRTC()) {
196
+ throw new Error('react-native-webrtc is not available');
197
+ }
198
+
199
+ const pcConfig = config || this.config;
200
+ const pc = new RTCPeerConnection(pcConfig);
201
+ this.peerConnection = pc;
202
+
203
+ this.setupPeerConnectionListeners();
204
+
205
+ return pc;
206
+ }
207
+
208
+ /**
209
+ * Get the current peer connection
210
+ */
211
+ getPeerConnection(): RTCPeerConnection | null {
212
+ return this.peerConnection;
213
+ }
214
+
215
+ /**
216
+ * Close the peer connection
217
+ */
218
+ closePeerConnection(): void {
219
+ if (this.peerConnection) {
220
+ this.peerConnection.close();
221
+ this.peerConnection = null;
222
+ }
223
+ this.remoteStream = null;
224
+ }
225
+
226
+ /**
227
+ * Setup listeners for peer connection events
228
+ */
229
+ private setupPeerConnectionListeners(): void {
230
+ if (!this.peerConnection) return;
231
+
232
+ // Handle ICE candidates
233
+ this.peerConnection.onicecandidate = (event: any) => {
234
+ if (this.iceCandidateCallback) {
235
+ this.iceCandidateCallback({
236
+ candidate: event.candidate,
237
+ sdpMid: event.candidate?.sdpMid,
238
+ sdpMLineIndex: event.candidate?.sdpMLineIndex,
239
+ });
240
+ }
241
+ };
242
+
243
+ // Handle remote stream
244
+ this.peerConnection.ontrack = (event: any) => {
245
+ if (event.streams && event.streams[0]) {
246
+ const stream = event.streams[0];
247
+ this.remoteStream = stream;
248
+ if (this.remoteStreamCallback) {
249
+ this.remoteStreamCallback(stream);
250
+ }
251
+ }
252
+ };
253
+
254
+ // Handle connection state changes
255
+ this.peerConnection.onconnectionstatechange = () => {
256
+ if (this.connectionStateCallback && this.peerConnection) {
257
+ this.connectionStateCallback(
258
+ this.peerConnection.connectionState as WebRTCConnectionState
259
+ );
260
+ }
261
+ };
262
+
263
+ // Handle ICE connection state changes
264
+ this.peerConnection.oniceconnectionstatechange = () => {
265
+ if (this.iceConnectionStateCallback && this.peerConnection) {
266
+ this.iceConnectionStateCallback(
267
+ this.peerConnection.iceConnectionState as ICEConnectionState
268
+ );
269
+ }
270
+ };
271
+ }
272
+
273
+ /**
274
+ * Add local stream to peer connection
275
+ *
276
+ * @param stream - The local MediaStream to add
277
+ */
278
+ addLocalStream(stream: MediaStream): void {
279
+ if (!this.peerConnection) {
280
+ throw new Error('Peer connection not created');
281
+ }
282
+
283
+ stream.getTracks().forEach((track: any) => {
284
+ this.peerConnection!.addTrack(track, stream);
285
+ });
286
+ }
287
+
288
+ /**
289
+ * Get the remote stream
290
+ */
291
+ getRemoteStream(): MediaStream | null {
292
+ return this.remoteStream;
293
+ }
294
+
295
+ // ==========================================================================
296
+ // Signaling Helpers
297
+ // ==========================================================================
298
+
299
+ /**
300
+ * Create an SDP offer
301
+ *
302
+ * @returns Promise resolving to SessionDescription
303
+ */
304
+ async createOffer(): Promise<SessionDescription> {
305
+ if (!this.peerConnection) {
306
+ throw new Error('Peer connection not created');
307
+ }
308
+
309
+ const offer = await this.peerConnection.createOffer({
310
+ offerToReceiveAudio: true,
311
+ offerToReceiveVideo: true,
312
+ });
313
+
314
+ await this.peerConnection.setLocalDescription(offer);
315
+
316
+ return {
317
+ type: 'offer',
318
+ sdp: offer.sdp ?? '',
319
+ };
320
+ }
321
+
322
+ /**
323
+ * Create an SDP answer
324
+ *
325
+ * @returns Promise resolving to SessionDescription
326
+ */
327
+ async createAnswer(): Promise<SessionDescription> {
328
+ if (!this.peerConnection) {
329
+ throw new Error('Peer connection not created');
330
+ }
331
+
332
+ const answer = await this.peerConnection.createAnswer();
333
+ await this.peerConnection.setLocalDescription(answer);
334
+
335
+ return {
336
+ type: 'answer',
337
+ sdp: answer.sdp ?? '',
338
+ };
339
+ }
340
+
341
+ /**
342
+ * Set the remote SDP description
343
+ *
344
+ * @param description - The remote SessionDescription
345
+ */
346
+ async setRemoteDescription(description: SessionDescription): Promise<void> {
347
+ if (!this.peerConnection) {
348
+ throw new Error('Peer connection not created');
349
+ }
350
+
351
+ if (!loadWebRTC()) {
352
+ throw new Error('react-native-webrtc is not available');
353
+ }
354
+
355
+ const rtcDescription = new RTCSessionDescription(description);
356
+ await this.peerConnection.setRemoteDescription(rtcDescription);
357
+ }
358
+
359
+ /**
360
+ * Add an ICE candidate from remote peer
361
+ *
362
+ * @param candidate - The ICE candidate to add
363
+ */
364
+ async addIceCandidate(candidate: RTCIceCandidate): Promise<void> {
365
+ if (!this.peerConnection) {
366
+ throw new Error('Peer connection not created');
367
+ }
368
+
369
+ if (!loadWebRTC()) {
370
+ throw new Error('react-native-webrtc is not available');
371
+ }
372
+
373
+ const iceCandidate = new RTCIceCandidate(candidate);
374
+ await this.peerConnection.addIceCandidate(iceCandidate);
375
+ }
376
+
377
+ // ==========================================================================
378
+ // Event Callbacks
379
+ // ==========================================================================
380
+
381
+ /**
382
+ * Register callback for ICE candidates
383
+ *
384
+ * @param callback - Function to call when ICE candidate is generated
385
+ */
386
+ onIceCandidate(callback: (event: ICECandidateEvent) => void): void {
387
+ this.iceCandidateCallback = callback;
388
+ }
389
+
390
+ /**
391
+ * Register callback for remote stream
392
+ *
393
+ * @param callback - Function to call when remote stream is received
394
+ */
395
+ onRemoteStream(callback: (stream: MediaStream) => void): void {
396
+ this.remoteStreamCallback = callback;
397
+ }
398
+
399
+ /**
400
+ * Register callback for connection state changes
401
+ *
402
+ * @param callback - Function to call when connection state changes
403
+ */
404
+ onConnectionStateChange(callback: (state: WebRTCConnectionState) => void): void {
405
+ this.connectionStateCallback = callback;
406
+ }
407
+
408
+ /**
409
+ * Register callback for ICE connection state changes
410
+ *
411
+ * @param callback - Function to call when ICE connection state changes
412
+ */
413
+ onIceConnectionStateChange(callback: (state: ICEConnectionState) => void): void {
414
+ this.iceConnectionStateCallback = callback;
415
+ }
416
+
417
+ // ==========================================================================
418
+ // Cleanup
419
+ // ==========================================================================
420
+
421
+ /**
422
+ * Clean up all resources
423
+ */
424
+ cleanup(): void {
425
+ this.stopLocalStream();
426
+ this.closePeerConnection();
427
+ this.iceCandidateCallback = null;
428
+ this.remoteStreamCallback = null;
429
+ this.connectionStateCallback = null;
430
+ this.iceConnectionStateCallback = null;
431
+ }
432
+ }
433
+
434
+ // Singleton instance for convenience
435
+ let managerInstance: WebRTCManager | null = null;
436
+
437
+ /**
438
+ * Get the shared WebRTC manager instance
439
+ */
440
+ export function getWebRTCManager(config?: PeerConnectionConfig): WebRTCManager {
441
+ if (!managerInstance) {
442
+ managerInstance = new WebRTCManager(config);
443
+ }
444
+ return managerInstance;
445
+ }
446
+
447
+ /**
448
+ * Create a new WebRTC manager instance
449
+ */
450
+ export function createWebRTCManager(config?: PeerConnectionConfig): WebRTCManager {
451
+ return new WebRTCManager(config);
452
+ }
453
+
@@ -0,0 +1,50 @@
1
+ // WebRTC Manager
2
+ export {
3
+ WebRTCManager,
4
+ getWebRTCManager,
5
+ createWebRTCManager,
6
+ isWebRTCAvailable,
7
+ } from './WebRTCManager';
8
+
9
+ // Legacy Bridge (deprecated, use WebRTCManager instead)
10
+ export { WebRTCBridge, getWebRTCBridge } from './WebRTCBridge';
11
+
12
+ // Types
13
+ export type {
14
+ // Core types
15
+ ICEServer,
16
+ PeerConnectionConfig,
17
+ VideoConstraints,
18
+ AudioConstraints,
19
+ MediaConstraints,
20
+
21
+ // State types
22
+ CallState,
23
+ WebRTCConnectionState,
24
+ ICEConnectionState,
25
+ ICEGatheringState,
26
+ SignalingState,
27
+
28
+ // Stream types
29
+ VideoFrameFormat,
30
+ WebRTCVideoSourceConfig,
31
+ WebRTCStreamStats,
32
+ WebRTCQualitySettings,
33
+
34
+ // Event types
35
+ WebRTCStreamEvent,
36
+ ICECandidateEvent,
37
+ SessionDescription,
38
+
39
+ // Hook types
40
+ UseWebRTCOptions,
41
+ UseWebRTCResult,
42
+ UseWebRTCWithDetectionOptions,
43
+ } from './types';
44
+
45
+ // Default configurations
46
+ export {
47
+ DEFAULT_ICE_SERVERS,
48
+ DEFAULT_PEER_CONNECTION_CONFIG,
49
+ DEFAULT_MEDIA_CONSTRAINTS,
50
+ } from './types';