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,294 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ import { Track } from 'gravix-rtc';
6
+ import { androidAudioFor } from "../android/bindings.js";
7
+ import { gravixMicMute } from "../android/micMute.js";
8
+ import { androidNoiseSuppressionStats } from "../android/noiseSuppression.js";
9
+ import { GravixAndroidRoomMusic } from "../android/roomMusic.js";
10
+ import { unsupported } from "../unsupported.js";
11
+ import { DEFAULT_MUSIC_OPTIONS } from "./roomMusicTypes.js";
12
+
13
+ /**
14
+ * Android: the song is decoded natively and mixed into the published mic
15
+ * (one stream, `MusicMixerEngine`), with monitor, mic volume, ducking, loop,
16
+ * seek and the 0.12.2 mute rules. Not ported yet on React Native:
17
+ * `asset` sources (copy the file out and use `file`), the lyric-sync
18
+ * `gx.music` messages (`syncPosition`, `remotePositionNow` stays undefined),
19
+ * `musicMaxBitrate` / `disableDtxWhileMusic` (use the core's publish options).
20
+ */
21
+ export class AndroidRoomMusic {
22
+ room = null;
23
+ native = null;
24
+ current = {
25
+ status: 'idle',
26
+ positionMs: 0
27
+ };
28
+ stampAt = 0;
29
+ unlisten = [];
30
+ constructor(options = {}) {
31
+ this.options = Object.freeze({
32
+ ...DEFAULT_MUSIC_OPTIONS,
33
+ ...options
34
+ });
35
+ }
36
+ get state() {
37
+ return this.current;
38
+ }
39
+ android(op) {
40
+ if (!androidAudioFor('roomMusic')) unsupported('roomMusic', op);
41
+ if (!this.native) {
42
+ const o = this.options;
43
+ this.native = new GravixAndroidRoomMusic({
44
+ musicVolume: o.musicVolume,
45
+ micVolume: o.micVolume,
46
+ ducking: o.ducking,
47
+ duckLevel: o.duckLevel,
48
+ loop: o.loop,
49
+ monitor: o.monitor,
50
+ continueWhileMicMuted: o.continueWhileMicMuted,
51
+ continueWhileMicReleased: o.continueWhileMicReleased,
52
+ pauseOnInterruption: o.pauseOnInterruption
53
+ });
54
+ this.unlisten.push(this.native.onCompleted(() => {
55
+ this.set({
56
+ status: 'idle',
57
+ positionMs: 0
58
+ });
59
+ this.micAfterMusic().catch(() => {});
60
+ }), this.native.onError(p => this.set({
61
+ status: 'error',
62
+ error: String(p?.message ?? p?.code ?? 'error')
63
+ })), this.native.onInterruption(p => {
64
+ if (p?.active === true) this.set({
65
+ status: 'paused',
66
+ positionMs: this.positionNow()
67
+ });else if (p?.resumed === true) this.set({
68
+ status: 'playing'
69
+ });
70
+ }));
71
+ }
72
+ return this.native;
73
+ }
74
+ set(patch) {
75
+ this.current = {
76
+ ...this.current,
77
+ ...patch
78
+ };
79
+ this.stampAt = Date.now();
80
+ }
81
+ async run(op, fn) {
82
+ await fn(this.android(op));
83
+ }
84
+
85
+ /** The published mic track (null before it is published). */
86
+ micTrack() {
87
+ const pub = this.room?.localParticipant.getTrackPublication(Track.Source.Microphone);
88
+ return pub?.track ?? null;
89
+ }
90
+ relaxed = false;
91
+
92
+ /**
93
+ * WebRTC NS / AGC / HPF relaxed while the song plays (Flutter relaxVoiceProcessing).
94
+ * Given back to WebRTC's defaults only while neither Gravix NS nor the singer
95
+ * capture is on (both want WebRTC's NS / AGC off).
96
+ */
97
+ async relax(on) {
98
+ if (!this.options.relaxVoiceProcessing || this.relaxed === on) return;
99
+ this.relaxed = on;
100
+ if (!on && !(await webrtcProcessingWanted())) return;
101
+ const id = this.micTrack()?.mediaStreamTrack?.id;
102
+ const b = androidAudioFor('roomMusic');
103
+ if (!id || !b) return;
104
+ try {
105
+ await b.call('setAudioProcessingOptions', {
106
+ trackId: id,
107
+ echoCancellation: true,
108
+ noiseSuppression: !on,
109
+ autoGainControl: !on,
110
+ highPassFilter: !on
111
+ });
112
+ } catch {
113
+ // best effort: the song still plays through WebRTC's processing
114
+ }
115
+ }
116
+ async micAfterMusic() {
117
+ const t = this.micTrack();
118
+ if (t && gravixMicMute.muteKind !== 'none') await gravixMicMute.musicEnded(t);
119
+ await this.relax(false);
120
+ }
121
+
122
+ /** Binds the controller to a connected room (the published mic carries the mix). */
123
+ attach(room) {
124
+ this.android('attach');
125
+ this.room = room;
126
+ // A core mute (setMicrophoneEnabled(false)) during a voice-only mute takes the mute
127
+ // over: give back the module mute / recorder, or a later core unmute stays silent.
128
+ const lp = room.localParticipant;
129
+ const onMuted = pub => {
130
+ if (pub?.source !== Track.Source.Microphone || !pub.track) return;
131
+ gravixMicMute.coreMuted(pub.track).catch(() => {});
132
+ };
133
+ lp.on('trackMuted', onMuted);
134
+ this.unlisten.push(() => lp.off('trackMuted', onMuted));
135
+ }
136
+ /** Checks the source; the native decoder opens it on `start`. */
137
+ async prepare(source) {
138
+ this.android('prepare');
139
+ sourcePath(source);
140
+ }
141
+ async start(source, options = {}) {
142
+ const m = this.android('start');
143
+ // A disabled mic has no record thread: nothing would clock the mixer and the room
144
+ // would hear nothing (Flutter re-opens the capture for the song; not ported yet).
145
+ if (this.micTrack()?.isMuted) {
146
+ throw new Error('roomMusic.start: the microphone is muted; unmute it first (mute during the song with setMicMuted(true))');
147
+ }
148
+ this.set({
149
+ status: 'loading',
150
+ source,
151
+ title: options.title,
152
+ positionMs: 0,
153
+ error: undefined
154
+ });
155
+ try {
156
+ const durationMs = await m.start(sourcePath(source), {
157
+ loop: options.loop ?? this.options.loop,
158
+ musicVolume: options.volume ?? m.currentOptions.musicVolume
159
+ });
160
+ this.set({
161
+ status: 'playing',
162
+ durationMs: durationMs >= 0 ? durationMs : undefined
163
+ });
164
+ await this.relax(true);
165
+ } catch (e) {
166
+ this.set({
167
+ status: 'error',
168
+ error: String(e)
169
+ });
170
+ throw e;
171
+ }
172
+ }
173
+ pause() {
174
+ return this.run('pause', async m => {
175
+ await m.pause();
176
+ this.set({
177
+ status: 'paused',
178
+ positionMs: this.positionNow()
179
+ });
180
+ });
181
+ }
182
+ resume() {
183
+ return this.run('resume', async m => {
184
+ await m.resume();
185
+ this.set({
186
+ status: 'playing'
187
+ });
188
+ });
189
+ }
190
+ stop() {
191
+ return this.run('stop', async m => {
192
+ await m.stop();
193
+ this.set({
194
+ status: 'idle',
195
+ positionMs: 0,
196
+ durationMs: undefined
197
+ });
198
+ await this.micAfterMusic();
199
+ });
200
+ }
201
+ seek(positionMs) {
202
+ return this.run('seek', async m => {
203
+ await m.seek(positionMs);
204
+ this.set({
205
+ positionMs
206
+ });
207
+ });
208
+ }
209
+ setMusicVolume(volume) {
210
+ return this.run('setMusicVolume', m => m.setMusicVolume(volume));
211
+ }
212
+ setMicVolume(volume) {
213
+ return this.run('setMicVolume', m => m.setMicVolume(volume));
214
+ }
215
+ setDucking(on) {
216
+ return this.run('setDucking', m => m.setDucking(on));
217
+ }
218
+ setLoop(on) {
219
+ return this.run('setLoop', m => m.setLoop(on));
220
+ }
221
+ /**
222
+ * Android: mutes / unmutes the mic while the song plays with the 0.12.2
223
+ * rules: `continueWhileMicMuted` keeps the song going out (voice zeroed,
224
+ * the publication stays live); with `GravixMicRelease.setMuteReleasesMic(true)`
225
+ * and `continueWhileMicReleased` the recorder is released too (OS mic
226
+ * indicator off). Without music, or with those off, it is a plain track mute.
227
+ */
228
+ async setMicMuted(muted) {
229
+ this.android('setMicMuted');
230
+ const t = this.micTrack();
231
+ if (!t) throw new Error('roomMusic.setMicMuted: no published microphone');
232
+ const playing = this.current.status === 'playing' || this.current.status === 'paused';
233
+ if (muted) {
234
+ if (!playing || !this.options.continueWhileMicMuted) {
235
+ await t.mute();
236
+ return;
237
+ }
238
+ await gravixMicMute.muteForMusic(t, gravixMicMute.muteReleasesMic && this.options.continueWhileMicReleased);
239
+ return;
240
+ }
241
+ if (!(await gravixMicMute.unmuteFromMusic(t))) await t.unmute();
242
+ }
243
+ /** The singer's song position now, extrapolated from the last native stamp. */
244
+ positionNow() {
245
+ this.android('positionNow');
246
+ const c = this.current;
247
+ if (c.status !== 'playing') return c.positionMs;
248
+ const p = c.positionMs + (Date.now() - this.stampAt);
249
+ return c.durationMs !== undefined ? Math.min(p, c.durationMs) : p;
250
+ }
251
+ /** A listener's view of a singer's position (lyric sync over `gx.music`; not on React Native yet). */
252
+ remotePositionNow(_participantIdentity) {
253
+ this.android('remotePositionNow');
254
+ return undefined;
255
+ }
256
+ async dispose() {
257
+ for (const u of this.unlisten.splice(0)) u();
258
+ if (this.native && this.current.status !== 'idle') {
259
+ await this.native.stop().catch(() => {});
260
+ await this.micAfterMusic().catch(() => {});
261
+ }
262
+ this.native = null;
263
+ this.room = null;
264
+ this.current = {
265
+ status: 'idle',
266
+ positionMs: 0
267
+ };
268
+ }
269
+ }
270
+
271
+ /** False while Gravix NS runs or the native singer half is on (WebRTC's NS / AGC stay off). */
272
+ async function webrtcProcessingWanted() {
273
+ try {
274
+ const s = await androidNoiseSuppressionStats();
275
+ if (!s) return true;
276
+ const ours = s.eng === 'rnnoise' || s.eng === 'dfn3';
277
+ return !ours && s.singerMode !== true;
278
+ } catch {
279
+ return true;
280
+ }
281
+ }
282
+
283
+ /** The native source string: a file path or a content:// uri. */
284
+ function sourcePath(source) {
285
+ switch (source.kind) {
286
+ case 'file':
287
+ return source.path;
288
+ case 'contentUri':
289
+ return source.uri;
290
+ default:
291
+ throw new Error('roomMusic: asset sources are not supported on React Native Android yet; copy the asset to a file and use GravixMusicSource.file');
292
+ }
293
+ }
294
+ //# sourceMappingURL=roomMusicAndroid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Track","androidAudioFor","gravixMicMute","androidNoiseSuppressionStats","GravixAndroidRoomMusic","unsupported","DEFAULT_MUSIC_OPTIONS","AndroidRoomMusic","room","native","current","status","positionMs","stampAt","unlisten","constructor","options","Object","freeze","state","android","op","o","musicVolume","micVolume","ducking","duckLevel","loop","monitor","continueWhileMicMuted","continueWhileMicReleased","pauseOnInterruption","push","onCompleted","set","micAfterMusic","catch","onError","p","error","String","message","code","onInterruption","active","positionNow","resumed","patch","Date","now","run","fn","micTrack","pub","localParticipant","getTrackPublication","Source","Microphone","track","relaxed","relax","on","relaxVoiceProcessing","webrtcProcessingWanted","id","mediaStreamTrack","b","call","trackId","echoCancellation","noiseSuppression","autoGainControl","highPassFilter","t","muteKind","musicEnded","attach","lp","onMuted","source","coreMuted","off","prepare","sourcePath","start","m","isMuted","Error","title","undefined","durationMs","volume","currentOptions","e","pause","resume","stop","seek","setMusicVolume","setMicVolume","setDucking","setLoop","setMicMuted","muted","playing","mute","muteForMusic","muteReleasesMic","unmuteFromMusic","unmute","c","Math","min","remotePositionNow","_participantIdentity","dispose","u","splice","s","ours","eng","singerMode","kind","path","uri"],"sourceRoot":"../../../src","sources":["features/roomMusicAndroid.ts"],"mappings":";;AAAA;;AAEA,SAASA,KAAK,QAAmB,YAAY;AAC7C,SAASC,eAAe,QAAQ,wBAAqB;AACrD,SAASC,aAA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
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ import { unsupported, unsupportedAsync } from "../unsupported.js";
6
+ import { iosAttach, iosCall, isIos, onIosAudioEvent, iosFeature } from "../ios/iosAudio.js";
7
+ import { DEFAULT_MUSIC_OPTIONS } from "./roomMusicTypes.js";
8
+ /** Flutter `GravixRoomMusic.staleReading` / `maxExtrapolation`. */
9
+ const STALE_READING_MS = 200;
10
+ const MAX_EXTRAPOLATION_MS = 750;
11
+ /** iOS: a file path or `file://` URL for the native decoder. */
12
+ function iosPath(source) {
13
+ if (source.kind === 'file') return source.path;
14
+ if (source.kind === 'asset') {
15
+ throw new Error('roomMusic on iOS needs a file path: resolve the asset to a local file first');
16
+ }
17
+ throw new Error('roomMusic: contentUri sources are Android only');
18
+ }
19
+ function clamp01(v, d) {
20
+ return typeof v === 'number' && Number.isFinite(v) ? Math.min(Math.max(v, 0), 1) : d;
21
+ }
22
+
23
+ /**
24
+ * iOS: the song is mixed natively after noise suppression and the voice
25
+ * effect (Flutter 0.12 post-effect route). A mute that releases the mic also
26
+ * silences the song for listeners and holds its position (iOS has no
27
+ * voice-only mute). Lyric sync (`gx.music`) is not part of the iOS native
28
+ * port; see docs/IOS_NATIVE_HOOKS.md.
29
+ *
30
+ * iOS applies musicVolume, micVolume, ducking, duckLevel, loop, monitor and
31
+ * postEffectMix. musicMaxBitrate / disableDtxWhileMusic / relaxVoiceProcessing
32
+ * go through gravix-rtc's `room.setSingerMode(true, ...)` while the song
33
+ * plays (needs {@link IosRoomMusic.attach}; an app-owned singer mode is left
34
+ * alone) and are undone when it stops. Not applied on iOS:
35
+ * pauseOnInterruption, continueWhileMicMuted, continueWhileMicReleased,
36
+ * syncPosition.
37
+ */
38
+ export class IosRoomMusic {
39
+ st = {
40
+ status: 'idle',
41
+ positionMs: 0
42
+ };
43
+ sampledAt = 0;
44
+ /** Age of the native position stamp at the last reading (ms). */
45
+ readingAgeMs = 0;
46
+ timer = null;
47
+ offCompleted = null;
48
+ room = null;
49
+ /** Singer mode was turned on by this controller (undo on stop). */
50
+ singerOurs = false;
51
+ constructor(options = {}) {
52
+ this.options = Object.freeze({
53
+ ...DEFAULT_MUSIC_OPTIONS,
54
+ ...options
55
+ });
56
+ }
57
+ get state() {
58
+ return this.st;
59
+ }
60
+
61
+ /** Binds the controller to a connected room (the published mic carries the mix). */
62
+ attach(room) {
63
+ if (!iosFeature('roomMusic')) unsupported('roomMusic', 'attach');
64
+ // iOS: the mix runs in the capture chain of whatever mic is published;
65
+ // the room is for the music bitrate / DTX (singer mode).
66
+ this.room = room;
67
+ }
68
+ /** Decodes ahead so `start` begins without a gap. */
69
+ async prepare(source) {
70
+ if (!iosFeature('roomMusic')) return unsupportedAsync('roomMusic', 'prepare');
71
+ iosPath(source); // validates; iOS opens the file on start
72
+ }
73
+ async start(source, options) {
74
+ if (!iosFeature('roomMusic')) return unsupportedAsync('roomMusic', 'start');
75
+ const o = this.options;
76
+ if (!o.postEffectMix) {
77
+ throw new Error('roomMusic on iOS supports only postEffectMix: true');
78
+ }
79
+ await iosAttach();
80
+ this.st = {
81
+ status: 'loading',
82
+ source,
83
+ positionMs: 0,
84
+ title: options?.title
85
+ };
86
+ try {
87
+ const r = await iosCall('music.start', {
88
+ source: iosPath(source),
89
+ musicVolume: clamp01(options?.volume ?? o.musicVolume, 1),
90
+ micVolume: clamp01(o.micVolume, 1),
91
+ ducking: o.ducking,
92
+ duckLevel: clamp01(o.duckLevel, 0.35),
93
+ monitor: o.monitor,
94
+ loop: options?.loop ?? o.loop,
95
+ postMix: true
96
+ });
97
+ this.st = {
98
+ status: 'playing',
99
+ source,
100
+ positionMs: 0,
101
+ durationMs: typeof r?.durationMs === 'number' ? r.durationMs : undefined,
102
+ title: options?.title
103
+ };
104
+ this.sampledAt = Date.now();
105
+ this.watch();
106
+ await this.singerOn();
107
+ } catch (e) {
108
+ this.st = {
109
+ status: 'error',
110
+ source,
111
+ positionMs: 0,
112
+ error: String(e?.message ?? e)
113
+ };
114
+ throw e;
115
+ }
116
+ }
117
+ async pause() {
118
+ if (!iosFeature('roomMusic')) return unsupportedAsync('roomMusic', 'pause');
119
+ await iosCall('music.pause');
120
+ await this.refresh();
121
+ }
122
+ async resume() {
123
+ if (!iosFeature('roomMusic')) return unsupportedAsync('roomMusic', 'resume');
124
+ await iosCall('music.resume');
125
+ await this.refresh();
126
+ }
127
+ async stop() {
128
+ if (!iosFeature('roomMusic')) return unsupportedAsync('roomMusic', 'stop');
129
+ await iosCall('music.stop');
130
+ this.idle();
131
+ }
132
+
133
+ /** Music bitrate / DTX / processing for the song (Flutter music session). */
134
+ async singerOn() {
135
+ const r = this.room;
136
+ const o = this.options;
137
+ if (!r || typeof r.setSingerMode !== 'function' || r.singerMode) return;
138
+ if (!o.disableDtxWhileMusic && o.musicMaxBitrate <= 0) return;
139
+ this.singerOurs = true;
140
+ try {
141
+ await r.setSingerMode(true, {
142
+ maxBitrate: o.musicMaxBitrate > 0 ? o.musicMaxBitrate : undefined,
143
+ disableDtx: o.disableDtxWhileMusic,
144
+ echoCancellation: true
145
+ });
146
+ } catch {
147
+ // the song plays at the voice bitrate
148
+ }
149
+ }
150
+ singerOff() {
151
+ if (!this.singerOurs) return;
152
+ this.singerOurs = false;
153
+ this.room?.setSingerMode(false)?.catch?.(() => {});
154
+ }
155
+ async seek(positionMs) {
156
+ if (!iosFeature('roomMusic')) return unsupportedAsync('roomMusic', 'seek');
157
+ await iosCall('music.seekTo', {
158
+ positionMs: Math.max(0, Math.round(positionMs))
159
+ });
160
+ await this.refresh();
161
+ }
162
+ async setMusicVolume(volume) {
163
+ if (!iosFeature('roomMusic')) return unsupportedAsync('roomMusic', 'setMusicVolume');
164
+ await iosCall('music.setVolume', {
165
+ volume: clamp01(volume, 1)
166
+ });
167
+ }
168
+ async setMicVolume(volume) {
169
+ if (!iosFeature('roomMusic')) return unsupportedAsync('roomMusic', 'setMicVolume');
170
+ await iosCall('music.setMicVolume', {
171
+ volume: clamp01(volume, 1)
172
+ });
173
+ }
174
+ async setDucking(on) {
175
+ if (!iosFeature('roomMusic')) return unsupportedAsync('roomMusic', 'setDucking');
176
+ await iosCall('music.setDucking', {
177
+ on,
178
+ level: clamp01(this.options.duckLevel, 0.35)
179
+ });
180
+ }
181
+ async setLoop(on) {
182
+ if (!iosFeature('roomMusic')) return unsupportedAsync('roomMusic', 'setLoop');
183
+ await iosCall('music.setLoop', {
184
+ on
185
+ });
186
+ }
187
+ /** The singer's song position now, extrapolated from the last native stamp. */
188
+ positionNow() {
189
+ if (!iosFeature('roomMusic')) return unsupported('roomMusic', 'positionNow');
190
+ if (this.st.status !== 'playing') return this.st.positionMs;
191
+ // Flutter rules: a native reading older than STALE_READING_MS means the
192
+ // song is not advancing (capture stopped / muted): hold at the reading;
193
+ // never run more than MAX_EXTRAPOLATION_MS past it.
194
+ if (this.readingAgeMs > STALE_READING_MS) return this.st.positionMs;
195
+ const age = Math.min(Math.max(Date.now() - this.sampledAt, 0), MAX_EXTRAPOLATION_MS);
196
+ const p = this.st.positionMs + age;
197
+ return this.st.durationMs ? Math.min(p, this.st.durationMs) : p;
198
+ }
199
+ /** A listener's view of a singer's position (lyric sync over `gx.music`). */
200
+ remotePositionNow(_participantIdentity) {
201
+ return unsupported('roomMusic', 'remotePositionNow');
202
+ }
203
+ async dispose() {
204
+ if (isIos() && this.st.status !== 'idle') {
205
+ try {
206
+ await iosCall('music.stop');
207
+ } catch {
208
+ // already stopped
209
+ }
210
+ }
211
+ this.idle();
212
+ }
213
+ watch() {
214
+ if (!this.offCompleted) {
215
+ this.offCompleted = onIosAudioEvent('music.onCompleted', () => this.idle());
216
+ }
217
+ if (!this.timer) {
218
+ this.timer = setInterval(() => {
219
+ this.refresh().catch(() => {});
220
+ }, 500);
221
+ }
222
+ }
223
+ idle() {
224
+ this.singerOff();
225
+ if (this.timer) clearInterval(this.timer);
226
+ this.timer = null;
227
+ this.offCompleted?.();
228
+ this.offCompleted = null;
229
+ this.st = {
230
+ status: 'idle',
231
+ positionMs: 0
232
+ };
233
+ }
234
+ async refresh() {
235
+ const m = await iosCall('music.getState');
236
+ if (!m.active) {
237
+ if (this.st.status === 'playing' || this.st.status === 'paused') this.idle();
238
+ return;
239
+ }
240
+ this.st = {
241
+ ...this.st,
242
+ status: m.paused ? 'paused' : 'playing',
243
+ positionMs: Math.max(0, Number(m.positionMs ?? 0)),
244
+ durationMs: typeof m.durationMs === 'number' && m.durationMs >= 0 ? m.durationMs : this.st.durationMs
245
+ };
246
+ this.readingAgeMs = Math.round(Number(m.positionAgeUs ?? 0) / 1000);
247
+ this.sampledAt = Date.now() - this.readingAgeMs;
248
+ }
249
+ }
250
+ //# sourceMappingURL=roomMusicIos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["unsupported","unsupportedAsync","iosAttach","iosCall","isIos","onIosAudioEvent","iosFeature","DEFAULT_MUSIC_OPTIONS","STALE_READING_MS","MAX_EXTRAPOLATION_MS","iosPath","source","kind","path","Error","clamp01","v","d","Number","isFinite","Math","min","max","IosRoomMusic","st","status","positionMs","sampledAt","readingAgeMs","timer","offCompleted","room","singerOurs","constructor","options","Object","freeze","state","attach","prepare","start","o","postEffectMix","title","r","musicVolume","volume","micVolume","ducking","duckLevel","monitor","loop","postMix","durationMs","undefined","Date","now","watch","singerOn","e","error","String","message","pause","refresh","resume","stop","idle","setSingerMode","singerMode","disableDtxWhileMusic","musicMaxBitrate","maxBitrate","disableDtx","echoCancellation","singerOff","catch","seek","round","setMusicVolume","setMicVolume","setDucking","on","level","setLoop","positionNow","age","p","remotePositionNow","_participantIdentity","dispose","setInterval","clearInterval","m","active","paused","positionAgeUs"],"sourceRoot":"../../../src","sources":["features/roomMusicIos.ts"],"mappings":";;AAAA;;AAGA,SAASA,WAAW,EAAEC,gBAAgB,QAAQ,mBAAgB;AAC9D,SACEC,SAAS,EACTC,OAAO,EACPC,KAAK,EACLC,eAAe,EACfC,UAAU,QACL,oBAAiB;AACxB,SACEC,qBAAqB,Q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AAC5D,MAAM,CAAC2E,CAAC,CAACG,aAAa,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;IACnE,IAAI,CAACrE,SAAS,GAAG4B,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC5B,YAAY;EACjD;AACF","ignoreList":[]}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ /**
6
+ * Room music / karaoke: a local audio file mixed into the published
7
+ * microphone (Flutter `GravixRoomMusic`). Native-only: until the platform
8
+ * implements it, every call throws `GravixUnsupportedError`.
9
+ */
10
+
11
+ /** Where the song comes from (Flutter `GravixMusicSource`). */
12
+
13
+ export const GravixMusicSource = {
14
+ file: path => ({
15
+ kind: 'file',
16
+ path
17
+ }),
18
+ /** Android `content://` uri (e.g. from a document picker). */
19
+ contentUri: uri => ({
20
+ kind: 'contentUri',
21
+ uri
22
+ }),
23
+ /** A file bundled with the app. */
24
+ asset: key => ({
25
+ kind: 'asset',
26
+ key
27
+ })
28
+ };
29
+
30
+ /** Same fields and defaults as Flutter `GravixMusicOptions` (0.12.2). */
31
+
32
+ export const DEFAULT_MUSIC_OPTIONS = Object.freeze({
33
+ musicVolume: 1.0,
34
+ micVolume: 1.0,
35
+ ducking: false,
36
+ duckLevel: 0.35,
37
+ loop: false,
38
+ monitor: true,
39
+ musicMaxBitrate: 96000,
40
+ continueWhileMicMuted: true,
41
+ continueWhileMicReleased: true,
42
+ pauseOnInterruption: true,
43
+ disableDtxWhileMusic: true,
44
+ relaxVoiceProcessing: true,
45
+ postEffectMix: true,
46
+ syncPosition: true
47
+ });
48
+
49
+ /** A singer position sample (Flutter `GravixMusicPosition`). */
50
+
51
+ /** Data topic of the listener lyric-sync messages (Flutter `kGravixMusicSyncTopic`). */
52
+ export const GRAVIX_MUSIC_SYNC_TOPIC = 'gx.music';
53
+ //# sourceMappingURL=roomMusicTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GravixMusicSource","file","path","kind","contentUri","uri","asset","key","DEFAULT_MUSIC_OPTIONS","Object","freeze","musicVolume","micVolume","ducking","duckLevel","loop","monitor","musicMaxBitrate","continueWhileMicMuted","continueWhileMicReleased","pauseOnInterruption","disableDtxWhileMusic","relaxVoiceProcessing","postEffectMix","syncPosition","GRAVIX_MUSIC_SYNC_TOPIC"],"sourceRoot":"../../../src","sources":["features/roomMusicTypes.ts"],"mappings":";;AAAA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAMA,OAAO,MAAMA,iBAAiB,GAAG;EAC/BC,IAAI,EAAGC,IAAY,KAAyB;IAAEC,IAAI,EAAE,MAAM;IAAED;EAAK,CAAC,CAAC;EACnE;EACAE,UAAU,EAAGC,GAAW,KAAyB;IAAEF,IAAI,EAAE,YAAY;IAAEE;EAAI,CAAC,CAAC;EAC7E;EACAC,KAAK,EAAGC,GAAW,KAAyB;IAAEJ,IAAI,EAAE,OAAO;IAAEI;EAAI,CAAC;AACpE,CAAC;;AAED;;AA4BA,OAAO,MAAMC,qBAA6D,GACxEC,MAAM,CAACC,MAAM,CAAC;EACZC,WAAW,EAAE,GAAG;EAChBC,SAAS,EAAE,GAAG;EACdC,OAAO,EAAE,KAAK;EACdC,SAAS,EAAE,IAAI;EACfC,IAAI,EAAE,KAAK;EACXC,OAAO,EAAE,IAAI;EACbC,eAAe,EAAE,KAAK;EACtBC,qBAAqB,EAAE,IAAI;EAC3BC,wBAAwB,EAAE,IAAI;EAC9BC,mBAAmB,EAAE,IAAI;EACzBC,oBAAoB,EAAE,IAAI;EAC1BC,oBAAoB,EAAE,IAAI;EAC1BC,aAAa,EAAE,IAAI;EACnBC,YAAY,EAAE;AAChB,CAAC,CAAC;;AAcJ;;AAQA;AACA,OAAO,MAAMC,uBAAuB,GAAG,UAAU","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ // Copyright (c) 2026 Gravity Compile. MIT License; see LICENSE.
4
+
5
+ import { unsupportedAsync } from "../unsupported.js";
6
+
7
+ /**
8
+ * Screen share needs a foreground service (Android MediaProjection) or a
9
+ * broadcast upload extension (iOS). react-native-webrtc has the
10
+ * capture parts; the Gravix wiring (service, extension, app-group setup) is
11
+ * not done yet. `localParticipant.setScreenShareEnabled` may work on Android
12
+ * when the app declares the media-projection service itself.
13
+ */
14
+ export const GravixScreenShare = {
15
+ start() {
16
+ return unsupportedAsync('screenShareService', 'start');
17
+ },
18
+ stop() {
19
+ return unsupportedAsync('screenShareService', 'stop');
20
+ }
21
+ };
22
+ //# sourceMappingURL=screenShare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["unsupportedAsync","GravixScreenShare","start","stop"],"sourceRoot":"../../../src","sources":["features/screenShare.ts"],"mappings":";;AAAA;;AAEA,SAASA,gBAAgB,QAAQ,mBAAgB;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG;EAC/BC,KAAKA,CAAA,EAAkB;IACrB,OAAOF,gBAAgB,CAAC,oBAAoB,EAAE,OAAO,CAAC;EACxD,CAAC;EACDG,IAAIA,CAAA,EAAkB;IACpB,OAAOH,gBAAgB,CAAC,oBAAoB,EAAE,MAAM,CAAC;EACvD;AACF,CAAC","ignoreList":[]}