gravix-rtc-react-native 0.0.0-stage → 0.2.0

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 (378) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/LICENSE +20 -0
  3. package/LICENSES/Apache-2.0.txt +175 -0
  4. package/NOTICE +68 -0
  5. package/README.md +313 -2
  6. package/android/build.gradle +137 -0
  7. package/android/consumer-rules.pro +29 -0
  8. package/android/src/main/AndroidManifest.xml +9 -0
  9. package/android/src/main/cpp/CMakeLists.txt +48 -0
  10. package/android/src/main/cpp/gx_dfn_engine.c +332 -0
  11. package/android/src/main/cpp/gx_fx_jni.cpp +34 -0
  12. package/android/src/main/cpp/gx_ns_jni.c +162 -0
  13. package/android/src/main/cpp/third_party/onnxruntime/LICENSE +21 -0
  14. package/android/src/main/cpp/third_party/onnxruntime/include/onnxruntime_c_api.h +9227 -0
  15. package/android/src/main/cpp/third_party/onnxruntime/include/onnxruntime_ep_c_api.h +3315 -0
  16. package/android/src/main/cpp/third_party/onnxruntime/include/onnxruntime_error_code.h +98 -0
  17. package/android/src/main/java/com/gravitycompile/gravixrtc/GravixAudioHooks.kt +144 -0
  18. package/android/src/main/java/com/gravitycompile/gravixrtc/GravixAudioModule.kt +105 -0
  19. package/android/src/main/java/com/gravitycompile/gravixrtc/GravixNativeAudio.kt +310 -0
  20. package/android/src/main/java/com/gravitycompile/gravixrtc/GravixRtc.kt +134 -0
  21. package/android/src/main/java/com/gravitycompile/gravixrtc/GravixRtcModule.kt +176 -0
  22. package/android/src/main/java/com/gravitycompile/gravixrtc/GravixRtcPackage.kt +39 -0
  23. package/android/src/main/java/com/gravitycompile/gravixrtc/audio/AudioDeviceKind.java +44 -0
  24. package/android/src/main/java/com/gravitycompile/gravixrtc/audio/AudioManagerUtils.kt +120 -0
  25. package/android/src/main/java/com/gravitycompile/gravixrtc/audio/AudioSwitchManager.java +270 -0
  26. package/android/src/main/java/com/gravitycompile/gravixrtc/audio/AudioType.kt +50 -0
  27. package/android/src/main/java/com/gravitycompile/gravixrtc/music/MusicCaptureRouter.kt +375 -0
  28. package/android/src/main/java/com/gravitycompile/gravixrtc/music/MusicDecoder.kt +339 -0
  29. package/android/src/main/java/com/gravitycompile/gravixrtc/music/MusicInterruptionWatcher.kt +82 -0
  30. package/android/src/main/java/com/gravitycompile/gravixrtc/music/MusicMicRelease.kt +117 -0
  31. package/android/src/main/java/com/gravitycompile/gravixrtc/music/MusicMixKernel.kt +191 -0
  32. package/android/src/main/java/com/gravitycompile/gravixrtc/music/MusicMixerEngine.kt +617 -0
  33. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/AudioRoutePolicy.kt +137 -0
  34. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GravixCaptureProcessing.kt +67 -0
  35. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxCaptureDump.kt +143 -0
  36. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxCaptureSwitcher.kt +196 -0
  37. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxNoiseProcessor.kt +795 -0
  38. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxNsLogic.kt +180 -0
  39. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxNsNative.kt +83 -0
  40. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxNsStudio.kt +372 -0
  41. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxRecordStartGuard.kt +76 -0
  42. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxRecorderSeam.kt +434 -0
  43. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxSingerSource.kt +37 -0
  44. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/GxVoiceFx.kt +160 -0
  45. package/android/src/main/java/com/gravitycompile/gravixrtc/processing/OtherAppAudioPolicy.kt +143 -0
  46. package/android/src/main/java/org/webrtc/audio/WebRtcAudioTrackHelper.kt +43 -0
  47. package/docs/ANDROID_NATIVE_HOOKS.md +102 -0
  48. package/docs/FEATURE_MATRIX.md +192 -0
  49. package/docs/IOS_NATIVE_HOOKS.md +190 -0
  50. package/gravix-rtc-react-native.podspec +49 -0
  51. package/ios/GravixRtc.h +7 -0
  52. package/ios/GravixRtc.mm +273 -0
  53. package/ios/GravixRtcSetup.h +29 -0
  54. package/ios/GravixRtcSetup.m +52 -0
  55. package/ios/audio/GravixRtcIosAudio.m +157 -0
  56. package/ios/audio/GxAudioDevice.h +62 -0
  57. package/ios/audio/GxAudioDevice.m +857 -0
  58. package/ios/audio/GxAudioSetup.h +34 -0
  59. package/ios/audio/GxAudioSetup.m +70 -0
  60. package/ios/audio/GxCompat.swift +53 -0
  61. package/ios/audio/GxIosAudio.swift +99 -0
  62. package/ios/audio/GxMusicController.swift +150 -0
  63. package/ios/audio/GxMusicPost.swift +362 -0
  64. package/ios/audio/GxNoiseProcessor.swift +718 -0
  65. package/ios/audio/GxNsDfn3CoreML.swift +195 -0
  66. package/ios/audio/GxNsStudioEngine.swift +237 -0
  67. package/ios/audio/GxNsStudioPack.swift +212 -0
  68. package/ios/audio/GxVoiceFx.swift +161 -0
  69. package/ios/audio/gx_adm_state.h +153 -0
  70. package/ios/gxcore/apple/gx_music_post.c +312 -0
  71. package/ios/gxcore/apple/gx_pcm.c +30 -0
  72. package/ios/gxcore/apple/gxns_build.h +19 -0
  73. package/ios/gxcore/apple/gxns_ios.c +17 -0
  74. package/ios/gxcore/apple/include/gx_fx.h +3 -0
  75. package/ios/gxcore/apple/include/gx_music_post.h +88 -0
  76. package/ios/gxcore/apple/include/gx_ns.h +3 -0
  77. package/ios/gxcore/apple/include/gx_pcm.h +33 -0
  78. package/ios/gxcore/apple/include/gxns_ios.h +18 -0
  79. package/ios/gxcore/apple/include/module.modulemap +10 -0
  80. package/ios/gxcore/apple/shim/rnnoise.h +2 -0
  81. package/ios/gxcore/apple/shim/speex_resampler.h +2 -0
  82. package/ios/gxcore/apple/units/gx_fx_forward.cpp +3 -0
  83. package/ios/gxcore/apple/units/gx_ns.c +7 -0
  84. package/ios/gxcore/apple/units/gx_ns_timer.c +7 -0
  85. package/ios/gxcore/apple/units/rnnoise_celt_lpc.c +7 -0
  86. package/ios/gxcore/apple/units/rnnoise_denoise.c +7 -0
  87. package/ios/gxcore/apple/units/rnnoise_kiss_fft.c +7 -0
  88. package/ios/gxcore/apple/units/rnnoise_pitch.c +7 -0
  89. package/ios/gxcore/apple/units/rnnoise_rnn.c +7 -0
  90. package/ios/gxcore/apple/units/rnnoise_rnn_data.c +7 -0
  91. package/ios/gxcore/apple/units/speexdsp_resample.c +7 -0
  92. package/ios/resources/ns/DFN3-NOTICE.txt +10 -0
  93. package/ios/resources/ns/DeepFilterNet-LICENSE-APACHE +201 -0
  94. package/ios/resources/ns/DeepFilterNet-LICENSE-MIT +19 -0
  95. package/ios/resources/ns/gxns_dfn3.mlmodelc/analytics/coremldata.bin +0 -0
  96. package/ios/resources/ns/gxns_dfn3.mlmodelc/coremldata.bin +0 -0
  97. package/ios/resources/ns/gxns_dfn3.mlmodelc/metadata.json +338 -0
  98. package/ios/resources/ns/gxns_dfn3.mlmodelc/model.mil +927 -0
  99. package/ios/resources/ns/gxns_dfn3.mlmodelc/weights/weight.bin +0 -0
  100. package/lib/module/android/bindings.js +49 -0
  101. package/lib/module/android/bindings.js.map +1 -0
  102. package/lib/module/android/index.js +13 -0
  103. package/lib/module/android/index.js.map +1 -0
  104. package/lib/module/android/micMute.js +341 -0
  105. package/lib/module/android/micMute.js.map +1 -0
  106. package/lib/module/android/nativeAudio.js +47 -0
  107. package/lib/module/android/nativeAudio.js.map +1 -0
  108. package/lib/module/android/noiseSuppression.js +170 -0
  109. package/lib/module/android/noiseSuppression.js.map +1 -0
  110. package/lib/module/android/roomMusic.js +142 -0
  111. package/lib/module/android/roomMusic.js.map +1 -0
  112. package/lib/module/android/singerMode.js +31 -0
  113. package/lib/module/android/singerMode.js.map +1 -0
  114. package/lib/module/android/voiceEffects.js +65 -0
  115. package/lib/module/android/voiceEffects.js.map +1 -0
  116. package/lib/module/audio/AudioManager.js +79 -0
  117. package/lib/module/audio/AudioManager.js.map +1 -0
  118. package/lib/module/audio/AudioSession.js +90 -0
  119. package/lib/module/audio/AudioSession.js.map +1 -0
  120. package/lib/module/audio/remoteVolume.js +54 -0
  121. package/lib/module/audio/remoteVolume.js.map +1 -0
  122. package/lib/module/components/VideoView.js +109 -0
  123. package/lib/module/components/VideoView.js.map +1 -0
  124. package/lib/module/features/audioScenario.js +53 -0
  125. package/lib/module/features/audioScenario.js.map +1 -0
  126. package/lib/module/features/beauty.js +828 -0
  127. package/lib/module/features/beauty.js.map +1 -0
  128. package/lib/module/features/micRelease.js +89 -0
  129. package/lib/module/features/micRelease.js.map +1 -0
  130. package/lib/module/features/noiseSuppression.js +213 -0
  131. package/lib/module/features/noiseSuppression.js.map +1 -0
  132. package/lib/module/features/roomMusic.js +90 -0
  133. package/lib/module/features/roomMusic.js.map +1 -0
  134. package/lib/module/features/roomMusicAndroid.js +294 -0
  135. package/lib/module/features/roomMusicAndroid.js.map +1 -0
  136. package/lib/module/features/roomMusicIos.js +250 -0
  137. package/lib/module/features/roomMusicIos.js.map +1 -0
  138. package/lib/module/features/roomMusicTypes.js +53 -0
  139. package/lib/module/features/roomMusicTypes.js.map +1 -0
  140. package/lib/module/features/screenShare.js +22 -0
  141. package/lib/module/features/screenShare.js.map +1 -0
  142. package/lib/module/features/singerMode.js +73 -0
  143. package/lib/module/features/singerMode.js.map +1 -0
  144. package/lib/module/features/voiceEffects.js +148 -0
  145. package/lib/module/features/voiceEffects.js.map +1 -0
  146. package/lib/module/hooks/context.js +34 -0
  147. package/lib/module/hooks/context.js.map +1 -0
  148. package/lib/module/hooks/hooks.js +145 -0
  149. package/lib/module/hooks/hooks.js.map +1 -0
  150. package/lib/module/hooks/types.js +4 -0
  151. package/lib/module/hooks/types.js.map +1 -0
  152. package/lib/module/hooks/useRoomEvents.js +30 -0
  153. package/lib/module/hooks/useRoomEvents.js.map +1 -0
  154. package/lib/module/index.js +43 -0
  155. package/lib/module/index.js.map +1 -0
  156. package/lib/module/ios/autoAttach.js +14 -0
  157. package/lib/module/ios/autoAttach.js.map +1 -0
  158. package/lib/module/ios/iosAudio.js +149 -0
  159. package/lib/module/ios/iosAudio.js.map +1 -0
  160. package/lib/module/join/appStateLifecycle.js +54 -0
  161. package/lib/module/join/appStateLifecycle.js.map +1 -0
  162. package/lib/module/micPolicy.js +249 -0
  163. package/lib/module/micPolicy.js.map +1 -0
  164. package/lib/module/native/NativeGravixAudio.js +18 -0
  165. package/lib/module/native/NativeGravixAudio.js.map +1 -0
  166. package/lib/module/native/NativeGravixRtc.js +13 -0
  167. package/lib/module/native/NativeGravixRtc.js.map +1 -0
  168. package/lib/module/native/module.js +23 -0
  169. package/lib/module/native/module.js.map +1 -0
  170. package/lib/module/package.json +1 -0
  171. package/lib/module/polyfills/DOMException.js +22 -0
  172. package/lib/module/polyfills/DOMException.js.map +1 -0
  173. package/lib/module/polyfills/early.js +18 -0
  174. package/lib/module/polyfills/early.js.map +1 -0
  175. package/lib/module/polyfills/event.js +71 -0
  176. package/lib/module/polyfills/event.js.map +1 -0
  177. package/lib/module/polyfills/sha256.js +92 -0
  178. package/lib/module/polyfills/sha256.js.map +1 -0
  179. package/lib/module/polyfills/subtleHmac.js +91 -0
  180. package/lib/module/polyfills/subtleHmac.js.map +1 -0
  181. package/lib/module/polyfills/textCoding.js +164 -0
  182. package/lib/module/polyfills/textCoding.js.map +1 -0
  183. package/lib/module/registerGlobals.js +135 -0
  184. package/lib/module/registerGlobals.js.map +1 -0
  185. package/lib/module/unsupported.js +90 -0
  186. package/lib/module/unsupported.js.map +1 -0
  187. package/lib/module/version.js +7 -0
  188. package/lib/module/version.js.map +1 -0
  189. package/lib/typescript/package.json +1 -0
  190. package/lib/typescript/src/android/bindings.d.ts +14 -0
  191. package/lib/typescript/src/android/bindings.d.ts.map +1 -0
  192. package/lib/typescript/src/android/index.d.ts +9 -0
  193. package/lib/typescript/src/android/index.d.ts.map +1 -0
  194. package/lib/typescript/src/android/micMute.d.ts +124 -0
  195. package/lib/typescript/src/android/micMute.d.ts.map +1 -0
  196. package/lib/typescript/src/android/nativeAudio.d.ts +40 -0
  197. package/lib/typescript/src/android/nativeAudio.d.ts.map +1 -0
  198. package/lib/typescript/src/android/noiseSuppression.d.ts +48 -0
  199. package/lib/typescript/src/android/noiseSuppression.d.ts.map +1 -0
  200. package/lib/typescript/src/android/roomMusic.d.ts +80 -0
  201. package/lib/typescript/src/android/roomMusic.d.ts.map +1 -0
  202. package/lib/typescript/src/android/singerMode.d.ts +27 -0
  203. package/lib/typescript/src/android/singerMode.d.ts.map +1 -0
  204. package/lib/typescript/src/android/voiceEffects.d.ts +30 -0
  205. package/lib/typescript/src/android/voiceEffects.d.ts.map +1 -0
  206. package/lib/typescript/src/audio/AudioManager.d.ts +32 -0
  207. package/lib/typescript/src/audio/AudioManager.d.ts.map +1 -0
  208. package/lib/typescript/src/audio/AudioSession.d.ts +70 -0
  209. package/lib/typescript/src/audio/AudioSession.d.ts.map +1 -0
  210. package/lib/typescript/src/audio/remoteVolume.d.ts +8 -0
  211. package/lib/typescript/src/audio/remoteVolume.d.ts.map +1 -0
  212. package/lib/typescript/src/components/VideoView.d.ts +44 -0
  213. package/lib/typescript/src/components/VideoView.d.ts.map +1 -0
  214. package/lib/typescript/src/features/audioScenario.d.ts +24 -0
  215. package/lib/typescript/src/features/audioScenario.d.ts.map +1 -0
  216. package/lib/typescript/src/features/beauty.d.ts +377 -0
  217. package/lib/typescript/src/features/beauty.d.ts.map +1 -0
  218. package/lib/typescript/src/features/micRelease.d.ts +28 -0
  219. package/lib/typescript/src/features/micRelease.d.ts.map +1 -0
  220. package/lib/typescript/src/features/noiseSuppression.d.ts +64 -0
  221. package/lib/typescript/src/features/noiseSuppression.d.ts.map +1 -0
  222. package/lib/typescript/src/features/roomMusic.d.ts +41 -0
  223. package/lib/typescript/src/features/roomMusic.d.ts.map +1 -0
  224. package/lib/typescript/src/features/roomMusicAndroid.d.ts +60 -0
  225. package/lib/typescript/src/features/roomMusicAndroid.d.ts.map +1 -0
  226. package/lib/typescript/src/features/roomMusicIos.d.ts +56 -0
  227. package/lib/typescript/src/features/roomMusicIos.d.ts.map +1 -0
  228. package/lib/typescript/src/features/roomMusicTypes.d.ts +76 -0
  229. package/lib/typescript/src/features/roomMusicTypes.d.ts.map +1 -0
  230. package/lib/typescript/src/features/screenShare.d.ts +12 -0
  231. package/lib/typescript/src/features/screenShare.d.ts.map +1 -0
  232. package/lib/typescript/src/features/singerMode.d.ts +20 -0
  233. package/lib/typescript/src/features/singerMode.d.ts.map +1 -0
  234. package/lib/typescript/src/features/voiceEffects.d.ts +46 -0
  235. package/lib/typescript/src/features/voiceEffects.d.ts.map +1 -0
  236. package/lib/typescript/src/hooks/context.d.ts +12 -0
  237. package/lib/typescript/src/hooks/context.d.ts.map +1 -0
  238. package/lib/typescript/src/hooks/hooks.d.ts +54 -0
  239. package/lib/typescript/src/hooks/hooks.d.ts.map +1 -0
  240. package/lib/typescript/src/hooks/types.d.ts +8 -0
  241. package/lib/typescript/src/hooks/types.d.ts.map +1 -0
  242. package/lib/typescript/src/hooks/useRoomEvents.d.ts +13 -0
  243. package/lib/typescript/src/hooks/useRoomEvents.d.ts.map +1 -0
  244. package/lib/typescript/src/index.d.ts +37 -0
  245. package/lib/typescript/src/index.d.ts.map +1 -0
  246. package/lib/typescript/src/ios/autoAttach.d.ts +2 -0
  247. package/lib/typescript/src/ios/autoAttach.d.ts.map +1 -0
  248. package/lib/typescript/src/ios/iosAudio.d.ts +96 -0
  249. package/lib/typescript/src/ios/iosAudio.d.ts.map +1 -0
  250. package/lib/typescript/src/join/appStateLifecycle.d.ts +14 -0
  251. package/lib/typescript/src/join/appStateLifecycle.d.ts.map +1 -0
  252. package/lib/typescript/src/micPolicy.d.ts +104 -0
  253. package/lib/typescript/src/micPolicy.d.ts.map +1 -0
  254. package/lib/typescript/src/native/NativeGravixAudio.d.ts +21 -0
  255. package/lib/typescript/src/native/NativeGravixAudio.d.ts.map +1 -0
  256. package/lib/typescript/src/native/NativeGravixRtc.d.ts +31 -0
  257. package/lib/typescript/src/native/NativeGravixRtc.d.ts.map +1 -0
  258. package/lib/typescript/src/native/module.d.ts +7 -0
  259. package/lib/typescript/src/native/module.d.ts.map +1 -0
  260. package/lib/typescript/src/polyfills/DOMException.d.ts +3 -0
  261. package/lib/typescript/src/polyfills/DOMException.d.ts.map +1 -0
  262. package/lib/typescript/src/polyfills/early.d.ts +2 -0
  263. package/lib/typescript/src/polyfills/early.d.ts.map +1 -0
  264. package/lib/typescript/src/polyfills/event.d.ts +2 -0
  265. package/lib/typescript/src/polyfills/event.d.ts.map +1 -0
  266. package/lib/typescript/src/polyfills/sha256.d.ts +3 -0
  267. package/lib/typescript/src/polyfills/sha256.d.ts.map +1 -0
  268. package/lib/typescript/src/polyfills/subtleHmac.d.ts +37 -0
  269. package/lib/typescript/src/polyfills/subtleHmac.d.ts.map +1 -0
  270. package/lib/typescript/src/polyfills/textCoding.d.ts +36 -0
  271. package/lib/typescript/src/polyfills/textCoding.d.ts.map +1 -0
  272. package/lib/typescript/src/registerGlobals.d.ts +42 -0
  273. package/lib/typescript/src/registerGlobals.d.ts.map +1 -0
  274. package/lib/typescript/src/unsupported.d.ts +42 -0
  275. package/lib/typescript/src/unsupported.d.ts.map +1 -0
  276. package/lib/typescript/src/version.d.ts +3 -0
  277. package/lib/typescript/src/version.d.ts.map +1 -0
  278. package/metro/index.js +39 -0
  279. package/metro/noise-stub.js +10 -0
  280. package/native/gxfx/include/gx_fx.h +82 -0
  281. package/native/gxfx/src/gx_fx.cpp +527 -0
  282. package/native/gxfx/third_party/README.md +4 -0
  283. package/native/gxfx/third_party/signalsmith-linear/LICENSE.txt +21 -0
  284. package/native/gxfx/third_party/signalsmith-linear/approx.h +191 -0
  285. package/native/gxfx/third_party/signalsmith-linear/fft.h +1386 -0
  286. package/native/gxfx/third_party/signalsmith-linear/linear.h +1129 -0
  287. package/native/gxfx/third_party/signalsmith-linear/platform/approx-cmsisdsp.h +40 -0
  288. package/native/gxfx/third_party/signalsmith-linear/platform/basic-fill-warnings.h +61 -0
  289. package/native/gxfx/third_party/signalsmith-linear/platform/fft-accelerate.h +340 -0
  290. package/native/gxfx/third_party/signalsmith-linear/platform/fft-cmsisdsp.h +307 -0
  291. package/native/gxfx/third_party/signalsmith-linear/platform/fft-ipp.h +532 -0
  292. package/native/gxfx/third_party/signalsmith-linear/platform/fft-linear.h +213 -0
  293. package/native/gxfx/third_party/signalsmith-linear/platform/fft-pffft-double.h +221 -0
  294. package/native/gxfx/third_party/signalsmith-linear/platform/fft-pffft.h +221 -0
  295. package/native/gxfx/third_party/signalsmith-linear/platform/linear-accelerate.h +593 -0
  296. package/native/gxfx/third_party/signalsmith-linear/platform/linear-cmsisdsp.h +713 -0
  297. package/native/gxfx/third_party/signalsmith-linear/platform/linear-xsimd-dispatch.cpp +6 -0
  298. package/native/gxfx/third_party/signalsmith-linear/platform/linear-xsimd.h +818 -0
  299. package/native/gxfx/third_party/signalsmith-linear/stft.h +700 -0
  300. package/native/gxfx/third_party/signalsmith-stretch-LICENSE.txt +21 -0
  301. package/native/gxfx/third_party/signalsmith-stretch.h +1060 -0
  302. package/native/gxns/CMakeLists.txt +67 -0
  303. package/native/gxns/include/gx_ns.h +285 -0
  304. package/native/gxns/src/gx_ns.c +1518 -0
  305. package/native/gxns/src/gx_ns_timer.c +84 -0
  306. package/native/gxns/src/gx_ns_timer.h +29 -0
  307. package/native/gxns/third_party/VENDOR.md +43 -0
  308. package/native/gxns/third_party/rnnoise/AUTHORS +1 -0
  309. package/native/gxns/third_party/rnnoise/COPYING +31 -0
  310. package/native/gxns/third_party/rnnoise/include/rnnoise.h +117 -0
  311. package/native/gxns/third_party/rnnoise/src/_kiss_fft_guts.h +182 -0
  312. package/native/gxns/third_party/rnnoise/src/arch.h +261 -0
  313. package/native/gxns/third_party/rnnoise/src/celt_lpc.c +172 -0
  314. package/native/gxns/third_party/rnnoise/src/celt_lpc.h +45 -0
  315. package/native/gxns/third_party/rnnoise/src/common.h +48 -0
  316. package/native/gxns/third_party/rnnoise/src/denoise.c +664 -0
  317. package/native/gxns/third_party/rnnoise/src/kiss_fft.c +601 -0
  318. package/native/gxns/third_party/rnnoise/src/kiss_fft.h +203 -0
  319. package/native/gxns/third_party/rnnoise/src/opus_types.h +159 -0
  320. package/native/gxns/third_party/rnnoise/src/pitch.c +523 -0
  321. package/native/gxns/third_party/rnnoise/src/pitch.h +149 -0
  322. package/native/gxns/third_party/rnnoise/src/rnn.c +178 -0
  323. package/native/gxns/third_party/rnnoise/src/rnn.h +65 -0
  324. package/native/gxns/third_party/rnnoise/src/rnn_data.c +11051 -0
  325. package/native/gxns/third_party/rnnoise/src/rnn_data.h +34 -0
  326. package/native/gxns/third_party/rnnoise/src/tansig_table.h +45 -0
  327. package/native/gxns/third_party/speexdsp/AUTHORS +18 -0
  328. package/native/gxns/third_party/speexdsp/COPYING +35 -0
  329. package/native/gxns/third_party/speexdsp/arch.h +232 -0
  330. package/native/gxns/third_party/speexdsp/resample.c +1239 -0
  331. package/native/gxns/third_party/speexdsp/resample_neon.h +339 -0
  332. package/native/gxns/third_party/speexdsp/resample_sse.h +128 -0
  333. package/native/gxns/third_party/speexdsp/speex_resampler.h +343 -0
  334. package/package.json +186 -4
  335. package/src/android/bindings.ts +61 -0
  336. package/src/android/index.ts +10 -0
  337. package/src/android/micMute.ts +422 -0
  338. package/src/android/nativeAudio.ts +94 -0
  339. package/src/android/noiseSuppression.ts +209 -0
  340. package/src/android/roomMusic.ts +193 -0
  341. package/src/android/singerMode.ts +53 -0
  342. package/src/android/voiceEffects.ts +126 -0
  343. package/src/audio/AudioManager.ts +111 -0
  344. package/src/audio/AudioSession.ts +190 -0
  345. package/src/audio/remoteVolume.ts +58 -0
  346. package/src/components/VideoView.tsx +152 -0
  347. package/src/features/audioScenario.ts +58 -0
  348. package/src/features/beauty.ts +1057 -0
  349. package/src/features/micRelease.ts +108 -0
  350. package/src/features/noiseSuppression.ts +251 -0
  351. package/src/features/roomMusic.ts +106 -0
  352. package/src/features/roomMusicAndroid.ts +310 -0
  353. package/src/features/roomMusicIos.ts +300 -0
  354. package/src/features/roomMusicTypes.ts +97 -0
  355. package/src/features/screenShare.ts +19 -0
  356. package/src/features/singerMode.ts +70 -0
  357. package/src/features/voiceEffects.ts +245 -0
  358. package/src/hooks/context.tsx +38 -0
  359. package/src/hooks/hooks.ts +247 -0
  360. package/src/hooks/types.ts +10 -0
  361. package/src/hooks/useRoomEvents.ts +35 -0
  362. package/src/index.tsx +134 -0
  363. package/src/ios/autoAttach.ts +11 -0
  364. package/src/ios/iosAudio.ts +202 -0
  365. package/src/join/appStateLifecycle.ts +55 -0
  366. package/src/micPolicy.ts +312 -0
  367. package/src/native/NativeGravixAudio.ts +30 -0
  368. package/src/native/NativeGravixRtc.ts +38 -0
  369. package/src/native/module.ts +22 -0
  370. package/src/polyfills/DOMException.ts +20 -0
  371. package/src/polyfills/early.ts +16 -0
  372. package/src/polyfills/event.ts +88 -0
  373. package/src/polyfills/sha256.ts +112 -0
  374. package/src/polyfills/subtleHmac.ts +124 -0
  375. package/src/polyfills/textCoding.ts +197 -0
  376. package/src/registerGlobals.ts +201 -0
  377. package/src/unsupported.ts +139 -0
  378. package/src/version.ts +4 -0
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
6
+ import { isFeatureSupported } from "../unsupported.js";
7
+
8
+ /**
9
+ * Bridge to the iOS-only native module `GravixRtcIosAudio` (ios/audio): voice
10
+ * effects, noise suppression, room music and the recorder state. It is a
11
+ * plain interop module (not in the shared codegen spec, so Android is
12
+ * unaffected); the feature classes in src/features call it from their iOS
13
+ * branches only. One generic `call(method, args)` mirrors the Flutter method
14
+ * channels (`fxConfigure`, `nsConfigure`, `music.start`, ...).
15
+ */
16
+
17
+ /** The microphone recorder as the Gravix iOS audio device sees it. */
18
+
19
+ export const IOS_AUDIO_EVENT = 'GravixIosAudioEvent';
20
+ export function isIos() {
21
+ return Platform.OS === 'ios';
22
+ }
23
+ export function iosAudioModule() {
24
+ if (!isIos()) return null;
25
+ return NativeModules.GravixRtcIosAudio ?? null;
26
+ }
27
+ function requireModule() {
28
+ const m = iosAudioModule();
29
+ if (!m) {
30
+ throw new Error('gravix-rtc-react-native: the iOS audio module (GravixRtcIosAudio) is not linked; run pod install');
31
+ }
32
+ return m;
33
+ }
34
+
35
+ /** Calls a native audio method; rejects with the native error code. */
36
+ export async function iosCall(method, args = {}) {
37
+ return await requireModule().call(method, args);
38
+ }
39
+ let attachPromise = null;
40
+
41
+ /**
42
+ * Installs the audio engine graph hook (music monitor, VPIO AGC) once. Called
43
+ * by every iOS feature before its first native call; cheap after the first.
44
+ */
45
+ export function iosAttach() {
46
+ if (!attachPromise) {
47
+ attachPromise = requireModule().attach().catch(e => {
48
+ attachPromise = null;
49
+ throw e;
50
+ });
51
+ }
52
+ return attachPromise;
53
+ }
54
+ export function iosRecorderState() {
55
+ return requireModule().getRecorderState();
56
+ }
57
+
58
+ /**
59
+ * Mute releases the mic on iOS: closes (true) or reopens the microphone input
60
+ * of the Gravix audio device (stock WebRTC keeps recording under a track
61
+ * mute). Resolves null without the native method, false when the Gravix audio
62
+ * device is not in use.
63
+ */
64
+ export async function iosSetCaptureClosed(closed) {
65
+ const m = iosAudioModule();
66
+ if (!m?.setCaptureClosed) return null;
67
+ return m.setCaptureClosed(closed);
68
+ }
69
+
70
+ /**
71
+ * The muted mic's publication ended (final unpublish, room left): the Gravix
72
+ * audio device keeps the mic closed while WebRTC still records and opens it
73
+ * once recording stops. A plain close survives a WebRTC recording stop / start,
74
+ * so a reconnect republish of a muted mic never opens the input. Resolves null
75
+ * without the native method.
76
+ */
77
+ export async function iosReleaseCaptureClose() {
78
+ const m = iosAudioModule();
79
+ if (!m?.releaseCaptureClose) return null;
80
+ return m.releaseCaptureClose();
81
+ }
82
+
83
+ /**
84
+ * Rollback for the single iOS mute path: Info.plist boolean
85
+ * `GravixMuteStopsMicTrack` = YES makes the room policy also stop the mic
86
+ * track on mute (`stopOnMute`; the core reacquires it with getUserMedia on
87
+ * unmute), as 0.2.0 betas did. Default false: the Gravix audio device's mic
88
+ * close is the only mute path.
89
+ */
90
+ export function iosMuteStopsMicTrack() {
91
+ const m = iosAudioModule();
92
+ if (!m) return false;
93
+ try {
94
+ return (m.muteStopsMicTrack ?? m.getConstants?.()?.muteStopsMicTrack) === true;
95
+ } catch {
96
+ return false;
97
+ }
98
+ }
99
+ const listeners = new Map();
100
+ let emitter = null;
101
+ let subscribed = false;
102
+
103
+ /**
104
+ * Subscribes to a native audio event: `onVoiceEffects`, `onNsEvent`,
105
+ * `music.onCompleted`. Returns the unsubscribe function.
106
+ */
107
+ export function onIosAudioEvent(name, fn) {
108
+ const m = iosAudioModule();
109
+ if (!m) return () => {};
110
+ let set = listeners.get(name);
111
+ if (!set) listeners.set(name, set = new Set());
112
+ set.add(fn);
113
+ if (!subscribed) {
114
+ subscribed = true;
115
+ emitter = emitter ?? new NativeEventEmitter(m);
116
+ emitter.addListener(IOS_AUDIO_EVENT, e => {
117
+ const s = e?.name ? listeners.get(e.name) : undefined;
118
+ s?.forEach(l => {
119
+ try {
120
+ l(e.body ?? {});
121
+ } catch {
122
+ // a listener's error must not stop the others
123
+ }
124
+ });
125
+ });
126
+ }
127
+ return () => {
128
+ set?.delete(fn);
129
+ };
130
+ }
131
+
132
+ /** Test hook. @internal */
133
+ export function __resetIosAudioForTests() {
134
+ attachPromise = null;
135
+ listeners.clear();
136
+ emitter = null;
137
+ subscribed = false;
138
+ }
139
+
140
+ /**
141
+ * Whether an iOS branch may run: on iOS and the native side reports the
142
+ * feature (it is false when GravixRtcSetup.setup() did not install the audio
143
+ * chain, or with an older native module); otherwise the stub throws
144
+ * GravixUnsupportedError as on every platform without the feature.
145
+ */
146
+ export function iosFeature(feature) {
147
+ return isIos() && isFeatureSupported(feature);
148
+ }
149
+ //# sourceMappingURL=iosAudio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeEventEmitter","NativeModules","Platform","isFeatureSupported","IOS_AUDIO_EVENT","isIos","OS","iosAudioModule","GravixRtcIosAudio","requireModule","m","Error","iosCall","method","args","call","attachPromise","iosAttach","attach","catch","e","iosRecorderState","getRecorderState","iosSetCaptureClosed","closed","setCaptureClosed","iosReleaseCaptureClose","releaseCaptureClose","iosMuteStopsMicTrack","muteStopsMicTrack","getConstants","listeners","Map","emitter","subscribed","onIosAudioEvent","name","fn","set","get","Set","add","addListener","s","undefined","forEach","l","body","delete","__resetIosAudioForTests","clear","iosFeature","feature"],"sourceRoot":"../../../src","sources":["ios/iosAudio.ts"],"mappings":";;AAAA;;AAEA,SAASA,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAC1E,SAASC,kBAAkB,QAAkC,mBAAgB;;AAE7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;;AAeA,OAAO,MAAMC,eAAe,GAAG,qBAAqB;AAEpD,OAAO,SAASC,KAAKA,CAAA,EAAY;EAC/B,OAAOH,QAAQ,CAACI,EAAE,KAAK,KAAK;AAC9B;AAEA,OAAO,SAASC,cAAcA,CAAA,EAA0B;EACtD,IAAI,CAACF,KAAK,CAAC,CAAC,EAAE,OAAO,IAAI;EACzB,OACGJ,aAAa,CAACO,iBAAiB,IAAmC,IAAI;AAE3E;AAEA,SAASC,aAAaA,CAAA,EAAmB;EACvC,MAAMC,CAAC,GAAGH,cAAc,CAAC,CAAC;EAC1B,IAAI,CAACG,CAAC,EAAE;IACN,MAAM,IAAIC,KAAK,CACb,kGACF,CAAC;EACH;EACA,OAAOD,CAAC;AACV;;AAEA;AACA,OAAO,eAAeE,OAAOA,CAC3BC,MAAc,EACdC,IAA6B,GAAG,CAAC,CAAC,EACtB;EACZ,OAAQ,MAAML,aAAa,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AS,CAACmB,KAAK,CAAC,CAAC;EACjBjB,OAAO,GAAG,IAAI;EACdC,UAAU,GAAG,KAAK;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASiB,UAAUA,CAACC,OAA4B,EAAW;EAChE,OAAO/C,KAAK,CAAC,CAAC,IAAIF,kBAAkB,CAACiD,OAAO,CAAC;AAC/C","ignoreList":[]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ import { GravixJoin } from 'gravix-rtc';
6
+ import { AppState } from 'react-native';
7
+
8
+ /**
9
+ * The app lifecycle in the shape gravix-rtc's join guard expects
10
+ * (`GravixPageLifecycle`): "hidden" = the app went to the background
11
+ * (`AppState` 'background'; iOS 'inactive', e.g. Control Center, is not
12
+ * hidden), "visible frame" = the next frame drawn while the app is active.
13
+ *
14
+ * In a browser GravixJoin uses `document.visibilityState`; in React Native
15
+ * there is no document, so without this the join has no lifecycle guard.
16
+ */
17
+ export function gravixAppStateLifecycle() {
18
+ return {
19
+ hidden: () => AppState.currentState === 'background',
20
+ onHide(listener) {
21
+ const sub = AppState.addEventListener('change', state => {
22
+ if (state === 'background') listener('hidden');
23
+ });
24
+ return () => sub.remove();
25
+ },
26
+ onVisibleFrame(listener) {
27
+ if (AppState.currentState === 'active') {
28
+ const id = requestAnimationFrame(() => listener());
29
+ return () => cancelAnimationFrame(id);
30
+ }
31
+ let rafId;
32
+ const sub = AppState.addEventListener('change', state => {
33
+ if (state === 'active') {
34
+ sub.remove();
35
+ rafId = requestAnimationFrame(() => listener());
36
+ }
37
+ });
38
+ return () => {
39
+ sub.remove();
40
+ if (rafId !== undefined) cancelAnimationFrame(rafId);
41
+ };
42
+ }
43
+ };
44
+ }
45
+
46
+ /** `new GravixJoin(options)` with the React Native app lifecycle as the join guard. */
47
+ export function createGravixJoin(options) {
48
+ // an explicit `lifecycle: undefined` must not drop the AppState guard
49
+ return new GravixJoin({
50
+ ...options,
51
+ lifecycle: options.lifecycle ?? gravixAppStateLifecycle()
52
+ });
53
+ }
54
+ //# sourceMappingURL=appStateLifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GravixJoin","AppState","gravixAppStateLifecycle","hidden","currentState","onHide","listener","sub","addEventListener","state","remove","onVisibleFrame","id","requestAnimationFrame","cancelAnimationFrame","rafId","undefined","createGravixJoin","options","lifecycle"],"sourceRoot":"../../../src","sources":["join/appStateLifecycle.ts"],"mappings":";;AAAA;;AAEA,SACEA,UAAU,QAGL,YAAY;AACnB,SAASC,QAAQ,QAAQ,cAAc;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAAA,EAAwB;EAC7D,OAAO;IACLC,MAAM,EAAEA,CAAA,KAAMF,QAAQ,CAACG,YAAY,KAAK,YAAY;IACpDC,MAAMA,CAACC,QAAQ,EAAE;MACf,MAAMC,GAAG,GAAGN,QAAQ,CAACO,gBAAgB,CAAC,QAAQ,EAAGC,KAAK,IAAK;QACzD,IAAIA,KAAK,KAAK,YAAY,EAAEH,QAAQ,CAAC,QAAQ,CAAC;MAChD,CAAC,CAAC;MACF,OAAO,MAAMC,GAAG,CAACG,MAAM,CAAC,CAAC;IAC3B,CAAC;IACDC,cAAcA,CAACL,QAAQ,EAAE;MACvB,IAAIL,QAAQ,CAACG,YAAY,KAAK,QAAQ,EAAE;QACtC,MAAMQ,EAAE,GAAGC,qBAAqB,CAAC,MAAMP,QAAQ,CAAC,CAAC,CAAC;QAClD,OAAO,MAAMQ,oBAAoB,CAACF,EAAE,CAAC;MACvC;MACA,IAAIG,KAAyB;MAC7B,MAAMR,GAAG,GAAGN,QAAQ,CAACO,gBAAgB,CAAC,QAAQ,EAAGC,KAAK,IAAK;QACzD,IAAIA,KAAK,KAAK,QAAQ,EAAE;UACtBF,GAAG,CAACG,MAAM,CAAC,CAAC;UACZK,KAAK,GAAGF,qBAAqB,CAAC,MAAMP,QAAQ,CAAC,CAAC,CAAC;QACjD;MACF,CAAC,CAAC;MACF,OAAO,MAAM;QACXC,GAAG,CAACG,MAAM,CAAC,CAAC;QACZ,IAAIK,KAAK,KAAKC,SAAS,EAAEF,oBAAoB,CAACC,KAAK,CAAC;MACtD,CAAC;IACH;EACF,CAAC;AACH;;AAEA;AACA,OAAO,SAASE,gBAAgBA,CAACC,OAA0B,EAAc;EACvE;EACA,OAAO,IAAIlB,UAAU,CAAC;IACpB,GAAGkB,OAAO;IACVC,SAAS,EAAED,OAAO,CAACC,SAAS,IAAIjB,uBAAuB,CAAC;EAC1D,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -0,0 +1,249 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ import { androidAudioFor } from "./android/bindings.js";
6
+ import { gravixMicMute } from "./android/micMute.js";
7
+ import { iosFeature, iosMuteStopsMicTrack, iosReleaseCaptureClose, iosSetCaptureClosed } from "./ios/iosAudio.js";
8
+
9
+ /**
10
+ * Mute releases the microphone, as the room default (Flutter 0.12.1+
11
+ * `GravixRoomService(muteReleasesMic: true)`), wired into EVERY gravix-rtc
12
+ * Room (also the ones GravixJoin creates) by {@link installRoomMicHooks}, which
13
+ * `registerGlobals()` runs. One-flag rollback:
14
+ * `registerGlobals({ muteReleasesMic: false })` (or
15
+ * `GravixMicRelease.setMuteReleasesMic(false)` at run time).
16
+ *
17
+ * - iOS (only with the Gravix audio device, Info.plist `GravixAudioDevice`;
18
+ * with WebRTC's built-in device `muteReleasesMic` is unsupported and the
19
+ * policy does nothing): every local mic mute closes the mic input of the
20
+ * Gravix audio device (`setCaptureClosed`), so the OS mic indicator goes
21
+ * off; an unmute reopens it at once. This is the ONLY mute path: the track
22
+ * is not also stopped (`stopOnMute`; react-native-webrtc 155's WebRTC keeps
23
+ * recording under a track stop, which only disables the track, and the
24
+ * unmute then paid a getUserMedia). Rollback: Info.plist
25
+ * `GravixMuteStopsMicTrack` = YES (`iosStopTrackOnMute` on the policy is an
26
+ * internal / test override). The close survives WebRTC's recording stop / start, so a muted
27
+ * mic republished after a reconnect never opens the input; it ends with an
28
+ * unmute, a fresh unmuted publish, or when the muted publication ends for
29
+ * good (final unpublish of a stopped track, room left: `releaseCaptureClose`,
30
+ * applied once WebRTC stops recording).
31
+ * - Android: every local mic mute closes the hardware recorder and every
32
+ * unmute reopens it (`GravixMicMute.setCaptureClosed`, the native capture
33
+ * seam; react-native-webrtc 155's WebRTC keeps recording under a plain
34
+ * mute). A mic published while already muted (also a reconnect republish)
35
+ * gets its recorder closed (`GravixMicMute.closeMutedCapture`). A core mute during a voice-only music mute
36
+ * hands the mute to the core; leaving the room gives the engine mute back.
37
+ */
38
+
39
+ const MIC = 'microphone';
40
+ const RECONNECTING = new Set(['reconnecting', 'signalReconnecting']);
41
+ function defaultPlatform() {
42
+ if (androidAudioFor('muteReleasesMic')) return 'android';
43
+ if (iosFeature('muteReleasesMic')) return 'ios';
44
+ return null;
45
+ }
46
+ export class GravixRoomMicPolicy {
47
+ constructor(platform = defaultPlatform, mic = gravixMicMute, iosCapture = iosSetCaptureClosed, iosRelease = iosReleaseCaptureClose, iosStopsTrackDefault = iosMuteStopsMicTrack) {
48
+ this.platform = platform;
49
+ this.mic = mic;
50
+ this.iosCapture = iosCapture;
51
+ this.iosRelease = iosRelease;
52
+ this.iosStopsTrackDefault = iosStopsTrackDefault;
53
+ }
54
+
55
+ /**
56
+ * iOS rollback: also stop the mic track on mute (`stopOnMute`, the 0.2.0
57
+ * beta double path). null (default) = Info.plist `GravixMuteStopsMicTrack`.
58
+ */
59
+ iosStopTrackOnMute = null;
60
+
61
+ /** Whether an iOS mic gets `stopOnMute` (releasesMic AND the rollback flag). */
62
+ iosStopsTrackOnMute() {
63
+ if (!this.releasesMic) return false;
64
+ if (this.iosStopTrackOnMute !== null) return this.iosStopTrackOnMute;
65
+ try {
66
+ return this.iosStopsTrackDefault();
67
+ } catch {
68
+ return false;
69
+ }
70
+ }
71
+
72
+ /** Rooms whose muted mic holds the iOS device mic close (one device per process). */
73
+ iosClosedBy = new Set();
74
+ /** Rooms that unpublished a muted mic and kept it (it may be published again), with the track. */
75
+ iosKeptMuted = new Map();
76
+
77
+ /** iOS mic close / reopen; never throws. */
78
+ iosClose(closed, room) {
79
+ if (closed) {
80
+ if (room) this.iosClosedBy.add(room);
81
+ } else {
82
+ this.iosClosedBy.clear(); // the device mic is open for every room again
83
+ }
84
+ try {
85
+ this.iosCapture(closed)?.catch?.(() => {});
86
+ } catch {
87
+ // the policy must never break the room's event flow
88
+ }
89
+ }
90
+
91
+ /**
92
+ * iOS: [room]'s muted publication ended for good. The device close ends once
93
+ * WebRTC stops recording (no input opens before), unless another room's
94
+ * muted mic still holds it. Never throws.
95
+ */
96
+ iosReleaseFor(room) {
97
+ if (!this.iosClosedBy.delete(room) || this.iosClosedBy.size > 0) return;
98
+ try {
99
+ this.iosRelease()?.catch?.(() => {});
100
+ } catch {
101
+ // the policy must never break the room's event flow
102
+ }
103
+ }
104
+
105
+ /** Mute releases the mic (default true). Mirrors the Android engine flag. */
106
+ get releasesMic() {
107
+ return this.mic.muteReleasesMic;
108
+ }
109
+ set releasesMic(on) {
110
+ this.mic.muteReleasesMic = on;
111
+ }
112
+
113
+ /**
114
+ * True while the local mic is muted: the core mute (`track.isMuted`) OR a
115
+ * voice-only music mute (Android), which the core does not see.
116
+ */
117
+ isMicMuted(room) {
118
+ if (this.mic.muteKind !== 'none') return true;
119
+ let muted = false;
120
+ room.localParticipant?.audioTrackPublications?.forEach(p => {
121
+ if (p.source === MIC && (p.track?.isMuted ?? p.isMuted)) muted = true;
122
+ });
123
+ return muted;
124
+ }
125
+
126
+ /** Voice-only mute changes (the core's TrackMuted / TrackUnmuted cover the rest). */
127
+ onMicMuteChanged(fn) {
128
+ return this.mic.onChange(fn);
129
+ }
130
+
131
+ /** Room event tap (installed on `Room.prototype.emit`). Never throws into the core. */
132
+ onRoomEvent(room, event, args) {
133
+ const platform = this.platform();
134
+ if (!platform) return;
135
+ switch (event) {
136
+ case 'localTrackPublished':
137
+ {
138
+ const pub = args[0];
139
+ if (pub?.source !== MIC || !pub.track) return;
140
+ // a fresh unmuted mic must never inherit a mute close of an earlier publication
141
+ if (platform === 'android' && !pub.track.isMuted) this.mic.setCaptureClosed?.(false)?.catch(() => {});
142
+ if (platform === 'ios') this.iosKeptMuted.delete(room);
143
+ if (platform === 'ios' && !pub.track.isMuted) this.iosClose(false);
144
+ // (iOS, muted: a reconnect republish; the device close held through
145
+ // WebRTC's recording restart, the mic never opened)
146
+ if (!this.releasesMic) return;
147
+ this.onMicPublished(platform, pub.track, room);
148
+ return;
149
+ }
150
+ case 'localTrackUnpublished':
151
+ {
152
+ const pub = args[0];
153
+ // unpublished while muted (seat leave): the mute close ends with the publication
154
+ if (platform === 'android' && pub?.source === MIC) this.mic.setCaptureClosed?.(false)?.catch(() => {});
155
+ // iOS: a full reconnect unpublishes and republishes the same live
156
+ // track (state 'reconnecting', track not stopped): the close stays, so
157
+ // the muted republish never opens the mic. A final unpublish stops
158
+ // the track (seat leave, room.disconnect()): release. A live muted
159
+ // track that is kept (reconnect, disconnect(false), unpublishTrack(t,
160
+ // false)) may be published again: the close stays until an unmute or
161
+ // an unmuted publish.
162
+ if (platform === 'ios' && pub?.source === MIC) {
163
+ const ended = !pub.track || pub.track.mediaStreamTrack?.readyState === 'ended';
164
+ if (ended && !RECONNECTING.has(room.state ?? '')) this.iosReleaseFor(room);else if (pub.track?.isMuted) this.iosKeptMuted.set(room, pub.track);
165
+ }
166
+ return;
167
+ }
168
+ case 'trackMuted':
169
+ {
170
+ const pub = args[0];
171
+ if (platform === 'ios') {
172
+ if (this.releasesMic && pub?.source === MIC && args[1] === room.localParticipant) this.iosClose(true, room);
173
+ return;
174
+ }
175
+ if (platform !== 'android' || pub?.source !== MIC || !pub.track || args[1] !== room.localParticipant) return;
176
+ this.mic.coreMuted(pub.track).catch(() => {});
177
+ if (this.releasesMic) this.mic.setCaptureClosed?.(true)?.catch(() => {});
178
+ return;
179
+ }
180
+ case 'trackUnmuted':
181
+ {
182
+ const pub = args[0];
183
+ if (pub?.source !== MIC || args[1] !== room.localParticipant) return;
184
+ if (platform === 'ios') this.iosClose(false);else this.mic.setCaptureClosed?.(false)?.catch(() => {});
185
+ return;
186
+ }
187
+ case 'disconnected':
188
+ if (platform === 'android') this.mic.leave().catch(() => {});
189
+ // iOS: the room left; its close ends once WebRTC stops recording
190
+ // (not while another room's muted mic still holds it, and not when
191
+ // the room kept its live muted mic: a connect() during a reconnect
192
+ // runs disconnect(false) and the app may publish that mic again)
193
+ // A failed reconnect unpublishes the mic while still 'reconnecting'
194
+ // and stops it: the kept track has ended, so the close ends too
195
+ // (2026-12-01 review; else the gate stayed closed with no room).
196
+ if (platform === 'ios') {
197
+ const kept = this.iosKeptMuted.has(room);
198
+ const t = this.iosKeptMuted.get(room);
199
+ this.iosKeptMuted.delete(room);
200
+ const keptEnded = kept && t?.mediaStreamTrack?.readyState === 'ended' && !this.iosStopsTrackOnMute();
201
+ if (kept && !keptEnded) this.iosClosedBy.delete(room);else this.iosReleaseFor(room);
202
+ }
203
+ return;
204
+ }
205
+ }
206
+ onMicPublished(platform, track, room) {
207
+ if (platform === 'ios') {
208
+ if (this.iosStopsTrackOnMute()) {
209
+ // rollback (GravixMuteStopsMicTrack): the track stop as a second path
210
+ track.stopOnMute = true;
211
+ const mst = track.mediaStreamTrack;
212
+ if (track.isMuted && !track.isUserProvided && mst.readyState !== 'ended') mst.stop?.();
213
+ }
214
+ if (track.isMuted) this.iosClose(true, room);
215
+ return;
216
+ }
217
+ if (track.isMuted) this.mic.closeMutedCapture(track).catch(() => {});
218
+ }
219
+ }
220
+
221
+ /** Process-wide policy (one audio device module per process). */
222
+ export const gravixRoomMicPolicy = new GravixRoomMicPolicy();
223
+ const PATCHED = '__gravixMicHooks';
224
+
225
+ /**
226
+ * Taps [RoomClass]'s `emit` so the policy sees every room's events, the Rooms
227
+ * GravixJoin builds included. Idempotent; the original emit always runs.
228
+ */
229
+ export function installRoomMicHooks(RoomClass, handler = (r, e, a) => gravixRoomMicPolicy.onRoomEvent(r, e, a)) {
230
+ const proto = RoomClass?.prototype;
231
+ if (!proto || typeof proto.emit !== 'function' || proto[PATCHED]) {
232
+ return false;
233
+ }
234
+ const original = proto.emit;
235
+ proto.emit = function (event, ...args) {
236
+ const r = original.call(this, event, ...args);
237
+ try {
238
+ handler(this, event, args);
239
+ } catch {
240
+ // the policy must never break the room's event flow
241
+ }
242
+ return r;
243
+ };
244
+ Object.defineProperty(proto, PATCHED, {
245
+ value: true
246
+ });
247
+ return true;
248
+ }
249
+ //# sourceMappingURL=micPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["androidAudioFor","gravixMicMute","iosFeature","iosMuteStopsMicTrack","iosReleaseCaptureClose","iosSetCaptureClosed","MIC","RECONNECTING","Set","defaultPlatform","GravixRoomMicPolicy","constructor","platform","mic","iosCapture","iosRelease","iosStopsTrackDefault","iosStopTrackOnMute","iosStopsTrackOnMute","releasesMic","iosClosedBy","iosKeptMuted","Map","iosClose","closed","room","add","clear","catch","iosReleaseFor","delete","size","muteReleasesMic","on","isMicMuted","muteKind","muted","localParticipant","audioTrackPublications","forEach","p","source","track","isMuted","onMicMuteChanged","fn","onChange","onRoomEvent","event","args","pub","setCaptureClosed","onMicPublished","ended","mediaStreamTrack","readyState","has","state","set","coreMuted","leave","kept","t","get","keptEnded","stopOnMute","mst","isUserProvided","stop","closeMutedCapture","gravixRoomMicPolicy","PATCHED","installRoomMicHooks","RoomClass","handler","r","e","a","proto","prototype","emit","original","call","Object","defineProperty","value"],"sourceRoot":"../../src","sources":["micPolicy.ts"],"mappings":";;AAAA;;AAEA,SAASA,eAAe,QAAQ,uBAAoB;AACpD,SAASC,aAAa,QAA4B,sBAAmB;AACrE,SACEC,UAAU,EACVC,oBAAoB,EACpBC,sBAAsB,EACtBC,mBAAmB,QACd,mBAAgB;;AAEvB;AACA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A0BhC,KAAa,EAAE,GAAGC,IAAe,EAAE;IACxE,MAAM0B,CAAC,GAAGM,QAAQ,CAACC,IAAI,CAAC,IAAI,EAAElC,KAAK,EAAE,GAAGC,IAAI,CAAC;IAC7C,IAAI;MACFyB,OAAO,CAAC,IAAI,EAAE1B,KAAK,EAAEC,IAAI,CAAC;IAC5B,CAAC,CAAC,MAAM;MACN;IAAA;IAEF,OAAO0B,CAAC;EACV,CAAC;EACDQ,MAAM,CAACC,cAAc,CAACN,KAAK,EAAEP,OAAO,EAAE;IAAEc,KAAK,EAAE;EAAK,CAAC,CAAC;EACtD,OAAO,IAAI;AACb","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ /**
6
+ * Codegen spec of the Android-only `GravixAudio` TurboModule: the native audio
7
+ * features (voice effects, noise suppression, room music, singer capture,
8
+ * mute that releases the mic). One generic call keeps the spec stable while
9
+ * the method set follows the Flutter SDK's channel methods
10
+ * (`android/.../GravixNativeAudio.kt` lists them). Events go out as the
11
+ * device event `GravixAudioEvent` ({ name, payload }).
12
+ *
13
+ * iOS does not register this module (`TurboModuleRegistry.get` returns null).
14
+ * Keep this file free of imports other than `react-native`.
15
+ */
16
+ import { TurboModuleRegistry } from 'react-native';
17
+ export default TurboModuleRegistry.get('GravixAudio');
18
+ //# sourceMappingURL=NativeGravixAudio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["native/NativeGravixAudio.ts"],"mappings":";;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,mBAAmB,QAGd,cAAc;AAYrB,eAAeA,mBAAmB,CAACC,GAAG,CAAO,aAAa,CAAC","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ /**
6
+ * Codegen spec of the `GravixRtc` TurboModule (Android: Kotlin, iOS: Obj-C++).
7
+ *
8
+ * Keep this file free of imports other than `react-native`: the codegen parser
9
+ * reads it statically.
10
+ */
11
+ import { TurboModuleRegistry } from 'react-native';
12
+ export default TurboModuleRegistry.get('GravixRtc');
13
+ //# sourceMappingURL=NativeGravixRtc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["native/NativeGravixRtc.ts"],"mappings":";;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,mBAAmB,QAGd,cAAc;AAyBrB,eAAeA,mBAAmB,CAACC,GAAG,CAAO,WAAW,CAAC","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ import { Platform } from 'react-native';
6
+ import NativeGravixRtc from "./NativeGravixRtc.js";
7
+ export const LINKING_ERROR = "The package 'gravix-rtc-react-native' doesn't seem to be linked. Make sure:\n\n" + Platform.select({
8
+ ios: "- You have run 'pod install'\n",
9
+ default: ''
10
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go (a development build works)\n';
11
+
12
+ /** The native module, or null when it is not linked (tests, Expo Go, web). */
13
+ export function nativeModuleOrNull() {
14
+ return NativeGravixRtc ?? null;
15
+ }
16
+
17
+ /** The native module; throws a clear linking error when it is missing. */
18
+ export function nativeModule() {
19
+ const m = nativeModuleOrNull();
20
+ if (!m) throw new Error(LINKING_ERROR);
21
+ return m;
22
+ }
23
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","NativeGravixRtc","LINKING_ERROR","select","ios","default","nativeModuleOrNull","nativeModule","m","Error"],"sourceRoot":"../../../src","sources":["native/module.ts"],"mappings":";;AAAA;;AAEA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,eAAe,MAAqB,sBAAmB;AAE9D,OAAO,MAAMC,aAAa,GACxB,iFAAiF,GACjFF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,2DAA2D;;AAE7D;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAAgB;EAChD,OAAOL,eAAe,IAAI,IAAI;AAChC;;AAEA;AACA,OAAO,SAASM,YAAYA,CAAA,EAAS;EACnC,MAAMC,CAAC,GAAGF,kBAAkB,CAAC,CAAC;EAC9B,IAAI,CAACE,CAAC,EAAE,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EACtC,OAAOM,CAAC;AACV","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ // Copyright 2023-2026 LiveKit, Inc.
4
+ // Modifications Copyright 2026 Gravity Compile.
5
+ // Licensed under the Apache License, Version 2.0; see LICENSES/Apache-2.0.txt.
6
+
7
+ /** DOMException is missing in some React Native runtimes; gravix-rtc and fetch/AbortController use it. */
8
+ export function installDOMException() {
9
+ const g = globalThis;
10
+ if (typeof g.DOMException !== 'undefined') return;
11
+ class GravixDOMException extends Error {
12
+ constructor(message = '', name) {
13
+ super(message);
14
+ this.message = message;
15
+ this.name = name ?? 'Error';
16
+ this.code = 0;
17
+ Object.setPrototypeOf(this, GravixDOMException.prototype);
18
+ }
19
+ }
20
+ g.DOMException = GravixDOMException;
21
+ }
22
+ //# sourceMappingURL=DOMException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["installDOMException","g","globalThis","DOMException","GravixDOMException","Error","constructor","message","name","code","Object","setPrototypeOf","prototype"],"sourceRoot":"../../../src","sources":["polyfills/DOMException.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA;AACA,OAAO,SAASA,mBAAmBA,CAAA,EAAS;EAC1C,MAAMC,CAAC,GAAGC,UAAwC;EAClD,IAAI,OAAOD,CAAC,CAACE,YAAY,KAAK,WAAW,EAAE;EAC3C,MAAMC,kBAAkB,SAASC,KAAK,CAAC;IAErCC,WAAWA,CAACC,OAAO,GAAG,EAAE,EAAEC,IAAa,EAAE;MACvC,KAAK,CAACD,OAAO,CAAC;MACd,IAAI,CAACA,OAAO,GAAGA,OAAO;MACtB,IAAI,CAACC,IAAI,GAAGA,IAAI,IAAI,OAAO;MAC3B,IAAI,CAACC,IAAI,GAAG,CAAC;MACbC,MAAM,CAACC,cAAc,CAAC,IAAI,EAAEP,kBAAkB,CAACQ,SAAS,CAAC;IAC3D;EACF;EACAX,CAAC,CAACE,YAAY,GAAGC,kBAAkB;AACrC","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ /**
6
+ * Side-effect module, imported by src/index.tsx BEFORE the gravix-rtc core is
7
+ * re-exported: the core uses `new TextDecoder()` and `extends DOMException` at
8
+ * module scope and `instanceof Event` in its connect path, and Hermes / React
9
+ * Native 0.83 have none of them (Fable B1, M1). Each install keeps a
10
+ * runtime-provided global. The rest of the polyfills stay in registerGlobals().
11
+ */
12
+ import { installDOMException } from "./DOMException.js";
13
+ import { installEvent } from "./event.js";
14
+ import { installTextCoding } from "./textCoding.js";
15
+ installDOMException();
16
+ installTextCoding();
17
+ installEvent();
18
+ //# sourceMappingURL=early.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["installDOMException","installEvent","installTextCoding"],"sourceRoot":"../../../src","sources":["polyfills/early.ts"],"mappings":";;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAmB,QAAQ,mBAAgB;AACpD,SAASC,YAAY,QAAQ,YAAS;AACtC,SAASC,iBAAiB,QAAQ,iBAAc;AAEhDF,mBAAmB,CAAC,CAAC;AACrBE,iBAAiB,CAAC,CAAC;AACnBD,YAAY,CAAC,CAAC","ignoreList":[]}