@stream-io/video-react-native-sdk 1.31.1 → 1.32.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 (207) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/android/src/main/AndroidManifest.xml +8 -1
  3. package/android/src/main/AndroidManifestNew.xml +11 -0
  4. package/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativeModule.kt +42 -5
  5. package/android/src/main/java/com/streamvideo/reactnative/audio/utils/WebRtcAudioUtils.kt +70 -6
  6. package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt +6 -4
  7. package/android/src/main/java/com/streamvideo/reactnative/keepalive/KeepAliveNotification.kt +83 -0
  8. package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +149 -0
  9. package/dist/commonjs/hooks/push/index.js +0 -2
  10. package/dist/commonjs/hooks/push/index.js.map +1 -1
  11. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +146 -0
  12. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
  13. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
  14. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  15. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +41 -106
  16. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  17. package/dist/commonjs/index.js +1 -0
  18. package/dist/commonjs/index.js.map +1 -1
  19. package/dist/commonjs/modules/call-manager/CallManager.js +26 -0
  20. package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
  21. package/dist/commonjs/providers/StreamCall/index.js +6 -6
  22. package/dist/commonjs/providers/StreamCall/index.js.map +1 -1
  23. package/dist/commonjs/utils/StreamVideoRN/index.js +35 -21
  24. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  25. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js +68 -0
  26. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js.map +1 -0
  27. package/dist/commonjs/utils/internal/callingx/callingx.js +150 -0
  28. package/dist/commonjs/utils/internal/callingx/callingx.js.map +1 -0
  29. package/dist/commonjs/utils/internal/registerSDKGlobals.js +53 -3
  30. package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
  31. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js +48 -0
  32. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js.map +1 -0
  33. package/dist/commonjs/utils/push/android.js +135 -202
  34. package/dist/commonjs/utils/push/android.js.map +1 -1
  35. package/dist/commonjs/utils/push/internal/ios.js +17 -34
  36. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  37. package/dist/commonjs/utils/push/internal/rxSubjects.js +1 -45
  38. package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
  39. package/dist/commonjs/utils/push/internal/utils.js +71 -53
  40. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  41. package/dist/commonjs/utils/push/ios.js.map +1 -1
  42. package/dist/commonjs/utils/push/libs/callingx.js +75 -0
  43. package/dist/commonjs/utils/push/libs/callingx.js.map +1 -0
  44. package/dist/commonjs/utils/push/libs/index.js +8 -19
  45. package/dist/commonjs/utils/push/libs/index.js.map +1 -1
  46. package/dist/commonjs/utils/push/libs/notifee/index.js +0 -23
  47. package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
  48. package/dist/commonjs/utils/push/setupCallingExpEvents.js +105 -0
  49. package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +1 -0
  50. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +7 -6
  51. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js.map +1 -1
  52. package/dist/commonjs/version.js +1 -1
  53. package/dist/module/hooks/push/index.js +0 -2
  54. package/dist/module/hooks/push/index.js.map +1 -1
  55. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +139 -0
  56. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
  57. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
  58. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  59. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +42 -107
  60. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  61. package/dist/module/index.js +1 -0
  62. package/dist/module/index.js.map +1 -1
  63. package/dist/module/modules/call-manager/CallManager.js +26 -0
  64. package/dist/module/modules/call-manager/CallManager.js.map +1 -1
  65. package/dist/module/providers/StreamCall/index.js +6 -6
  66. package/dist/module/providers/StreamCall/index.js.map +1 -1
  67. package/dist/module/utils/StreamVideoRN/index.js +35 -21
  68. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  69. package/dist/module/utils/internal/callingx/audioSessionPromise.js +61 -0
  70. package/dist/module/utils/internal/callingx/audioSessionPromise.js.map +1 -0
  71. package/dist/module/utils/internal/callingx/callingx.js +140 -0
  72. package/dist/module/utils/internal/callingx/callingx.js.map +1 -0
  73. package/dist/module/utils/internal/registerSDKGlobals.js +53 -3
  74. package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
  75. package/dist/module/utils/keepCallAliveHeadlessTask.js +42 -0
  76. package/dist/module/utils/keepCallAliveHeadlessTask.js.map +1 -0
  77. package/dist/module/utils/push/android.js +137 -204
  78. package/dist/module/utils/push/android.js.map +1 -1
  79. package/dist/module/utils/push/internal/ios.js +17 -34
  80. package/dist/module/utils/push/internal/ios.js.map +1 -1
  81. package/dist/module/utils/push/internal/rxSubjects.js +0 -44
  82. package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
  83. package/dist/module/utils/push/internal/utils.js +67 -50
  84. package/dist/module/utils/push/internal/utils.js.map +1 -1
  85. package/dist/module/utils/push/ios.js.map +1 -1
  86. package/dist/module/utils/push/libs/callingx.js +67 -0
  87. package/dist/module/utils/push/libs/callingx.js.map +1 -0
  88. package/dist/module/utils/push/libs/index.js +1 -2
  89. package/dist/module/utils/push/libs/index.js.map +1 -1
  90. package/dist/module/utils/push/libs/notifee/index.js +0 -21
  91. package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
  92. package/dist/module/utils/push/setupCallingExpEvents.js +99 -0
  93. package/dist/module/utils/push/setupCallingExpEvents.js.map +1 -0
  94. package/dist/module/utils/push/setupIosVoipPushEvents.js +7 -6
  95. package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
  96. package/dist/module/version.js +1 -1
  97. package/dist/typescript/hooks/push/index.d.ts.map +1 -1
  98. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts +5 -0
  99. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +1 -0
  100. package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
  101. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  102. package/dist/typescript/index.d.ts +1 -0
  103. package/dist/typescript/index.d.ts.map +1 -1
  104. package/dist/typescript/modules/call-manager/CallManager.d.ts +5 -0
  105. package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
  106. package/dist/typescript/utils/StreamVideoRN/index.d.ts +22 -2
  107. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  108. package/dist/typescript/utils/StreamVideoRN/types.d.ts +59 -25
  109. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  110. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts +16 -0
  111. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts.map +1 -0
  112. package/dist/typescript/utils/internal/callingx/callingx.d.ts +18 -0
  113. package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +1 -0
  114. package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
  115. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts +10 -0
  116. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts.map +1 -0
  117. package/dist/typescript/utils/push/android.d.ts +1 -2
  118. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  119. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  120. package/dist/typescript/utils/push/internal/rxSubjects.d.ts +0 -33
  121. package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
  122. package/dist/typescript/utils/push/internal/utils.d.ts +14 -8
  123. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  124. package/dist/typescript/utils/push/ios.d.ts +1 -2
  125. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  126. package/dist/typescript/utils/push/libs/callingx.d.ts +9 -0
  127. package/dist/typescript/utils/push/libs/callingx.d.ts.map +1 -0
  128. package/dist/typescript/utils/push/libs/index.d.ts +1 -2
  129. package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
  130. package/dist/typescript/utils/push/libs/notifee/index.d.ts +0 -2
  131. package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
  132. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +8 -0
  133. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +1 -0
  134. package/dist/typescript/utils/push/setupIosVoipPushEvents.d.ts.map +1 -1
  135. package/dist/typescript/version.d.ts +1 -1
  136. package/expo-config-plugin/dist/withAndroidManifest.js +1 -33
  137. package/expo-config-plugin/dist/withAndroidPermissions.js +2 -7
  138. package/expo-config-plugin/dist/withAppDelegate.js +19 -197
  139. package/expo-config-plugin/dist/withMainActivity.js +1 -1
  140. package/expo-config-plugin/dist/withiOSInfoPlist.js +2 -3
  141. package/ios/StreamInCallManager.m +2 -0
  142. package/ios/StreamInCallManager.swift +19 -7
  143. package/ios/StreamVideoReactNative-Bridging-Header.h +3 -1
  144. package/ios/StreamVideoReactNative.h +7 -4
  145. package/ios/StreamVideoReactNative.m +199 -84
  146. package/package.json +11 -16
  147. package/src/hooks/push/index.ts +0 -2
  148. package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +193 -0
  149. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +21 -34
  150. package/src/hooks/useAndroidKeepCallAliveEffect.ts +63 -129
  151. package/src/index.ts +1 -0
  152. package/src/modules/call-manager/CallManager.ts +36 -0
  153. package/src/modules/call-manager/native-module.d.ts +7 -0
  154. package/src/providers/StreamCall/index.tsx +6 -6
  155. package/src/utils/StreamVideoRN/index.ts +42 -30
  156. package/src/utils/StreamVideoRN/types.ts +61 -25
  157. package/src/utils/internal/callingx/audioSessionPromise.ts +65 -0
  158. package/src/utils/internal/callingx/callingx.ts +197 -0
  159. package/src/utils/internal/registerSDKGlobals.ts +52 -4
  160. package/src/utils/keepCallAliveHeadlessTask.ts +54 -0
  161. package/src/utils/push/android.ts +198 -311
  162. package/src/utils/push/internal/ios.ts +28 -44
  163. package/src/utils/push/internal/rxSubjects.ts +0 -61
  164. package/src/utils/push/internal/utils.ts +108 -64
  165. package/src/utils/push/ios.ts +1 -6
  166. package/src/utils/push/libs/callingx.ts +89 -0
  167. package/src/utils/push/libs/index.ts +1 -2
  168. package/src/utils/push/libs/notifee/index.ts +0 -31
  169. package/src/utils/push/setupCallingExpEvents.ts +135 -0
  170. package/src/utils/push/setupIosVoipPushEvents.ts +11 -7
  171. package/src/version.ts +1 -1
  172. package/android/src/main/java/com/streamvideo/reactnative/util/CallAliveServiceChecker.kt +0 -95
  173. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -160
  174. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
  175. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +0 -67
  176. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +0 -1
  177. package/dist/commonjs/utils/push/libs/callkeep.js +0 -17
  178. package/dist/commonjs/utils/push/libs/callkeep.js.map +0 -1
  179. package/dist/commonjs/utils/push/libs/voipPushNotification.js +0 -17
  180. package/dist/commonjs/utils/push/libs/voipPushNotification.js.map +0 -1
  181. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +0 -205
  182. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +0 -1
  183. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -153
  184. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
  185. package/dist/module/hooks/push/useProcessPushCallEffect.js +0 -60
  186. package/dist/module/hooks/push/useProcessPushCallEffect.js.map +0 -1
  187. package/dist/module/utils/push/libs/callkeep.js +0 -11
  188. package/dist/module/utils/push/libs/callkeep.js.map +0 -1
  189. package/dist/module/utils/push/libs/voipPushNotification.js +0 -11
  190. package/dist/module/utils/push/libs/voipPushNotification.js.map +0 -1
  191. package/dist/module/utils/push/setupIosCallKeepEvents.js +0 -199
  192. package/dist/module/utils/push/setupIosCallKeepEvents.js.map +0 -1
  193. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts +0 -5
  194. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +0 -1
  195. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts +0 -8
  196. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts.map +0 -1
  197. package/dist/typescript/utils/push/libs/callkeep.d.ts +0 -3
  198. package/dist/typescript/utils/push/libs/callkeep.d.ts.map +0 -1
  199. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts +0 -3
  200. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts.map +0 -1
  201. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts +0 -6
  202. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +0 -1
  203. package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +0 -235
  204. package/src/hooks/push/useProcessPushCallEffect.ts +0 -108
  205. package/src/utils/push/libs/callkeep.ts +0 -16
  206. package/src/utils/push/libs/voipPushNotification.ts +0 -17
  207. package/src/utils/push/setupIosCallKeepEvents.ts +0 -252
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.32.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.31.1...@stream-io/video-react-native-sdk-1.32.0) (2026-04-09)
6
+
7
+ ### Dependency Updates
8
+
9
+ - `@stream-io/noise-cancellation-react-native` updated to version `0.7.0`
10
+ - `@stream-io/react-native-callingx` updated to version `0.1.0`
11
+ - `@stream-io/video-filters-react-native` updated to version `0.12.0`
12
+ - `@stream-io/video-client` updated to version `1.46.0`
13
+ - `@stream-io/video-react-bindings` updated to version `1.14.0`
14
+
15
+ ### Features
16
+
17
+ - callkit/telecom integration ([#2028](https://github.com/GetStream/stream-video-js/issues/2028)) ([d579acd](https://github.com/GetStream/stream-video-js/commit/d579acd1975fb4945e40452b27e372694c737628))
18
+
5
19
  ## [1.31.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.31.0...@stream-io/video-react-native-sdk-1.31.1) (2026-04-02)
6
20
 
7
21
  ### Dependency Updates
@@ -2,6 +2,13 @@
2
2
  package="com.streamvideo.reactnative">
3
3
 
4
4
  <uses-permission android:name="android.permission.INTERNET" />
5
- <uses-permission android:name="android.permission.DEVICE_POWER" />
6
5
  <uses-permission android:name="android.permission.WAKE_LOCK" />
6
+
7
+ <application>
8
+ <service
9
+ android:name="com.streamvideo.reactnative.keepalive.StreamCallKeepAliveHeadlessService"
10
+ android:exported="false"
11
+ android:stopWithTask="true"
12
+ android:foregroundServiceType="mediaPlayback|camera|microphone" />
13
+ </application>
7
14
  </manifest>
@@ -1,2 +1,13 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+
3
+ <uses-permission android:name="android.permission.INTERNET" />
4
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
5
+
6
+ <application>
7
+ <service
8
+ android:name="com.streamvideo.reactnative.keepalive.StreamCallKeepAliveHeadlessService"
9
+ android:exported="false"
10
+ android:stopWithTask="true"
11
+ android:foregroundServiceType="mediaPlayback|camera|microphone" />
12
+ </application>
2
13
  </manifest>
@@ -17,6 +17,7 @@ import android.os.Build
17
17
  import android.os.PowerManager
18
18
  import android.util.Base64
19
19
  import android.util.Log
20
+ import androidx.core.content.ContextCompat
20
21
  import com.facebook.react.bridge.Arguments
21
22
  import com.facebook.react.bridge.Promise
22
23
  import com.facebook.react.bridge.ReactApplicationContext
@@ -27,8 +28,8 @@ import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEm
27
28
  import com.oney.WebRTCModule.WebRTCModule
28
29
  import com.oney.WebRTCModule.WebRTCModuleOptions
29
30
  import com.streamvideo.reactnative.screenshare.ScreenAudioCapture
31
+ import com.streamvideo.reactnative.keepalive.StreamCallKeepAliveHeadlessService
30
32
  import com.streamvideo.reactnative.util.CallAlivePermissionsHelper
31
- import com.streamvideo.reactnative.util.CallAliveServiceChecker
32
33
  import com.streamvideo.reactnative.util.PiPHelper
33
34
  import com.streamvideo.reactnative.util.RingtoneUtil
34
35
  import com.streamvideo.reactnative.util.YuvFrame
@@ -122,11 +123,47 @@ class StreamVideoReactNativeModule(reactContext: ReactApplicationContext) :
122
123
  promise.resolve(false)
123
124
  return
124
125
  }
125
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
126
- val isForegroundServiceDeclared = CallAliveServiceChecker.isForegroundServiceDeclared(reactApplicationContext)
127
- promise.resolve(isForegroundServiceDeclared)
128
- } else {
126
+ // Service is declared in the SDK's own AndroidManifest and merged by default.
127
+ // Permissions are expected to be provided by the app (or via Expo config plugin).
128
+ promise.resolve(true)
129
+ }
130
+
131
+
132
+ @ReactMethod
133
+ fun startKeepCallAliveService(
134
+ callCid: String,
135
+ channelId: String,
136
+ channelName: String,
137
+ title: String,
138
+ body: String,
139
+ smallIconName: String?,
140
+ promise: Promise
141
+ ) {
142
+ try {
143
+ val intent = StreamCallKeepAliveHeadlessService.buildStartIntent(
144
+ reactApplicationContext,
145
+ callCid,
146
+ channelId,
147
+ channelName,
148
+ title,
149
+ body,
150
+ smallIconName
151
+ )
152
+ ContextCompat.startForegroundService(reactApplicationContext, intent)
129
153
  promise.resolve(true)
154
+ } catch (e: Exception) {
155
+ promise.reject(NAME, "Failed to start keep call alive foreground service", e)
156
+ }
157
+ }
158
+
159
+ @ReactMethod
160
+ fun stopKeepCallAliveService(promise: Promise) {
161
+ try {
162
+ val intent = StreamCallKeepAliveHeadlessService.buildStopIntent(reactApplicationContext)
163
+ val stopped = reactApplicationContext.stopService(intent)
164
+ promise.resolve(stopped)
165
+ } catch (e: Exception) {
166
+ promise.reject(NAME, "Failed to stop keep call alive foreground service", e)
130
167
  }
131
168
  }
132
169
 
@@ -55,14 +55,78 @@ object WebRtcAudioUtils {
55
55
  * what might be the root cause.
56
56
  */
57
57
  fun logAudioState(tag: String, reactContext: ReactContext) {
58
+ Log.d(tag, getAudioStateLog(reactContext))
59
+ }
60
+
61
+ /**
62
+ * Returns a string containing information about the current audio state.
63
+ * Similar to logAudioState but returns the information instead of logging it.
64
+ */
65
+ fun getAudioStateLog(reactContext: ReactContext): String {
66
+ val audioManager = reactContext.getSystemService(Context.AUDIO_SERVICE) as AudioManager
67
+ val sb = StringBuilder()
68
+
69
+ // Volume control stream
58
70
  reactContext.currentActivity?.let {
59
- Log.d(tag, "volumeControlStream: " + streamTypeToString(it.volumeControlStream))
71
+ sb.appendLine("volumeControlStream: ${streamTypeToString(it.volumeControlStream)}")
60
72
  }
61
- val audioManager = reactContext.getSystemService(Context.AUDIO_SERVICE) as AudioManager
62
- logDeviceInfo(tag)
63
- logAudioStateBasic(tag, reactContext, audioManager)
64
- logAudioStateVolume(tag, audioManager)
65
- logAudioDeviceInfo(tag, audioManager)
73
+
74
+ // Device info
75
+ sb.appendLine("Android SDK: ${Build.VERSION.SDK_INT}, Release: ${Build.VERSION.RELEASE}, Brand: ${Build.BRAND}, Device: ${Build.DEVICE}, Id: ${Build.ID}, Hardware: ${Build.HARDWARE}, Manufacturer: ${Build.MANUFACTURER}, Model: ${Build.MODEL}, Product: ${Build.PRODUCT}")
76
+
77
+ // Basic audio state
78
+ sb.appendLine("Audio State: audio mode: ${modeToString(audioManager.mode)}, has mic: ${hasMicrophone(reactContext)}, mic muted: ${audioManager.isMicrophoneMute}, music active: ${audioManager.isMusicActive}, speakerphone: ${audioManager.isSpeakerphoneOn}, BT SCO: ${audioManager.isBluetoothScoOn}")
79
+
80
+ // Volume info
81
+ val fixedVolume = audioManager.isVolumeFixed
82
+ sb.appendLine(" fixed volume=$fixedVolume")
83
+ if (!fixedVolume) {
84
+ val streams = intArrayOf(
85
+ AudioManager.STREAM_VOICE_CALL,
86
+ AudioManager.STREAM_MUSIC,
87
+ AudioManager.STREAM_RING,
88
+ AudioManager.STREAM_ALARM,
89
+ AudioManager.STREAM_NOTIFICATION,
90
+ AudioManager.STREAM_SYSTEM
91
+ )
92
+ for (stream in streams) {
93
+ val info = StringBuilder()
94
+ info.append(" ${streamTypeToString(stream)}: ")
95
+ info.append("volume=${audioManager.getStreamVolume(stream)}")
96
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
97
+ info.append(", min=${audioManager.getStreamMinVolume(stream)}")
98
+ }
99
+ info.append(", max=${audioManager.getStreamMaxVolume(stream)}")
100
+ info.append(", muted=${audioManager.isStreamMute(stream)}")
101
+ sb.appendLine(info.toString())
102
+ }
103
+ }
104
+
105
+ // Audio devices
106
+ val inputDevices = audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS)
107
+ val outputDevices = audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS)
108
+ val devices = inputDevices + outputDevices
109
+ if (devices.isNotEmpty()) {
110
+ sb.appendLine("Audio Devices:")
111
+ for (device in devices) {
112
+ val info = StringBuilder()
113
+ info.append(" ${deviceTypeToString(device.type)}")
114
+ info.append(if (device.isSource) "(in): " else "(out): ")
115
+ if (device.channelCounts.isNotEmpty()) {
116
+ info.append("channels=${device.channelCounts.contentToString()}, ")
117
+ }
118
+ if (device.encodings.isNotEmpty()) {
119
+ info.append("encodings=${device.encodings.contentToString()}, ")
120
+ }
121
+ if (device.sampleRates.isNotEmpty()) {
122
+ info.append("sample rates=${device.sampleRates.contentToString()}, ")
123
+ }
124
+ info.append("id=${device.id}")
125
+ sb.appendLine(info.toString())
126
+ }
127
+ }
128
+
129
+ return sb.toString()
66
130
  }
67
131
 
68
132
  /** Converts AudioDeviceInfo types to local string representation. */
@@ -168,10 +168,12 @@ class StreamInCallManagerModule(reactContext: ReactApplicationContext) :
168
168
 
169
169
  @ReactMethod
170
170
  fun logAudioState() {
171
- WebRtcAudioUtils.logAudioState(
172
- TAG,
173
- reactApplicationContext,
174
- )
171
+ Log.d(TAG, getAudioStateLog())
172
+ }
173
+
174
+ @ReactMethod(isBlockingSynchronousMethod = true)
175
+ fun getAudioStateLog(): String {
176
+ return WebRtcAudioUtils.getAudioStateLog(reactApplicationContext)
175
177
  }
176
178
 
177
179
  @Suppress("unused")
@@ -0,0 +1,83 @@
1
+ package com.streamvideo.reactnative.keepalive
2
+
3
+ import android.app.Notification
4
+ import android.app.NotificationChannel
5
+ import android.app.NotificationManager
6
+ import android.app.PendingIntent
7
+ import android.content.Context
8
+ import android.content.Intent
9
+ import android.content.pm.PackageManager
10
+ import android.os.Build
11
+ import androidx.core.app.NotificationCompat
12
+
13
+ internal object KeepAliveNotification {
14
+ private const val DEFAULT_CHANNEL_DESCRIPTION = "Stream call keep-alive"
15
+
16
+ fun ensureChannel(
17
+ context: Context,
18
+ channelId: String,
19
+ channelName: String
20
+ ) {
21
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
22
+ val manager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
23
+ val existing = manager.getNotificationChannel(channelId)
24
+ if (existing != null) return
25
+
26
+ val channel = NotificationChannel(
27
+ channelId,
28
+ channelName,
29
+ NotificationManager.IMPORTANCE_LOW
30
+ ).apply {
31
+ description = DEFAULT_CHANNEL_DESCRIPTION
32
+ setShowBadge(false)
33
+ }
34
+ manager.createNotificationChannel(channel)
35
+ }
36
+
37
+ fun buildOngoingNotification(
38
+ context: Context,
39
+ channelId: String,
40
+ title: String,
41
+ body: String,
42
+ smallIconName: String?
43
+ ): Notification {
44
+ val launchIntent = context.packageManager.getLaunchIntentForPackage(context.packageName)
45
+ val pendingIntentFlags =
46
+ PendingIntent.FLAG_UPDATE_CURRENT or
47
+ PendingIntent.FLAG_IMMUTABLE
48
+ val contentIntent = if (launchIntent != null) {
49
+ PendingIntent.getActivity(context, 0, launchIntent, pendingIntentFlags)
50
+ } else {
51
+ // Fallback: empty intent to avoid crash if launch activity is missing for some reason
52
+ PendingIntent.getActivity(context, 0, Intent(), pendingIntentFlags)
53
+ }
54
+
55
+ val iconResId = resolveSmallIconResId(context, smallIconName)
56
+ return NotificationCompat.Builder(context, channelId)
57
+ .setContentTitle(title)
58
+ .setContentText(body)
59
+ .setOngoing(true)
60
+ .setOnlyAlertOnce(true)
61
+ .setCategory(NotificationCompat.CATEGORY_CALL)
62
+ .setContentIntent(contentIntent)
63
+ .setSmallIcon(iconResId)
64
+ .build()
65
+ }
66
+
67
+ private fun resolveSmallIconResId(context: Context, smallIconName: String?): Int {
68
+ val resources = context.resources
69
+ val packageName = context.packageName
70
+ if (!smallIconName.isNullOrBlank()) {
71
+ val id = resources.getIdentifier(smallIconName, "drawable", packageName)
72
+ if (id != 0) return id
73
+ }
74
+ // Default to the app icon
75
+ return try {
76
+ val appInfo = context.packageManager.getApplicationInfo(packageName, 0)
77
+ appInfo.icon
78
+ } catch (_: PackageManager.NameNotFoundException) {
79
+ android.R.drawable.ic_dialog_info
80
+ }
81
+ }
82
+ }
83
+
@@ -0,0 +1,149 @@
1
+ package com.streamvideo.reactnative.keepalive
2
+
3
+ import android.Manifest
4
+ import android.content.Intent
5
+ import android.content.pm.PackageManager
6
+ import android.content.pm.ServiceInfo
7
+ import android.os.Build
8
+ import android.util.Log
9
+ import androidx.annotation.RequiresApi
10
+ import androidx.core.app.ServiceCompat
11
+ import androidx.core.content.ContextCompat
12
+ import com.facebook.react.HeadlessJsTaskService
13
+ import com.facebook.react.bridge.Arguments
14
+ import com.facebook.react.jstasks.HeadlessJsTaskConfig
15
+
16
+ /**
17
+ * Foreground service that runs a React Native HeadlessJS task to keep a call alive.
18
+ *
19
+ */
20
+ class StreamCallKeepAliveHeadlessService : HeadlessJsTaskService() {
21
+
22
+ override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
23
+ val safeIntent = intent ?: Intent()
24
+ val channelId = safeIntent.getStringExtra(EXTRA_CHANNEL_ID) ?: DEFAULT_CHANNEL_ID
25
+ val channelName = safeIntent.getStringExtra(EXTRA_CHANNEL_NAME) ?: DEFAULT_CHANNEL_NAME
26
+ val title = safeIntent.getStringExtra(EXTRA_TITLE) ?: DEFAULT_TITLE
27
+ val body = safeIntent.getStringExtra(EXTRA_BODY) ?: DEFAULT_BODY
28
+ val smallIconName = safeIntent.getStringExtra(EXTRA_SMALL_ICON_NAME)
29
+
30
+ KeepAliveNotification.ensureChannel(this, channelId, channelName)
31
+ val notification = KeepAliveNotification.buildOngoingNotification(
32
+ context = this,
33
+ channelId = channelId,
34
+ title = title,
35
+ body = body,
36
+ smallIconName = smallIconName
37
+ )
38
+
39
+ startForegroundCompat(notification)
40
+
41
+ // Ensure HeadlessJS task is started
42
+ return super.onStartCommand(safeIntent, flags, startId)
43
+ }
44
+
45
+ override fun getTaskConfig(intent: Intent?): HeadlessJsTaskConfig? {
46
+ val callCid = intent?.getStringExtra(EXTRA_CALL_CID) ?: return null
47
+ val data = Arguments.createMap().apply {
48
+ putString("callCid", callCid)
49
+ }
50
+ // We intentionally allow long-running work (the JS task can return a never-resolving Promise).
51
+ return HeadlessJsTaskConfig(
52
+ TASK_NAME,
53
+ data,
54
+ 0, // timeout (0 = no timeout)
55
+ true // allowedInForeground
56
+ )
57
+ }
58
+
59
+ override fun onDestroy() {
60
+ super.onDestroy()
61
+ stopForeground(STOP_FOREGROUND_REMOVE)
62
+ }
63
+
64
+ @RequiresApi(Build.VERSION_CODES.R)
65
+ private fun computeForegroundServiceTypes(): Int {
66
+ var types = ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK
67
+
68
+ val hasCameraPermission =
69
+ ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED
70
+ if (hasCameraPermission) {
71
+ types = types or ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA
72
+ }
73
+
74
+ val hasMicrophonePermission =
75
+ ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED
76
+ if (hasMicrophonePermission) {
77
+ types = types or ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE
78
+ }
79
+
80
+ return types
81
+ }
82
+
83
+ private fun startForegroundCompat(notification: android.app.Notification) {
84
+ try {
85
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
86
+ val types =
87
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) computeForegroundServiceTypes()
88
+ else ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK
89
+ startForeground(NOTIFICATION_ID, notification, types)
90
+ } else {
91
+ startForeground(NOTIFICATION_ID, notification)
92
+ }
93
+ } catch (e: Exception) {
94
+ // Avoid crashing the app if the system rejects starting a foreground service (e.g.
95
+ // background start restrictions, invalid notification/channel, or permission issues).
96
+ Log.e(
97
+ TAG,
98
+ "startForegroundCompat: Failed to start foreground service: ${e.message}",
99
+ e
100
+ )
101
+ }
102
+ }
103
+
104
+ companion object {
105
+ private const val TAG = "StreamCallKeepAliveHeadlessService"
106
+
107
+ const val TASK_NAME = "StreamVideoKeepCallAlive"
108
+
109
+ const val EXTRA_CALL_CID = "callCid"
110
+ const val EXTRA_CHANNEL_ID = "channelId"
111
+ const val EXTRA_CHANNEL_NAME = "channelName"
112
+ const val EXTRA_TITLE = "title"
113
+ const val EXTRA_BODY = "body"
114
+ const val EXTRA_SMALL_ICON_NAME = "smallIconName"
115
+
116
+ private const val NOTIFICATION_ID = 6061
117
+
118
+ private const val DEFAULT_CHANNEL_ID = "stream_call_foreground_service"
119
+ private const val DEFAULT_CHANNEL_NAME = "Call in progress"
120
+ private const val DEFAULT_TITLE = "Call in progress"
121
+ private const val DEFAULT_BODY = "Tap to return to the call"
122
+
123
+ fun buildStartIntent(
124
+ context: android.content.Context,
125
+ callCid: String,
126
+ channelId: String,
127
+ channelName: String,
128
+ title: String,
129
+ body: String,
130
+ smallIconName: String?
131
+ ): Intent {
132
+ return Intent(context, StreamCallKeepAliveHeadlessService::class.java).apply {
133
+ putExtra(EXTRA_CALL_CID, callCid)
134
+ putExtra(EXTRA_CHANNEL_ID, channelId)
135
+ putExtra(EXTRA_CHANNEL_NAME, channelName)
136
+ putExtra(EXTRA_TITLE, title)
137
+ putExtra(EXTRA_BODY, body)
138
+ if (!smallIconName.isNullOrBlank()) {
139
+ putExtra(EXTRA_SMALL_ICON_NAME, smallIconName)
140
+ }
141
+ }
142
+ }
143
+
144
+ fun buildStopIntent(context: android.content.Context): Intent {
145
+ return Intent(context, StreamCallKeepAliveHeadlessService::class.java)
146
+ }
147
+ }
148
+ }
149
+
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.usePushRegisterEffect = void 0;
7
7
  var _useIosVoipPushEventsSetupEffect = require("./useIosVoipPushEventsSetupEffect");
8
- var _useProcessPushCallEffect = require("./useProcessPushCallEffect");
9
8
  var _useInitAndroidTokenAndRest = require("./useInitAndroidTokenAndRest");
10
9
  var _useIosInitRemoteNotifications = require("./useIosInitRemoteNotifications");
11
10
  var _useProcessPushNonRingingCallEffect = require("./useProcessPushNonRingingCallEffect");
@@ -17,7 +16,6 @@ const usePushRegisterEffect = () => {
17
16
  (0, _useIosInitRemoteNotifications.useIosInitRemoteNotifications)();
18
17
  (0, _useIosVoipPushEventsSetupEffect.useIosVoipPushEventsSetupEffect)();
19
18
  (0, _useProcessPushNonRingingCallEffect.useProcessPushNonRingingCallEffect)();
20
- (0, _useProcessPushCallEffect.useProcessPushCallEffect)();
21
19
  (0, _useInitAndroidTokenAndRest.useInitAndroidTokenAndRest)();
22
20
  };
23
21
  exports.usePushRegisterEffect = usePushRegisterEffect;
@@ -1 +1 @@
1
- {"version":3,"names":["_useIosVoipPushEventsSetupEffect","require","_useProcessPushCallEffect","_useInitAndroidTokenAndRest","_useIosInitRemoteNotifications","_useProcessPushNonRingingCallEffect","usePushRegisterEffect","useIosInitRemoteNotifications","useIosVoipPushEventsSetupEffect","useProcessPushNonRingingCallEffect","useProcessPushCallEffect","useInitAndroidTokenAndRest","exports"],"sourceRoot":"../../../../src","sources":["hooks/push/index.ts"],"mappings":";;;;;;AAAA,IAAAA,gCAAA,GAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,8BAAA,GAAAH,OAAA;AACA,IAAAI,mCAAA,GAAAJ,OAAA;AAEA;AACA;AACA;AACA;AACO,MAAMK,qBAAqB,GAAGA,CAAA,KAAM;EACzC,IAAAC,4DAA6B,EAAC,CAAC;EAC/B,IAAAC,gEAA+B,EAAC,CAAC;EACjC,IAAAC,sEAAkC,EAAC,CAAC;EACpC,IAAAC,kDAAwB,EAAC,CAAC;EAC1B,IAAAC,sDAA0B,EAAC,CAAC;AAC9B,CAAC;AAACC,OAAA,CAAAN,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_useIosVoipPushEventsSetupEffect","require","_useInitAndroidTokenAndRest","_useIosInitRemoteNotifications","_useProcessPushNonRingingCallEffect","usePushRegisterEffect","useIosInitRemoteNotifications","useIosVoipPushEventsSetupEffect","useProcessPushNonRingingCallEffect","useInitAndroidTokenAndRest","exports"],"sourceRoot":"../../../../src","sources":["hooks/push/index.ts"],"mappings":";;;;;;AAAA,IAAAA,gCAAA,GAAAC,OAAA;AACA,IAAAC,2BAAA,GAAAD,OAAA;AACA,IAAAE,8BAAA,GAAAF,OAAA;AACA,IAAAG,mCAAA,GAAAH,OAAA;AAEA;AACA;AACA;AACA;AACO,MAAMI,qBAAqB,GAAGA,CAAA,KAAM;EACzC,IAAAC,4DAA6B,EAAC,CAAC;EAC/B,IAAAC,gEAA+B,EAAC,CAAC;EACjC,IAAAC,sEAAkC,EAAC,CAAC;EACpC,IAAAC,sDAA0B,EAAC,CAAC;AAC9B,CAAC;AAACC,OAAA,CAAAL,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useCallingExpWithCallingStateEffect = void 0;
7
+ var _videoClient = require("@stream-io/video-client");
8
+ var _videoReactBindings = require("@stream-io/video-react-bindings");
9
+ var _react = require("react");
10
+ var _operators = require("rxjs/operators");
11
+ var _callingx = require("../../utils/internal/callingx/callingx");
12
+ var _callingx2 = require("../../utils/push/libs/callingx");
13
+ const logger = _videoClient.videoLoggerSystem.getLogger('callingx');
14
+
15
+ /**
16
+ * This hook is used to inform sync call state with CallKit/Telecom (i.e. start call, end call, mute/unmute call).
17
+ */
18
+ const useCallingExpWithCallingStateEffect = () => {
19
+ const {
20
+ useMicrophoneState,
21
+ useParticipants,
22
+ useCallMembers
23
+ } = (0, _videoReactBindings.useCallStateHooks)();
24
+ const activeCall = (0, _videoReactBindings.useCall)();
25
+ const {
26
+ isMute,
27
+ microphone
28
+ } = useMicrophoneState();
29
+ const callMembers = useCallMembers();
30
+ const participants = useParticipants();
31
+ const activeCallCid = activeCall?.cid;
32
+ const createdByUserId = activeCall?.state.createdBy?.id;
33
+ const callCustomDisplayName = activeCall?.state.custom?.display_name;
34
+ const currentUserId = activeCall?.currentUserId;
35
+ const isIncoming = activeCall?.ringing && !activeCall?.isCreatedByMe || false;
36
+ const callDisplayName = (0, _react.useMemo)(() => callCustomDisplayName ?? (0, _callingx.getCallDisplayName)(callMembers, participants, currentUserId), [callMembers, participants, currentUserId, callCustomDisplayName]);
37
+ (0, _react.useEffect)(() => {
38
+ const callingx = (0, _callingx2.getCallingxLibIfAvailable)();
39
+ if (!callingx?.isSetup || !activeCall) {
40
+ return;
41
+ }
42
+ // need to capture RINGING -> Joining -> Joined state change for the first time
43
+ // and inform callingx that the call is active
44
+ const shouldMakeCallActive = call => {
45
+ // only for outgoing calls or non-ringing ongoing calls in callingx
46
+ // Note: incoming calls are handled by callingx pending states instead
47
+ return call.ringing && call.isCreatedByMe || !call.ringing && callingx.isOngoingCallsEnabled;
48
+ };
49
+ const subscription = activeCall.state.callingState$.pipe((0, _operators.filter)(callingState => shouldMakeCallActive(activeCall) && callingState === _videoClient.CallingState.JOINED && callingx.isCallTracked(activeCall.cid)), (0, _operators.take)(1) // only need to capture the first joined state for outgoing calls
50
+ // then subscription completes and is automatically unsubscribed
51
+ ).subscribe(() => {
52
+ callingx.setCurrentCallActive(activeCall.cid);
53
+ });
54
+ return () => {
55
+ subscription.unsubscribe();
56
+ };
57
+ }, [activeCall]);
58
+ (0, _react.useEffect)(() => {
59
+ return () => {
60
+ const callingx = (0, _callingx2.getCallingxLibIfAvailable)();
61
+ if (!callingx?.isSetup || !activeCallCid) {
62
+ return;
63
+ }
64
+ const isCallTracked = callingx.isCallTracked(activeCallCid);
65
+ if (!isCallTracked) {
66
+ logger.debug(`useCallingExpWithCallingStateEffect:No active call cid to end in calling exp: ${activeCallCid} isCallTracked: ${isCallTracked}`);
67
+ return;
68
+ }
69
+ //if incoming stream call was unmounted, we need to end the call in CallKit/Telecom
70
+ logger.debug(`useCallingExpWithCallingStateEffect: Ending call in callingx: ${activeCallCid}`);
71
+ callingx.endCallWithReason(activeCallCid, 'local').catch(error => {
72
+ logger.error(`useCallingExpWithCallingStateEffect: Error ending call in callingx: ${activeCallCid}`, error);
73
+ });
74
+ };
75
+ }, [activeCallCid]);
76
+ (0, _react.useEffect)(() => {
77
+ const callingx = (0, _callingx2.getCallingxLibIfAvailable)();
78
+ if (!callingx?.isSetup || !activeCallCid) {
79
+ return;
80
+ }
81
+ const isCallTracked = callingx.isCallTracked(activeCallCid);
82
+ if (!isCallTracked) {
83
+ logger.debug(`useCallingExpWithCallingStateEffect:No active call cid to update callingx: ${activeCallCid} isCallTracked: ${isCallTracked}`);
84
+ return;
85
+ }
86
+ callingx.updateDisplay(activeCallCid, createdByUserId ?? callDisplayName, callDisplayName, isIncoming);
87
+ }, [activeCallCid, createdByUserId, callDisplayName, isIncoming]);
88
+
89
+ // Sync microphone mute state from app → CallKit
90
+ (0, _react.useEffect)(() => {
91
+ const callingx = (0, _callingx2.getCallingxLibIfAvailable)();
92
+ if (!callingx?.isSetup || !activeCallCid) {
93
+ return;
94
+ }
95
+ const isCallTracked = callingx.isCallTracked(activeCallCid);
96
+ if (!isCallTracked) {
97
+ logger.debug(`useCallingExpWithCallingStateEffect: No active call cid to set muted in calling exp: ${activeCallCid} isCallTracked: ${isCallTracked}`);
98
+ return;
99
+ }
100
+ callingx.setMutedCall(activeCallCid, isMute);
101
+ }, [activeCallCid, isMute]);
102
+
103
+ // Sync mute state from CallKit → app (only for system-initiated mute actions)
104
+ (0, _react.useEffect)(() => {
105
+ const callingx = (0, _callingx2.getCallingxLibIfAvailable)();
106
+ if (!callingx?.isSetup || !activeCallCid) {
107
+ logger.debug(`useCallingExpWithCallingStateEffect: No active call cid to set muted in calling exp: ${activeCallCid} callingx isSetup: ${callingx?.isSetup}`);
108
+ return;
109
+ }
110
+
111
+ // Listen to mic toggle events from CallKit/Telecom and update stream call microphone state.
112
+ // Only system-initiated mute actions (e.g. user tapped mute on the native CallKit UI)
113
+ // are sent here — app-initiated actions are filtered out on the native side to prevent
114
+ // the feedback loop: app mutes mic → setMutedCall → CallKit delegate → event to JS → loop.
115
+ const subscription = callingx.addEventListener('didPerformSetMutedCallAction', async event => {
116
+ const {
117
+ callId,
118
+ muted
119
+ } = event;
120
+ const isCallTracked = callingx.isCallTracked(activeCallCid);
121
+ if (!isCallTracked || callId !== activeCallCid) {
122
+ logger.debug(`useCallingExpWithCallingStateEffect: No active call cid to set muted in calling exp: ${activeCallCid} isCallTracked: ${isCallTracked} callId: ${callId}`);
123
+ return;
124
+ }
125
+ const isCurrentlyMuted = microphone.state.status === 'disabled';
126
+ if (isCurrentlyMuted === muted) {
127
+ logger.debug(`useCallingExpWithCallingStateEffect: Mic toggle is already in the desired state: ${muted} for call: ${activeCallCid}`);
128
+ return;
129
+ }
130
+ try {
131
+ if (muted) {
132
+ await microphone.disable();
133
+ } else {
134
+ await microphone.enable();
135
+ }
136
+ } catch (error) {
137
+ logger.error(`useCallingExpWithCallingStateEffect: Error toggling mic in calling exp: ${activeCallCid}`, error);
138
+ }
139
+ });
140
+ return () => {
141
+ subscription.remove();
142
+ };
143
+ }, [activeCallCid, microphone]);
144
+ };
145
+ exports.useCallingExpWithCallingStateEffect = useCallingExpWithCallingStateEffect;
146
+ //# sourceMappingURL=useCallingExpWithCallingStateEffect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_videoClient","require","_videoReactBindings","_react","_operators","_callingx","_callingx2","logger","videoLoggerSystem","getLogger","useCallingExpWithCallingStateEffect","useMicrophoneState","useParticipants","useCallMembers","useCallStateHooks","activeCall","useCall","isMute","microphone","callMembers","participants","activeCallCid","cid","createdByUserId","state","createdBy","id","callCustomDisplayName","custom","display_name","currentUserId","isIncoming","ringing","isCreatedByMe","callDisplayName","useMemo","getCallDisplayName","useEffect","callingx","getCallingxLibIfAvailable","isSetup","shouldMakeCallActive","call","isOngoingCallsEnabled","subscription","callingState$","pipe","filter","callingState","CallingState","JOINED","isCallTracked","take","subscribe","setCurrentCallActive","unsubscribe","debug","endCallWithReason","catch","error","updateDisplay","setMutedCall","addEventListener","event","callId","muted","isCurrentlyMuted","status","disable","enable","remove","exports"],"sourceRoot":"../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