@arfuhad/react-native-smart-camera 0.1.2 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/CHANGELOG.md +75 -3
  2. package/README.md +259 -206
  3. package/android/build.gradle +14 -39
  4. package/android/src/main/java/com/smartcamera/FaceDetectorFrameProcessorPlugin.kt +324 -0
  5. package/android/src/main/java/com/smartcamera/SmartCameraPackage.kt +28 -0
  6. package/build/detection/blinkProcessor.js +2 -1
  7. package/build/detection/blinkProcessor.js.map +1 -1
  8. package/build/detection/faceDetector.d.ts +4 -4
  9. package/build/detection/faceDetector.d.ts.map +1 -1
  10. package/build/detection/faceDetector.js +31 -11
  11. package/build/detection/faceDetector.js.map +1 -1
  12. package/build/detection/index.d.ts +1 -1
  13. package/build/detection/index.d.ts.map +1 -1
  14. package/build/detection/index.js +1 -1
  15. package/build/detection/index.js.map +1 -1
  16. package/build/detection/staticImageDetector.d.ts +11 -11
  17. package/build/detection/staticImageDetector.d.ts.map +1 -1
  18. package/build/detection/staticImageDetector.js +19 -23
  19. package/build/detection/staticImageDetector.js.map +1 -1
  20. package/build/hooks/index.d.ts +6 -0
  21. package/build/hooks/index.d.ts.map +1 -1
  22. package/build/hooks/index.js +8 -0
  23. package/build/hooks/index.js.map +1 -1
  24. package/build/hooks/useBlinkDetection.d.ts +27 -16
  25. package/build/hooks/useBlinkDetection.d.ts.map +1 -1
  26. package/build/hooks/useBlinkDetection.js +63 -37
  27. package/build/hooks/useBlinkDetection.js.map +1 -1
  28. package/build/hooks/useFaceDetection.js +3 -2
  29. package/build/hooks/useFaceDetection.js.map +1 -1
  30. package/build/hooks/useFaceDetector.d.ts +123 -0
  31. package/build/hooks/useFaceDetector.d.ts.map +1 -0
  32. package/build/hooks/useFaceDetector.js +133 -0
  33. package/build/hooks/useFaceDetector.js.map +1 -0
  34. package/build/hooks/useSmartCamera.js.map +1 -1
  35. package/build/hooks/useSmartCameraWebRTC.d.ts +3 -5
  36. package/build/hooks/useSmartCameraWebRTC.d.ts.map +1 -1
  37. package/build/hooks/useSmartCameraWebRTC.js +19 -87
  38. package/build/hooks/useSmartCameraWebRTC.js.map +1 -1
  39. package/build/hooks/useWebRTC.d.ts +88 -0
  40. package/build/hooks/useWebRTC.d.ts.map +1 -0
  41. package/build/hooks/useWebRTC.js +394 -0
  42. package/build/hooks/useWebRTC.js.map +1 -0
  43. package/build/hooks/useWebRTCWithDetection.d.ts +89 -0
  44. package/build/hooks/useWebRTCWithDetection.d.ts.map +1 -0
  45. package/build/hooks/useWebRTCWithDetection.js +131 -0
  46. package/build/hooks/useWebRTCWithDetection.js.map +1 -0
  47. package/build/index.d.ts +24 -10
  48. package/build/index.d.ts.map +1 -1
  49. package/build/index.js +38 -13
  50. package/build/index.js.map +1 -1
  51. package/build/types.d.ts +28 -12
  52. package/build/types.d.ts.map +1 -1
  53. package/build/types.js.map +1 -1
  54. package/build/utils/index.js.map +1 -1
  55. package/build/webrtc/WebRTCBridge.d.ts +3 -0
  56. package/build/webrtc/WebRTCBridge.d.ts.map +1 -1
  57. package/build/webrtc/WebRTCBridge.js +12 -15
  58. package/build/webrtc/WebRTCBridge.js.map +1 -1
  59. package/build/webrtc/WebRTCManager.d.ts +148 -0
  60. package/build/webrtc/WebRTCManager.d.ts.map +1 -0
  61. package/build/webrtc/WebRTCManager.js +383 -0
  62. package/build/webrtc/WebRTCManager.js.map +1 -0
  63. package/build/webrtc/index.d.ts +3 -1
  64. package/build/webrtc/index.d.ts.map +1 -1
  65. package/build/webrtc/index.js +5 -0
  66. package/build/webrtc/index.js.map +1 -1
  67. package/build/webrtc/types.d.ts +212 -4
  68. package/build/webrtc/types.d.ts.map +1 -1
  69. package/build/webrtc/types.js +34 -1
  70. package/build/webrtc/types.js.map +1 -1
  71. package/ios/FaceDetectorFrameProcessorPlugin.m +11 -0
  72. package/ios/FaceDetectorFrameProcessorPlugin.swift +304 -0
  73. package/package.json +11 -11
  74. package/react-native-smart-camera.podspec +32 -0
  75. package/src/detection/blinkProcessor.ts +127 -0
  76. package/src/detection/faceDetector.ts +78 -0
  77. package/src/detection/index.ts +3 -0
  78. package/src/detection/staticImageDetector.ts +53 -0
  79. package/src/hooks/index.ts +26 -0
  80. package/src/hooks/useBlinkDetection.ts +127 -0
  81. package/src/hooks/useFaceDetection.ts +105 -0
  82. package/src/hooks/useFaceDetector.ts +191 -0
  83. package/src/hooks/useSmartCamera.ts +83 -0
  84. package/src/hooks/useSmartCameraWebRTC.ts +120 -0
  85. package/src/hooks/useWebRTC.ts +453 -0
  86. package/src/hooks/useWebRTCWithDetection.ts +181 -0
  87. package/src/index.ts +170 -0
  88. package/src/types.ts +636 -0
  89. package/src/utils/index.ts +355 -0
  90. package/src/webrtc/WebRTCBridge.ts +127 -0
  91. package/src/webrtc/WebRTCManager.ts +453 -0
  92. package/src/webrtc/index.ts +50 -0
  93. package/src/webrtc/types.ts +361 -0
  94. package/android/build/.transforms/e0a0b120a9ccc3a8de4f5784bc36b161/results.bin +0 -1
  95. package/android/build/.transforms/e0a0b120a9ccc3a8de4f5784bc36b161/transformed/classes/classes_dex/classes.dex +0 -0
  96. package/android/build/generated/source/buildConfig/debug/expo/modules/smartcamera/BuildConfig.java +0 -10
  97. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -7
  98. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
  99. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -6
  100. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  101. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  102. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  103. package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -0
  104. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
  105. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
  106. package/android/build/intermediates/java_res/debug/out/META-INF/arfuhad-react-native-smart-camera_debug.kotlin_module +0 -0
  107. package/android/build/intermediates/javac/debug/classes/expo/modules/smartcamera/BuildConfig.class +0 -0
  108. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -2
  109. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -7
  110. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -7
  111. package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
  112. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  113. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1
  114. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  115. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  116. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  117. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  118. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  119. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  120. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  121. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  122. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  123. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  124. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  125. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  126. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  127. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  128. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  129. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  130. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  131. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  132. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  133. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  134. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  135. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  136. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  137. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  138. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  139. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  140. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  141. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  142. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab +0 -0
  143. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream +0 -0
  144. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len +0 -0
  145. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.len +0 -0
  146. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.values.at +0 -0
  147. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i +0 -0
  148. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i.len +0 -0
  149. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  150. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  151. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  152. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  153. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  154. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  155. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  156. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  157. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  158. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  159. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  160. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  161. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  162. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  163. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  164. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  165. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  166. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  167. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  168. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  169. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  170. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  171. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  172. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  173. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  174. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  175. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  176. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  177. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
  178. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  179. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  180. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  181. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  182. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  183. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  184. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  185. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  186. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  187. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  188. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  189. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  190. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  191. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  192. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  193. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  194. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  195. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  196. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  197. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  198. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  199. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  200. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  201. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  202. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -16
  203. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  204. package/android/build/tmp/kotlin-classes/debug/META-INF/arfuhad-react-native-smart-camera_debug.kotlin_module +0 -0
  205. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/DetectedFace.class +0 -0
  206. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceBounds.class +0 -0
  207. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceContoursData.class +0 -0
  208. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceDetectionOptions.class +0 -0
  209. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceLandmarksData.class +0 -0
  210. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/ImageLoader$Companion.class +0 -0
  211. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/ImageLoader$loadImage$2.class +0 -0
  212. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/ImageLoader.class +0 -0
  213. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetector$detectFaces$2$1.class +0 -0
  214. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetector$detectFaces$2$2.class +0 -0
  215. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetector.class +0 -0
  216. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetectorKt$sam$com_google_android_gms_tasks_OnSuccessListener$0.class +0 -0
  217. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetectorKt.class +0 -0
  218. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/PointData.class +0 -0
  219. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$Companion.class +0 -0
  220. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$1$1$1.class +0 -0
  221. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$1$3$1.class +0 -0
  222. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$1$4$1.class +0 -0
  223. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunction$1.class +0 -0
  224. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunction$2.class +0 -0
  225. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunction$3.class +0 -0
  226. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$1.class +0 -0
  227. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$2.class +0 -0
  228. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$3.class +0 -0
  229. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$4.class +0 -0
  230. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$1.class +0 -0
  231. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$2.class +0 -0
  232. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$3.class +0 -0
  233. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$4.class +0 -0
  234. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$FunctionWithoutArgs$1.class +0 -0
  235. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$FunctionWithoutArgs$2.class +0 -0
  236. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$OnActivityEntersBackground$1.class +0 -0
  237. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$OnActivityEntersForeground$1.class +0 -0
  238. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$OnDestroy$1.class +0 -0
  239. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule.class +0 -0
  240. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraView.class +0 -0
  241. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/WebRTCFrameBridge$Companion.class +0 -0
  242. package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/WebRTCFrameBridge.class +0 -0
  243. package/android/src/main/java/expo/modules/smartcamera/ImageLoader.kt +0 -106
  244. package/android/src/main/java/expo/modules/smartcamera/MLKitFaceDetector.kt +0 -273
  245. package/android/src/main/java/expo/modules/smartcamera/SmartCameraModule.kt +0 -205
  246. package/android/src/main/java/expo/modules/smartcamera/SmartCameraView.kt +0 -153
  247. package/android/src/main/java/expo/modules/smartcamera/WebRTCFrameBridge.kt +0 -184
  248. package/build/SmartCamera.d.ts +0 -17
  249. package/build/SmartCamera.d.ts.map +0 -1
  250. package/build/SmartCamera.js +0 -270
  251. package/build/SmartCamera.js.map +0 -1
  252. package/build/SmartCameraModule.d.ts +0 -112
  253. package/build/SmartCameraModule.d.ts.map +0 -1
  254. package/build/SmartCameraModule.js +0 -121
  255. package/build/SmartCameraModule.js.map +0 -1
  256. package/build/SmartCameraView.d.ts +0 -8
  257. package/build/SmartCameraView.d.ts.map +0 -1
  258. package/build/SmartCameraView.js +0 -7
  259. package/build/SmartCameraView.js.map +0 -1
  260. package/expo-module.config.json +0 -9
  261. package/ios/MLKitFaceDetector.swift +0 -310
  262. package/ios/SmartCamera.podspec +0 -33
  263. package/ios/SmartCameraModule.swift +0 -225
  264. package/ios/SmartCameraView.swift +0 -146
  265. package/ios/WebRTCFrameBridge.swift +0 -150
@@ -1 +1 @@
1
- {"version":3,"file":"useSmartCamera.js","sourceRoot":"","sources":["../../src/hooks/useSmartCamera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAG1F;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAe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MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,yBAAyB,EAAE,CAAC;IAEzD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9B,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;QACxD,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,qBAAqB,EAAE,MAAM,CAAC,qBAAqB;KACpD,CAAC,CAAC,CAAC;AACN,CAAC","sourcesContent":["import { useState, useCallback, useMemo } from 'react';\nimport { useCameraDevice, useCameraPermission, Camera } from 'react-native-vision-camera';\nimport type { CameraFacing, UseSmartCameraResult, CameraDevice } from '../types';\n\n/**\n * Hook for managing SmartCamera state and permissions\n * \n * @returns Camera state, permission handlers, and device info\n * \n * @example\n * ```tsx\n * function CameraScreen() {\n * const { \n * hasPermission, \n * requestPermission, \n * device, \n * switchCamera,\n * currentCamera \n * } = useSmartCamera();\n * \n * if (!hasPermission) {\n * return <Button onPress={requestPermission} title=\"Grant Permission\" />;\n * }\n * \n * return <SmartCamera camera={currentCamera} />;\n * }\n * ```\n */\nexport function useSmartCamera(): UseSmartCameraResult {\n const [currentCamera, setCurrentCamera] = useState<CameraFacing>('front');\n const { hasPermission, requestPermission: requestCameraPermission } = useCameraPermission();\n const nativeDevice = useCameraDevice(currentCamera);\n\n // Map native device to our CameraDevice type\n const device: CameraDevice | undefined = useMemo(() => {\n if (!nativeDevice) return undefined;\n\n return {\n id: nativeDevice.id,\n name: nativeDevice.name,\n position: nativeDevice.position === 'front' ? 'front' : 'back',\n hasFlash: nativeDevice.hasFlash,\n hasTorch: nativeDevice.hasTorch,\n supportsLowLightBoost: nativeDevice.supportsLowLightBoost,\n };\n }, [nativeDevice]);\n\n // Request camera permission\n const requestPermission = useCallback(async (): Promise<boolean> => {\n const result = await requestCameraPermission();\n return result;\n }, [requestCameraPermission]);\n\n // Switch between front and back camera\n const switchCamera = useCallback(() => {\n setCurrentCamera((prev) => (prev === 'front' ? 'back' : 'front'));\n }, []);\n\n return {\n hasPermission,\n requestPermission,\n device,\n switchCamera,\n currentCamera,\n };\n}\n\n/**\n * Get all available camera devices\n */\nexport async function getAvailableCameras(): Promise<CameraDevice[]> {\n const devices = await Camera.getAvailableCameraDevices();\n \n return devices.map((device) => ({\n id: device.id,\n name: device.name,\n position: device.position === 'front' ? 'front' : 'back',\n hasFlash: device.hasFlash,\n hasTorch: device.hasTorch,\n supportsLowLightBoost: device.supportsLowLightBoost,\n }));\n}\n\n"]}
1
+ {"version":3,"file":"useSmartCamera.js","sourceRoot":"","sources":["../../src/hooks/useSmartCamera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAG1F;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAe,OAAO,CAAC,CAAC;IAC1E,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAC5F,MAAM,YAAY,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;IAEpD,6CAA6C;IAC7C,MAAM,MAAM,GAA6B,OAAO,CAAC,GAAG,EAAE;QACpD,IAAI,CAAC,YAAY;YAAE,OAAO,SAAS,CAAC;QAEpC,OAAO;YACL,EAAE,EAAE,YAAY,CAAC,EAAE;YACnB,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,QAAQ,EAAE,YAAY,CAAC,QAAQ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,MAAM,CAAC,qBAAqB;KACpD,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -13,8 +13,8 @@ export interface UseSmartCameraWebRTCOptions extends Omit<WebRTCConfig, 'enabled
13
13
  /**
14
14
  * Hook for managing WebRTC streaming with SmartCamera
15
15
  *
16
- * This hook provides control over WebRTC video streaming, allowing you to
17
- * start/stop streaming and switch cameras while streaming.
16
+ * NOTE: This is a stub implementation. WebRTC functionality is not yet implemented.
17
+ * The hook provides the interface but does not perform actual streaming.
18
18
  *
19
19
  * @param options - WebRTC configuration options
20
20
  * @returns WebRTC streaming controls and state
@@ -42,9 +42,7 @@ export interface UseSmartCameraWebRTCOptions extends Omit<WebRTCConfig, 'enabled
42
42
  *
43
43
  * return (
44
44
  * <View>
45
- * <SmartCamera
46
- * webrtc={{ enabled: isStreaming, peerConnection, mode: 'call' }}
47
- * />
45
+ * <Camera device={device} isActive={true} />
48
46
  * <Button
49
47
  * onPress={isStreaming ? stopStreaming : startStreaming}
50
48
  * title={isStreaming ? 'End Call' : 'Start Call'}
@@ -1 +1 @@
1
- {"version":3,"file":"useSmartCameraWebRTC.d.ts","sourceRoot":"","sources":["../../src/hooks/useSmartCameraWebRTC.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAQvF;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAChF,8CAA8C;IAC9C,aAAa,CAAC,EAAE,YAAY,CAAC;IAE7B,4CAA4C;IAC5C,sBAAsB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;IAExD,oCAAoC;IACpC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,2BAAgC,GACxC,0BAA0B,CAiI5B"}
1
+ {"version":3,"file":"useSmartCameraWebRTC.d.ts","sourceRoot":"","sources":["../../src/hooks/useSmartCameraWebRTC.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEvF;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAChF,8CAA8C;IAC9C,aAAa,CAAC,EAAE,YAAY,CAAC;IAE7B,4CAA4C;IAC5C,sBAAsB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;IAExD,oCAAoC;IACpC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,2BAAgC,GACxC,0BAA0B,CA0D5B"}
@@ -1,10 +1,9 @@
1
1
  import { useState, useCallback, useRef, useEffect } from 'react';
2
- import { initializeWebRTC, startWebRTCStream, stopWebRTCStream, addWebRTCStateChangeListener, } from '../SmartCameraModule';
3
2
  /**
4
3
  * Hook for managing WebRTC streaming with SmartCamera
5
4
  *
6
- * This hook provides control over WebRTC video streaming, allowing you to
7
- * start/stop streaming and switch cameras while streaming.
5
+ * NOTE: This is a stub implementation. WebRTC functionality is not yet implemented.
6
+ * The hook provides the interface but does not perform actual streaming.
8
7
  *
9
8
  * @param options - WebRTC configuration options
10
9
  * @returns WebRTC streaming controls and state
@@ -32,9 +31,7 @@ import { initializeWebRTC, startWebRTCStream, stopWebRTCStream, addWebRTCStateCh
32
31
  *
33
32
  * return (
34
33
  * <View>
35
- * <SmartCamera
36
- * webrtc={{ enabled: isStreaming, peerConnection, mode: 'call' }}
37
- * />
34
+ * <Camera device={device} isActive={true} />
38
35
  * <Button
39
36
  * onPress={isStreaming ? stopStreaming : startStreaming}
40
37
  * title={isStreaming ? 'End Call' : 'Start Call'}
@@ -45,19 +42,16 @@ import { initializeWebRTC, startWebRTCStream, stopWebRTCStream, addWebRTCStateCh
45
42
  * ```
46
43
  */
47
44
  export function useSmartCameraWebRTC(options = {}) {
48
- const { peerConnection, mode = 'call', videoConstraints = { width: 1280, height: 720, frameRate: 30 }, initialCamera = 'front', onStreamingStateChange, onError, } = options;
45
+ const { initialCamera = 'front', onStreamingStateChange, onError, } = options;
49
46
  const [videoTrack, setVideoTrack] = useState(null);
50
47
  const [isStreaming, setIsStreaming] = useState(false);
51
- const [isInitialized, setIsInitialized] = useState(false);
52
48
  const [currentCamera, setCurrentCamera] = useState(initialCamera);
53
- const peerConnectionRef = useRef(peerConnection);
54
49
  const callbacksRef = useRef({ onStreamingStateChange, onError });
55
50
  const isMounted = useRef(true);
56
51
  // Keep refs updated
57
52
  useEffect(() => {
58
- peerConnectionRef.current = peerConnection;
59
53
  callbacksRef.current = { onStreamingStateChange, onError };
60
- }, [peerConnection, onStreamingStateChange, onError]);
54
+ }, [onStreamingStateChange, onError]);
61
55
  // Track mounted state
62
56
  useEffect(() => {
63
57
  isMounted.current = true;
@@ -65,90 +59,28 @@ export function useSmartCameraWebRTC(options = {}) {
65
59
  isMounted.current = false;
66
60
  };
67
61
  }, []);
68
- // Subscribe to WebRTC state changes
69
- useEffect(() => {
70
- const subscription = addWebRTCStateChangeListener((state) => {
71
- if (isMounted.current) {
72
- setIsStreaming(state.isStreaming);
73
- callbacksRef.current.onStreamingStateChange?.(state.isStreaming);
74
- }
75
- });
76
- return () => {
77
- subscription.remove();
78
- };
79
- }, []);
80
- // Initialize WebRTC on first use
81
- const ensureInitialized = useCallback(async () => {
82
- if (isInitialized)
83
- return;
84
- try {
85
- await initializeWebRTC();
86
- if (isMounted.current) {
87
- setIsInitialized(true);
88
- }
89
- }
90
- catch (error) {
91
- const err = error instanceof Error ? error : new Error(String(error));
92
- callbacksRef.current.onError?.(err);
93
- throw err;
94
- }
95
- }, [isInitialized]);
96
- // Start streaming
62
+ // Start streaming (stub)
97
63
  const startStreaming = useCallback(async () => {
98
- try {
99
- // Ensure WebRTC is initialized
100
- await ensureInitialized();
101
- // Start the WebRTC stream with video constraints
102
- await startWebRTCStream({
103
- width: videoConstraints.width ?? 1280,
104
- height: videoConstraints.height ?? 720,
105
- frameRate: videoConstraints.frameRate ?? 30,
106
- });
107
- if (isMounted.current) {
108
- setIsStreaming(true);
109
- callbacksRef.current.onStreamingStateChange?.(true);
110
- }
64
+ var _a, _b;
65
+ console.warn('[SmartCamera] WebRTC streaming is not yet implemented');
66
+ if (isMounted.current) {
67
+ setIsStreaming(true);
68
+ (_b = (_a = callbacksRef.current).onStreamingStateChange) === null || _b === void 0 ? void 0 : _b.call(_a, true);
111
69
  }
112
- catch (error) {
113
- const err = error instanceof Error ? error : new Error(String(error));
114
- callbacksRef.current.onError?.(err);
115
- throw err;
116
- }
117
- }, [videoConstraints, ensureInitialized]);
118
- // Stop streaming
70
+ }, []);
71
+ // Stop streaming (stub)
119
72
  const stopStreaming = useCallback(() => {
120
- try {
121
- stopWebRTCStream();
122
- if (isMounted.current) {
123
- setVideoTrack(null);
124
- setIsStreaming(false);
125
- callbacksRef.current.onStreamingStateChange?.(false);
126
- }
127
- }
128
- catch (error) {
129
- const err = error instanceof Error ? error : new Error(String(error));
130
- callbacksRef.current.onError?.(err);
73
+ var _a, _b;
74
+ if (isMounted.current) {
75
+ setVideoTrack(null);
76
+ setIsStreaming(false);
77
+ (_b = (_a = callbacksRef.current).onStreamingStateChange) === null || _b === void 0 ? void 0 : _b.call(_a, false);
131
78
  }
132
79
  }, []);
133
- // Switch camera while streaming
80
+ // Switch camera
134
81
  const switchCamera = useCallback(() => {
135
82
  setCurrentCamera((prev) => (prev === 'front' ? 'back' : 'front'));
136
- // The camera switch will be handled by the SmartCamera component
137
- // when the camera prop changes
138
83
  }, []);
139
- // Cleanup on unmount
140
- useEffect(() => {
141
- return () => {
142
- if (isStreaming) {
143
- try {
144
- stopWebRTCStream();
145
- }
146
- catch {
147
- // Ignore cleanup errors
148
- }
149
- }
150
- };
151
- }, [isStreaming]);
152
84
  return {
153
85
  videoTrack,
154
86
  isStreaming,
@@ -1 +1 @@
1
- {"version":3,"file":"useSmartCameraWebRTC.js","sourceRoot":"","sources":["../../src/hooks/useSmartCameraWebRTC.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAgB9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAuC,EAAE;IAEzC,MAAM,EACJ,cAAc,EACd,IAAI,GAAG,MAAM,EACb,gBAAgB,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,EAC9D,aAAa,GAAG,OAAO,EACvB,sBAAsB,EACtB,OAAO,GACR,GAAG,OAAO,CAAC;IAEZ,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAA0B,IAAI,CAAC,CAAC;IAC5E,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAe,aAAa,CAAC,CAAC;IAEhF,MAAM,iBAAiB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,MAAM,CAAC,EAAE,sBAAsB,EAAE,O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YACH,gBAAgB,EAAE,CAAC;YACnB,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;gBACtB,aAAa,CAAC,IAAI,CAAC,CAAC;gBACpB,cAAc,CAAC,KAAK,CAAC,CAAC;gBACtB,YAAY,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC,KAAK,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACtE,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,gCAAgC;IAChC,MAAM,YAAY,GAAG,WAAW,CAAC,GAAS,EAAE;QAC1C,gBAAgB,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAClE,iEAAiE;QACjE,+BAA+B;IACjC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,qBAAqB;IACrB,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,IAAI,WAAW,EAAE,CAAC;gBAChB,IAAI,CAAC;oBACH,gBAAgB,EAAE,CAAC;gBACrB,CAAC;gBAAC,MAAM,CAAC;oBACP,wBAAwB;gBAC1B,CAAC;YACH,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO;QACL,UAAU;QACV,WAAW;QACX,cAAc;QACd,aAAa;QACb,YAAY;KACb,CAAC;AACJ,CAAC","sourcesContent":["import { useState, useCallback, useRef, useEffect } from 'react';\nimport type { WebRTCConfig, UseSmartCameraWebRTCResult, CameraFacing } from '../types';\nimport {\n initializeWebRTC,\n startWebRTCStream,\n stopWebRTCStream,\n addWebRTCStateChangeListener,\n} from '../SmartCameraModule';\n\n/**\n * Options for useSmartCameraWebRTC hook\n */\nexport interface UseSmartCameraWebRTCOptions extends Omit<WebRTCConfig, 'enabled'> {\n /** Initial camera facing. Default: 'front' */\n initialCamera?: CameraFacing;\n \n /** Callback when streaming state changes */\n onStreamingStateChange?: (isStreaming: boolean) => void;\n \n /** Callback when an error occurs */\n onError?: (error: Error) => void;\n}\n\n/**\n * Hook for managing WebRTC streaming with SmartCamera\n * \n * This hook provides control over WebRTC video streaming, allowing you to\n * start/stop streaming and switch cameras while streaming.\n * \n * @param options - WebRTC configuration options\n * @returns WebRTC streaming controls and state\n * \n * @example\n * ```tsx\n * function VideoCall() {\n * const peerConnection = useRef(new RTCPeerConnection(config)).current;\n * \n * const {\n * videoTrack,\n * isStreaming,\n * startStreaming,\n * stopStreaming,\n * switchCamera,\n * } = useSmartCameraWebRTC({\n * peerConnection,\n * mode: 'call',\n * videoConstraints: {\n * width: 1280,\n * height: 720,\n * frameRate: 30,\n * },\n * });\n * \n * return (\n * <View>\n * <SmartCamera \n * webrtc={{ enabled: isStreaming, peerConnection, mode: 'call' }}\n * />\n * <Button \n * onPress={isStreaming ? stopStreaming : startStreaming} \n * title={isStreaming ? 'End Call' : 'Start Call'} \n * />\n * </View>\n * );\n * }\n * ```\n */\nexport function useSmartCameraWebRTC(\n options: UseSmartCameraWebRTCOptions = {}\n): UseSmartCameraWebRTCResult {\n const {\n peerConnection,\n mode = 'call',\n videoConstraints = { width: 1280, height: 720, frameRate: 30 },\n initialCamera = 'front',\n onStreamingStateChange,\n onError,\n } = options;\n\n const [videoTrack, setVideoTrack] = useState<MediaStreamTrack | null>(null);\n const [isStreaming, setIsStreaming] = useState(false);\n const [isInitialized, setIsInitialized] = useState(false);\n const [currentCamera, setCurrentCamera] = useState<CameraFacing>(initialCamera);\n \n const peerConnectionRef = useRef(peerConnection);\n const callbacksRef = useRef({ onStreamingStateChange, onError });\n const isMounted = useRef(true);\n\n // Keep refs updated\n useEffect(() => {\n peerConnectionRef.current = peerConnection;\n callbacksRef.current = { onStreamingStateChange, onError };\n }, [peerConnection, onStreamingStateChange, onError]);\n\n // Track mounted state\n useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n // Subscribe to WebRTC state changes\n useEffect(() => {\n const subscription = addWebRTCStateChangeListener((state) => {\n if (isMounted.current) {\n setIsStreaming(state.isStreaming);\n callbacksRef.current.onStreamingStateChange?.(state.isStreaming);\n }\n });\n\n return () => {\n subscription.remove();\n };\n }, []);\n\n // Initialize WebRTC on first use\n const ensureInitialized = useCallback(async (): Promise<void> => {\n if (isInitialized) return;\n\n try {\n await initializeWebRTC();\n if (isMounted.current) {\n setIsInitialized(true);\n }\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n callbacksRef.current.onError?.(err);\n throw err;\n }\n }, [isInitialized]);\n\n // Start streaming\n const startStreaming = useCallback(async (): Promise<void> => {\n try {\n // Ensure WebRTC is initialized\n await ensureInitialized();\n\n // Start the WebRTC stream with video constraints\n await startWebRTCStream({\n width: videoConstraints.width ?? 1280,\n height: videoConstraints.height ?? 720,\n frameRate: videoConstraints.frameRate ?? 30,\n });\n\n if (isMounted.current) {\n setIsStreaming(true);\n callbacksRef.current.onStreamingStateChange?.(true);\n }\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n callbacksRef.current.onError?.(err);\n throw err;\n }\n }, [videoConstraints, ensureInitialized]);\n\n // Stop streaming\n const stopStreaming = useCallback((): void => {\n try {\n stopWebRTCStream();\n if (isMounted.current) {\n setVideoTrack(null);\n setIsStreaming(false);\n callbacksRef.current.onStreamingStateChange?.(false);\n }\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n callbacksRef.current.onError?.(err);\n }\n }, []);\n\n // Switch camera while streaming\n const switchCamera = useCallback((): void => {\n setCurrentCamera((prev) => (prev === 'front' ? 'back' : 'front'));\n // The camera switch will be handled by the SmartCamera component\n // when the camera prop changes\n }, []);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n if (isStreaming) {\n try {\n stopWebRTCStream();\n } catch {\n // Ignore cleanup errors\n }\n }\n };\n }, [isStreaming]);\n\n return {\n videoTrack,\n isStreaming,\n startStreaming,\n stopStreaming,\n switchCamera,\n };\n}\n"]}
1
+ {"version":3,"file":"useSmartCameraWebRTC.js","sourceRoot":"","sources":["../../src/hooks/useSmartCameraWebRTC.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAiBjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAuC,EAAE;IAEzC,MAAM,EACJ,aAAa,GAAG,OAAO,EACvB,sBAAsB,EACtB,OAAO,GACR,GAAG,OAAO,CAAC;IAEZ,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAA0B,IAAI,CAAC,CAAC;IAC5E,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAe,aAAa,CAAC,CAAC;IAEhF,MAAM,YAAY,GAAG,MAAM,CAAC,EAAE,sBAAsB,EAAE,OAAO,EAAE,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAE/B,oBAAoB;IACpB,SAAS,CAAC,GAAG,EAAE;QACb,YAAY,CAAC,OAAO,GAAG,EAAE,sBAAsB,EAAE,OAAO,EAAE,CAAC;IAC7D,CAAC,EAAE,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC,CAAC;IAEtC,sBAAsB;IACtB,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;QACzB,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,yBAAyB;IACzB,MAAM,cAAc,GAAG,WAAW,CAAC,KAAK,IAAmB,EAAE;;QAC3D,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;QAEtE,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,cAAc,CAAC,IAAI,CAAC,CAAC;YACrB,MAAA,MAAA,YAAY,CAAC,OAAO,EAAC,sBAAsB,mDAAG,IAAI,CAAC,CAAC;QACtD,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,wBAAwB;IACxB,MAAM,aAAa,GAAG,WAAW,CAAC,GAAS,EAAE;;QAC3C,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,aAAa,CAAC,IAAI,CAAC,CAAC;YACpB,cAAc,CAAC,KAAK,CAAC,CAAC;YACtB,MAAA,MAAA,YAAY,CAAC,OAAO,EAAC,sBAAsB,mDAAG,KAAK,CAAC,CAAC;QACvD,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,gBAAgB;IAChB,MAAM,YAAY,GAAG,WAAW,CAAC,GAAS,EAAE;QAC1C,gBAAgB,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,UAAU;QACV,WAAW;QACX,cAAc;QACd,aAAa;QACb,YAAY;KACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,88 @@
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
+ import type { UseWebRTCOptions, UseWebRTCResult } from '../webrtc/types';
12
+ /**
13
+ * Hook for WebRTC video calling
14
+ *
15
+ * @param options - Configuration options
16
+ * @returns WebRTC controls and state
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * import { useWebRTC } from '@arfuhad/react-native-smart-camera';
21
+ * import { RTCView } from 'react-native-webrtc';
22
+ *
23
+ * function VideoCall() {
24
+ * const {
25
+ * localStream,
26
+ * remoteStream,
27
+ * callState,
28
+ * startLocalStream,
29
+ * createPeerConnection,
30
+ * createOffer,
31
+ * setRemoteDescription,
32
+ * addIceCandidate,
33
+ * onIceCandidate,
34
+ * switchCamera,
35
+ * toggleAudio,
36
+ * toggleVideo,
37
+ * cleanup,
38
+ * } = useWebRTC({
39
+ * config: {
40
+ * iceServers: [{ urls: 'stun:stun.l.google.com:19302' }],
41
+ * },
42
+ * onRemoteStream: (stream) => console.log('Remote stream received'),
43
+ * });
44
+ *
45
+ * // Start a call
46
+ * const startCall = async () => {
47
+ * await startLocalStream();
48
+ * createPeerConnection();
49
+ * const offer = await createOffer();
50
+ * // Send offer via your signaling server
51
+ * socket.emit('offer', offer);
52
+ * };
53
+ *
54
+ * // Handle incoming call
55
+ * useEffect(() => {
56
+ * socket.on('offer', async (offer) => {
57
+ * await startLocalStream();
58
+ * createPeerConnection();
59
+ * await setRemoteDescription(offer);
60
+ * const answer = await createAnswer();
61
+ * socket.emit('answer', answer);
62
+ * });
63
+ *
64
+ * socket.on('ice-candidate', (candidate) => {
65
+ * addIceCandidate(candidate);
66
+ * });
67
+ *
68
+ * onIceCandidate((event) => {
69
+ * if (event.candidate) {
70
+ * socket.emit('ice-candidate', event.candidate);
71
+ * }
72
+ * });
73
+ * }, []);
74
+ *
75
+ * return (
76
+ * <View>
77
+ * {remoteStream && <RTCView streamURL={remoteStream.toURL()} />}
78
+ * {localStream && <RTCView streamURL={localStream.toURL()} />}
79
+ * <Button onPress={switchCamera} title="Switch Camera" />
80
+ * <Button onPress={toggleAudio} title="Mute/Unmute" />
81
+ * </View>
82
+ * );
83
+ * }
84
+ * ```
85
+ */
86
+ export declare function useWebRTC(options?: UseWebRTCOptions): UseWebRTCResult;
87
+ export type { UseWebRTCOptions, UseWebRTCResult };
88
+ //# sourceMappingURL=useWebRTC.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWebRTC.d.ts","sourceRoot":"","sources":["../../src/hooks/useWebRTC.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EAQhB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,eAAe,CA2VzE;AAED,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC"}