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,71 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ /**
6
+ * Minimal DOM `Event` / `EventTarget` for React Native. gravix-rtc checks
7
+ * `x instanceof Event` in its signal dial / abort handlers; without a global
8
+ * `Event` that line throws and `room.connect()` never settles (Fable M1).
9
+ */
10
+
11
+ class GravixEvent {
12
+ static NONE = 0;
13
+ static AT_TARGET = 2;
14
+ timeStamp = Date.now();
15
+ defaultPrevented = false;
16
+ target = null;
17
+ currentTarget = null;
18
+ constructor(type, init = {}) {
19
+ if (arguments.length === 0) {
20
+ throw new TypeError('Event: 1 argument required, but only 0 present.');
21
+ }
22
+ this.type = String(type);
23
+ this.bubbles = init.bubbles === true;
24
+ this.cancelable = init.cancelable === true;
25
+ }
26
+ preventDefault() {
27
+ if (this.cancelable) this.defaultPrevented = true;
28
+ }
29
+ stopPropagation() {}
30
+ stopImmediatePropagation() {
31
+ this.stopped = true;
32
+ }
33
+ }
34
+ class GravixEventTarget {
35
+ listeners = new Map();
36
+ addEventListener(type, fn, options) {
37
+ if (!fn) return;
38
+ const list = this.listeners.get(type) ?? [];
39
+ if (list.some(l => l.fn === fn)) return;
40
+ list.push({
41
+ fn,
42
+ once: typeof options === 'object' && options.once === true
43
+ });
44
+ this.listeners.set(type, list);
45
+ }
46
+ removeEventListener(type, fn) {
47
+ const list = this.listeners.get(type);
48
+ if (!list || !fn) return;
49
+ this.listeners.set(type, list.filter(l => l.fn !== fn));
50
+ }
51
+ dispatchEvent(event) {
52
+ const list = this.listeners.get(event.type);
53
+ event.target = this;
54
+ event.currentTarget = this;
55
+ if (list) {
56
+ for (const l of [...list]) {
57
+ if (l.once) this.removeEventListener(event.type, l.fn);
58
+ if (typeof l.fn === 'function') l.fn.call(this, event);else l.fn.handleEvent(event);
59
+ if (event.stopped) break;
60
+ }
61
+ }
62
+ event.currentTarget = null;
63
+ return !event.defaultPrevented;
64
+ }
65
+ }
66
+ export function installEvent() {
67
+ const g = globalThis;
68
+ if (typeof g.Event === 'undefined') g.Event = GravixEvent;
69
+ if (typeof g.EventTarget === 'undefined') g.EventTarget = GravixEventTarget;
70
+ }
71
+ //# sourceMappingURL=event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GravixEvent","NONE","AT_TARGET","timeStamp","Date","now","defaultPrevented","target","currentTarget","constructor","type","init","arguments","length","TypeError","String","bubbles","cancelable","preventDefault","stopPropagation","stopImmediatePropagation","stopped","GravixEventTarget","listeners","Map","addEventListener","fn","options","list","get","some","l","push","once","set","removeEventListener","filter","dispatchEvent","event","call","handleEvent","installEvent","g","globalThis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,gBAAgB;EAChC;AACF;AAEA,OAAO,SAASmC,YAAYA,CAAA,EAAS;EACnC,MAAMC,CAAC,GAAGC,UAAwD;EAClE,IAAI,OAAOD,CAAC,CAACE,KAAK,KAAK,WAAW,EAAEF,CAAC,CAACE,KAAK,GAAG5C,WAAW;EACzD,IAAI,OAAO0C,CAAC,CAACG,WAAW,KAAK,WAAW,EAAEH,CAAC,CAACG,WAAW,GAAGvB,iBAAiB;AAC7E","ignoreList":[]}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ /**
6
+ * Minimal SHA-256 and HMAC-SHA256 (FIPS 180-4, RFC 2104) in plain TypeScript.
7
+ *
8
+ * Only used by the `crypto.subtle` HMAC shim (see ./subtleHmac.ts) so that
9
+ * `createToken` / `GravixTokenProvider.local` from gravix-rtc can sign HS256
10
+ * join tokens on Hermes, which has no WebCrypto.
11
+ */
12
+
13
+ const K = new Uint32Array([0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]);
14
+
15
+ /* eslint-disable no-bitwise */
16
+ export function sha256(data) {
17
+ const h = new Uint32Array([0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19]);
18
+ const bitLen = data.length * 8;
19
+ const padded = new Uint8Array(data.length + 9 + 63 >> 6 << 6 >>> 0);
20
+ padded.set(data);
21
+ padded[data.length] = 0x80;
22
+ const view = new DataView(padded.buffer);
23
+ // Messages here are far below 2^32 bits; the high word stays 0.
24
+ view.setUint32(padded.length - 4, bitLen >>> 0, false);
25
+ view.setUint32(padded.length - 8, Math.floor(bitLen / 0x100000000), false);
26
+ const w = new Uint32Array(64);
27
+ for (let off = 0; off < padded.length; off += 64) {
28
+ for (let i = 0; i < 16; i++) w[i] = view.getUint32(off + i * 4, false);
29
+ for (let i = 16; i < 64; i++) {
30
+ const a = w[i - 15];
31
+ const b = w[i - 2];
32
+ const s0 = (a >>> 7 | a << 25) ^ (a >>> 18 | a << 14) ^ a >>> 3;
33
+ const s1 = (b >>> 17 | b << 15) ^ (b >>> 19 | b << 13) ^ b >>> 10;
34
+ w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
35
+ }
36
+ let a = h[0];
37
+ let b = h[1];
38
+ let c = h[2];
39
+ let d = h[3];
40
+ let e = h[4];
41
+ let f = h[5];
42
+ let g = h[6];
43
+ let hh = h[7];
44
+ for (let i = 0; i < 64; i++) {
45
+ const S1 = (e >>> 6 | e << 26) ^ (e >>> 11 | e << 21) ^ (e >>> 25 | e << 7);
46
+ const ch = e & f ^ ~e & g;
47
+ const t1 = hh + S1 + ch + K[i] + w[i] >>> 0;
48
+ const S0 = (a >>> 2 | a << 30) ^ (a >>> 13 | a << 19) ^ (a >>> 22 | a << 10);
49
+ const maj = a & b ^ a & c ^ b & c;
50
+ const t2 = S0 + maj >>> 0;
51
+ hh = g;
52
+ g = f;
53
+ f = e;
54
+ e = d + t1 >>> 0;
55
+ d = c;
56
+ c = b;
57
+ b = a;
58
+ a = t1 + t2 >>> 0;
59
+ }
60
+ h[0] = h[0] + a >>> 0;
61
+ h[1] = h[1] + b >>> 0;
62
+ h[2] = h[2] + c >>> 0;
63
+ h[3] = h[3] + d >>> 0;
64
+ h[4] = h[4] + e >>> 0;
65
+ h[5] = h[5] + f >>> 0;
66
+ h[6] = h[6] + g >>> 0;
67
+ h[7] = h[7] + hh >>> 0;
68
+ }
69
+ const out = new Uint8Array(32);
70
+ const outView = new DataView(out.buffer);
71
+ for (let i = 0; i < 8; i++) outView.setUint32(i * 4, h[i], false);
72
+ return out;
73
+ }
74
+ /* eslint-enable no-bitwise */
75
+
76
+ export function hmacSha256(key, message) {
77
+ const block = 64;
78
+ let k = key.length > block ? sha256(key) : key;
79
+ const padded = new Uint8Array(block);
80
+ padded.set(k);
81
+ k = padded;
82
+ const inner = new Uint8Array(block + message.length);
83
+ const outer = new Uint8Array(block + 32);
84
+ for (let i = 0; i < block; i++) {
85
+ inner[i] = k[i] ^ 0x36; // eslint-disable-line no-bitwise
86
+ outer[i] = k[i] ^ 0x5c; // eslint-disable-line no-bitwise
87
+ }
88
+ inner.set(message, block);
89
+ outer.set(sha256(inner), block);
90
+ return sha256(outer);
91
+ }
92
+ //# sourceMappingURL=sha256.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["K","Uint32Array","sha256","data","h","bitLen","length","padded","Uint8Array","set","view","DataView","buffer","setUint32","Math","floor","w","off","i","getUint32","a","b","s0","s1","c","d","e","f","g","hh","S1","ch","t1","S0","maj","t2","out","outView","hmacSha256","key","message","block","k","inner","outer"],"sourceRoot":"../../../src","sources":["polyfills/sha256.ts"],"mappings":";;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,CAAC,GAAG,IAAIC,WAAW,CA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AC0C,KAAK,CAAC;AACtB","ignoreList":[]}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ import { hmacSha256 } from "./sha256.js";
6
+
7
+ /**
8
+ * A `crypto.subtle` stand-in for Hermes that supports exactly what
9
+ * gravix-rtc's `createToken` (local HS256 join tokens) needs:
10
+ * `importKey('raw', key, { name: 'HMAC', hash: 'SHA-256' }, ...)` and
11
+ * `sign('HMAC', key, data)`. Every other call rejects with NotSupportedError,
12
+ * so E2EE (which needs AES-GCM/HKDF) still reports itself unsupported.
13
+ *
14
+ * Installed by `registerGlobals()` only when `globalThis.crypto.subtle` is
15
+ * missing; a real WebCrypto (e.g. a native polyfill) always wins.
16
+ */
17
+
18
+ const KEY_BYTES = Symbol('gravixHmacKey');
19
+ function toBytes(data) {
20
+ if (data instanceof Uint8Array) return data;
21
+ if (data instanceof ArrayBuffer) return new Uint8Array(data);
22
+ if (ArrayBuffer.isView(data)) {
23
+ return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
24
+ }
25
+ throw new TypeError('Expected a BufferSource');
26
+ }
27
+ function notSupported(op) {
28
+ const Err = globalThis.DOMException;
29
+ const msg = `crypto.subtle.${op} is not available in React Native (gravix-rtc-react-native ships only HMAC-SHA256)`;
30
+ return Promise.reject(Err ? new Err(msg, 'NotSupportedError') : new Error(msg));
31
+ }
32
+ function algName(alg) {
33
+ return typeof alg === 'string' ? alg : String(alg?.name ?? '');
34
+ }
35
+ function hashName(alg) {
36
+ const hash = alg?.hash;
37
+ return typeof hash === 'string' ? hash : String(hash?.name ?? '');
38
+ }
39
+ export const gravixSubtleHmac = {
40
+ __gravixShim: true,
41
+ importKey(format, keyData, algorithm, _extractable, _usages) {
42
+ if (format !== 'raw' || algName(algorithm).toUpperCase() !== 'HMAC' || hashName(algorithm).toUpperCase() !== 'SHA-256') {
43
+ return notSupported(`importKey(${format}, ${algName(algorithm)})`);
44
+ }
45
+ // Copy: the caller may reuse its buffer.
46
+ const bytes = new Uint8Array(toBytes(keyData));
47
+ return Promise.resolve({
48
+ type: 'secret',
49
+ algorithm: {
50
+ name: 'HMAC'
51
+ },
52
+ [KEY_BYTES]: bytes
53
+ });
54
+ },
55
+ sign(algorithm, key, data) {
56
+ if (algName(algorithm).toUpperCase() !== 'HMAC' || !key || !(KEY_BYTES in key)) {
57
+ return notSupported(`sign(${algName(algorithm)})`);
58
+ }
59
+ const sig = hmacSha256(key[KEY_BYTES], toBytes(data));
60
+ return Promise.resolve(sig.buffer.slice(sig.byteOffset, sig.byteOffset + sig.byteLength));
61
+ },
62
+ verify: () => notSupported('verify'),
63
+ digest: () => notSupported('digest'),
64
+ encrypt: () => notSupported('encrypt'),
65
+ decrypt: () => notSupported('decrypt'),
66
+ deriveKey: () => notSupported('deriveKey'),
67
+ deriveBits: () => notSupported('deriveBits'),
68
+ generateKey: () => notSupported('generateKey'),
69
+ exportKey: () => notSupported('exportKey'),
70
+ wrapKey: () => notSupported('wrapKey'),
71
+ unwrapKey: () => notSupported('unwrapKey')
72
+ };
73
+
74
+ /** Installs the shim when there is no `crypto.subtle`. Returns whether it did. */
75
+ export function installSubtleHmacShim() {
76
+ const g = globalThis;
77
+ if (!g.crypto) {
78
+ g.crypto = {};
79
+ }
80
+ if (g.crypto.subtle) return false;
81
+ try {
82
+ g.crypto.subtle = gravixSubtleHmac;
83
+ } catch {
84
+ Object.defineProperty(g.crypto, 'subtle', {
85
+ value: gravixSubtleHmac,
86
+ configurable: true
87
+ });
88
+ }
89
+ return true;
90
+ }
91
+ //# sourceMappingURL=subtleHmac.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["hmacSha256","KEY_BYTES","Symbol","toBytes","data","Uint8Array","ArrayBuffer","isView","buffer","byteOffset","byteLength","TypeError","notSupported","op","Err","globalThis","DOMException","msg","Promise","reject","Error","algName","alg","String","name","hashName","hash","gravixSubtleHmac","__gravixShim","importKey","format","keyData","algorithm","_extractable","_usages","toUpperCase","bytes","resolve","type","sign","key","sig","slice","verify","digest","encrypt","decrypt","deriveKey","deriveBits","generateKey","exportKey","wrapKey","unwrapKey","installSubtleHmacShim","g","crypto","subtle","Object","defineProperty","value","configurable"],"sourceRoot":"../../../src","sources":["polyfills/subtleHmac.ts"],"mappings":";;AAAA;;AAEA,SAASA,UAAU,QAAQ,aAAU;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,SAAS,GAAGC,MAAM,CAAC,eAAe,CAAC;AAQzC,SAASC,OAAOA,CAACC,IAAa,EAAc;EAC1C,IAAIA,IAAI,YAAYC,UAAU,EAAE,OAAOD,IAAI;EAC3C,IAAIA,IAAI,YAAYE,WAAW,EAAE,OAAO,IAAID,UAAU,CAACD,IAAI,CAAC;EAC5D,IAAIE,WAAW,CAACC,MAAM,CAACH,IAAI,CAAC,EAAE;IAC5B,OAAO,IAAIC,UAAU,CAACD,IAAI,CAACI,MAAM,EAAEJ,IAAI,CAACK,UAAU,EAAEL,IAAI,CAACM,UAAU,CAAC;EACtE;EACA,MAAM,IAAIC,SAAS,CAAC,yBAAyB,CAAC;AAChD;AAEA,SAASC,YAAYA,CAACC,EAAU,EAAkB;EAChD,MAAMC,GAAG,GACPC,UAAU,CACVC,YAAY;EACd,MAAMC,GAAG,GAAG,iBAAiBJ,EAAE,oFAAoF;EACnH,OAAOK,OAAO,CAACC,MAAM,CACnBL,GAAG,GAAG,IAAIA,GAAG,CAACG,GAAG,EAAE,mBAAmB,CAAC,GAAG,IAAIG,KAAK,CAACH,GAAG,CACzD,CAAC;AACH;AAEA,SAASI,OAAOA,CAACC,GAAY,EAAU;EACrC,OAAO,OAAOA,GAAG,KAAK,QAAQ,GAC1BA,GAAG,GACHC,MAAM,CAAED,GAAG,EAAwBE,IAAI,IAAI,EAAE,CAAC;AACpD;AAEA,SAASC,QAAQA,CAACH,GAAY,EAAU;EACtC,MAAMI,IAAI,GAAIJ,GAAG,EAAyBI,IAAI;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0,0 +1,164 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ /**
6
+ * UTF-8 TextEncoder/TextDecoder for runtimes that lack them (older Hermes has
7
+ * TextEncoder only; @bufbuild/protobuf in gravix-rtc decodes signalling strings
8
+ * with TextDecoder). Installed only when missing.
9
+ */
10
+
11
+ /* eslint-disable no-bitwise */
12
+ function encodeUtf8(input) {
13
+ const out = [];
14
+ for (let i = 0; i < input.length; i++) {
15
+ let c = input.charCodeAt(i);
16
+ if (c >= 0xd800 && c <= 0xdbff && i + 1 < input.length) {
17
+ const d = input.charCodeAt(i + 1);
18
+ if (d >= 0xdc00 && d <= 0xdfff) {
19
+ c = 0x10000 + (c - 0xd800 << 10) + (d - 0xdc00);
20
+ i++;
21
+ }
22
+ } else if (c >= 0xd800 && c <= 0xdfff) {
23
+ c = 0xfffd;
24
+ }
25
+ if (c < 0x80) out.push(c);else if (c < 0x800) out.push(0xc0 | c >> 6, 0x80 | c & 63);else if (c < 0x10000) out.push(0xe0 | c >> 12, 0x80 | c >> 6 & 63, 0x80 | c & 63);else out.push(0xf0 | c >> 18, 0x80 | c >> 12 & 63, 0x80 | c >> 6 & 63, 0x80 | c & 63);
26
+ }
27
+ return new Uint8Array(out);
28
+ }
29
+ class FatalDecodeError extends TypeError {
30
+ constructor() {
31
+ super('TextDecoder: the encoded data was not valid utf-8');
32
+ }
33
+ }
34
+ function decodeUtf8(bytes, dropBom = true, fatal = false) {
35
+ let out = '';
36
+ let i = 0;
37
+ // A BOM at the start is dropped, as TextDecoder does by default.
38
+ if (dropBom && bytes[0] === 0xef && bytes[1] === 0xbb && bytes[2] === 0xbf) i = 3;
39
+ const chunk = [];
40
+ const flush = () => {
41
+ out += String.fromCharCode.apply(null, chunk);
42
+ chunk.length = 0;
43
+ };
44
+ while (i < bytes.length) {
45
+ const b = bytes[i];
46
+ let cp = 0xfffd;
47
+ let need = 0;
48
+ if (b < 0x80) {
49
+ cp = b;
50
+ } else if (b >= 0xc2 && b < 0xe0) {
51
+ need = 1;
52
+ cp = b & 0x1f;
53
+ } else if (b >= 0xe0 && b < 0xf0) {
54
+ need = 2;
55
+ cp = b & 0x0f;
56
+ } else if (b >= 0xf0 && b < 0xf5) {
57
+ need = 3;
58
+ cp = b & 0x07;
59
+ }
60
+ i++;
61
+ let ok = true;
62
+ for (let k = 0; k < need; k++) {
63
+ const n = bytes[i];
64
+ if (n === undefined || (n & 0xc0) !== 0x80) {
65
+ ok = false;
66
+ break;
67
+ }
68
+ cp = cp << 6 | n & 0x3f;
69
+ i++;
70
+ }
71
+ if (!ok || need === 2 && cp < 0x800 || need === 3 && (cp < 0x10000 || cp > 0x10ffff) || cp >= 0xd800 && cp <= 0xdfff || need === 0 && b >= 0x80) {
72
+ if (fatal) throw new FatalDecodeError();
73
+ cp = 0xfffd;
74
+ }
75
+ if (cp >= 0x10000) {
76
+ cp -= 0x10000;
77
+ chunk.push(0xd800 + (cp >> 10), 0xdc00 + (cp & 0x3ff));
78
+ } else {
79
+ chunk.push(cp);
80
+ }
81
+ if (chunk.length > 4096) flush();
82
+ }
83
+ flush();
84
+ return out;
85
+ }
86
+ /* eslint-enable no-bitwise */
87
+
88
+ class GravixTextEncoder {
89
+ encoding = 'utf-8';
90
+ encode(input = '') {
91
+ return encodeUtf8(String(input));
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Length of an incomplete UTF-8 sequence at the end of [b] (0..3): the bytes
97
+ * a streaming decode keeps for the next chunk.
98
+ */
99
+ function incompleteTail(b) {
100
+ for (let back = 1; back <= Math.min(3, b.length); back++) {
101
+ const x = b[b.length - back];
102
+ if (x >= 0x80 && x < 0xc0) continue; // continuation: look further back
103
+ const need = x >= 0xf0 && x < 0xf5 ? 3 : x >= 0xe0 ? 2 : x >= 0xc2 ? 1 : 0;
104
+ return need >= back ? back : 0;
105
+ }
106
+ return 0;
107
+ }
108
+
109
+ /** WHATWG TextDecoder, utf-8 only, with `fatal`, `ignoreBOM` and `{stream}`. */
110
+ class GravixTextDecoder {
111
+ encoding = 'utf-8';
112
+ pending = new Uint8Array(0);
113
+ started = false;
114
+ constructor(label = 'utf-8', options = {}) {
115
+ const l = String(label).toLowerCase();
116
+ if (l !== 'utf-8' && l !== 'utf8' && l !== 'unicode-1-1-utf-8') {
117
+ throw new RangeError(`TextDecoder: only utf-8 is supported, got '${label}'`);
118
+ }
119
+ this.fatal = options.fatal === true;
120
+ this.ignoreBOM = options.ignoreBOM === true;
121
+ }
122
+ decode(input, options = {}) {
123
+ let bytes = !input ? new Uint8Array(0) : input instanceof ArrayBuffer ? new Uint8Array(input) : new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
124
+ if (this.pending.length > 0) {
125
+ const joined = new Uint8Array(this.pending.length + bytes.length);
126
+ joined.set(this.pending, 0);
127
+ joined.set(bytes, this.pending.length);
128
+ bytes = joined;
129
+ }
130
+ const stream = options.stream === true;
131
+ let keep = stream ? incompleteTail(bytes) : 0;
132
+ // a stream start may still be a partial BOM
133
+ if (stream && !this.started && bytes.length < 3) keep = bytes.length;
134
+ const body = keep > 0 ? bytes.subarray(0, bytes.length - keep) : bytes;
135
+ this.pending = keep > 0 ? bytes.slice(bytes.length - keep) : new Uint8Array(0);
136
+ const dropBom = !this.ignoreBOM && !this.started;
137
+ if (body.length > 0) this.started = true;
138
+ let out;
139
+ try {
140
+ out = decodeUtf8(body, dropBom, this.fatal);
141
+ } catch (e) {
142
+ this.reset();
143
+ throw e;
144
+ }
145
+ if (!stream) this.reset();
146
+ return out;
147
+ }
148
+ reset() {
149
+ this.pending = new Uint8Array(0);
150
+ this.started = false;
151
+ }
152
+ }
153
+ export function installTextCoding() {
154
+ const g = globalThis;
155
+ if (typeof g.TextEncoder === 'undefined') g.TextEncoder = GravixTextEncoder;
156
+ if (typeof g.TextDecoder === 'undefined') g.TextDecoder = GravixTextDecoder;
157
+ }
158
+ export const __test = {
159
+ encodeUtf8,
160
+ decodeUtf8,
161
+ GravixTextDecoder,
162
+ GravixTextEncoder
163
+ };
164
+ //# sourceMappingURL=textCoding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["encodeUtf8","input","out","i","length","c","charCodeAt","d","push","Uint8Array","FatalDecodeError","TypeError","constructor","decodeUtf8","bytes","dropBom","fatal","chunk","flush","String","fromCharCode","apply","b","cp","need","ok","k","n","undefined","GravixTextEncoder","encoding","encode","incompleteTail","back","Math","min","x","GravixTextDecoder","pending","started","label","options","l","toLowerCase","RangeError","ignoreBOM","decode","ArrayBuffer","buffer","byteOffset","byteLength","joined","set","stream","keep","body","subarray","slice","e","reset","installTextCoding","g","globalThis","TextEncoder","TextDecoder","__test"],"sourceRoot":"../../../src","sources":["polyfills/textCoding.ts"],"mappings":";;AAAA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAASA,UAAUA,CAACC,KAAa,EAAc;EAC7C,MAAMC,GAAa,GAAG,EAAE;EACxB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,KAAK,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACrC,IAAIE,CAAC,GAAGJ,KAAK,CAACK,UAAU,CAACH,CAAC,CAAC;IAC3B,IAAIE,CAAC,IAAI,MAAM,IAAIA,CAAC,IAAI,MAAM,IAAIF,CAAC,GAAG,CAAC,GAAGF,KAAK,CAACG,MAAM,EAAE;MACtD,MAAMG,CAAC,GAAGN,KAAK,CAACK,UAAU,CAACH,CAAC,GAAG,CAAC,CAAC;MACjC,IAAII,CAAC,IAAI,MAAM,IAAIA,CAAC,IAAI,MAAM,EAAE;QAC9BF,CAAC,GAAG,OAAO,IAAKA,CAAC,GAAG,MAAM,IAAK,EAAE,CAAC,IAAIE,CAAC,GAAG,MAAM,CAAC;QACjDJ,CAAC,EAAE;MACL;IACF,CAAC,MAAM,IAAIE,CAAC,IAAI,MAAM,IAAIA,CAAC,IAAI,MAAM,EAAE;MACrCA,CAAC,GAAG,MAAM;IACZ;IACA,IAAIA,CAAC,GAAG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;EACQyD,KAAKA,CAAA,EAAS;IACpB,IAAI,CAACrB,OAAO,GAAG,IAAI7B,UAAU,CAAC,CAAC,CAAC;IAChC,IAAI,CAAC8B,OAAO,GAAG,KAAK;EACtB;AACF;AAEA,OAAO,SAASqB,iBAAiBA,CAAA,EAAS;EACxC,MAAMC,CAAC,GAAGC,UAA8D;EACxE,IAAI,OAAOD,CAAC,CAACE,WAAW,KAAK,WAAW,EAAEF,CAAC,CAACE,WAAW,GAAGlC,iBAAiB;EAC3E,IAAI,OAAOgC,CAAC,CAACG,WAAW,KAAK,WAAW,EAAEH,CAAC,CAACG,WAAW,GAAG3B,iBAAiB;AAC7E;AAEA,OAAO,MAAM4B,MAAM,GAAG;EACpBjE,UAAU;EACVa,UAAU;EACVwB,iBAAiB;EACjBR;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,135 @@
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
+ import 'well-known-symbols/Symbol.asyncIterator/auto';
8
+ import 'well-known-symbols/Symbol.iterator/auto';
9
+ import { registerGlobals as webrtcRegisterGlobals } from 'react-native-webrtc';
10
+ import { PixelRatio, Platform } from 'react-native';
11
+ import { setupURLPolyfill } from 'react-native-url-polyfill';
12
+ import { CountQueuingStrategy, ReadableStream, TransformStream, WritableStream } from 'web-streams-polyfill';
13
+ import { setupIOSAudioManagement } from "./audio/AudioManager.js";
14
+ import { Room } from 'gravix-rtc';
15
+ import { installRemoteVolumeHook } from "./audio/remoteVolume.js";
16
+ import { gravixRoomMicPolicy, installRoomMicHooks } from "./micPolicy.js";
17
+ import { installDOMException } from "./polyfills/DOMException.js";
18
+ import { installSubtleHmacShim } from "./polyfills/subtleHmac.js";
19
+ import { installTextCoding } from "./polyfills/textCoding.js";
20
+
21
+ /** What the gravix-rtc core reads to tell it runs in React Native (`getReactNativeOs`). */
22
+
23
+ let registered = false;
24
+
25
+ /**
26
+ * Installs WebRTC and the web APIs gravix-rtc needs into the React Native
27
+ * runtime. Call once, at app start, before any `Room` is created.
28
+ * Safe to call more than once.
29
+ */
30
+ export function registerGlobals(options = {}) {
31
+ const opts = {
32
+ autoConfigureAudioSession: true,
33
+ preferSpeakerOutput: true,
34
+ cryptoHmacShim: true,
35
+ muteReleasesMic: true,
36
+ ...options
37
+ };
38
+ if (registered) return;
39
+ registered = true;
40
+ installDOMException();
41
+ webrtcRegisterGlobals();
42
+ if (opts.autoConfigureAudioSession) {
43
+ setupIOSAudioManagement(opts.preferSpeakerOutput, opts.iosAudioSessionPolicy);
44
+ }
45
+ const info = {
46
+ platform: Platform.OS,
47
+ devicePixelRatio: PixelRatio.get()
48
+ };
49
+ globalThis.GravixReactNativeGlobal = info;
50
+ setupURLPolyfill();
51
+ fixUserAgent();
52
+ shimPromiseAllSettled();
53
+ shimArrayAt();
54
+ shimCryptoRandom();
55
+ installTextCoding();
56
+ if (opts.cryptoHmacShim) installSubtleHmacShim();
57
+ installGlobalEventTarget();
58
+ gravixRoomMicPolicy.releasesMic = opts.muteReleasesMic;
59
+ if (opts.muteReleasesMic) installRoomMicHooks(Room);
60
+ installRemoteVolumeHook(Room);
61
+ shimWebStreams();
62
+ }
63
+
64
+ /** Test hook: lets a test call `registerGlobals` again. @internal */
65
+ export function __resetRegisterGlobalsForTests() {
66
+ registered = false;
67
+ }
68
+ function fixUserAgent() {
69
+ // webrtc-adapter (bundled in gravix-rtc) reads navigator.userAgent.
70
+ const nav = globalThis.navigator;
71
+ if (nav && nav.userAgent === undefined) {
72
+ nav.userAgent = nav.product ?? 'Unknown';
73
+ }
74
+ }
75
+ function shimPromiseAllSettled() {
76
+ if (typeof Promise.allSettled !== 'function') {
77
+ require('promise.allsettled').shim();
78
+ }
79
+ }
80
+ function shimArrayAt() {
81
+ // sdp-transform uses Array.prototype.at.
82
+ if (!Array.prototype.at) {
83
+ require('array.prototype.at').shim();
84
+ }
85
+ }
86
+
87
+ /* eslint-disable no-bitwise */
88
+
89
+ function shimCryptoRandom() {
90
+ const g = globalThis;
91
+ if (!g.crypto) g.crypto = {};
92
+ const c = g.crypto;
93
+ if (typeof c.getRandomValues !== 'function') {
94
+ // Used for ids only (never for key material: E2EE is not supported here).
95
+ c.getRandomValues = arr => {
96
+ if (arr) {
97
+ const bytes = new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
98
+ for (let i = 0; i < bytes.length; i++) bytes[i] = Math.random() * 256 | 0;
99
+ }
100
+ return arr;
101
+ };
102
+ }
103
+ if (typeof c.randomUUID !== 'function') {
104
+ c.randomUUID = () => 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, ch => {
105
+ const r = Math.random() * 16 | 0;
106
+ const v = ch === 'x' ? r : r & 0x3 | 0x8;
107
+ return v.toString(16);
108
+ });
109
+ }
110
+ }
111
+ /* eslint-enable no-bitwise */
112
+
113
+ function shimWebStreams() {
114
+ const g = globalThis;
115
+ if (typeof g.WritableStream === 'undefined') g.WritableStream = WritableStream;
116
+ if (typeof g.ReadableStream === 'undefined') g.ReadableStream = ReadableStream;
117
+ if (typeof g.CountQueuingStrategy === 'undefined') g.CountQueuingStrategy = CountQueuingStrategy;
118
+ if (typeof g.TransformStream === 'undefined') g.TransformStream = TransformStream;
119
+ }
120
+
121
+ /**
122
+ * React Native's global object (`window`) has no add/removeEventListener;
123
+ * gravix-rtc's `startRegionMeasurement()` without `networkEvents` falls back
124
+ * to `window` (online / offline). Listeners are kept but never fire: pass
125
+ * `networkEvents` (e.g. from @react-native-community/netinfo) for real ones.
126
+ */
127
+ function installGlobalEventTarget() {
128
+ const g = globalThis;
129
+ if (typeof g.addEventListener === 'function' || !g.EventTarget) return;
130
+ const t = new g.EventTarget();
131
+ g.addEventListener = t.addEventListener.bind(t);
132
+ g.removeEventListener = t.removeEventListener.bind(t);
133
+ if (typeof g.dispatchEvent !== 'function') g.dispatchEvent = t.dispatchEvent.bind(t);
134
+ }
135
+ //# sourceMappingURL=registerGlobals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["registerGlobals","webrtcRegisterGlobals","PixelRatio","Platform","setupURLPolyfill","CountQueuingStrategy","ReadableStream","TransformStream","WritableStream","setupIOSAudioManagement","Room","installRemoteVolumeHook","gravixRoomMicPolicy","installRoomMicHooks","installDOMException","installSubtleHmacShim","installTextCoding","registered","options","opts","autoConfigureAudioSession","preferSpeakerOutput","cryptoHmacShim","muteReleasesMic","iosAudioSessionPolicy","info","platform","OS","devicePixelRatio","get","globalThis","GravixReactNativeGlobal","fixUserAgent","shimPromiseAllSettled","shimArrayAt","shimCryptoRandom","installGlobalEventTarget","releasesMic","shimWebStreams","__resetRegisterGlobalsForTests","nav","navigator","userAgent","undefined","product","Promise","allSettled","require","shim","Array","prototype","at","g","crypto","c","getRandomValues","arr","bytes","Uint8Array","buffer","byteOffset","byteLength","i","length","Math","random","randomUUID","replace","ch","r","v","toString","addEventListener","EventTarget","t","bind","removeEventListener","dispatchEvent"],"sourceRoot":"../../src","sources":["registerGlobals.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,OAAO,8CAA8C;AACrD,OAAO,yCAAyC;AAChD,SAASA,eAAe,IAAIC,qBAAqB,QAAQ,qBAAqB;AAC9E,SAASC,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AACnD,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SACEC,oBAAoB,EACpBC,cAAc,EACdC,eAAe,EACfC,cAAc,QACT,sBAAsB;AAC7B,SACEC,uBAAuB,QAElB,yBAAsB;AAC7B,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,uBAAuB,QAAQ,yBAAsB;AAC9D,SAASC,mBAAmB,EAAEC,mBAAmB,QAAQ,gBAAa;AACtE,SAASC,mBAAmB,QAAQ,6BAA0B;AAC9D,SAASC,qBAAqB,QAAQ,2BAAwB;AAC9D,SAASC,iBAAiB,QAAQ,2BAAwB;;A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