@stream-io/video-react-native-sdk 1.40.1-beta.0 → 1.40.2
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.
- package/CHANGELOG.md +29 -0
- package/android/src/main/java/com/streamvideo/reactnative/audio/AudioDeviceManager.kt +45 -16
- package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt +12 -0
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js +1 -1
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js.map +1 -1
- package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +36 -4
- package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
- package/dist/commonjs/modules/call-manager/CallManager.js +133 -1
- package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
- package/dist/commonjs/utils/internal/callingx/callingx.js +37 -0
- package/dist/commonjs/utils/internal/callingx/callingx.js.map +1 -1
- package/dist/commonjs/utils/internal/registerSDKGlobals.js +34 -0
- package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/commonjs/utils/push/android.js +101 -103
- package/dist/commonjs/utils/push/android.js.map +1 -1
- package/dist/commonjs/utils/push/libs/callingx.js +3 -0
- package/dist/commonjs/utils/push/libs/callingx.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/commonjs/version.js.map +1 -1
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js +2 -2
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js.map +1 -1
- package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +36 -4
- package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
- package/dist/module/modules/call-manager/CallManager.js +133 -1
- package/dist/module/modules/call-manager/CallManager.js.map +1 -1
- package/dist/module/utils/internal/callingx/callingx.js +38 -1
- package/dist/module/utils/internal/callingx/callingx.js.map +1 -1
- package/dist/module/utils/internal/registerSDKGlobals.js +34 -0
- package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/module/utils/push/android.js +101 -103
- package/dist/module/utils/push/android.js.map +1 -1
- package/dist/module/utils/push/libs/callingx.js +3 -0
- package/dist/module/utils/push/libs/callingx.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/module/version.js.map +1 -1
- package/dist/typescript/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.d.ts.map +1 -1
- package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
- package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/types.d.ts +5 -0
- package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
- package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +1 -1
- package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
- package/dist/typescript/utils/push/android.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/callingx.d.ts.map +1 -1
- package/dist/typescript/version.d.ts +1 -1
- package/dist/typescript/version.d.ts.map +1 -1
- package/expo-config-plugin/dist/index.js +0 -2
- package/package.json +8 -12
- package/src/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.tsx +3 -2
- package/src/hooks/useAndroidKeepCallAliveEffect.ts +54 -10
- package/src/modules/call-manager/CallManager.ts +162 -1
- package/src/modules/call-manager/native-module.d.ts +8 -0
- package/src/utils/StreamVideoRN/types.ts +5 -0
- package/src/utils/internal/callingx/callingx.ts +44 -1
- package/src/utils/internal/registerSDKGlobals.ts +38 -0
- package/src/utils/push/android.ts +141 -140
- package/src/utils/push/libs/callingx.ts +4 -0
- package/src/version.ts +1 -1
- package/expo-config-plugin/dist/withBuildProperties.js +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.40.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.40.1...@stream-io/video-react-native-sdk-1.40.2) (2026-07-09)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
- `@stream-io/noise-cancellation-react-native` updated to version `0.9.2`
|
|
10
|
+
- `@stream-io/react-native-callingx` updated to version `0.6.2`
|
|
11
|
+
- `@stream-io/video-filters-react-native` updated to version `0.14.2`
|
|
12
|
+
- `@stream-io/typescript-config` updated to version `0.1.0`
|
|
13
|
+
- `@stream-io/video-client` updated to version `1.55.2`
|
|
14
|
+
- `@stream-io/video-react-bindings` updated to version `1.18.2`
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
- android callingx calls should handle audio through through telecom ([#2324](https://github.com/GetStream/stream-video-js/issues/2324)) ([95bcc2a](https://github.com/GetStream/stream-video-js/commit/95bcc2a2dac12c0051b61a1704f927793eaaf727))
|
|
19
|
+
- callingx background handling ([#2310](https://github.com/GetStream/stream-video-js/issues/2310)) ([a96df4f](https://github.com/GetStream/stream-video-js/commit/a96df4ffc9279d2d9cd14da5196a275faf3d1891))
|
|
20
|
+
- **react-native-sdk:** subscribe to remote video when the participant appears after mount ([#2317](https://github.com/GetStream/stream-video-js/issues/2317)) ([f9ab807](https://github.com/GetStream/stream-video-js/commit/f9ab807975b75b526b175b85c275dac6b8eedd56))
|
|
21
|
+
- remove redundant expo build-properties plugin that reset ios.forceStaticLinking ([#2314](https://github.com/GetStream/stream-video-js/issues/2314)) ([54689f3](https://github.com/GetStream/stream-video-js/commit/54689f3daf19143192291c712f978fe43e2035a1)), closes [#2313](https://github.com/GetStream/stream-video-js/issues/2313)
|
|
22
|
+
|
|
23
|
+
## [1.40.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.40.0...@stream-io/video-react-native-sdk-1.40.1) (2026-07-02)
|
|
24
|
+
|
|
25
|
+
### Dependency Updates
|
|
26
|
+
|
|
27
|
+
- `@stream-io/noise-cancellation-react-native` updated to version `0.9.1`
|
|
28
|
+
- `@stream-io/react-native-callingx` updated to version `0.6.1`
|
|
29
|
+
- `@stream-io/video-filters-react-native` updated to version `0.14.1`
|
|
30
|
+
- `@stream-io/typescript-config` updated to version `0.1.0`
|
|
31
|
+
- `@stream-io/video-client` updated to version `1.55.1`
|
|
32
|
+
- `@stream-io/video-react-bindings` updated to version `1.18.1`
|
|
33
|
+
|
|
5
34
|
## [1.40.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.39.0...@stream-io/video-react-native-sdk-1.40.0) (2026-06-26)
|
|
6
35
|
|
|
7
36
|
### Dependency Updates
|
|
@@ -103,6 +103,14 @@ class AudioDeviceManager(
|
|
|
103
103
|
|
|
104
104
|
var callAudioRole: CallAudioRole = CallAudioRole.Communicator
|
|
105
105
|
|
|
106
|
+
/**
|
|
107
|
+
* When true, the call is managed by the Android Telecom stack (via callingx).
|
|
108
|
+
* Telecom owns audio focus, audio mode and device routing, so we must NOT use
|
|
109
|
+
* AudioManager.setCommunicationDevice / startBluetoothSco / audio-focus APIs here.
|
|
110
|
+
* We keep owning proximity, keep-screen-on and mic/output mute.
|
|
111
|
+
*/
|
|
112
|
+
var telecomManagedMode: Boolean = false
|
|
113
|
+
|
|
106
114
|
val bluetoothManager = BluetoothManager(mReactContext, this)
|
|
107
115
|
|
|
108
116
|
private val proximityManager by lazy { ProximityManager(mReactContext, this) }
|
|
@@ -114,12 +122,14 @@ class AudioDeviceManager(
|
|
|
114
122
|
}
|
|
115
123
|
|
|
116
124
|
fun setup() {
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
if (!telecomManagedMode) {
|
|
126
|
+
if (callAudioRole == CallAudioRole.Communicator) {
|
|
127
|
+
mAudioManager.mode = AudioManager.MODE_IN_COMMUNICATION
|
|
128
|
+
} else {
|
|
129
|
+
// Audio routing is handled automatically by the system in normal media mode
|
|
130
|
+
// and bluetooth microphones may not work on some devices.
|
|
131
|
+
mAudioManager.mode = AudioManager.MODE_NORMAL
|
|
132
|
+
}
|
|
123
133
|
}
|
|
124
134
|
audioFocusUtil.setup(callAudioRole, mReactContext)
|
|
125
135
|
}
|
|
@@ -133,33 +143,44 @@ class AudioDeviceManager(
|
|
|
133
143
|
// Audio routing is manually controlled by the SDK in communication media mode
|
|
134
144
|
// and local microphone can be published
|
|
135
145
|
activity.volumeControlStream = AudioManager.STREAM_VOICE_CALL
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
146
|
+
if (!telecomManagedMode) {
|
|
147
|
+
// Telecom owns routing/focus; only run our own routing when not Telecom-managed.
|
|
148
|
+
bluetoothManager.start()
|
|
149
|
+
mAudioManager.registerAudioDeviceCallback(this, null)
|
|
150
|
+
updateAudioDeviceState()
|
|
151
|
+
}
|
|
139
152
|
proximityManager.start()
|
|
140
153
|
} else {
|
|
141
154
|
activity.volumeControlStream = AudioManager.USE_DEFAULT_STREAM_TYPE
|
|
142
155
|
}
|
|
143
|
-
|
|
156
|
+
if (!telecomManagedMode) {
|
|
157
|
+
audioFocusUtil.requestFocus(callAudioRole, mReactContext)
|
|
158
|
+
}
|
|
144
159
|
}
|
|
145
160
|
}
|
|
146
161
|
|
|
147
162
|
fun stop(activity: Activity) {
|
|
148
163
|
runInAudioThread {
|
|
149
164
|
if (callAudioRole == CallAudioRole.Communicator) {
|
|
150
|
-
if (
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
165
|
+
if (!telecomManagedMode) {
|
|
166
|
+
// Only tear down what we set up ourselves; Telecom owns its own teardown.
|
|
167
|
+
if (Build.VERSION.SDK_INT >= 31) {
|
|
168
|
+
mAudioManager.clearCommunicationDevice()
|
|
169
|
+
} else {
|
|
170
|
+
mAudioManager.setSpeakerphoneOn(false)
|
|
171
|
+
}
|
|
172
|
+
bluetoothManager.stop()
|
|
154
173
|
}
|
|
155
174
|
callAudioRole = CallAudioRole.Communicator
|
|
156
175
|
enableStereo = false
|
|
157
176
|
defaultAudioDevice = AudioDeviceEndpoint.TYPE_SPEAKER
|
|
158
|
-
bluetoothManager.stop()
|
|
159
177
|
proximityManager.stop()
|
|
160
178
|
}
|
|
161
179
|
activity.volumeControlStream = AudioManager.USE_DEFAULT_STREAM_TYPE
|
|
162
|
-
|
|
180
|
+
if (!telecomManagedMode) {
|
|
181
|
+
audioFocusUtil.abandonFocus()
|
|
182
|
+
}
|
|
183
|
+
telecomManagedMode = false
|
|
163
184
|
}
|
|
164
185
|
}
|
|
165
186
|
|
|
@@ -379,6 +400,10 @@ class AudioDeviceManager(
|
|
|
379
400
|
*/
|
|
380
401
|
fun updateAudioDeviceState() {
|
|
381
402
|
runInAudioThread {
|
|
403
|
+
if (telecomManagedMode) {
|
|
404
|
+
// Telecom is the single source of truth for routing/endpoints in this mode.
|
|
405
|
+
return@runInAudioThread
|
|
406
|
+
}
|
|
382
407
|
val audioDevices = getCurrentDeviceEndpoints()
|
|
383
408
|
val audioDeviceNamesSet = audioDevices.map { it.name }.toSet()
|
|
384
409
|
val devicesChanged = if (cachedAvailableEndpointNamesSet.size != audioDevices.size) {
|
|
@@ -551,6 +576,10 @@ class AudioDeviceManager(
|
|
|
551
576
|
}
|
|
552
577
|
|
|
553
578
|
private fun sendAudioStatusEvent() {
|
|
579
|
+
if (telecomManagedMode) {
|
|
580
|
+
// callingx emits endpoint changes in this mode; avoid duplicate/conflicting events.
|
|
581
|
+
return
|
|
582
|
+
}
|
|
554
583
|
try {
|
|
555
584
|
if (mReactContext.hasActiveReactInstance()) {
|
|
556
585
|
val payload = audioStatusMap()
|
package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt
CHANGED
|
@@ -63,6 +63,18 @@ class StreamInCallManagerModule(reactContext: ReactApplicationContext) :
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
@ReactMethod
|
|
67
|
+
fun setTelecomManagedMode(enabled: Boolean) {
|
|
68
|
+
AudioDeviceManager.runInAudioThread {
|
|
69
|
+
if (audioManagerActivated) {
|
|
70
|
+
Log.e(TAG, "setTelecomManagedMode(): AudioManager is already activated and so telecom-managed mode cannot be changed")
|
|
71
|
+
return@runInAudioThread
|
|
72
|
+
}
|
|
73
|
+
Log.d(TAG, "setTelecomManagedMode(): $enabled")
|
|
74
|
+
mAudioDeviceManager.telecomManagedMode = enabled
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
66
78
|
@ReactMethod
|
|
67
79
|
fun setDefaultAudioDeviceEndpointType(endpointDeviceTypeName: String) {
|
|
68
80
|
AudioDeviceManager.runInAudioThread {
|
package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js
CHANGED
|
@@ -44,7 +44,7 @@ const TrackSubscriber = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
44
44
|
});
|
|
45
45
|
call.trackSubscriptionManager.apply(debounceType);
|
|
46
46
|
};
|
|
47
|
-
const isPublishingTrack$ = call.state.participants$.pipe((0, _rxjs.map)(ps => ps.find(p => p.sessionId === participantSessionId)), (0, _rxjs.
|
|
47
|
+
const isPublishingTrack$ = call.state.participants$.pipe((0, _rxjs.map)(ps => ps.find(p => p.sessionId === participantSessionId)), (0, _rxjs.filter)(p => !!p), (0, _rxjs.distinctUntilKeyChanged)('publishedTracks'), (0, _rxjs.map)(p => trackType === 'videoTrack' ? (0, _videoClient.hasVideo)(p) : (0, _videoClient.hasScreenShare)(p)), (0, _rxjs.distinctUntilChanged)());
|
|
48
48
|
const isJoinedState$ = call.state.callingState$.pipe((0, _rxjs.map)(callingState => callingState === _videoClient.CallingState.JOINED));
|
|
49
49
|
const subscription = (0, _rxjs.combineLatest)([dimensions$, isPublishingTrack$, isJoinedState$]).subscribe(([dimension, isPublishing, isJoined]) => {
|
|
50
50
|
if (isJoined) {
|
package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_videoClient","_rxjs","TrackSubscriber","forwardRef","props","ref","call","participantSessionId","trackType","isVisible","dimensions$","useMemo","BehaviorSubject","undefined","useEffect","requestTrackWithDimensions","debounceType","dimension","width","height","state","updateParticipantTracks","trackSubscriptionManager","apply","isPublishingTrack$","participants$","pipe","map","ps","find","p","sessionId","
|
|
1
|
+
{"version":3,"names":["_react","require","_videoClient","_rxjs","TrackSubscriber","forwardRef","props","ref","call","participantSessionId","trackType","isVisible","dimensions$","useMemo","BehaviorSubject","undefined","useEffect","requestTrackWithDimensions","debounceType","dimension","width","height","state","updateParticipantTracks","trackSubscriptionManager","apply","isPublishingTrack$","participants$","pipe","map","ps","find","p","sessionId","filter","distinctUntilKeyChanged","hasVideo","hasScreenShare","distinctUntilChanged","isJoinedState$","callingState$","callingState","CallingState","JOINED","subscription","combineLatest","subscribe","isPublishing","isJoined","DebounceType","MEDIUM","IMMEDIATE","unsubscribe","useImperativeHandle","onLayoutUpdate","event","Math","trunc","nativeEvent","layout","next","displayName","_default","exports","default"],"sourceRoot":"../../../../../../src","sources":["components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAUA,IAAAE,KAAA,GAAAF,OAAA;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,eAAe,gBAAG,IAAAC,iBAAU,EAChC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACd,MAAM;IAAEC,IAAI;IAAEC,oBAAoB;IAAEC,SAAS;IAAEC;EAAU,CAAC,GAAGL,KAAK;EAClE,MAAMM,WAAW,GAAG,IAAAC,cAAO,EAAC,MAAM;IAChC,OAAO,IAAIC,qBAAe,CACxBC,SACF,CAAC;EACH,CAAC,E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,SAAS,EAAE4B,YAAY,EAAEC,QAAQ,CAAC,KAAK;MACpD,IAAIA,QAAQ,EAAE;QACZ,IAAI,CAACrC,SAAS,IAAI,CAACoC,YAAY,EAAE;UAC/B9B,0BAA0B,CAACgC,yBAAY,CAACC,MAAM,EAAEnC,SAAS,CAAC;QAC5D,CAAC,MAAM,IAAII,SAAS,EAAE;UACpBF,0BAA0B,CAACgC,yBAAY,CAACE,SAAS,EAAEhC,SAAS,CAAC;QAC/D;MACF;IACF,CAAC,CAAC;IAEF,OAAO,MAAM;MACXyB,YAAY,CAACQ,WAAW,CAAC,CAAC;IAC5B,CAAC;EACH,CAAC,EAAE,CAAC5C,IAAI,EAAEC,oBAAoB,EAAEC,SAAS,EAAEC,SAAS,EAAEC,WAAW,CAAC,CAAC;EAEnE,IAAAyC,0BAAmB,EACjB9C,GAAG,EACH,OAAO;IACL+C,cAAc,EAAGC,KAAK,IAAK;MACzB,MAAMpC,SAAS,GAAG;QAChBC,KAAK,EAAEoC,IAAI,CAACC,KAAK,CAACF,KAAK,CAACG,WAAW,CAACC,MAAM,CAACvC,KAAK,CAAC;QACjDC,MAAM,EAAEmC,IAAI,CAACC,KAAK,CAACF,KAAK,CAACG,WAAW,CAACC,MAAM,CAACtC,MAAM;MACpD,CAAC;MACDT,WAAW,CAACgD,IAAI,CAACzC,SAAS,CAAC;IAC7B;EACF,CAAC,CAAC,EACF,CAACP,WAAW,CACd,CAAC;EAED,OAAO,IAAI;AACb,CACF,CAAC;AAEDR,eAAe,CAACyD,WAAW,GAAG,iBAAiB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEjC5D,eAAe","ignoreList":[]}
|
|
@@ -65,6 +65,7 @@ async function startForegroundService(call_cid) {
|
|
|
65
65
|
*/
|
|
66
66
|
const useAndroidKeepCallAliveEffect = () => {
|
|
67
67
|
const foregroundServiceStartedRef = (0, _react.useRef)(false);
|
|
68
|
+
const callingxKeepAliveOwnerRef = (0, _react.useRef)(undefined);
|
|
68
69
|
const call = (0, _videoReactBindings.useCall)();
|
|
69
70
|
_keepCallAliveHeadlessTask.keepCallAliveCallRef.current = call;
|
|
70
71
|
const activeCallCid = call?.cid;
|
|
@@ -80,12 +81,35 @@ const useAndroidKeepCallAliveEffect = () => {
|
|
|
80
81
|
return undefined;
|
|
81
82
|
}
|
|
82
83
|
const callingx = (0, _libs.getCallingxLibIfAvailable)();
|
|
83
|
-
|
|
84
|
+
const isCallingxManaged = !!callingx?.isSetup && (isRingingCall || !isRingingCall && callingx?.isOngoingCallsEnabled);
|
|
85
|
+
const isCallEnded = callingState === _videoClient.CallingState.IDLE || callingState === _videoClient.CallingState.LEFT;
|
|
86
|
+
|
|
87
|
+
// Release the callingx keep-alive task when the call ends.
|
|
88
|
+
if (callingxKeepAliveOwnerRef.current && isCallEnded) {
|
|
89
|
+
const currentOwner = callingxKeepAliveOwnerRef.current;
|
|
90
|
+
callingxKeepAliveOwnerRef.current = undefined;
|
|
91
|
+
callingx?.releaseBackgroundTask(currentOwner).catch(() => {});
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
if (isCallingxManaged && callingx) {
|
|
95
|
+
// Mutual exclusion: never acquire the callingx task while the SDK's own keep-alive FGS is
|
|
96
|
+
// running — only one keep-alive mechanism should be active per call.
|
|
97
|
+
if (!callingxKeepAliveOwnerRef.current && !isCallEnded && !foregroundServiceStartedRef.current) {
|
|
98
|
+
const owner = `keepalive:${activeCallCid}`;
|
|
99
|
+
callingxKeepAliveOwnerRef.current = owner;
|
|
100
|
+
callingx.acquireBackgroundTask(owner).catch(e => {
|
|
101
|
+
if (callingxKeepAliveOwnerRef.current === owner) {
|
|
102
|
+
callingxKeepAliveOwnerRef.current = undefined;
|
|
103
|
+
}
|
|
104
|
+
_videoClient.videoLoggerSystem.getLogger('useAndroidKeepCallAliveEffect').warn('Failed to acquire callingx keep-alive background task', e);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
84
107
|
return undefined;
|
|
85
108
|
}
|
|
86
109
|
|
|
87
|
-
//
|
|
88
|
-
|
|
110
|
+
// Start keep-alive FGS as soon as the call is joined — but only if the callingx
|
|
111
|
+
// keep-alive task isn't already holding the call alive.
|
|
112
|
+
if (shouldStartForegroundService && !callingxKeepAliveOwnerRef.current) {
|
|
89
113
|
const run = async () => {
|
|
90
114
|
if (foregroundServiceStartedRef.current) {
|
|
91
115
|
return;
|
|
@@ -107,7 +131,7 @@ const useAndroidKeepCallAliveEffect = () => {
|
|
|
107
131
|
return () => {
|
|
108
132
|
sub.remove();
|
|
109
133
|
};
|
|
110
|
-
} else if (
|
|
134
|
+
} else if (isCallEnded) {
|
|
111
135
|
if (foregroundServiceStartedRef.current) {
|
|
112
136
|
_keepCallAliveHeadlessTask.keepCallAliveCallRef.current = undefined;
|
|
113
137
|
// stop foreground service when the call is not active
|
|
@@ -125,6 +149,14 @@ const useAndroidKeepCallAliveEffect = () => {
|
|
|
125
149
|
stopForegroundServiceNoThrow();
|
|
126
150
|
foregroundServiceStartedRef.current = false;
|
|
127
151
|
}
|
|
152
|
+
// release the callingx keep-alive task if still held
|
|
153
|
+
if (callingxKeepAliveOwnerRef.current) {
|
|
154
|
+
const owner = callingxKeepAliveOwnerRef.current;
|
|
155
|
+
callingxKeepAliveOwnerRef.current = undefined;
|
|
156
|
+
(0, _libs.getCallingxLibIfAvailable)()?.releaseBackgroundTask(owner).catch(() => {
|
|
157
|
+
_videoClient.videoLoggerSystem.getLogger('useAndroidKeepCallAliveEffect').warn('Failed to release callingx keep-alive background task', owner);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
128
160
|
};
|
|
129
161
|
}, []);
|
|
130
162
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_videoReactBindings","require","_react","_utils","_reactNative","_videoClient","_keepCallAliveHeadlessTask","_libs","stopForegroundServiceNoThrow","logger","videoLoggerSystem","getLogger","NativeModules","StreamVideoReactNative","stopKeepCallAliveService","e","warn","startForegroundService","call_cid","isCallAliveConfigured","info","hasPostNotificationsPermission","Number","Platform","Version","PermissionsAndroid","check","PERMISSIONS","POST_NOTIFICATIONS","videoConfig","StreamVideoRN","getConfig","foregroundServiceConfig","foregroundService","notificationTexts","android","channel","smallIconName","push","smallIcon","requestAnimationFrame","startKeepCallAliveService","id","name","title","body","useAndroidKeepCallAliveEffect","foregroundServiceStartedRef","useRef","call","useCall","keepCallAliveCallRef","current","activeCallCid","cid","useCallCallingState","useCallStateHooks","callingState","isCallJoined","CallingState","JOINED","isRingingCall","ringing","shouldStartForegroundService","useEffect","OS","
|
|
1
|
+
{"version":3,"names":["_videoReactBindings","require","_react","_utils","_reactNative","_videoClient","_keepCallAliveHeadlessTask","_libs","stopForegroundServiceNoThrow","logger","videoLoggerSystem","getLogger","NativeModules","StreamVideoReactNative","stopKeepCallAliveService","e","warn","startForegroundService","call_cid","isCallAliveConfigured","info","hasPostNotificationsPermission","Number","Platform","Version","PermissionsAndroid","check","PERMISSIONS","POST_NOTIFICATIONS","videoConfig","StreamVideoRN","getConfig","foregroundServiceConfig","foregroundService","notificationTexts","android","channel","smallIconName","push","smallIcon","requestAnimationFrame","startKeepCallAliveService","id","name","title","body","useAndroidKeepCallAliveEffect","foregroundServiceStartedRef","useRef","callingxKeepAliveOwnerRef","undefined","call","useCall","keepCallAliveCallRef","current","activeCallCid","cid","useCallCallingState","useCallStateHooks","callingState","isCallJoined","CallingState","JOINED","isRingingCall","ringing","shouldStartForegroundService","useEffect","OS","callingx","getCallingxLibIfAvailable","isCallingxManaged","isSetup","isOngoingCallsEnabled","isCallEnded","IDLE","LEFT","currentOwner","releaseBackgroundTask","catch","owner","acquireBackgroundTask","run","AppState","currentState","sub","addEventListener","nextAppState","remove","exports"],"sourceRoot":"../../../src","sources":["hooks/useAndroidKeepCallAliveEffect.ts"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAA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CL,yBAAyB,CAACK,OAAO,GAAGJ,SAAS;QAC7C,IAAAmB,+BAAyB,EAAC,CAAC,EACvBQ,qBAAqB,CAACE,KAAK,CAAC,CAC7BD,KAAK,CAAC,MAAM;UACXpE,8BAAiB,CACdC,SAAS,CAAC,+BAA+B,CAAC,CAC1CK,IAAI,CACH,uDAAuD,EACvD+D,KACF,CAAC;QACL,CAAC,CAAC;MACN;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAACS,OAAA,CAAA1C,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
|
@@ -13,12 +13,71 @@ const AUDIO_INTERRUPTION_EVENT = 'StreamInCallManagerAudioInterruption';
|
|
|
13
13
|
const invariant = (condition, message) => {
|
|
14
14
|
if (!condition) throw new Error(message);
|
|
15
15
|
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* On Android, whether the current call is managed by Telecom (via callingx).
|
|
19
|
+
* In that mode, audio routing/mode is owned by Telecom and StreamInCallManager audio methods should not be used
|
|
20
|
+
*/
|
|
21
|
+
const isAndroidTelecomManaged = () => {
|
|
22
|
+
if (_reactNative.Platform.OS !== 'android' || !CallingxModule) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return CallingxModule.isSetup && CallingxModule.isTelecomBacked && (CallingxModule.hasRegisteredCall() || CallingxModule.isOngoingCallsEnabled);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* When the current call is Telecom-managed, returns the callingx module and the
|
|
30
|
+
* registered callId. Centralizes the guard so call sites don't repeat the module /
|
|
31
|
+
* callId checks — `isAndroidTelecomManaged()` already implies the module exists, but
|
|
32
|
+
* the extra narrowing here is what makes that provable to the type-checker.
|
|
33
|
+
*/
|
|
34
|
+
const getTelecomContext = () => {
|
|
35
|
+
if (!isAndroidTelecomManaged() || !CallingxModule) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const callId = CallingxModule.getRegisteredCallIds()[0];
|
|
39
|
+
if (!callId) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
cx: CallingxModule,
|
|
44
|
+
callId
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** Map a generic Telecom endpoint type to the SDK's endpoint display name. */
|
|
49
|
+
const endpointTypeToDisplayName = type => {
|
|
50
|
+
switch (type) {
|
|
51
|
+
case 'earpiece':
|
|
52
|
+
return 'Earpiece';
|
|
53
|
+
case 'speaker':
|
|
54
|
+
return 'Speaker';
|
|
55
|
+
case 'wired_headset':
|
|
56
|
+
return 'Wired Headset';
|
|
57
|
+
case 'bluetooth':
|
|
58
|
+
return 'Bluetooth Device';
|
|
59
|
+
default:
|
|
60
|
+
return 'Unknown';
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** Adapt a callingx endpoints snapshot to the SDK's {@link AudioDeviceStatus}. */
|
|
65
|
+
const snapshotToStatus = snapshot => ({
|
|
66
|
+
devices: snapshot.endpoints.map(e => e.name),
|
|
67
|
+
currentEndpointType: snapshot.currentEndpoint ? endpointTypeToDisplayName(snapshot.currentEndpoint.type) : 'Unknown',
|
|
68
|
+
selectedDevice: snapshot.currentEndpoint?.name ?? ''
|
|
69
|
+
});
|
|
16
70
|
class AndroidCallManager {
|
|
17
71
|
/**
|
|
18
72
|
* Get the current audio device status.
|
|
19
73
|
*/
|
|
20
74
|
getAudioDeviceStatus = async () => {
|
|
21
75
|
invariant(_reactNative.Platform.OS === 'android', 'Supported only on Android');
|
|
76
|
+
const tc = getTelecomContext();
|
|
77
|
+
if (tc) {
|
|
78
|
+
const snapshot = await tc.cx.getAvailableAudioEndpoints(tc.callId);
|
|
79
|
+
return snapshotToStatus(snapshot);
|
|
80
|
+
}
|
|
22
81
|
return NativeManager.getAudioDeviceStatus();
|
|
23
82
|
};
|
|
24
83
|
|
|
@@ -29,6 +88,24 @@ class AndroidCallManager {
|
|
|
29
88
|
*/
|
|
30
89
|
selectAudioDevice = endpointName => {
|
|
31
90
|
invariant(_reactNative.Platform.OS === 'android', 'Supported only on Android');
|
|
91
|
+
const tc = getTelecomContext();
|
|
92
|
+
if (tc) {
|
|
93
|
+
const {
|
|
94
|
+
cx,
|
|
95
|
+
callId
|
|
96
|
+
} = tc;
|
|
97
|
+
// Resolve name -> endpoint id from the current Telecom snapshot, then route via Telecom.
|
|
98
|
+
cx.getAvailableAudioEndpoints(callId).then(snapshot => {
|
|
99
|
+
const target = snapshot.endpoints.find(e => e.name === endpointName);
|
|
100
|
+
if (target) {
|
|
101
|
+
return cx.requestAudioEndpointChange(callId, target.id);
|
|
102
|
+
}
|
|
103
|
+
return undefined;
|
|
104
|
+
}).catch(error => {
|
|
105
|
+
_videoClient.videoLoggerSystem.getLogger('CallManager').warn(`selectAudioDevice: failed to route to "${endpointName}" for call ${callId} via Telecom`, error);
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
32
109
|
NativeManager.chooseAudioDeviceEndpoint(endpointName);
|
|
33
110
|
};
|
|
34
111
|
|
|
@@ -38,9 +115,22 @@ class AndroidCallManager {
|
|
|
38
115
|
*/
|
|
39
116
|
addAudioDeviceChangeListener = onChange => {
|
|
40
117
|
invariant(_reactNative.Platform.OS === 'android', 'Supported only on Android');
|
|
118
|
+
const cleanups = [];
|
|
119
|
+
|
|
120
|
+
// Telecom (callingx) route changes.
|
|
121
|
+
if (CallingxModule?.isSetup && CallingxModule.isTelecomBacked) {
|
|
122
|
+
const sub = CallingxModule.addEventListener('didChangeAudioEndpoints', params => onChange(snapshotToStatus(params)));
|
|
123
|
+
cleanups.push(() => sub.remove());
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// StreamInCallManager route changes (non-Telecom calls). Native
|
|
127
|
+
// suppresses these while in telecom-managed mode, and callingx emits no
|
|
128
|
+
// endpoint events for non-Telecom calls, so the two sources never overlap
|
|
129
|
+
// at runtime — safe to keep both subscribed in parallel.
|
|
41
130
|
this.eventEmitter ??= new _reactNative.NativeEventEmitter(NativeManager);
|
|
42
131
|
const s = this.eventEmitter.addListener('onAudioDeviceChanged', onChange);
|
|
43
|
-
|
|
132
|
+
cleanups.push(() => s.remove());
|
|
133
|
+
return () => cleanups.forEach(cleanup => cleanup());
|
|
44
134
|
};
|
|
45
135
|
}
|
|
46
136
|
class IOSCallManager {
|
|
@@ -80,6 +170,34 @@ class SpeakerManager {
|
|
|
80
170
|
* Forces speakerphone on/off.
|
|
81
171
|
*/
|
|
82
172
|
setForceSpeakerphoneOn = force => {
|
|
173
|
+
const tc = getTelecomContext();
|
|
174
|
+
if (tc) {
|
|
175
|
+
const {
|
|
176
|
+
cx,
|
|
177
|
+
callId
|
|
178
|
+
} = tc;
|
|
179
|
+
// Telecom owns routing: map on -> speaker endpoint, off -> highest-priority
|
|
180
|
+
// non-speaker endpoint (wired > bluetooth > earpiece), mirroring classic behavior.
|
|
181
|
+
cx.getAvailableAudioEndpoints(callId).then(snapshot => {
|
|
182
|
+
let target;
|
|
183
|
+
if (force) {
|
|
184
|
+
target = snapshot.endpoints.find(e => e.type === 'speaker');
|
|
185
|
+
} else {
|
|
186
|
+
// Priority for the "speakerphone off" fallback: prefer wired, then bluetooth, then earpiece.
|
|
187
|
+
for (const type of ['wired_headset', 'bluetooth', 'earpiece']) {
|
|
188
|
+
target = snapshot.endpoints.find(e => e.type === type);
|
|
189
|
+
if (target) break;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (target) {
|
|
193
|
+
return cx.requestAudioEndpointChange(callId, target.id);
|
|
194
|
+
}
|
|
195
|
+
return undefined;
|
|
196
|
+
}).catch(error => {
|
|
197
|
+
_videoClient.videoLoggerSystem.getLogger('CallManager').warn(`setForceSpeakerphoneOn(${force}): failed to route for call ${callId} via Telecom`, error);
|
|
198
|
+
});
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
83
201
|
NativeManager.setForceSpeakerphoneOn(force);
|
|
84
202
|
};
|
|
85
203
|
}
|
|
@@ -125,6 +243,20 @@ class CallManager {
|
|
|
125
243
|
_videoClient.videoLoggerSystem.getLogger('CallManager').debug('start: skipping start as callkit is handling the audio session');
|
|
126
244
|
return;
|
|
127
245
|
}
|
|
246
|
+
if (isAndroidTelecomManaged()) {
|
|
247
|
+
// Telecom owns routing/focus; forward the sticky preference to callingx and run in
|
|
248
|
+
// telecom-managed mode (StreamInCallManager keeps proximity/keep-screen-on only).
|
|
249
|
+
if (config?.audioRole !== 'listener' && CallingxModule) {
|
|
250
|
+
CallingxModule.setDefaultAudioDeviceEndpointType(config?.deviceEndpointType ?? 'speaker');
|
|
251
|
+
}
|
|
252
|
+
NativeManager.setTelecomManagedMode(true);
|
|
253
|
+
NativeManager.setAudioRole(config?.audioRole ?? 'communicator');
|
|
254
|
+
NativeManager.start();
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (_reactNative.Platform.OS === 'android') {
|
|
258
|
+
NativeManager.setTelecomManagedMode(false);
|
|
259
|
+
}
|
|
128
260
|
NativeManager.setAudioRole(config?.audioRole ?? 'communicator');
|
|
129
261
|
if (config?.audioRole === 'communicator') {
|
|
130
262
|
const type = config.deviceEndpointType ?? 'speaker';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_callingx","_videoClient","NativeManager","NativeModules","StreamInCallManager","CallingxModule","getCallingxLibIfAvailable","AUDIO_INTERRUPTION_EVENT","invariant","condition","message","Error","AndroidCallManager","getAudioDeviceStatus","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_callingx","_videoClient","NativeManager","NativeModules","StreamInCallManager","CallingxModule","getCallingxLibIfAvailable","AUDIO_INTERRUPTION_EVENT","invariant","condition","message","Error","isAndroidTelecomManaged","Platform","OS","isSetup","isTelecomBacked","hasRegisteredCall","isOngoingCallsEnabled","getTelecomContext","undefined","callId","getRegisteredCallIds","cx","endpointTypeToDisplayName","type","snapshotToStatus","snapshot","devices","endpoints","map","e","name","currentEndpointType","currentEndpoint","selectedDevice","AndroidCallManager","getAudioDeviceStatus","tc","getAvailableAudioEndpoints","selectAudioDevice","endpointName","then","target","find","requestAudioEndpointChange","id","catch","error","videoLoggerSystem","getLogger","warn","chooseAudioDeviceEndpoint","addAudioDeviceChangeListener","onChange","cleanups","sub","addEventListener","params","push","remove","eventEmitter","NativeEventEmitter","s","addListener","forEach","cleanup","IOSCallManager","showDeviceSelector","showAudioRoutePicker","addAudioInterruptionListener","onInterruption","SpeakerManager","setMute","mute","muteAudioOutput","unmuteAudioOutput","setForceSpeakerphoneOn","force","shouldBypassForCallKit","CallManager","android","ios","speaker","start","config","audioRole","deviceEndpointType","setDefaultAudioDeviceEndpointType","debug","setTelecomManagedMode","setAudioRole","enableStereoAudioOutput","setEnableStereoAudioOutput","stop","logAudioState","getAudioStateLog","exports"],"sourceRoot":"../../../../src","sources":["modules/call-manager/CallManager.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAUA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,MAAMG,aAAa,GAAGC,0BAAa,CAACC,mBAAmB;AACvD,MAAMC,cAAc,GAAG,IAAAC,mCAAyB,EAAC,CAAC;AAClD,MAAMC,wBAAwB,GAAG,sCAAsC;AAEvE,MAAMC,SAAS,GAAGA,CAACC,SAAkB,EAAEC,OAAe,KAAK;EACzD,IAAI,CAACD,SAAS,EAAE,MAAM,IAAIE,KAAK,CAACD,OAAO,CAAC;AAC1C,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAME,uBAAuB,GAAGA,CAAA,KAAe;EAC7C,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAI,CAACT,cAAc,EAAE;IAChD,OAAO,KAAK;EACd;EACA,OACEA,cAAc,CAACU,OAAO,IACtBV,cAAc,CAACW,eAAe,KAC7BX,cAAc,CAACY,iBAAiB,CAAC,CAAC,IAAIZ,cAAc,CAACa,qBAAqB,CAA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F,KAAK,CAAC,CAAC;MACrB;IACF;IACA,IAAIvE,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;MAC7BZ,aAAa,CAACwF,qBAAqB,CAAC,KAAK,CAAC;IAC5C;IACAxF,aAAa,CAACyF,YAAY,CAACN,MAAM,EAAEC,SAAS,IAAI,cAAc,CAAC;IAC/D,IAAID,MAAM,EAAEC,SAAS,KAAK,cAAc,EAAE;MACxC,MAAM7D,IAAI,GAAG4D,MAAM,CAACE,kBAAkB,IAAI,SAAS;MACnDrF,aAAa,CAACsF,iCAAiC,CAAC/D,IAAI,CAAC;IACvD;IACA,IAAI4D,MAAM,EAAEC,SAAS,KAAK,UAAU,IAAID,MAAM,CAACO,uBAAuB,EAAE;MACtE1F,aAAa,CAAC2F,0BAA0B,CAAC,IAAI,CAAC;IAChD;IACA3F,aAAa,CAACkF,KAAK,CAAC,CAAC;EACvB,CAAC;;EAED;AACF;AACA;EACEU,IAAI,GAAGA,CAAA,KAAY;IACjB,IAAIf,sBAAsB,CAAC,CAAC,EAAE;MAC5B9B,8BAAiB,CACdC,SAAS,CAAC,aAAa,CAAC,CACxBuC,KAAK,CAAC,8DAA8D,CAAC;MACxE;IACF;IACAvF,aAAa,CAAC4F,IAAI,CAAC,CAAC;EACtB,CAAC;;EAED;AACF;AACA;AACA;EACEC,aAAa,GAAGA,CAAA,KAAY7F,aAAa,CAAC6F,aAAa,CAAC,CAAC;;EAEzD;AACF;AACA;AACA;EACEC,gBAAgB,GAAGA,CAAA,KAAc9F,aAAa,CAAC8F,gBAAgB,CAAC,CAAC;AACnE;AAACC,OAAA,CAAAjB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -18,6 +18,40 @@ var _videoClient = require("@stream-io/video-client");
|
|
|
18
18
|
|
|
19
19
|
const CallingxModule = (0, _callingx.getCallingxLibIfAvailable)();
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Fallback when Telecom registration fails/times out on Android: no component would own audio
|
|
23
|
+
* (Telecom never took over), so re-establish StreamInCallManager in its classic (non-telecom)
|
|
24
|
+
* mode to keep the call audible.
|
|
25
|
+
*/
|
|
26
|
+
function recoverAudioToClassicMode() {
|
|
27
|
+
if (_reactNative.Platform.OS !== 'android') {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!CallingxModule?.isSetup || !CallingxModule.isTelecomBacked) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
// If a call is already registered, Telecom owns audio for it (the registration
|
|
34
|
+
// partially succeeded). Switching to classic mode here would fight Telecom's
|
|
35
|
+
// routing/focus — leave ownership intact.
|
|
36
|
+
if (CallingxModule.hasRegisteredCall()) {
|
|
37
|
+
_videoClient.videoLoggerSystem.getLogger('callingx').debug('recoverAudioToClassicMode: Telecom already owns a registered call; skipping classic fallback');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const StreamInCallManagerNativeModule = _reactNative.NativeModules.StreamInCallManager;
|
|
41
|
+
if (!StreamInCallManagerNativeModule) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const logger = _videoClient.videoLoggerSystem.getLogger('callingx');
|
|
45
|
+
logger.warn('Telecom registration failed; falling back to classic StreamInCallManager audio');
|
|
46
|
+
try {
|
|
47
|
+
StreamInCallManagerNativeModule.stop();
|
|
48
|
+
StreamInCallManagerNativeModule.setTelecomManagedMode(false);
|
|
49
|
+
StreamInCallManagerNativeModule.start();
|
|
50
|
+
} catch (error) {
|
|
51
|
+
logger.error('recoverAudioToClassicMode: failed to recover audio', error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
21
55
|
/**
|
|
22
56
|
* Gets the call display name. To be used for display in native call screen.
|
|
23
57
|
*/
|
|
@@ -65,6 +99,7 @@ async function registerOutgoingCall(call) {
|
|
|
65
99
|
);
|
|
66
100
|
} catch (error) {
|
|
67
101
|
logger.error(`registerOutgoingCall: Error registering outgoing call in callingx: ${call.cid}`, error);
|
|
102
|
+
recoverAudioToClassicMode();
|
|
68
103
|
}
|
|
69
104
|
}
|
|
70
105
|
|
|
@@ -103,6 +138,7 @@ async function joinCallingxCall(call, activeCalls) {
|
|
|
103
138
|
await startCallInCallingx();
|
|
104
139
|
} catch (error) {
|
|
105
140
|
logger.error(`startCallingxCall: Error starting call in callingx: ${call.cid}`, error);
|
|
141
|
+
recoverAudioToClassicMode();
|
|
106
142
|
}
|
|
107
143
|
} else if (isIncomingCall) {
|
|
108
144
|
logger.debug(`joinCallingxCall: Joining incoming call ${call.cid}`);
|
|
@@ -135,6 +171,7 @@ async function joinCallingxCall(call, activeCalls) {
|
|
|
135
171
|
}
|
|
136
172
|
} catch (error) {
|
|
137
173
|
logger.error(`Error joining incoming call in callingx: ${call.cid}`, error);
|
|
174
|
+
recoverAudioToClassicMode();
|
|
138
175
|
}
|
|
139
176
|
}
|
|
140
177
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_callingx","_audioSessionPromise","_videoClient","CallingxModule","getCallingxLibIfAvailable","getCallDisplayName","callMembers","participants","currentUserId","names","length","flatMap","member","user","id","name","participant","userId","find","sort","join","getCallDisplayNameFromCall","call","state","custom","display_name","members","registerOutgoingCall","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_callingx","_audioSessionPromise","_videoClient","CallingxModule","getCallingxLibIfAvailable","recoverAudioToClassicMode","Platform","OS","isSetup","isTelecomBacked","hasRegisteredCall","videoLoggerSystem","getLogger","debug","StreamInCallManagerNativeModule","NativeModules","StreamInCallManager","logger","warn","stop","setTelecomManagedMode","start","error","getCallDisplayName","callMembers","participants","currentUserId","names","length","flatMap","member","user","id","name","participant","userId","find","sort","join","getCallDisplayNameFromCall","call","state","custom","display_name","members","registerOutgoingCall","isOwnTracksLoopbackAllowed","isOutcomingCall","ringing","isCreatedByMe","cid","callDisplayName","startCall","createdBy","settings","video","enabled","joinCallingxCall","activeCalls","isIncomingCall","startCallInCallingx","waitForAudioSessionActivation","isOngoingCallsEnabled","activeCallsToLeave","filter","c","callingState","CallingState","LEFT","activeCall","leave","reason","catch","e","displayIncomingCall","answerIncomingCall","endCallingxCall","isCallTracked","endCallWithReason"],"sourceRoot":"../../../../../src","sources":["utils/internal/callingx/callingx.ts"],"mappings":";;;;;;;;;AAIA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AAMA,IAAAG,YAAA,GAAAH,OAAA;AAbA;AACA;AACA;AACA;;AAYA,MAAMI,cAAc,GAAG,IAAAC,mCAAyB,EAAC,CAAC;;AAElD;AACA;AACA;AACA;AACA;AACA,SAASC,yBAAyBA,CAAA,EAAG;EACnC,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;IAC7B;EACF;EACA,IAAI,CAACJ,cAAc,EAAEK,OAAO,IAAI,CAACL,cAAc,CAACM,eAAe,EAAE;IAC/D;EACF;EACA;EACA;EACA;EACA,IAAIN,cAAc,CAACO,iBAAiB,CAAC,CAAC,EAAE;IACtCC,8BAAiB,CACdC,SAAS,CAAC,UAAU,CAAC,CACrBC,KAAK,CACJ,8FACF,CAAC;IACH;EACF;EACA,MAAMC,+BAA+B,GAAGC,0BAAa,CAACC,mBAAmB;EACzE,IAAI,CAACF,+BAA+B,EAAE;IACpC;EACF;EACA,MAAMG,MAAM,GAAGN,8BAAiB,CAACC,SAAS,CAAC,UAAU,CAAC;EACtDK,MAAM,CAACC,IAAI,CACT,gFACF,CAAC;EACD,IAAI;IACFJ,+BAA+B,CAACK,IAAI,CAAC,CAAC;IACtCL,+BAA+B,CAACM,qBAAqB,CAAC,KAAK,CAAC;IAC5DN,+BAA+B,CAACO,KAAK,CAAC,CAAC;EACzC,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdL,MAAM,CAACK,KAAK,CAAC,oDAAoD,EAAEA,KAAK,CAAC;EAC3E;AACF;;AAEA;AACA;AACA;AACO,SAASC,kBAAkBA,CAChCC,WAAy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