@stream-io/video-react-native-sdk 1.43.0 → 1.44.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.
- package/CHANGELOG.md +22 -1
- package/dist/commonjs/components/Call/CallControls/internal/ReactionsPicker.js.map +1 -1
- package/dist/commonjs/components/Call/Lobby/Lobby.js +4 -9
- package/dist/commonjs/components/Call/Lobby/Lobby.js.map +1 -1
- package/dist/commonjs/components/Call/Lobby/LobbyCameraPreview.js +93 -0
- package/dist/commonjs/components/Call/Lobby/LobbyCameraPreview.js.map +1 -0
- package/dist/commonjs/components/Call/Lobby/index.js +11 -0
- package/dist/commonjs/components/Call/Lobby/index.js.map +1 -1
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js +4 -15
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js.map +1 -1
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/index.js +10 -4
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/index.js.map +1 -1
- package/dist/commonjs/modules/call-manager/CallManager.js +37 -54
- package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
- package/dist/commonjs/utils/internal/callingx/callingx.js +26 -37
- package/dist/commonjs/utils/internal/callingx/callingx.js.map +1 -1
- package/dist/commonjs/utils/internal/registerMediaEngine.js +41 -0
- package/dist/commonjs/utils/internal/registerMediaEngine.js.map +1 -0
- package/dist/commonjs/utils/internal/registerSDKGlobals.js +93 -35
- package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/commonjs/utils/push/android.js +6 -8
- package/dist/commonjs/utils/push/android.js.map +1 -1
- package/dist/commonjs/utils/push/libs/firebaseMessaging/index.js +0 -9
- package/dist/commonjs/utils/push/libs/firebaseMessaging/index.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/module/components/Call/CallControls/internal/ReactionsPicker.js.map +1 -1
- package/dist/module/components/Call/Lobby/Lobby.js +4 -9
- package/dist/module/components/Call/Lobby/Lobby.js.map +1 -1
- package/dist/module/components/Call/Lobby/LobbyCameraPreview.js +87 -0
- package/dist/module/components/Call/Lobby/LobbyCameraPreview.js.map +1 -0
- package/dist/module/components/Call/Lobby/index.js +1 -0
- package/dist/module/components/Call/Lobby/index.js.map +1 -1
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js +6 -17
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js.map +1 -1
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/index.js +11 -5
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/index.js.map +1 -1
- package/dist/module/modules/call-manager/CallManager.js +36 -53
- package/dist/module/modules/call-manager/CallManager.js.map +1 -1
- package/dist/module/utils/internal/callingx/callingx.js +25 -38
- package/dist/module/utils/internal/callingx/callingx.js.map +1 -1
- package/dist/module/utils/internal/registerMediaEngine.js +37 -0
- package/dist/module/utils/internal/registerMediaEngine.js.map +1 -0
- package/dist/module/utils/internal/registerSDKGlobals.js +95 -37
- package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/module/utils/push/android.js +7 -9
- package/dist/module/utils/push/android.js.map +1 -1
- package/dist/module/utils/push/libs/firebaseMessaging/index.js +0 -8
- package/dist/module/utils/push/libs/firebaseMessaging/index.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/typescript/components/Call/Lobby/Lobby.d.ts.map +1 -1
- package/dist/typescript/components/Call/Lobby/LobbyCameraPreview.d.ts +28 -0
- package/dist/typescript/components/Call/Lobby/LobbyCameraPreview.d.ts.map +1 -0
- package/dist/typescript/components/Call/Lobby/index.d.ts +1 -0
- package/dist/typescript/components/Call/Lobby/index.d.ts.map +1 -1
- package/dist/typescript/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.d.ts +11 -6
- package/dist/typescript/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.d.ts.map +1 -1
- package/dist/typescript/components/Participant/ParticipantView/VideoRenderer/index.d.ts.map +1 -1
- package/dist/typescript/modules/call-manager/CallManager.d.ts +28 -6
- package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
- package/dist/typescript/modules/call-manager/types.d.ts +0 -1
- package/dist/typescript/modules/call-manager/types.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/types.d.ts +3 -0
- package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
- package/dist/typescript/utils/internal/callingx/callingx.d.ts +2 -0
- package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +1 -1
- package/dist/typescript/utils/internal/registerMediaEngine.d.ts +15 -0
- package/dist/typescript/utils/internal/registerMediaEngine.d.ts.map +1 -0
- 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/firebaseMessaging/index.d.ts +0 -1
- package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts.map +1 -1
- package/dist/typescript/version.d.ts +1 -1
- package/ios/StreamInCallManager.m +4 -0
- package/ios/StreamInCallManager.swift +42 -10
- package/package.json +8 -8
- package/src/components/Call/CallControls/internal/ReactionsPicker.tsx +2 -2
- package/src/components/Call/Lobby/Lobby.tsx +4 -11
- package/src/components/Call/Lobby/LobbyCameraPreview.tsx +99 -0
- package/src/components/Call/Lobby/index.ts +1 -0
- package/src/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.tsx +56 -75
- package/src/components/Participant/ParticipantView/VideoRenderer/index.tsx +18 -7
- package/src/modules/call-manager/CallManager.ts +40 -71
- package/src/modules/call-manager/native-module.d.ts +13 -0
- package/src/modules/call-manager/types.ts +0 -1
- package/src/utils/StreamVideoRN/types.ts +3 -0
- package/src/utils/internal/callingx/callingx.ts +35 -44
- package/src/utils/internal/registerMediaEngine.ts +42 -0
- package/src/utils/internal/registerSDKGlobals.ts +115 -42
- package/src/utils/push/android.ts +9 -17
- package/src/utils/push/libs/firebaseMessaging/index.ts +0 -19
- package/src/version.ts +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
StreamRNVideoSDKGlobals,
|
|
3
|
+
videoLoggerSystem,
|
|
4
|
+
} from '@stream-io/video-client';
|
|
2
5
|
import { NativeModules, PermissionsAndroid, Platform } from 'react-native';
|
|
3
6
|
import {
|
|
4
|
-
AudioDeviceModule,
|
|
5
7
|
AudioEngineMuteMode,
|
|
6
8
|
audioDeviceModuleEvents,
|
|
7
9
|
} from '@stream-io/react-native-webrtc';
|
|
@@ -10,7 +12,11 @@ import {
|
|
|
10
12
|
endCallingxCall,
|
|
11
13
|
registerOutgoingCall,
|
|
12
14
|
joinCallingxCall,
|
|
15
|
+
wireAudioEngineSubscription,
|
|
16
|
+
unwireAudioEngineSubscription,
|
|
13
17
|
} from './callingx/callingx';
|
|
18
|
+
import { registerCallMediaEngine } from './registerMediaEngine';
|
|
19
|
+
import { callManager as publicCallManager } from '../../modules/call-manager';
|
|
14
20
|
|
|
15
21
|
const StreamInCallManagerNativeModule = NativeModules.StreamInCallManager;
|
|
16
22
|
const StreamVideoReactNativeModule = NativeModules.StreamVideoReactNative as {
|
|
@@ -19,6 +25,18 @@ const StreamVideoReactNativeModule = NativeModules.StreamVideoReactNative as {
|
|
|
19
25
|
|
|
20
26
|
const CallingxModule = getCallingxLibIfAvailable();
|
|
21
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Runs a fire-and-forget native call, logging instead of throwing on a bridge
|
|
30
|
+
* error so it can't crash the caller (e.g. the join/leave flow).
|
|
31
|
+
*/
|
|
32
|
+
const safeNativeCall = (label: string, fn: () => void): void => {
|
|
33
|
+
try {
|
|
34
|
+
fn();
|
|
35
|
+
} catch (error) {
|
|
36
|
+
videoLoggerSystem.getLogger('CallManager').warn(`${label} failed`, error);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
22
40
|
/**
|
|
23
41
|
* Checks if StreamInCallManager should be bypassed because CallKit is handling
|
|
24
42
|
* the audio session via CallingX.
|
|
@@ -52,22 +70,17 @@ const shouldBypassForCallKit = ({
|
|
|
52
70
|
* StreamInCallManager entirely — Telecom provides no proximity/keep-screen-on — instead we
|
|
53
71
|
* run it in "telecom-managed" mode where it only keeps proximity/keep-screen-on/mute.
|
|
54
72
|
*/
|
|
55
|
-
const isAndroidTelecomManaged = ({
|
|
56
|
-
|
|
57
|
-
}: {
|
|
58
|
-
isRingingTypeCall: boolean;
|
|
59
|
-
}): boolean => {
|
|
60
|
-
if (Platform.OS !== 'android') {
|
|
73
|
+
const isAndroidTelecomManaged = ({ cid }: { cid: string }): boolean => {
|
|
74
|
+
if (Platform.OS !== 'android' || !CallingxModule) {
|
|
61
75
|
return false;
|
|
62
76
|
}
|
|
63
|
-
if (!CallingxModule) {
|
|
77
|
+
if (!CallingxModule.isSetup || !CallingxModule.isTelecomBacked) {
|
|
64
78
|
return false;
|
|
65
79
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
);
|
|
80
|
+
// Trust Telecom's actual per-call registration. A call that never registered
|
|
81
|
+
// (e.g. Telecom registration failed) is not managed, so start() falls through
|
|
82
|
+
// to the classic path — this is where audio recovery happens.
|
|
83
|
+
return CallingxModule.isCallTracked(cid);
|
|
71
84
|
};
|
|
72
85
|
|
|
73
86
|
const streamRNVideoSDKGlobals: StreamRNVideoSDKGlobals = {
|
|
@@ -75,43 +88,101 @@ const streamRNVideoSDKGlobals: StreamRNVideoSDKGlobals = {
|
|
|
75
88
|
joinCall: joinCallingxCall,
|
|
76
89
|
endCall: endCallingxCall,
|
|
77
90
|
registerOutgoingCall: registerOutgoingCall,
|
|
91
|
+
wireAudioEngineSubscription: wireAudioEngineSubscription,
|
|
92
|
+
unwireAudioEngineSubscription: unwireAudioEngineSubscription,
|
|
78
93
|
},
|
|
79
94
|
callManager: {
|
|
80
|
-
setup: ({ defaultDevice, isRingingTypeCall }) => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
setup: ({ defaultDevice, isRingingTypeCall, cid }) => {
|
|
96
|
+
const isTelecomManaged = isAndroidTelecomManaged({ cid });
|
|
97
|
+
const isCallKitManaged = shouldBypassForCallKit({ isRingingTypeCall });
|
|
98
|
+
if (Platform.OS === 'android') {
|
|
99
|
+
StreamInCallManagerNativeModule.setTelecomManagedMode(isTelecomManaged);
|
|
85
100
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
StreamInCallManagerNativeModule.setup();
|
|
92
|
-
return;
|
|
101
|
+
|
|
102
|
+
if (isTelecomManaged || isCallKitManaged) {
|
|
103
|
+
safeNativeCall('setup defaultAudioDevice (callingx)', () =>
|
|
104
|
+
CallingxModule?.setDefaultAudioDeviceEndpointType(defaultDevice),
|
|
105
|
+
);
|
|
93
106
|
}
|
|
94
|
-
|
|
95
|
-
|
|
107
|
+
|
|
108
|
+
if (!isTelecomManaged) {
|
|
109
|
+
safeNativeCall('setup defaultAudioDevice', () =>
|
|
110
|
+
StreamInCallManagerNativeModule.setDefaultAudioDeviceEndpointType(
|
|
111
|
+
defaultDevice,
|
|
112
|
+
),
|
|
113
|
+
);
|
|
96
114
|
}
|
|
97
|
-
StreamInCallManagerNativeModule.setDefaultAudioDeviceEndpointType(
|
|
98
|
-
defaultDevice,
|
|
99
|
-
);
|
|
100
|
-
StreamInCallManagerNativeModule.setup();
|
|
101
115
|
},
|
|
102
|
-
start: ({ isRingingTypeCall }) => {
|
|
116
|
+
start: ({ isRingingTypeCall, cid }) => {
|
|
117
|
+
// Apply the audio config a consumer recorded via `callManager.start(config)` at this single
|
|
118
|
+
// join-time start, before the native audio manager is activated.
|
|
119
|
+
const config = publicCallManager.getStoredConfig();
|
|
120
|
+
const deviceOverride =
|
|
121
|
+
config?.audioRole === 'communicator'
|
|
122
|
+
? config.deviceEndpointType
|
|
123
|
+
: undefined;
|
|
124
|
+
|
|
103
125
|
if (shouldBypassForCallKit({ isRingingTypeCall })) {
|
|
126
|
+
// CallKit owns activation. Only forward an explicit endpoint override; the
|
|
127
|
+
// SpeakerManager-derived default was already forwarded via `setup`.
|
|
128
|
+
if (deviceOverride) {
|
|
129
|
+
safeNativeCall('start defaultAudioDevice (callingx)', () =>
|
|
130
|
+
CallingxModule?.setDefaultAudioDeviceEndpointType(deviceOverride),
|
|
131
|
+
);
|
|
132
|
+
safeNativeCall('start defaultAudioDevice', () =>
|
|
133
|
+
StreamInCallManagerNativeModule.setDefaultAudioDeviceEndpointType(
|
|
134
|
+
deviceOverride,
|
|
135
|
+
),
|
|
136
|
+
);
|
|
137
|
+
}
|
|
104
138
|
return;
|
|
105
139
|
}
|
|
106
|
-
|
|
107
|
-
|
|
140
|
+
|
|
141
|
+
const isTelecomManaged = isAndroidTelecomManaged({ cid });
|
|
142
|
+
if (Platform.OS === 'android') {
|
|
143
|
+
StreamInCallManagerNativeModule.setTelecomManagedMode(isTelecomManaged);
|
|
144
|
+
}
|
|
145
|
+
if (config?.audioRole) {
|
|
146
|
+
StreamInCallManagerNativeModule.setAudioRole(config.audioRole);
|
|
147
|
+
}
|
|
148
|
+
if (deviceOverride) {
|
|
149
|
+
// Override the SpeakerManager-derived default device (set via `setup`).
|
|
150
|
+
if (isTelecomManaged) {
|
|
151
|
+
safeNativeCall('start defaultAudioDevice (callingx)', () =>
|
|
152
|
+
CallingxModule?.setDefaultAudioDeviceEndpointType(deviceOverride),
|
|
153
|
+
);
|
|
154
|
+
} else {
|
|
155
|
+
safeNativeCall('start defaultAudioDevice', () =>
|
|
156
|
+
StreamInCallManagerNativeModule.setDefaultAudioDeviceEndpointType(
|
|
157
|
+
deviceOverride,
|
|
158
|
+
),
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const stereoOutput = config?.audioRole === 'listener';
|
|
164
|
+
StreamInCallManagerNativeModule.setEnableStereoAudioOutput(stereoOutput);
|
|
108
165
|
StreamInCallManagerNativeModule.start();
|
|
109
166
|
},
|
|
110
|
-
stop: ({ isRingingTypeCall }) => {
|
|
111
|
-
|
|
112
|
-
|
|
167
|
+
stop: ({ isRingingTypeCall, shouldStopCallManager }) => {
|
|
168
|
+
// Clear the stored audio config so it doesn't carry into the next call.
|
|
169
|
+
publicCallManager.stop();
|
|
170
|
+
|
|
171
|
+
// We want to interact with ADM only when it was instantiated. This guards a case when
|
|
172
|
+
// leave is invoked for ringing call - in this case PC Factory and ADM are not yet created.
|
|
173
|
+
if (shouldStopCallManager) {
|
|
174
|
+
// Teardown of setMutedRecordingPrepared. Done here (before the CallKit gate)
|
|
175
|
+
// so it runs on both paths and while the call factory is still alive: leave()
|
|
176
|
+
// calls stop() before disposing the engine, so the ADM resolves to the call's
|
|
177
|
+
// factory rather than a default.
|
|
178
|
+
if (Platform.OS === 'ios') {
|
|
179
|
+
StreamInCallManagerNativeModule.setRecordingAlwaysPreparedMode(false);
|
|
180
|
+
}
|
|
181
|
+
if (shouldBypassForCallKit({ isRingingTypeCall })) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
StreamInCallManagerNativeModule.stop();
|
|
113
185
|
}
|
|
114
|
-
StreamInCallManagerNativeModule.stop();
|
|
115
186
|
},
|
|
116
187
|
// iOS-only. Keep the AVAudioEngine mic-input (voice-processing) chain
|
|
117
188
|
// prepared while muted so the engine stays full-duplex and remote audio
|
|
@@ -125,11 +196,11 @@ const streamRNVideoSDKGlobals: StreamRNVideoSDKGlobals = {
|
|
|
125
196
|
if (enabled) {
|
|
126
197
|
// Mute via the voice-processing unit (it's the default, fail safe config here) so the input chain
|
|
127
198
|
// stays built while muted, rather than tearing the engine down.
|
|
128
|
-
|
|
199
|
+
StreamInCallManagerNativeModule.setMuteMode(
|
|
129
200
|
AudioEngineMuteMode.VoiceProcessing,
|
|
130
|
-
)
|
|
201
|
+
);
|
|
131
202
|
}
|
|
132
|
-
|
|
203
|
+
StreamInCallManagerNativeModule.setRecordingAlwaysPreparedMode(enabled);
|
|
133
204
|
},
|
|
134
205
|
},
|
|
135
206
|
permissions: {
|
|
@@ -169,4 +240,6 @@ export function registerSDKGlobals() {
|
|
|
169
240
|
if (!globalThis.streamRNVideoSDK) {
|
|
170
241
|
globalThis.streamRNVideoSDK = streamRNVideoSDKGlobals;
|
|
171
242
|
}
|
|
243
|
+
|
|
244
|
+
registerCallMediaEngine();
|
|
172
245
|
}
|
|
@@ -5,11 +5,7 @@ import {
|
|
|
5
5
|
} from '@stream-io/video-client';
|
|
6
6
|
import { AppState, Platform } from 'react-native';
|
|
7
7
|
import type { StreamVideoConfig } from '../StreamVideoRN/types';
|
|
8
|
-
import {
|
|
9
|
-
type FirebaseMessagingTypes,
|
|
10
|
-
getFirebaseMessagingLib,
|
|
11
|
-
getFirebaseMessagingLibNoThrow,
|
|
12
|
-
} from './libs';
|
|
8
|
+
import { type FirebaseMessagingTypes, getFirebaseMessagingLib } from './libs';
|
|
13
9
|
import { pushUnsubscriptionCallbacks } from './internal/constants';
|
|
14
10
|
import { canListenToWS, shouldCallBeClosed } from './internal/utils';
|
|
15
11
|
import { setPushLogoutCallback } from '../internal/pushLogoutCallback';
|
|
@@ -60,18 +56,14 @@ export async function initAndroidPushToken(
|
|
|
60
56
|
await client.addDevice(token, 'firebase', push_provider_name);
|
|
61
57
|
};
|
|
62
58
|
|
|
63
|
-
const messaging =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
setUnsubscribeListener(unsubscribe);
|
|
72
|
-
const token = await messaging().getToken();
|
|
73
|
-
await setDeviceToken(token);
|
|
74
|
-
}
|
|
59
|
+
const messaging = getFirebaseMessagingLib();
|
|
60
|
+
logger.debug(`setting firebase token listeners`);
|
|
61
|
+
const unsubscribe = messaging().onTokenRefresh((refreshedToken) =>
|
|
62
|
+
setDeviceToken(refreshedToken),
|
|
63
|
+
);
|
|
64
|
+
setUnsubscribeListener(unsubscribe);
|
|
65
|
+
const token = await messaging().getToken();
|
|
66
|
+
await setDeviceToken(token);
|
|
75
67
|
}
|
|
76
68
|
|
|
77
69
|
/**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { lib, type Type } from './lib';
|
|
2
|
-
import { videoLoggerSystem } from '@stream-io/video-client';
|
|
3
2
|
|
|
4
3
|
export type { FirebaseMessagingTypes } from '@react-native-firebase/messaging';
|
|
5
4
|
export type FirebaseMessagingType = Type;
|
|
@@ -16,21 +15,3 @@ export function getFirebaseMessagingLib(): FirebaseMessagingType {
|
|
|
16
15
|
}
|
|
17
16
|
return lib;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
|
-
export function getFirebaseMessagingLibNoThrow(
|
|
21
|
-
isExpo: boolean,
|
|
22
|
-
): FirebaseMessagingType | undefined {
|
|
23
|
-
if (!lib) {
|
|
24
|
-
const logger = videoLoggerSystem.getLogger(
|
|
25
|
-
'getFirebaseMessagingLibNoThrow',
|
|
26
|
-
);
|
|
27
|
-
logger.debug(
|
|
28
|
-
`${
|
|
29
|
-
isExpo
|
|
30
|
-
? 'In Expo, @react-native-firebase/messaging library is required to receive ringing notifications in app killed state for Android.'
|
|
31
|
-
: ''
|
|
32
|
-
}${INSTALLATION_INSTRUCTION}`,
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
return lib;
|
|
36
|
-
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.
|
|
1
|
+
export const version = '1.44.0';
|