@100mslive/react-native-hms 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +145 -340
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +205 -75
- package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +127 -127
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +153 -115
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +147 -17
- package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +7 -7
- package/ios/HMSDecoder.swift +205 -129
- package/ios/HMSHelper.swift +3 -3
- package/ios/HMSManager.m +3 -0
- package/ios/HMSManager.swift +22 -1
- package/ios/HMSRNSDK.swift +228 -79
- package/ios/HMSView.m +2 -0
- package/ios/HMSView.swift +35 -3
- package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/yogesh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
- package/lib/commonjs/classes/HMSChangeTrackStateRequest.js.map +1 -1
- package/lib/commonjs/classes/HMSEncoder.js +133 -84
- package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSStreamingState.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalVideoTrack.js +0 -2
- package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSMessageRecipient.js +1 -1
- package/lib/commonjs/classes/HMSMessageRecipient.js.map +1 -1
- package/lib/commonjs/classes/HMSNativeEventEmitter.js +106 -0
- package/lib/commonjs/classes/HMSNativeEventEmitter.js.map +1 -0
- package/lib/commonjs/classes/HMSPeer.js +4 -0
- package/lib/commonjs/classes/HMSPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSPublishSettings.js +0 -6
- package/lib/commonjs/classes/HMSPublishSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSRole.js +0 -6
- package/lib/commonjs/classes/HMSRole.js.map +1 -1
- package/lib/commonjs/classes/HMSRoleChangeRequest.js +3 -1
- package/lib/commonjs/classes/HMSRoleChangeRequest.js.map +1 -1
- package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +465 -137
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -1
- package/lib/commonjs/classes/HMSSubscribeSettings.js +0 -2
- package/lib/commonjs/classes/HMSSubscribeSettings.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -1
- package/lib/module/classes/HMSChangeTrackStateRequest.js.map +1 -1
- package/lib/module/classes/HMSEncoder.js +133 -84
- package/lib/module/classes/HMSEncoder.js.map +1 -1
- package/lib/module/classes/HMSHLSStreamingState.js.map +1 -1
- package/lib/module/classes/HMSLocalVideoTrack.js +0 -2
- package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSMessageRecipient.js +1 -1
- package/lib/module/classes/HMSMessageRecipient.js.map +1 -1
- package/lib/module/classes/HMSNativeEventEmitter.js +99 -0
- package/lib/module/classes/HMSNativeEventEmitter.js.map +1 -0
- package/lib/module/classes/HMSPeer.js +4 -0
- package/lib/module/classes/HMSPeer.js.map +1 -1
- package/lib/module/classes/HMSPublishSettings.js +0 -6
- package/lib/module/classes/HMSPublishSettings.js.map +1 -1
- package/lib/module/classes/HMSRole.js +0 -6
- package/lib/module/classes/HMSRole.js.map +1 -1
- package/lib/module/classes/HMSRoleChangeRequest.js +3 -1
- package/lib/module/classes/HMSRoleChangeRequest.js.map +1 -1
- package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +466 -138
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HMSServerRecordingState.js.map +1 -1
- package/lib/module/classes/HMSSubscribeSettings.js +0 -2
- package/lib/module/classes/HMSSubscribeSettings.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +4 -4
- package/lib/typescript/classes/HMSChangeTrackStateRequest.d.ts +2 -2
- package/lib/typescript/classes/HMSEncoder.d.ts +3 -0
- package/lib/typescript/classes/HMSHLSStreamingState.d.ts +2 -2
- package/lib/typescript/classes/HMSLocalVideoTrack.d.ts +0 -2
- package/lib/typescript/classes/HMSMessageRecipient.d.ts +2 -2
- package/lib/typescript/classes/HMSNativeEventEmitter.d.ts +13 -0
- package/lib/typescript/classes/HMSPublishSettings.d.ts +8 -15
- package/lib/typescript/classes/HMSRole.d.ts +0 -6
- package/lib/typescript/classes/HMSRoleChangeRequest.d.ts +2 -2
- package/lib/typescript/classes/HMSRtmpStreamingState.d.ts +4 -4
- package/lib/typescript/classes/HMSSDK.d.ts +2 -12
- package/lib/typescript/classes/HMSServerRecordingState.d.ts +2 -2
- package/lib/typescript/classes/HMSSubscribeSettings.d.ts +0 -2
- package/lib/typescript/index.d.ts +1 -0
- package/package.json +5 -4
- package/react-native-hms.podspec +1 -1
- package/sdk-versions.json +3 -2
- package/src/classes/HMSBrowserRecordingState.ts +4 -4
- package/src/classes/HMSChangeTrackStateRequest.ts +2 -2
- package/src/classes/HMSEncoder.ts +186 -99
- package/src/classes/HMSHLSStreamingState.ts +2 -2
- package/src/classes/HMSLocalVideoTrack.ts +0 -2
- package/src/classes/HMSMessageRecipient.ts +3 -3
- package/src/classes/HMSNativeEventEmitter.ts +86 -0
- package/src/classes/HMSPeer.ts +4 -0
- package/src/classes/HMSPublishSettings.ts +8 -18
- package/src/classes/HMSRole.ts +0 -9
- package/src/classes/HMSRoleChangeRequest.ts +5 -3
- package/src/classes/HMSRtmpStreamingState.ts +4 -4
- package/src/classes/HMSSDK.tsx +629 -269
- package/src/classes/HMSServerRecordingState.ts +2 -2
- package/src/classes/HMSSubscribeSettings.ts +1 -7
- package/src/index.ts +1 -0
package/src/classes/HMSSDK.tsx
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
AppState,
|
|
4
|
-
NativeEventEmitter,
|
|
5
4
|
NativeModules,
|
|
6
5
|
Platform,
|
|
7
6
|
ViewStyle,
|
|
8
7
|
} from 'react-native';
|
|
9
|
-
|
|
10
8
|
import { HMSEncoder } from './HMSEncoder';
|
|
11
9
|
import { HMSHelper } from './HMSHelper';
|
|
12
10
|
import { HMSLocalAudioStats } from './HMSLocalAudioStats';
|
|
@@ -36,6 +34,7 @@ import type { HMSAudioMixingMode } from './HMSAudioMixingMode';
|
|
|
36
34
|
import type { HMSLogSettings } from './HMSLogSettings';
|
|
37
35
|
import { HMSMessageType } from './HMSMessageType';
|
|
38
36
|
import { HMSPIPListenerActions } from './HMSPIPListenerActions';
|
|
37
|
+
import { type HMSEventSubscription, HMSNativeEventEmitter } from './HMSNativeEventEmitter';
|
|
39
38
|
|
|
40
39
|
interface HmsViewProps {
|
|
41
40
|
trackId: string;
|
|
@@ -61,7 +60,7 @@ const {
|
|
|
61
60
|
|
|
62
61
|
const ReactNativeVersion = require('react-native/Libraries/Core/ReactNativeVersion');
|
|
63
62
|
|
|
64
|
-
const HmsEventEmitter = new
|
|
63
|
+
const HmsEventEmitter = new HMSNativeEventEmitter(HMSManager);
|
|
65
64
|
|
|
66
65
|
let HmsSdk: HMSSDK | undefined;
|
|
67
66
|
|
|
@@ -91,6 +90,13 @@ export class HMSSDK {
|
|
|
91
90
|
private onAudioDeviceChangedDelegate?: any;
|
|
92
91
|
private onPIPRoomLeaveDelegate?: any;
|
|
93
92
|
|
|
93
|
+
private emitterSubscriptions: Partial<
|
|
94
|
+
Record<
|
|
95
|
+
HMSUpdateListenerActions | HMSPIPListenerActions,
|
|
96
|
+
HMSEventSubscription
|
|
97
|
+
>
|
|
98
|
+
> = {};
|
|
99
|
+
|
|
94
100
|
private constructor(id: string) {
|
|
95
101
|
this.id = id;
|
|
96
102
|
}
|
|
@@ -131,7 +137,6 @@ export class HMSSDK {
|
|
|
131
137
|
logSettings: params?.logSettings,
|
|
132
138
|
});
|
|
133
139
|
HmsSdk = new HMSSDK(id);
|
|
134
|
-
HmsSdk.attachListeners();
|
|
135
140
|
return HmsSdk;
|
|
136
141
|
}
|
|
137
142
|
|
|
@@ -160,228 +165,10 @@ export class HMSSDK {
|
|
|
160
165
|
*/
|
|
161
166
|
destroy = async () => {
|
|
162
167
|
logger?.verbose('#Function destroy', { id: this.id });
|
|
163
|
-
this.
|
|
168
|
+
this.removeAllListeners();
|
|
164
169
|
return await HMSManager.destroy({ id: this.id });
|
|
165
170
|
};
|
|
166
171
|
|
|
167
|
-
/**
|
|
168
|
-
* - Attaches all the listeners to native callbacks.
|
|
169
|
-
* Note: this function connects sdk to native side and not app to sdk.
|
|
170
|
-
* @memberof HMSSDK
|
|
171
|
-
*/
|
|
172
|
-
attachListeners = () => {
|
|
173
|
-
HmsEventEmitter.addListener(
|
|
174
|
-
HMSUpdateListenerActions.ON_PREVIEW,
|
|
175
|
-
this.onPreviewListener
|
|
176
|
-
);
|
|
177
|
-
|
|
178
|
-
HmsEventEmitter.addListener(
|
|
179
|
-
HMSUpdateListenerActions.ON_JOIN,
|
|
180
|
-
this.onJoinListener
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
HmsEventEmitter.addListener(
|
|
184
|
-
HMSUpdateListenerActions.ON_ROOM_UPDATE,
|
|
185
|
-
this.onRoomListener
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
HmsEventEmitter.addListener(
|
|
189
|
-
HMSUpdateListenerActions.ON_PEER_UPDATE,
|
|
190
|
-
this.onPeerListener
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
HmsEventEmitter.addListener(
|
|
194
|
-
HMSUpdateListenerActions.ON_TRACK_UPDATE,
|
|
195
|
-
this.onTrackListener
|
|
196
|
-
);
|
|
197
|
-
|
|
198
|
-
HmsEventEmitter.addListener(
|
|
199
|
-
HMSUpdateListenerActions.ON_ERROR,
|
|
200
|
-
this.onErrorListener
|
|
201
|
-
);
|
|
202
|
-
|
|
203
|
-
HmsEventEmitter.addListener(
|
|
204
|
-
HMSUpdateListenerActions.ON_MESSAGE,
|
|
205
|
-
this.onMessageListener
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
HmsEventEmitter.addListener(
|
|
209
|
-
HMSUpdateListenerActions.ON_SPEAKER,
|
|
210
|
-
this.onSpeakerListener
|
|
211
|
-
);
|
|
212
|
-
|
|
213
|
-
HmsEventEmitter.addListener(
|
|
214
|
-
HMSUpdateListenerActions.RECONNECTING,
|
|
215
|
-
this.reconnectingListener
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
HmsEventEmitter.addListener(
|
|
219
|
-
HMSUpdateListenerActions.RECONNECTED,
|
|
220
|
-
this.reconnectedListener
|
|
221
|
-
);
|
|
222
|
-
|
|
223
|
-
HmsEventEmitter.addListener(
|
|
224
|
-
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST,
|
|
225
|
-
this.onRoleChangeRequestListener
|
|
226
|
-
);
|
|
227
|
-
|
|
228
|
-
HmsEventEmitter.addListener(
|
|
229
|
-
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST,
|
|
230
|
-
this.onChangeTrackStateRequestListener
|
|
231
|
-
);
|
|
232
|
-
|
|
233
|
-
HmsEventEmitter.addListener(
|
|
234
|
-
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM,
|
|
235
|
-
this.onRemovedFromRoomListener
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
HmsEventEmitter.addListener(
|
|
239
|
-
HMSUpdateListenerActions.ON_RTC_STATS,
|
|
240
|
-
this.RTCStatsListener
|
|
241
|
-
);
|
|
242
|
-
|
|
243
|
-
HmsEventEmitter.addListener(
|
|
244
|
-
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS,
|
|
245
|
-
this.onLocalAudioStatsListener
|
|
246
|
-
);
|
|
247
|
-
|
|
248
|
-
HmsEventEmitter.addListener(
|
|
249
|
-
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS,
|
|
250
|
-
this.onLocalVideoStatsListener
|
|
251
|
-
);
|
|
252
|
-
|
|
253
|
-
HmsEventEmitter.addListener(
|
|
254
|
-
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS,
|
|
255
|
-
this.onRemoteAudioStatsListener
|
|
256
|
-
);
|
|
257
|
-
|
|
258
|
-
HmsEventEmitter.addListener(
|
|
259
|
-
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS,
|
|
260
|
-
this.onRemoteVideoStatsListener
|
|
261
|
-
);
|
|
262
|
-
|
|
263
|
-
HmsEventEmitter.addListener(
|
|
264
|
-
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED,
|
|
265
|
-
this.onAudioDeviceChangedListener
|
|
266
|
-
);
|
|
267
|
-
|
|
268
|
-
if (Platform.OS === 'android') {
|
|
269
|
-
HmsEventEmitter.addListener(
|
|
270
|
-
HMSPIPListenerActions.ON_PIP_ROOM_LEAVE,
|
|
271
|
-
this.onPIPRoomLeaveListener
|
|
272
|
-
);
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Disconnects all the listeners of this sdk from native listeners.
|
|
278
|
-
* Note: this function is only called from destroy function and should only be called when the current instance of {@link HMSSDK} is not required anymore.
|
|
279
|
-
* @memberof HMSSDK
|
|
280
|
-
*/
|
|
281
|
-
removeListeners = () => {
|
|
282
|
-
HmsEventEmitter.removeListener(
|
|
283
|
-
HMSUpdateListenerActions.ON_JOIN,
|
|
284
|
-
this.onJoinListener
|
|
285
|
-
);
|
|
286
|
-
|
|
287
|
-
HmsEventEmitter.removeListener(
|
|
288
|
-
HMSUpdateListenerActions.ON_PREVIEW,
|
|
289
|
-
this.onPreviewListener
|
|
290
|
-
);
|
|
291
|
-
|
|
292
|
-
HmsEventEmitter.removeListener(
|
|
293
|
-
HMSUpdateListenerActions.ON_ROOM_UPDATE,
|
|
294
|
-
this.onRoomListener
|
|
295
|
-
);
|
|
296
|
-
|
|
297
|
-
HmsEventEmitter.removeListener(
|
|
298
|
-
HMSUpdateListenerActions.ON_PEER_UPDATE,
|
|
299
|
-
this.onPeerListener
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
HmsEventEmitter.removeListener(
|
|
303
|
-
HMSUpdateListenerActions.ON_TRACK_UPDATE,
|
|
304
|
-
this.onTrackListener
|
|
305
|
-
);
|
|
306
|
-
|
|
307
|
-
HmsEventEmitter.removeListener(
|
|
308
|
-
HMSUpdateListenerActions.ON_ERROR,
|
|
309
|
-
this.onErrorListener
|
|
310
|
-
);
|
|
311
|
-
|
|
312
|
-
HmsEventEmitter.removeListener(
|
|
313
|
-
HMSUpdateListenerActions.ON_MESSAGE,
|
|
314
|
-
this.onMessageListener
|
|
315
|
-
);
|
|
316
|
-
|
|
317
|
-
HmsEventEmitter.removeListener(
|
|
318
|
-
HMSUpdateListenerActions.ON_SPEAKER,
|
|
319
|
-
this.onSpeakerListener
|
|
320
|
-
);
|
|
321
|
-
|
|
322
|
-
HmsEventEmitter.removeListener(
|
|
323
|
-
HMSUpdateListenerActions.RECONNECTING,
|
|
324
|
-
this.reconnectingListener
|
|
325
|
-
);
|
|
326
|
-
|
|
327
|
-
HmsEventEmitter.removeListener(
|
|
328
|
-
HMSUpdateListenerActions.RECONNECTED,
|
|
329
|
-
this.reconnectedListener
|
|
330
|
-
);
|
|
331
|
-
|
|
332
|
-
HmsEventEmitter.removeListener(
|
|
333
|
-
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST,
|
|
334
|
-
this.onRoleChangeRequestListener
|
|
335
|
-
);
|
|
336
|
-
|
|
337
|
-
HmsEventEmitter.removeListener(
|
|
338
|
-
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST,
|
|
339
|
-
this.onChangeTrackStateRequestListener
|
|
340
|
-
);
|
|
341
|
-
|
|
342
|
-
HmsEventEmitter.removeListener(
|
|
343
|
-
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM,
|
|
344
|
-
this.onRemovedFromRoomListener
|
|
345
|
-
);
|
|
346
|
-
|
|
347
|
-
HmsEventEmitter.removeListener(
|
|
348
|
-
HMSUpdateListenerActions.ON_RTC_STATS,
|
|
349
|
-
this.RTCStatsListener
|
|
350
|
-
);
|
|
351
|
-
|
|
352
|
-
HmsEventEmitter.removeListener(
|
|
353
|
-
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS,
|
|
354
|
-
this.onLocalAudioStatsListener
|
|
355
|
-
);
|
|
356
|
-
|
|
357
|
-
HmsEventEmitter.removeListener(
|
|
358
|
-
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS,
|
|
359
|
-
this.onLocalVideoStatsListener
|
|
360
|
-
);
|
|
361
|
-
|
|
362
|
-
HmsEventEmitter.removeListener(
|
|
363
|
-
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS,
|
|
364
|
-
this.onRemoteAudioStatsListener
|
|
365
|
-
);
|
|
366
|
-
|
|
367
|
-
HmsEventEmitter.removeListener(
|
|
368
|
-
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS,
|
|
369
|
-
this.onRemoteVideoStatsListener
|
|
370
|
-
);
|
|
371
|
-
|
|
372
|
-
HmsEventEmitter.removeListener(
|
|
373
|
-
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED,
|
|
374
|
-
this.onAudioDeviceChangedListener
|
|
375
|
-
);
|
|
376
|
-
|
|
377
|
-
if (Platform.OS === 'android') {
|
|
378
|
-
HmsEventEmitter.removeListener(
|
|
379
|
-
HMSPIPListenerActions.ON_PIP_ROOM_LEAVE,
|
|
380
|
-
this.onPIPRoomLeaveListener
|
|
381
|
-
);
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
|
|
385
172
|
/**
|
|
386
173
|
* takes an instance of [HMSConfig]{@link HMSConfig} and joins the room.
|
|
387
174
|
* after joining the room user will start receiving the events and updates of the room.
|
|
@@ -461,6 +248,12 @@ export class HMSSDK {
|
|
|
461
248
|
);
|
|
462
249
|
});
|
|
463
250
|
|
|
251
|
+
roomLeaveCleanup = () => {
|
|
252
|
+
this.muteStatus = undefined;
|
|
253
|
+
this?.appStateSubscription?.remove();
|
|
254
|
+
HMSEncoder.clearData(); // Clearing cached data in encoder
|
|
255
|
+
};
|
|
256
|
+
|
|
464
257
|
/**
|
|
465
258
|
* Calls leave function of native sdk and session of current user is invalidated.
|
|
466
259
|
*
|
|
@@ -475,8 +268,7 @@ export class HMSSDK {
|
|
|
475
268
|
};
|
|
476
269
|
|
|
477
270
|
const op = await HMSManager.leave(data);
|
|
478
|
-
this.
|
|
479
|
-
this?.appStateSubscription?.remove();
|
|
271
|
+
this.roomLeaveCleanup();
|
|
480
272
|
return op;
|
|
481
273
|
};
|
|
482
274
|
|
|
@@ -1303,66 +1095,376 @@ export class HMSSDK {
|
|
|
1303
1095
|
id: this.id,
|
|
1304
1096
|
});
|
|
1305
1097
|
switch (action) {
|
|
1306
|
-
case HMSUpdateListenerActions.ON_PREVIEW:
|
|
1098
|
+
case HMSUpdateListenerActions.ON_PREVIEW: {
|
|
1099
|
+
// Checking if we already have ON_PREVIEW subscription
|
|
1100
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_PREVIEW]) {
|
|
1101
|
+
// Adding ON_PREVIEW native listener
|
|
1102
|
+
const previewSubscription = HmsEventEmitter.addListener(
|
|
1103
|
+
this.id,
|
|
1104
|
+
HMSUpdateListenerActions.ON_PREVIEW,
|
|
1105
|
+
this.onPreviewListener
|
|
1106
|
+
);
|
|
1107
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_PREVIEW] =
|
|
1108
|
+
previewSubscription;
|
|
1109
|
+
}
|
|
1110
|
+
// Adding App Delegate listener
|
|
1307
1111
|
this.onPreviewDelegate = callback;
|
|
1308
1112
|
break;
|
|
1309
|
-
|
|
1113
|
+
}
|
|
1114
|
+
case HMSUpdateListenerActions.ON_JOIN: {
|
|
1115
|
+
// Checking if we already have ON_JOIN subscription
|
|
1116
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_JOIN]) {
|
|
1117
|
+
// Adding ON_JOIN native listener
|
|
1118
|
+
const joinSubscription = HmsEventEmitter.addListener(
|
|
1119
|
+
this.id,
|
|
1120
|
+
HMSUpdateListenerActions.ON_JOIN,
|
|
1121
|
+
this.onJoinListener
|
|
1122
|
+
);
|
|
1123
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_JOIN] =
|
|
1124
|
+
joinSubscription;
|
|
1125
|
+
}
|
|
1126
|
+
// Adding App Delegate listener
|
|
1310
1127
|
this.onJoinDelegate = callback;
|
|
1311
1128
|
break;
|
|
1312
|
-
|
|
1129
|
+
}
|
|
1130
|
+
case HMSUpdateListenerActions.ON_ROOM_UPDATE: {
|
|
1131
|
+
// Checking if we already have ON_ROOM_UPDATE subscription
|
|
1132
|
+
if (
|
|
1133
|
+
!this.emitterSubscriptions[HMSUpdateListenerActions.ON_ROOM_UPDATE]
|
|
1134
|
+
) {
|
|
1135
|
+
// Adding ON_ROOM_UPDATE native listener
|
|
1136
|
+
const roomSubscription = HmsEventEmitter.addListener(
|
|
1137
|
+
this.id,
|
|
1138
|
+
HMSUpdateListenerActions.ON_ROOM_UPDATE,
|
|
1139
|
+
this.onRoomListener
|
|
1140
|
+
);
|
|
1141
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_ROOM_UPDATE] =
|
|
1142
|
+
roomSubscription;
|
|
1143
|
+
}
|
|
1144
|
+
// Adding App Delegate listener
|
|
1313
1145
|
this.onRoomDelegate = callback;
|
|
1314
1146
|
break;
|
|
1315
|
-
|
|
1147
|
+
}
|
|
1148
|
+
case HMSUpdateListenerActions.ON_PEER_UPDATE: {
|
|
1149
|
+
// Checking if we already have ON_PEER_UPDATE subscription
|
|
1150
|
+
if (
|
|
1151
|
+
!this.emitterSubscriptions[HMSUpdateListenerActions.ON_PEER_UPDATE]
|
|
1152
|
+
) {
|
|
1153
|
+
// Adding ON_PEER_UPDATE native listener
|
|
1154
|
+
const peerSubscription = HmsEventEmitter.addListener(
|
|
1155
|
+
this.id,
|
|
1156
|
+
HMSUpdateListenerActions.ON_PEER_UPDATE,
|
|
1157
|
+
this.onPeerListener
|
|
1158
|
+
);
|
|
1159
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_PEER_UPDATE] =
|
|
1160
|
+
peerSubscription;
|
|
1161
|
+
}
|
|
1162
|
+
// Adding App Delegate listener
|
|
1316
1163
|
this.onPeerDelegate = callback;
|
|
1317
1164
|
break;
|
|
1318
|
-
|
|
1165
|
+
}
|
|
1166
|
+
case HMSUpdateListenerActions.ON_TRACK_UPDATE: {
|
|
1167
|
+
// Checking if we already have ON_TRACK_UPDATE subscription
|
|
1168
|
+
if (
|
|
1169
|
+
!this.emitterSubscriptions[HMSUpdateListenerActions.ON_TRACK_UPDATE]
|
|
1170
|
+
) {
|
|
1171
|
+
// Adding ON_TRACK_UPDATE native listener
|
|
1172
|
+
const trackSubscription = HmsEventEmitter.addListener(
|
|
1173
|
+
this.id,
|
|
1174
|
+
HMSUpdateListenerActions.ON_TRACK_UPDATE,
|
|
1175
|
+
this.onTrackListener
|
|
1176
|
+
);
|
|
1177
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_TRACK_UPDATE] =
|
|
1178
|
+
trackSubscription;
|
|
1179
|
+
}
|
|
1180
|
+
// Adding App Delegate listener
|
|
1319
1181
|
this.onTrackDelegate = callback;
|
|
1320
1182
|
break;
|
|
1321
|
-
|
|
1183
|
+
}
|
|
1184
|
+
case HMSUpdateListenerActions.ON_ERROR: {
|
|
1185
|
+
// Checking if we already have ON_ERROR subscription
|
|
1186
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_ERROR]) {
|
|
1187
|
+
// Adding ON_ERROR native listener
|
|
1188
|
+
const errorSubscription = HmsEventEmitter.addListener(
|
|
1189
|
+
this.id,
|
|
1190
|
+
HMSUpdateListenerActions.ON_ERROR,
|
|
1191
|
+
this.onErrorListener
|
|
1192
|
+
);
|
|
1193
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_ERROR] =
|
|
1194
|
+
errorSubscription;
|
|
1195
|
+
}
|
|
1196
|
+
// Adding App Delegate listener
|
|
1322
1197
|
this.onErrorDelegate = callback;
|
|
1323
1198
|
break;
|
|
1324
|
-
|
|
1199
|
+
}
|
|
1200
|
+
case HMSUpdateListenerActions.ON_MESSAGE: {
|
|
1201
|
+
// Checking if we already have ON_MESSAGE subscription
|
|
1202
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_MESSAGE]) {
|
|
1203
|
+
// Adding ON_MESSAGE native listener
|
|
1204
|
+
const messageSubscription = HmsEventEmitter.addListener(
|
|
1205
|
+
this.id,
|
|
1206
|
+
HMSUpdateListenerActions.ON_MESSAGE,
|
|
1207
|
+
this.onMessageListener
|
|
1208
|
+
);
|
|
1209
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_MESSAGE] =
|
|
1210
|
+
messageSubscription;
|
|
1211
|
+
}
|
|
1212
|
+
// Adding App Delegate listener
|
|
1325
1213
|
this.onMessageDelegate = callback;
|
|
1326
1214
|
break;
|
|
1327
|
-
|
|
1215
|
+
}
|
|
1216
|
+
case HMSUpdateListenerActions.ON_SPEAKER: {
|
|
1217
|
+
// Checking if we already have ON_SPEAKER subscription
|
|
1218
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_SPEAKER]) {
|
|
1219
|
+
// Adding ON_SPEAKER native listener
|
|
1220
|
+
const speakerSubscription = HmsEventEmitter.addListener(
|
|
1221
|
+
this.id,
|
|
1222
|
+
HMSUpdateListenerActions.ON_SPEAKER,
|
|
1223
|
+
this.onSpeakerListener
|
|
1224
|
+
);
|
|
1225
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_SPEAKER] =
|
|
1226
|
+
speakerSubscription;
|
|
1227
|
+
}
|
|
1228
|
+
// Adding App Delegate listener
|
|
1328
1229
|
this.onSpeakerDelegate = callback;
|
|
1329
1230
|
break;
|
|
1330
|
-
|
|
1231
|
+
}
|
|
1232
|
+
case HMSUpdateListenerActions.RECONNECTING: {
|
|
1233
|
+
// Checking if we already have RECONNECTING subscription
|
|
1234
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTING]) {
|
|
1235
|
+
// Adding RECONNECTING native listener
|
|
1236
|
+
const reconnectingSubscription = HmsEventEmitter.addListener(
|
|
1237
|
+
this.id,
|
|
1238
|
+
HMSUpdateListenerActions.RECONNECTING,
|
|
1239
|
+
this.reconnectingListener
|
|
1240
|
+
);
|
|
1241
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTING] =
|
|
1242
|
+
reconnectingSubscription;
|
|
1243
|
+
}
|
|
1244
|
+
// Adding App Delegate listener
|
|
1331
1245
|
this.onReconnectingDelegate = callback;
|
|
1332
1246
|
break;
|
|
1333
|
-
|
|
1247
|
+
}
|
|
1248
|
+
case HMSUpdateListenerActions.RECONNECTED: {
|
|
1249
|
+
// Checking if we already have RECONNECTED subscription
|
|
1250
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTED]) {
|
|
1251
|
+
// Adding RECONNECTED native listener
|
|
1252
|
+
const reconnectedSubscription = HmsEventEmitter.addListener(
|
|
1253
|
+
this.id,
|
|
1254
|
+
HMSUpdateListenerActions.RECONNECTED,
|
|
1255
|
+
this.reconnectedListener
|
|
1256
|
+
);
|
|
1257
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTED] =
|
|
1258
|
+
reconnectedSubscription;
|
|
1259
|
+
}
|
|
1260
|
+
// Adding App Delegate listener
|
|
1334
1261
|
this.onReconnectedDelegate = callback;
|
|
1335
1262
|
break;
|
|
1336
|
-
|
|
1263
|
+
}
|
|
1264
|
+
case HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST: {
|
|
1265
|
+
// Checking if we already have ON_ROLE_CHANGE_REQUEST subscription
|
|
1266
|
+
if (
|
|
1267
|
+
!this.emitterSubscriptions[
|
|
1268
|
+
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST
|
|
1269
|
+
]
|
|
1270
|
+
) {
|
|
1271
|
+
// Adding ON_ROLE_CHANGE_REQUEST native listener
|
|
1272
|
+
const roleChangeReqSubscription = HmsEventEmitter.addListener(
|
|
1273
|
+
this.id,
|
|
1274
|
+
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST,
|
|
1275
|
+
this.onRoleChangeRequestListener
|
|
1276
|
+
);
|
|
1277
|
+
this.emitterSubscriptions[
|
|
1278
|
+
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST
|
|
1279
|
+
] = roleChangeReqSubscription;
|
|
1280
|
+
}
|
|
1281
|
+
// Adding App Delegate listener
|
|
1337
1282
|
this.onRoleChangeRequestDelegate = callback;
|
|
1338
1283
|
break;
|
|
1339
|
-
|
|
1284
|
+
}
|
|
1285
|
+
case HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST: {
|
|
1286
|
+
// Checking if we already have ON_CHANGE_TRACK_STATE_REQUEST subscription
|
|
1287
|
+
if (
|
|
1288
|
+
!this.emitterSubscriptions[
|
|
1289
|
+
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST
|
|
1290
|
+
]
|
|
1291
|
+
) {
|
|
1292
|
+
// Adding ON_CHANGE_TRACK_STATE_REQUEST native listener
|
|
1293
|
+
const changeTrackReqSubscription = HmsEventEmitter.addListener(
|
|
1294
|
+
this.id,
|
|
1295
|
+
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST,
|
|
1296
|
+
this.onChangeTrackStateRequestListener
|
|
1297
|
+
);
|
|
1298
|
+
this.emitterSubscriptions[
|
|
1299
|
+
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST
|
|
1300
|
+
] = changeTrackReqSubscription;
|
|
1301
|
+
}
|
|
1302
|
+
// Adding App Delegate listener
|
|
1340
1303
|
this.onChangeTrackStateRequestDelegate = callback;
|
|
1341
1304
|
break;
|
|
1342
|
-
|
|
1305
|
+
}
|
|
1306
|
+
case HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM: {
|
|
1307
|
+
// Checking if we already have ON_REMOVED_FROM_ROOM subscription
|
|
1308
|
+
if (
|
|
1309
|
+
!this.emitterSubscriptions[
|
|
1310
|
+
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM
|
|
1311
|
+
]
|
|
1312
|
+
) {
|
|
1313
|
+
// Adding ON_REMOVED_FROM_ROOM native listener
|
|
1314
|
+
const removedFromRoomSubscription = HmsEventEmitter.addListener(
|
|
1315
|
+
this.id,
|
|
1316
|
+
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM,
|
|
1317
|
+
this.onRemovedFromRoomListener
|
|
1318
|
+
);
|
|
1319
|
+
this.emitterSubscriptions[
|
|
1320
|
+
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM
|
|
1321
|
+
] = removedFromRoomSubscription;
|
|
1322
|
+
}
|
|
1323
|
+
// Adding App Delegate listener
|
|
1343
1324
|
this.onRemovedFromRoomDelegate = callback;
|
|
1344
1325
|
break;
|
|
1345
|
-
|
|
1326
|
+
}
|
|
1327
|
+
case HMSUpdateListenerActions.ON_RTC_STATS: {
|
|
1328
|
+
// Checking if we already have ON_RTC_STATS subscription
|
|
1329
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_RTC_STATS]) {
|
|
1330
|
+
// Adding ON_RTC_STATS native listener
|
|
1331
|
+
const rtcStatsSubscription = HmsEventEmitter.addListener(
|
|
1332
|
+
this.id,
|
|
1333
|
+
HMSUpdateListenerActions.ON_RTC_STATS,
|
|
1334
|
+
this.RTCStatsListener
|
|
1335
|
+
);
|
|
1336
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_RTC_STATS] =
|
|
1337
|
+
rtcStatsSubscription;
|
|
1338
|
+
}
|
|
1339
|
+
// Adding App Delegate listener
|
|
1346
1340
|
this.onRtcStatsDelegate = callback;
|
|
1347
1341
|
break;
|
|
1348
|
-
|
|
1342
|
+
}
|
|
1343
|
+
case HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS: {
|
|
1344
|
+
// Checking if we already have ON_LOCAL_AUDIO_STATS subscription
|
|
1345
|
+
if (
|
|
1346
|
+
!this.emitterSubscriptions[
|
|
1347
|
+
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS
|
|
1348
|
+
]
|
|
1349
|
+
) {
|
|
1350
|
+
// Adding ON_LOCAL_AUDIO_STATS native listener
|
|
1351
|
+
const lclAudioStatsSubscription = HmsEventEmitter.addListener(
|
|
1352
|
+
this.id,
|
|
1353
|
+
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS,
|
|
1354
|
+
this.onLocalAudioStatsListener
|
|
1355
|
+
);
|
|
1356
|
+
this.emitterSubscriptions[
|
|
1357
|
+
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS
|
|
1358
|
+
] = lclAudioStatsSubscription;
|
|
1359
|
+
}
|
|
1360
|
+
// Adding App Delegate listener
|
|
1349
1361
|
this.onLocalAudioStatsDelegate = callback;
|
|
1350
1362
|
break;
|
|
1351
|
-
|
|
1363
|
+
}
|
|
1364
|
+
case HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS: {
|
|
1365
|
+
// Checking if we already have ON_LOCAL_VIDEO_STATS subscription
|
|
1366
|
+
if (
|
|
1367
|
+
!this.emitterSubscriptions[
|
|
1368
|
+
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS
|
|
1369
|
+
]
|
|
1370
|
+
) {
|
|
1371
|
+
// Adding ON_LOCAL_VIDEO_STATS native listener
|
|
1372
|
+
const lclVideoStatsSubscription = HmsEventEmitter.addListener(
|
|
1373
|
+
this.id,
|
|
1374
|
+
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS,
|
|
1375
|
+
this.onLocalVideoStatsListener
|
|
1376
|
+
);
|
|
1377
|
+
this.emitterSubscriptions[
|
|
1378
|
+
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS
|
|
1379
|
+
] = lclVideoStatsSubscription;
|
|
1380
|
+
}
|
|
1381
|
+
// Adding App Delegate listener
|
|
1352
1382
|
this.onLocalVideoStatsDelegate = callback;
|
|
1353
1383
|
break;
|
|
1354
|
-
|
|
1384
|
+
}
|
|
1385
|
+
case HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS: {
|
|
1386
|
+
// Checking if we already have ON_REMOTE_AUDIO_STATS subscription
|
|
1387
|
+
if (
|
|
1388
|
+
!this.emitterSubscriptions[
|
|
1389
|
+
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS
|
|
1390
|
+
]
|
|
1391
|
+
) {
|
|
1392
|
+
// Adding ON_REMOTE_AUDIO_STATS native listener
|
|
1393
|
+
const rmAudioStatsSubscription = HmsEventEmitter.addListener(
|
|
1394
|
+
this.id,
|
|
1395
|
+
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS,
|
|
1396
|
+
this.onRemoteAudioStatsListener
|
|
1397
|
+
);
|
|
1398
|
+
this.emitterSubscriptions[
|
|
1399
|
+
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS
|
|
1400
|
+
] = rmAudioStatsSubscription;
|
|
1401
|
+
}
|
|
1402
|
+
// Adding App Delegate listener
|
|
1355
1403
|
this.onRemoteAudioStatsDelegate = callback;
|
|
1356
1404
|
break;
|
|
1357
|
-
|
|
1405
|
+
}
|
|
1406
|
+
case HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS: {
|
|
1407
|
+
// Checking if we already have ON_REMOTE_VIDEO_STATS subscription
|
|
1408
|
+
if (
|
|
1409
|
+
!this.emitterSubscriptions[
|
|
1410
|
+
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS
|
|
1411
|
+
]
|
|
1412
|
+
) {
|
|
1413
|
+
// Adding ON_REMOTE_VIDEO_STATS native listener
|
|
1414
|
+
const rmVideoStatsSubscription = HmsEventEmitter.addListener(
|
|
1415
|
+
this.id,
|
|
1416
|
+
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS,
|
|
1417
|
+
this.onRemoteVideoStatsListener
|
|
1418
|
+
);
|
|
1419
|
+
this.emitterSubscriptions[
|
|
1420
|
+
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS
|
|
1421
|
+
] = rmVideoStatsSubscription;
|
|
1422
|
+
}
|
|
1423
|
+
// Adding App Delegate listener
|
|
1358
1424
|
this.onRemoteVideoStatsDelegate = callback;
|
|
1359
1425
|
break;
|
|
1360
|
-
|
|
1426
|
+
}
|
|
1427
|
+
case HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED: {
|
|
1428
|
+
// Checking if we already have ON_AUDIO_DEVICE_CHANGED subscription
|
|
1429
|
+
if (
|
|
1430
|
+
!this.emitterSubscriptions[
|
|
1431
|
+
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED
|
|
1432
|
+
]
|
|
1433
|
+
) {
|
|
1434
|
+
// Adding ON_AUDIO_DEVICE_CHANGED native listener
|
|
1435
|
+
const audDeviceChgSubscription = HmsEventEmitter.addListener(
|
|
1436
|
+
this.id,
|
|
1437
|
+
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED,
|
|
1438
|
+
this.onAudioDeviceChangedListener
|
|
1439
|
+
);
|
|
1440
|
+
this.emitterSubscriptions[
|
|
1441
|
+
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED
|
|
1442
|
+
] = audDeviceChgSubscription;
|
|
1443
|
+
}
|
|
1444
|
+
// Adding App Delegate listener
|
|
1361
1445
|
this.onAudioDeviceChangedDelegate = callback;
|
|
1362
1446
|
break;
|
|
1363
|
-
|
|
1364
|
-
|
|
1447
|
+
}
|
|
1448
|
+
case HMSPIPListenerActions.ON_PIP_ROOM_LEAVE: {
|
|
1449
|
+
if (Platform.OS === 'android') {
|
|
1450
|
+
// Checking if we already have ON_PIP_ROOM_LEAVE subscription
|
|
1451
|
+
if (
|
|
1452
|
+
!this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_ROOM_LEAVE]
|
|
1453
|
+
) {
|
|
1454
|
+
// Adding ON_PIP_ROOM_LEAVE native listener
|
|
1455
|
+
const pipRoomLeaveSubscription = HmsEventEmitter.addListener(
|
|
1456
|
+
this.id,
|
|
1457
|
+
HMSPIPListenerActions.ON_PIP_ROOM_LEAVE,
|
|
1458
|
+
this.onPIPRoomLeaveListener
|
|
1459
|
+
);
|
|
1460
|
+
this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_ROOM_LEAVE] =
|
|
1461
|
+
pipRoomLeaveSubscription;
|
|
1462
|
+
}
|
|
1463
|
+
// Adding App Delegate listener
|
|
1464
|
+
this.onPIPRoomLeaveDelegate = callback;
|
|
1465
|
+
}
|
|
1365
1466
|
break;
|
|
1467
|
+
}
|
|
1366
1468
|
default:
|
|
1367
1469
|
}
|
|
1368
1470
|
};
|
|
@@ -1379,66 +1481,312 @@ export class HMSSDK {
|
|
|
1379
1481
|
) => {
|
|
1380
1482
|
logger?.verbose('#Function removeEventListener', { action, id: this.id });
|
|
1381
1483
|
switch (action) {
|
|
1382
|
-
case HMSUpdateListenerActions.ON_PREVIEW:
|
|
1484
|
+
case HMSUpdateListenerActions.ON_PREVIEW: {
|
|
1485
|
+
const subscription =
|
|
1486
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_PREVIEW];
|
|
1487
|
+
// Removing ON_PREVIEW native listener
|
|
1488
|
+
if (subscription) {
|
|
1489
|
+
subscription.remove();
|
|
1490
|
+
|
|
1491
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_PREVIEW] =
|
|
1492
|
+
undefined;
|
|
1493
|
+
}
|
|
1494
|
+
// Removing App Delegate listener
|
|
1383
1495
|
this.onPreviewDelegate = null;
|
|
1384
1496
|
break;
|
|
1385
|
-
|
|
1497
|
+
}
|
|
1498
|
+
case HMSUpdateListenerActions.ON_JOIN: {
|
|
1499
|
+
const subscription =
|
|
1500
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_JOIN];
|
|
1501
|
+
// Removing ON_JOIN native listener
|
|
1502
|
+
if (subscription) {
|
|
1503
|
+
subscription.remove();
|
|
1504
|
+
|
|
1505
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_JOIN] =
|
|
1506
|
+
undefined;
|
|
1507
|
+
}
|
|
1508
|
+
// Removing App Delegate listener
|
|
1386
1509
|
this.onJoinDelegate = null;
|
|
1387
1510
|
break;
|
|
1388
|
-
|
|
1511
|
+
}
|
|
1512
|
+
case HMSUpdateListenerActions.ON_ROOM_UPDATE: {
|
|
1513
|
+
const subscription =
|
|
1514
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_ROOM_UPDATE];
|
|
1515
|
+
// Removing ON_ROOM_UPDATE native listener
|
|
1516
|
+
if (subscription) {
|
|
1517
|
+
subscription.remove();
|
|
1518
|
+
|
|
1519
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_ROOM_UPDATE] =
|
|
1520
|
+
undefined;
|
|
1521
|
+
}
|
|
1522
|
+
// Removing App Delegate listener
|
|
1389
1523
|
this.onRoomDelegate = null;
|
|
1390
1524
|
break;
|
|
1391
|
-
|
|
1525
|
+
}
|
|
1526
|
+
case HMSUpdateListenerActions.ON_PEER_UPDATE: {
|
|
1527
|
+
const subscription =
|
|
1528
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_PEER_UPDATE];
|
|
1529
|
+
// Removing ON_PEER_UPDATE native listener
|
|
1530
|
+
if (subscription) {
|
|
1531
|
+
subscription.remove();
|
|
1532
|
+
|
|
1533
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_PEER_UPDATE] =
|
|
1534
|
+
undefined;
|
|
1535
|
+
}
|
|
1536
|
+
// Removing App Delegate listener
|
|
1392
1537
|
this.onPeerDelegate = null;
|
|
1393
1538
|
break;
|
|
1394
|
-
|
|
1539
|
+
}
|
|
1540
|
+
case HMSUpdateListenerActions.ON_TRACK_UPDATE: {
|
|
1541
|
+
const subscription =
|
|
1542
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_TRACK_UPDATE];
|
|
1543
|
+
// Removing ON_TRACK_UPDATE native listener
|
|
1544
|
+
if (subscription) {
|
|
1545
|
+
subscription.remove();
|
|
1546
|
+
|
|
1547
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_TRACK_UPDATE] =
|
|
1548
|
+
undefined;
|
|
1549
|
+
}
|
|
1550
|
+
// Removing App Delegate listener
|
|
1395
1551
|
this.onTrackDelegate = null;
|
|
1396
1552
|
break;
|
|
1397
|
-
|
|
1553
|
+
}
|
|
1554
|
+
case HMSUpdateListenerActions.ON_ERROR: {
|
|
1555
|
+
const subscription =
|
|
1556
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_ERROR];
|
|
1557
|
+
// Removing ON_ERROR native listener
|
|
1558
|
+
if (subscription) {
|
|
1559
|
+
subscription.remove();
|
|
1560
|
+
|
|
1561
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_ERROR] =
|
|
1562
|
+
undefined;
|
|
1563
|
+
}
|
|
1564
|
+
// Removing App Delegate listener
|
|
1398
1565
|
this.onErrorDelegate = null;
|
|
1399
1566
|
break;
|
|
1400
|
-
|
|
1567
|
+
}
|
|
1568
|
+
case HMSUpdateListenerActions.ON_MESSAGE: {
|
|
1569
|
+
const subscription =
|
|
1570
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_MESSAGE];
|
|
1571
|
+
// Removing ON_MESSAGE native listener
|
|
1572
|
+
if (subscription) {
|
|
1573
|
+
subscription.remove();
|
|
1574
|
+
|
|
1575
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_MESSAGE] =
|
|
1576
|
+
undefined;
|
|
1577
|
+
}
|
|
1578
|
+
// Removing App Delegate listener
|
|
1401
1579
|
this.onMessageDelegate = null;
|
|
1402
1580
|
break;
|
|
1403
|
-
|
|
1581
|
+
}
|
|
1582
|
+
case HMSUpdateListenerActions.ON_SPEAKER: {
|
|
1583
|
+
const subscription =
|
|
1584
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_SPEAKER];
|
|
1585
|
+
// Removing ON_SPEAKER native listener
|
|
1586
|
+
if (subscription) {
|
|
1587
|
+
subscription.remove();
|
|
1588
|
+
|
|
1589
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_SPEAKER] =
|
|
1590
|
+
undefined;
|
|
1591
|
+
}
|
|
1592
|
+
// Removing App Delegate listener
|
|
1404
1593
|
this.onSpeakerDelegate = null;
|
|
1405
1594
|
break;
|
|
1406
|
-
|
|
1595
|
+
}
|
|
1596
|
+
case HMSUpdateListenerActions.RECONNECTING: {
|
|
1597
|
+
const subscription =
|
|
1598
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTING];
|
|
1599
|
+
// Removing RECONNECTING native listener
|
|
1600
|
+
if (subscription) {
|
|
1601
|
+
subscription.remove();
|
|
1602
|
+
|
|
1603
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTING] =
|
|
1604
|
+
undefined;
|
|
1605
|
+
}
|
|
1606
|
+
// Removing App Delegate listener
|
|
1407
1607
|
this.onReconnectingDelegate = null;
|
|
1408
1608
|
break;
|
|
1409
|
-
|
|
1609
|
+
}
|
|
1610
|
+
case HMSUpdateListenerActions.RECONNECTED: {
|
|
1611
|
+
const subscription =
|
|
1612
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTED];
|
|
1613
|
+
// Removing RECONNECTED native listener
|
|
1614
|
+
if (subscription) {
|
|
1615
|
+
subscription.remove();
|
|
1616
|
+
|
|
1617
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTED] =
|
|
1618
|
+
undefined;
|
|
1619
|
+
}
|
|
1620
|
+
// Removing App Delegate listener
|
|
1410
1621
|
this.onReconnectedDelegate = null;
|
|
1411
1622
|
break;
|
|
1412
|
-
|
|
1623
|
+
}
|
|
1624
|
+
case HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST: {
|
|
1625
|
+
const subscription =
|
|
1626
|
+
this.emitterSubscriptions[
|
|
1627
|
+
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST
|
|
1628
|
+
];
|
|
1629
|
+
// Removing ON_ROLE_CHANGE_REQUEST native listener
|
|
1630
|
+
if (subscription) {
|
|
1631
|
+
subscription.remove();
|
|
1632
|
+
|
|
1633
|
+
this.emitterSubscriptions[
|
|
1634
|
+
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST
|
|
1635
|
+
] = undefined;
|
|
1636
|
+
}
|
|
1637
|
+
// Removing App Delegate listener
|
|
1413
1638
|
this.onRoleChangeRequestDelegate = null;
|
|
1414
1639
|
break;
|
|
1415
|
-
|
|
1640
|
+
}
|
|
1641
|
+
case HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST: {
|
|
1642
|
+
const subscription =
|
|
1643
|
+
this.emitterSubscriptions[
|
|
1644
|
+
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST
|
|
1645
|
+
];
|
|
1646
|
+
// Removing ON_CHANGE_TRACK_STATE_REQUEST native listener
|
|
1647
|
+
if (subscription) {
|
|
1648
|
+
subscription.remove();
|
|
1649
|
+
|
|
1650
|
+
this.emitterSubscriptions[
|
|
1651
|
+
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST
|
|
1652
|
+
] = undefined;
|
|
1653
|
+
}
|
|
1654
|
+
// Removing App Delegate listener
|
|
1416
1655
|
this.onChangeTrackStateRequestDelegate = null;
|
|
1417
1656
|
break;
|
|
1418
|
-
|
|
1657
|
+
}
|
|
1658
|
+
case HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM: {
|
|
1659
|
+
const subscription =
|
|
1660
|
+
this.emitterSubscriptions[
|
|
1661
|
+
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM
|
|
1662
|
+
];
|
|
1663
|
+
// Removing ON_REMOVED_FROM_ROOM native listener
|
|
1664
|
+
if (subscription) {
|
|
1665
|
+
subscription.remove();
|
|
1666
|
+
|
|
1667
|
+
this.emitterSubscriptions[
|
|
1668
|
+
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM
|
|
1669
|
+
] = undefined;
|
|
1670
|
+
}
|
|
1671
|
+
// Removing App Delegate listener
|
|
1419
1672
|
this.onRemovedFromRoomDelegate = null;
|
|
1420
1673
|
break;
|
|
1421
|
-
|
|
1674
|
+
}
|
|
1675
|
+
case HMSUpdateListenerActions.ON_RTC_STATS: {
|
|
1676
|
+
const subscription =
|
|
1677
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_RTC_STATS];
|
|
1678
|
+
// Removing ON_RTC_STATS native listener
|
|
1679
|
+
if (subscription) {
|
|
1680
|
+
subscription.remove();
|
|
1681
|
+
|
|
1682
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_RTC_STATS] =
|
|
1683
|
+
undefined;
|
|
1684
|
+
}
|
|
1685
|
+
// Removing App Delegate listener
|
|
1422
1686
|
this.onRtcStatsDelegate = null;
|
|
1423
1687
|
break;
|
|
1424
|
-
|
|
1688
|
+
}
|
|
1689
|
+
case HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS: {
|
|
1690
|
+
const subscription =
|
|
1691
|
+
this.emitterSubscriptions[
|
|
1692
|
+
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS
|
|
1693
|
+
];
|
|
1694
|
+
// Removing ON_LOCAL_AUDIO_STATS native listener
|
|
1695
|
+
if (subscription) {
|
|
1696
|
+
subscription.remove();
|
|
1697
|
+
|
|
1698
|
+
this.emitterSubscriptions[
|
|
1699
|
+
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS
|
|
1700
|
+
] = undefined;
|
|
1701
|
+
}
|
|
1702
|
+
// Removing App Delegate listener
|
|
1425
1703
|
this.onLocalAudioStatsDelegate = null;
|
|
1426
1704
|
break;
|
|
1427
|
-
|
|
1705
|
+
}
|
|
1706
|
+
case HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS: {
|
|
1707
|
+
const subscription =
|
|
1708
|
+
this.emitterSubscriptions[
|
|
1709
|
+
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS
|
|
1710
|
+
];
|
|
1711
|
+
// Removing ON_LOCAL_VIDEO_STATS native listener
|
|
1712
|
+
if (subscription) {
|
|
1713
|
+
subscription.remove();
|
|
1714
|
+
|
|
1715
|
+
this.emitterSubscriptions[
|
|
1716
|
+
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS
|
|
1717
|
+
] = undefined;
|
|
1718
|
+
}
|
|
1719
|
+
// Removing App Delegate listener
|
|
1428
1720
|
this.onLocalVideoStatsDelegate = null;
|
|
1429
1721
|
break;
|
|
1430
|
-
|
|
1722
|
+
}
|
|
1723
|
+
case HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS: {
|
|
1724
|
+
const subscription =
|
|
1725
|
+
this.emitterSubscriptions[
|
|
1726
|
+
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS
|
|
1727
|
+
];
|
|
1728
|
+
// Removing ON_REMOTE_AUDIO_STATS native listener
|
|
1729
|
+
if (subscription) {
|
|
1730
|
+
subscription.remove();
|
|
1731
|
+
|
|
1732
|
+
this.emitterSubscriptions[
|
|
1733
|
+
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS
|
|
1734
|
+
] = undefined;
|
|
1735
|
+
}
|
|
1736
|
+
// Removing App Delegate listener
|
|
1431
1737
|
this.onRemoteAudioStatsDelegate = null;
|
|
1432
1738
|
break;
|
|
1433
|
-
|
|
1739
|
+
}
|
|
1740
|
+
case HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS: {
|
|
1741
|
+
const subscription =
|
|
1742
|
+
this.emitterSubscriptions[
|
|
1743
|
+
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS
|
|
1744
|
+
];
|
|
1745
|
+
// Removing ON_REMOTE_VIDEO_STATS native listener
|
|
1746
|
+
if (subscription) {
|
|
1747
|
+
subscription.remove();
|
|
1748
|
+
|
|
1749
|
+
this.emitterSubscriptions[
|
|
1750
|
+
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS
|
|
1751
|
+
] = undefined;
|
|
1752
|
+
}
|
|
1753
|
+
// Removing App Delegate listener
|
|
1434
1754
|
this.onRemoteVideoStatsDelegate = null;
|
|
1435
1755
|
break;
|
|
1436
|
-
|
|
1756
|
+
}
|
|
1757
|
+
case HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED: {
|
|
1758
|
+
const subscription =
|
|
1759
|
+
this.emitterSubscriptions[
|
|
1760
|
+
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED
|
|
1761
|
+
];
|
|
1762
|
+
// Removing ON_AUDIO_DEVICE_CHANGED native listener
|
|
1763
|
+
if (subscription) {
|
|
1764
|
+
subscription.remove();
|
|
1765
|
+
|
|
1766
|
+
this.emitterSubscriptions[
|
|
1767
|
+
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED
|
|
1768
|
+
] = undefined;
|
|
1769
|
+
}
|
|
1770
|
+
// Removing App Delegate listener
|
|
1437
1771
|
this.onAudioDeviceChangedDelegate = null;
|
|
1438
1772
|
break;
|
|
1439
|
-
|
|
1440
|
-
|
|
1773
|
+
}
|
|
1774
|
+
case HMSPIPListenerActions.ON_PIP_ROOM_LEAVE: {
|
|
1775
|
+
if (Platform.OS === 'android') {
|
|
1776
|
+
const subscription =
|
|
1777
|
+
this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_ROOM_LEAVE];
|
|
1778
|
+
// Removing ON_PIP_ROOM_LEAVE native listener
|
|
1779
|
+
if (subscription) {
|
|
1780
|
+
subscription.remove();
|
|
1781
|
+
|
|
1782
|
+
this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_ROOM_LEAVE] =
|
|
1783
|
+
undefined;
|
|
1784
|
+
}
|
|
1785
|
+
// Removing App Delegate listener
|
|
1786
|
+
this.onPIPRoomLeaveDelegate = null;
|
|
1787
|
+
}
|
|
1441
1788
|
break;
|
|
1789
|
+
}
|
|
1442
1790
|
default:
|
|
1443
1791
|
}
|
|
1444
1792
|
};
|
|
@@ -1464,6 +1812,16 @@ export class HMSSDK {
|
|
|
1464
1812
|
this.onRemovedFromRoomDelegate = null;
|
|
1465
1813
|
this.onPIPRoomLeaveDelegate = null;
|
|
1466
1814
|
|
|
1815
|
+
// Getting list of all available `emitterSubscription` objects
|
|
1816
|
+
Object.values(this.emitterSubscriptions)
|
|
1817
|
+
.filter(Boolean)
|
|
1818
|
+
.forEach((emitterSubscription) => {
|
|
1819
|
+
emitterSubscription.remove();
|
|
1820
|
+
});
|
|
1821
|
+
|
|
1822
|
+
// clearing reference of all `emitterSubscription` objects
|
|
1823
|
+
this.emitterSubscriptions = {};
|
|
1824
|
+
|
|
1467
1825
|
logger?.verbose('#Function REMOVE_ALL_LISTENER', { id: this.id });
|
|
1468
1826
|
};
|
|
1469
1827
|
|
|
@@ -1648,6 +2006,8 @@ export class HMSSDK {
|
|
|
1648
2006
|
if (data.id !== this.id) {
|
|
1649
2007
|
return;
|
|
1650
2008
|
}
|
|
2009
|
+
this.roomLeaveCleanup();
|
|
2010
|
+
|
|
1651
2011
|
if (this.onRemovedFromRoomDelegate) {
|
|
1652
2012
|
let requestedBy = null;
|
|
1653
2013
|
if (data.requestedBy) {
|
|
@@ -1809,8 +2169,8 @@ export class HMSSDK {
|
|
|
1809
2169
|
if (data.id !== this.id) {
|
|
1810
2170
|
return;
|
|
1811
2171
|
}
|
|
1812
|
-
|
|
1813
|
-
this
|
|
2172
|
+
|
|
2173
|
+
this.roomLeaveCleanup();
|
|
1814
2174
|
|
|
1815
2175
|
if (this.onPIPRoomLeaveDelegate) {
|
|
1816
2176
|
logger?.verbose('#Listener onPIPRoomLeave_CALL', data);
|