@100mslive/react-native-hms 1.7.0 → 1.7.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.
Files changed (205) hide show
  1. package/README.md +30 -39
  2. package/android/.gradle/6.7.1/executionHistory/executionHistory.bin +0 -0
  3. package/android/.gradle/6.7.1/executionHistory/executionHistory.lock +0 -0
  4. package/android/.gradle/6.7.1/fileChanges/last-build.bin +0 -0
  5. package/android/.gradle/6.7.1/fileHashes/fileHashes.bin +0 -0
  6. package/android/.gradle/6.7.1/fileHashes/fileHashes.lock +0 -0
  7. package/android/.gradle/6.7.1/gc.properties +0 -0
  8. package/android/.gradle/6.9/executionHistory/executionHistory.bin +0 -0
  9. package/android/.gradle/6.9/executionHistory/executionHistory.lock +0 -0
  10. package/android/.gradle/6.9/fileChanges/last-build.bin +0 -0
  11. package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
  12. package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
  13. package/android/.gradle/6.9/gc.properties +0 -0
  14. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  15. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  16. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  17. package/android/.gradle/checksums/checksums.lock +0 -0
  18. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  19. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  20. package/android/.gradle/configuration-cache/gc.properties +0 -0
  21. package/android/.gradle/vcs-1/gc.properties +0 -0
  22. package/android/build.gradle +16 -9
  23. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  24. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  25. package/android/gradlew +103 -104
  26. package/android/gradlew.bat +3 -18
  27. package/android/local.properties +0 -7
  28. package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +37 -9
  29. package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +2 -1
  30. package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +7 -0
  31. package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +39 -10
  32. package/ios/HMSDecoder.swift +9 -10
  33. package/ios/HMSHelper.swift +6 -2
  34. package/ios/HMSManager.m +4 -0
  35. package/ios/HMSManager.swift +8 -0
  36. package/ios/HMSRNSDK.swift +54 -24
  37. package/lib/commonjs/classes/HMSAudioTrack.js.map +1 -1
  38. package/lib/commonjs/classes/HMSBrowserRecordingState.js +2 -0
  39. package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
  40. package/lib/commonjs/classes/HMSCameraControl.js +3 -5
  41. package/lib/commonjs/classes/HMSCameraControl.js.map +1 -1
  42. package/lib/commonjs/classes/HMSEncoder.js +42 -40
  43. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  44. package/lib/commonjs/classes/HMSEventEmitter.js +10 -0
  45. package/lib/commonjs/classes/HMSEventEmitter.js.map +1 -0
  46. package/lib/commonjs/classes/HMSHelper.js +1 -1
  47. package/lib/commonjs/classes/HMSHelper.js.map +1 -1
  48. package/lib/commonjs/classes/HMSLocalAudioTrack.js +2 -2
  49. package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
  50. package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
  51. package/lib/commonjs/classes/HMSLocalVideoTrack.js +2 -2
  52. package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
  53. package/lib/commonjs/classes/HMSLogger.js +4 -4
  54. package/lib/commonjs/classes/HMSLogger.js.map +1 -1
  55. package/lib/commonjs/classes/HMSManagerModule.js +18 -0
  56. package/lib/commonjs/classes/HMSManagerModule.js.map +1 -0
  57. package/lib/commonjs/classes/HMSMessage.js.map +1 -1
  58. package/lib/commonjs/classes/HMSNativeEventEmitter.js +6 -6
  59. package/lib/commonjs/classes/HMSNativeEventEmitter.js.map +1 -1
  60. package/lib/commonjs/classes/HMSNativeEventListener.js +13 -0
  61. package/lib/commonjs/classes/HMSNativeEventListener.js.map +1 -0
  62. package/lib/commonjs/classes/HMSPeer.js +2 -15
  63. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  64. package/lib/commonjs/classes/HMSPeersCache.js +3 -5
  65. package/lib/commonjs/classes/HMSPeersCache.js.map +1 -1
  66. package/lib/commonjs/classes/HMSRemoteAudioTrack.js +2 -2
  67. package/lib/commonjs/classes/HMSRemoteAudioTrack.js.map +1 -1
  68. package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
  69. package/lib/commonjs/classes/HMSRemoteVideoTrack.js +5 -5
  70. package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
  71. package/lib/commonjs/classes/HMSRoom.js.map +1 -1
  72. package/lib/commonjs/classes/HMSRoomCache.js +10 -5
  73. package/lib/commonjs/classes/HMSRoomCache.js.map +1 -1
  74. package/lib/commonjs/classes/HMSSDK.js +165 -170
  75. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  76. package/lib/commonjs/classes/HMSSessionStore.js +9 -10
  77. package/lib/commonjs/classes/HMSSessionStore.js.map +1 -1
  78. package/lib/commonjs/classes/HMSTrack.js.map +1 -1
  79. package/lib/commonjs/classes/HMSVideoTrack.js.map +1 -1
  80. package/lib/commonjs/classes/HmsView.js +1 -1
  81. package/lib/commonjs/classes/HmsView.js.map +1 -1
  82. package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js +8 -8
  83. package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
  84. package/lib/commonjs/components/HMSHLSPlayer/RCTHMSHLSPlayer.js.map +1 -1
  85. package/lib/commonjs/components/HMSHLSPlayer/hooks.js.map +1 -1
  86. package/lib/commonjs/hooks/useHMSPeerUpdates.js +77 -0
  87. package/lib/commonjs/hooks/useHMSPeerUpdates.js.map +1 -0
  88. package/lib/commonjs/index.js +25 -13
  89. package/lib/commonjs/index.js.map +1 -1
  90. package/lib/module/classes/HMSAudioTrack.js.map +1 -1
  91. package/lib/module/classes/HMSBrowserRecordingState.js +2 -0
  92. package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -1
  93. package/lib/module/classes/HMSCameraControl.js +1 -4
  94. package/lib/module/classes/HMSCameraControl.js.map +1 -1
  95. package/lib/module/classes/HMSEncoder.js +40 -39
  96. package/lib/module/classes/HMSEncoder.js.map +1 -1
  97. package/lib/module/classes/HMSEventEmitter.js +3 -0
  98. package/lib/module/classes/HMSEventEmitter.js.map +1 -0
  99. package/lib/module/classes/HMSHelper.js +1 -1
  100. package/lib/module/classes/HMSHelper.js.map +1 -1
  101. package/lib/module/classes/HMSLocalAudioTrack.js +2 -2
  102. package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
  103. package/lib/module/classes/HMSLocalPeer.js.map +1 -1
  104. package/lib/module/classes/HMSLocalVideoTrack.js +2 -2
  105. package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
  106. package/lib/module/classes/HMSLogger.js +4 -4
  107. package/lib/module/classes/HMSLogger.js.map +1 -1
  108. package/lib/module/classes/HMSManagerModule.js +11 -0
  109. package/lib/module/classes/HMSManagerModule.js.map +1 -0
  110. package/lib/module/classes/HMSMessage.js.map +1 -1
  111. package/lib/module/classes/HMSNativeEventEmitter.js +6 -6
  112. package/lib/module/classes/HMSNativeEventEmitter.js.map +1 -1
  113. package/lib/module/classes/HMSNativeEventListener.js +5 -0
  114. package/lib/module/classes/HMSNativeEventListener.js.map +1 -0
  115. package/lib/module/classes/HMSPeer.js +2 -15
  116. package/lib/module/classes/HMSPeer.js.map +1 -1
  117. package/lib/module/classes/HMSPeersCache.js +1 -4
  118. package/lib/module/classes/HMSPeersCache.js.map +1 -1
  119. package/lib/module/classes/HMSRemoteAudioTrack.js +2 -2
  120. package/lib/module/classes/HMSRemoteAudioTrack.js.map +1 -1
  121. package/lib/module/classes/HMSRemotePeer.js.map +1 -1
  122. package/lib/module/classes/HMSRemoteVideoTrack.js +5 -5
  123. package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
  124. package/lib/module/classes/HMSRoom.js.map +1 -1
  125. package/lib/module/classes/HMSRoomCache.js +8 -4
  126. package/lib/module/classes/HMSRoomCache.js.map +1 -1
  127. package/lib/module/classes/HMSSDK.js +113 -118
  128. package/lib/module/classes/HMSSDK.js.map +1 -1
  129. package/lib/module/classes/HMSSessionStore.js +5 -7
  130. package/lib/module/classes/HMSSessionStore.js.map +1 -1
  131. package/lib/module/classes/HMSTrack.js.map +1 -1
  132. package/lib/module/classes/HMSVideoTrack.js.map +1 -1
  133. package/lib/module/classes/HmsView.js +1 -1
  134. package/lib/module/classes/HmsView.js.map +1 -1
  135. package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js +8 -8
  136. package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
  137. package/lib/module/components/HMSHLSPlayer/RCTHMSHLSPlayer.js.map +1 -1
  138. package/lib/module/components/HMSHLSPlayer/hooks.js.map +1 -1
  139. package/lib/module/hooks/useHMSPeerUpdates.js +67 -0
  140. package/lib/module/hooks/useHMSPeerUpdates.js.map +1 -0
  141. package/lib/module/index.js +6 -1
  142. package/lib/module/index.js.map +1 -1
  143. package/lib/typescript/classes/HMSAudioTrack.d.ts +2 -1
  144. package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +2 -0
  145. package/lib/typescript/classes/HMSEventEmitter.d.ts +2 -0
  146. package/lib/typescript/classes/HMSLocalAudioTrack.d.ts +2 -1
  147. package/lib/typescript/classes/HMSLocalPeer.d.ts +4 -2
  148. package/lib/typescript/classes/HMSLocalVideoTrack.d.ts +2 -1
  149. package/lib/typescript/classes/HMSManagerModule.d.ts +3 -0
  150. package/lib/typescript/classes/HMSMessage.d.ts +2 -3
  151. package/lib/typescript/classes/HMSNativeEventListener.d.ts +4 -0
  152. package/lib/typescript/classes/HMSPeer.d.ts +2 -3
  153. package/lib/typescript/classes/HMSRemoteAudioTrack.d.ts +2 -1
  154. package/lib/typescript/classes/HMSRemotePeer.d.ts +4 -2
  155. package/lib/typescript/classes/HMSRemoteVideoTrack.d.ts +2 -1
  156. package/lib/typescript/classes/HMSRoom.d.ts +1 -1
  157. package/lib/typescript/classes/HMSSDK.d.ts +8 -7
  158. package/lib/typescript/classes/HMSTrack.d.ts +3 -2
  159. package/lib/typescript/classes/HMSVideoTrack.d.ts +2 -1
  160. package/lib/typescript/classes/HmsView.d.ts +1 -1
  161. package/lib/typescript/components/HMSHLSPlayer/RCTHMSHLSPlayer.d.ts +1 -1
  162. package/lib/typescript/components/HMSHLSPlayer/hooks.d.ts +1 -1
  163. package/lib/typescript/hooks/useHMSPeerUpdates.d.ts +7 -0
  164. package/lib/typescript/index.d.ts +2 -1
  165. package/package.json +2 -2
  166. package/sdk-versions.json +2 -2
  167. package/src/classes/HMSAudioTrack.ts +2 -1
  168. package/src/classes/HMSBrowserRecordingState.ts +3 -0
  169. package/src/classes/HMSCameraControl.ts +1 -2
  170. package/src/classes/HMSEncoder.ts +7 -5
  171. package/src/classes/HMSEventEmitter.ts +3 -0
  172. package/src/classes/HMSLocalAudioTrack.ts +2 -1
  173. package/src/classes/HMSLocalPeer.ts +4 -2
  174. package/src/classes/HMSLocalVideoTrack.ts +2 -1
  175. package/src/classes/HMSManagerModule.ts +18 -0
  176. package/src/classes/HMSMessage.ts +2 -3
  177. package/src/classes/HMSNativeEventEmitter.ts +2 -1
  178. package/src/classes/HMSNativeEventListener.ts +8 -0
  179. package/src/classes/HMSPeer.ts +3 -26
  180. package/src/classes/HMSPeersCache.ts +2 -3
  181. package/src/classes/HMSRemoteAudioTrack.ts +2 -1
  182. package/src/classes/HMSRemotePeer.ts +4 -2
  183. package/src/classes/HMSRemoteVideoTrack.ts +2 -1
  184. package/src/classes/HMSRoom.ts +1 -1
  185. package/src/classes/HMSRoomCache.ts +11 -3
  186. package/src/classes/HMSSDK.tsx +47 -52
  187. package/src/classes/HMSSessionStore.ts +6 -8
  188. package/src/classes/HMSTrack.ts +3 -2
  189. package/src/classes/HMSVideoTrack.ts +2 -1
  190. package/src/classes/HmsView.tsx +4 -2
  191. package/src/components/HMSHLSPlayer/HMSHLSPlayer.tsx +36 -10
  192. package/src/components/HMSHLSPlayer/RCTHMSHLSPlayer.ts +2 -3
  193. package/src/components/HMSHLSPlayer/hooks.ts +3 -2
  194. package/src/hooks/useHMSPeerUpdates.ts +85 -0
  195. package/src/index.ts +6 -1
  196. package/ios/Hmssdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  197. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  198. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/yogesh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  199. package/ios/Hmssdk.xcodeproj/xcuserdata/yogesh.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  200. package/lib/commonjs/classes/HMSMessageType.js +0 -13
  201. package/lib/commonjs/classes/HMSMessageType.js.map +0 -1
  202. package/lib/module/classes/HMSMessageType.js +0 -6
  203. package/lib/module/classes/HMSMessageType.js.map +0 -1
  204. package/lib/typescript/classes/HMSMessageType.d.ts +0 -4
  205. package/src/classes/HMSMessageType.ts +0 -4
@@ -1,10 +1,9 @@
1
- import { NativeModules } from 'react-native';
1
+ import HMSManager from './HMSManagerModule';
2
+
2
3
  import type { HMSRoom } from './HMSRoom';
3
4
  import { HMSEncoder } from './HMSEncoder';
4
5
  import { HMSRoomUpdate } from './HMSRoomUpdate';
5
6
 
6
- const { HMSManager } = NativeModules;
7
-
8
7
  export let hmsRoomCache: HMSRoomCache | undefined;
9
8
 
10
9
  export const getHmsRoomCache = () => hmsRoomCache;
@@ -93,6 +92,13 @@ export class HMSRoomCache {
93
92
  );
94
93
  break;
95
94
  }
95
+ case HMSRoomUpdate.ROOM_PEER_COUNT_UPDATED: {
96
+ this._data.set(
97
+ 'peerCount',
98
+ encodeHMSRoomProperty(this.id, 'peerCount', data)
99
+ );
100
+ break;
101
+ }
96
102
  default: {
97
103
  for (const key in data) {
98
104
  const property = key as keyof HMSRoomCacheProps;
@@ -149,6 +155,8 @@ function encodeHMSRoomProperty<T extends keyof HMSRoomCacheProps>(
149
155
  value = HMSEncoder.encodeHLSRecordingState(data.hlsRecordingState);
150
156
  } else if (property === 'localPeer') {
151
157
  value = HMSEncoder.encodeHmsLocalPeer(data.localPeer, id);
158
+ } else if (property === 'peerCount') {
159
+ value = typeof data[property] === 'number' ? data[property] : null;
152
160
  } else {
153
161
  value = data[property];
154
162
  }
@@ -1,11 +1,14 @@
1
1
  import React from 'react';
2
- import { AppState, NativeModules, Platform } from 'react-native';
2
+ import { AppState, Platform } from 'react-native';
3
3
  import { HMSEncoder } from './HMSEncoder';
4
4
  import { HMSHelper } from './HMSHelper';
5
5
  import { getLogger, logger, setLogger } from './HMSLogger';
6
6
  import { HMSTrackType } from './HMSTrackType';
7
7
  import { HMSUpdateListenerActions } from './HMSUpdateListenerActions';
8
- import { HmsViewComponent, HmsComponentProps } from './HmsView';
8
+ import { HmsViewComponent } from './HmsView';
9
+ import type { HmsComponentProps } from './HmsView';
10
+
11
+ import HMSManager from './HMSManagerModule';
9
12
 
10
13
  import type { HMSConfig } from './HMSConfig';
11
14
  import type { HMSLocalPeer } from './HMSLocalPeer';
@@ -23,10 +26,9 @@ import type { HMSAudioDevice } from './HMSAudioDevice';
23
26
  import type { HMSAudioMode } from './HMSAudioMode';
24
27
  import type { HMSAudioMixingMode } from './HMSAudioMixingMode';
25
28
  import type { HMSLogSettings } from './HMSLogSettings';
26
- import { HMSMessageType } from './HMSMessageType';
27
29
  import { HMSPIPListenerActions } from './HMSPIPListenerActions';
28
- import type { HMSEventSubscription } from './HMSNativeEventEmitter';
29
- import { HMSNativeEventEmitter } from './HMSNativeEventEmitter';
30
+ import HMSNativeEventListener from './HMSNativeEventListener';
31
+ import type { HMSNativeEventSubscription } from './HMSNativeEventListener';
30
32
  import {
31
33
  clearHmsPeersCache,
32
34
  getHmsPeersCache,
@@ -52,17 +54,8 @@ interface PIPConfig {
52
54
  videoButton?: boolean;
53
55
  }
54
56
 
55
- const {
56
- /**
57
- * @ignore
58
- */
59
- HMSManager,
60
- } = NativeModules;
61
-
62
57
  const ReactNativeVersion = require('react-native/Libraries/Core/ReactNativeVersion');
63
58
 
64
- const HmsEventEmitter = new HMSNativeEventEmitter(HMSManager);
65
-
66
59
  let HmsSdk: HMSSDK | undefined;
67
60
 
68
61
  export class HMSSDK {
@@ -94,7 +87,7 @@ export class HMSSDK {
94
87
  private emitterSubscriptions: Partial<
95
88
  Record<
96
89
  HMSUpdateListenerActions | HMSPIPListenerActions,
97
- HMSEventSubscription
90
+ HMSNativeEventSubscription
98
91
  >
99
92
  > = {};
100
93
 
@@ -124,6 +117,7 @@ export class HMSSDK {
124
117
  appGroup?: String;
125
118
  preferredExtension?: String;
126
119
  logSettings?: HMSLogSettings;
120
+ isPrebuilt?: boolean;
127
121
  }) {
128
122
  const { version } = require('../../package.json');
129
123
  const { major, minor, patch } = ReactNativeVersion.version;
@@ -134,6 +128,7 @@ export class HMSSDK {
134
128
  frameworkInfo: {
135
129
  version: major + '.' + minor + '.' + patch,
136
130
  sdkVersion: version,
131
+ isPrebuilt: params?.isPrebuilt || false,
137
132
  },
138
133
  logSettings: params?.logSettings,
139
134
  });
@@ -302,13 +297,11 @@ export class HMSSDK {
302
297
  *
303
298
  * checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
304
299
  *
305
- * @param {message: string} and @param {type: string}
306
300
  * @memberof HMSSDK
301
+ * @param message the message that is to be sent
302
+ * @param type the default type is set to CHAT. You can pass a custom type here for sending events like Emoji Reactions, Notifications, etc
307
303
  */
308
- sendBroadcastMessage = async (
309
- message: string,
310
- type: HMSMessageType = HMSMessageType.CHAT
311
- ) => {
304
+ sendBroadcastMessage = async (message: string, type: string = 'chat') => {
312
305
  logger?.verbose('#Function sendBroadcastMessage', {
313
306
  message,
314
307
  type: type || null,
@@ -335,7 +328,7 @@ export class HMSSDK {
335
328
  sendGroupMessage = async (
336
329
  message: string,
337
330
  roles: HMSRole[],
338
- type: HMSMessageType = HMSMessageType.CHAT
331
+ type: string = 'chat'
339
332
  ) => {
340
333
  logger?.verbose('#Function sendGroupMessage', {
341
334
  message,
@@ -365,7 +358,7 @@ export class HMSSDK {
365
358
  sendDirectMessage = async (
366
359
  message: string,
367
360
  peer: HMSPeer,
368
- type: HMSMessageType = HMSMessageType.CHAT
361
+ type: string = 'chat'
369
362
  ) => {
370
363
  logger?.verbose('#Function sendDirectMessage', {
371
364
  message,
@@ -1007,8 +1000,8 @@ export class HMSSDK {
1007
1000
  *
1008
1001
  * checkout {@link https://www.100ms.live/docs/react-native/v2/features/audio-output-routing#switch-audio-focus-to-another-device} for more info
1009
1002
  *
1010
- * @param {HMSAudioDevice}
1011
1003
  * @memberof HMSSDK
1004
+ * @param audioDevice
1012
1005
  */
1013
1006
  switchAudioOutput = (audioDevice: HMSAudioDevice) => {
1014
1007
  logger?.verbose('#Function switchAudioOutput', {
@@ -1148,7 +1141,7 @@ export class HMSSDK {
1148
1141
  // Checking if we already have ON_PREVIEW subscription
1149
1142
  if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_PREVIEW]) {
1150
1143
  // Adding ON_PREVIEW native listener
1151
- const previewSubscription = HmsEventEmitter.addListener(
1144
+ const previewSubscription = HMSNativeEventListener.addListener(
1152
1145
  this.id,
1153
1146
  HMSUpdateListenerActions.ON_PREVIEW,
1154
1147
  this.onPreviewListener
@@ -1164,7 +1157,7 @@ export class HMSSDK {
1164
1157
  // Checking if we already have ON_JOIN subscription
1165
1158
  if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_JOIN]) {
1166
1159
  // Adding ON_JOIN native listener
1167
- const joinSubscription = HmsEventEmitter.addListener(
1160
+ const joinSubscription = HMSNativeEventListener.addListener(
1168
1161
  this.id,
1169
1162
  HMSUpdateListenerActions.ON_JOIN,
1170
1163
  this.onJoinListener
@@ -1182,7 +1175,7 @@ export class HMSSDK {
1182
1175
  !this.emitterSubscriptions[HMSUpdateListenerActions.ON_ROOM_UPDATE]
1183
1176
  ) {
1184
1177
  // Adding ON_ROOM_UPDATE native listener
1185
- const roomSubscription = HmsEventEmitter.addListener(
1178
+ const roomSubscription = HMSNativeEventListener.addListener(
1186
1179
  this.id,
1187
1180
  HMSUpdateListenerActions.ON_ROOM_UPDATE,
1188
1181
  this.onRoomListener
@@ -1200,7 +1193,7 @@ export class HMSSDK {
1200
1193
  !this.emitterSubscriptions[HMSUpdateListenerActions.ON_PEER_UPDATE]
1201
1194
  ) {
1202
1195
  // Adding ON_PEER_UPDATE native listener
1203
- const peerSubscription = HmsEventEmitter.addListener(
1196
+ const peerSubscription = HMSNativeEventListener.addListener(
1204
1197
  this.id,
1205
1198
  HMSUpdateListenerActions.ON_PEER_UPDATE,
1206
1199
  this.onPeerListener
@@ -1218,7 +1211,7 @@ export class HMSSDK {
1218
1211
  !this.emitterSubscriptions[HMSUpdateListenerActions.ON_TRACK_UPDATE]
1219
1212
  ) {
1220
1213
  // Adding ON_TRACK_UPDATE native listener
1221
- const trackSubscription = HmsEventEmitter.addListener(
1214
+ const trackSubscription = HMSNativeEventListener.addListener(
1222
1215
  this.id,
1223
1216
  HMSUpdateListenerActions.ON_TRACK_UPDATE,
1224
1217
  this.onTrackListener
@@ -1234,7 +1227,7 @@ export class HMSSDK {
1234
1227
  // Checking if we already have ON_ERROR subscription
1235
1228
  if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_ERROR]) {
1236
1229
  // Adding ON_ERROR native listener
1237
- const errorSubscription = HmsEventEmitter.addListener(
1230
+ const errorSubscription = HMSNativeEventListener.addListener(
1238
1231
  this.id,
1239
1232
  HMSUpdateListenerActions.ON_ERROR,
1240
1233
  this.onErrorListener
@@ -1250,7 +1243,7 @@ export class HMSSDK {
1250
1243
  // Checking if we already have ON_MESSAGE subscription
1251
1244
  if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_MESSAGE]) {
1252
1245
  // Adding ON_MESSAGE native listener
1253
- const messageSubscription = HmsEventEmitter.addListener(
1246
+ const messageSubscription = HMSNativeEventListener.addListener(
1254
1247
  this.id,
1255
1248
  HMSUpdateListenerActions.ON_MESSAGE,
1256
1249
  this.onMessageListener
@@ -1266,7 +1259,7 @@ export class HMSSDK {
1266
1259
  // Checking if we already have ON_SPEAKER subscription
1267
1260
  if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_SPEAKER]) {
1268
1261
  // Adding ON_SPEAKER native listener
1269
- const speakerSubscription = HmsEventEmitter.addListener(
1262
+ const speakerSubscription = HMSNativeEventListener.addListener(
1270
1263
  this.id,
1271
1264
  HMSUpdateListenerActions.ON_SPEAKER,
1272
1265
  this.onSpeakerListener
@@ -1282,7 +1275,7 @@ export class HMSSDK {
1282
1275
  // Checking if we already have RECONNECTING subscription
1283
1276
  if (!this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTING]) {
1284
1277
  // Adding RECONNECTING native listener
1285
- const reconnectingSubscription = HmsEventEmitter.addListener(
1278
+ const reconnectingSubscription = HMSNativeEventListener.addListener(
1286
1279
  this.id,
1287
1280
  HMSUpdateListenerActions.RECONNECTING,
1288
1281
  this.reconnectingListener
@@ -1298,7 +1291,7 @@ export class HMSSDK {
1298
1291
  // Checking if we already have RECONNECTED subscription
1299
1292
  if (!this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTED]) {
1300
1293
  // Adding RECONNECTED native listener
1301
- const reconnectedSubscription = HmsEventEmitter.addListener(
1294
+ const reconnectedSubscription = HMSNativeEventListener.addListener(
1302
1295
  this.id,
1303
1296
  HMSUpdateListenerActions.RECONNECTED,
1304
1297
  this.reconnectedListener
@@ -1318,7 +1311,7 @@ export class HMSSDK {
1318
1311
  ]
1319
1312
  ) {
1320
1313
  // Adding ON_ROLE_CHANGE_REQUEST native listener
1321
- const roleChangeReqSubscription = HmsEventEmitter.addListener(
1314
+ const roleChangeReqSubscription = HMSNativeEventListener.addListener(
1322
1315
  this.id,
1323
1316
  HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST,
1324
1317
  this.onRoleChangeRequestListener
@@ -1339,7 +1332,7 @@ export class HMSSDK {
1339
1332
  ]
1340
1333
  ) {
1341
1334
  // Adding ON_CHANGE_TRACK_STATE_REQUEST native listener
1342
- const changeTrackReqSubscription = HmsEventEmitter.addListener(
1335
+ const changeTrackReqSubscription = HMSNativeEventListener.addListener(
1343
1336
  this.id,
1344
1337
  HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST,
1345
1338
  this.onChangeTrackStateRequestListener
@@ -1360,11 +1353,12 @@ export class HMSSDK {
1360
1353
  ]
1361
1354
  ) {
1362
1355
  // Adding ON_REMOVED_FROM_ROOM native listener
1363
- const removedFromRoomSubscription = HmsEventEmitter.addListener(
1364
- this.id,
1365
- HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM,
1366
- this.onRemovedFromRoomListener
1367
- );
1356
+ const removedFromRoomSubscription =
1357
+ HMSNativeEventListener.addListener(
1358
+ this.id,
1359
+ HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM,
1360
+ this.onRemovedFromRoomListener
1361
+ );
1368
1362
  this.emitterSubscriptions[
1369
1363
  HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM
1370
1364
  ] = removedFromRoomSubscription;
@@ -1377,7 +1371,7 @@ export class HMSSDK {
1377
1371
  // Checking if we already have ON_RTC_STATS subscription
1378
1372
  if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_RTC_STATS]) {
1379
1373
  // Adding ON_RTC_STATS native listener
1380
- const rtcStatsSubscription = HmsEventEmitter.addListener(
1374
+ const rtcStatsSubscription = HMSNativeEventListener.addListener(
1381
1375
  this.id,
1382
1376
  HMSUpdateListenerActions.ON_RTC_STATS,
1383
1377
  this.RTCStatsListener
@@ -1397,7 +1391,7 @@ export class HMSSDK {
1397
1391
  ]
1398
1392
  ) {
1399
1393
  // Adding ON_LOCAL_AUDIO_STATS native listener
1400
- const lclAudioStatsSubscription = HmsEventEmitter.addListener(
1394
+ const lclAudioStatsSubscription = HMSNativeEventListener.addListener(
1401
1395
  this.id,
1402
1396
  HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS,
1403
1397
  this.onLocalAudioStatsListener
@@ -1418,7 +1412,7 @@ export class HMSSDK {
1418
1412
  ]
1419
1413
  ) {
1420
1414
  // Adding ON_LOCAL_VIDEO_STATS native listener
1421
- const lclVideoStatsSubscription = HmsEventEmitter.addListener(
1415
+ const lclVideoStatsSubscription = HMSNativeEventListener.addListener(
1422
1416
  this.id,
1423
1417
  HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS,
1424
1418
  this.onLocalVideoStatsListener
@@ -1439,7 +1433,7 @@ export class HMSSDK {
1439
1433
  ]
1440
1434
  ) {
1441
1435
  // Adding ON_REMOTE_AUDIO_STATS native listener
1442
- const rmAudioStatsSubscription = HmsEventEmitter.addListener(
1436
+ const rmAudioStatsSubscription = HMSNativeEventListener.addListener(
1443
1437
  this.id,
1444
1438
  HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS,
1445
1439
  this.onRemoteAudioStatsListener
@@ -1460,7 +1454,7 @@ export class HMSSDK {
1460
1454
  ]
1461
1455
  ) {
1462
1456
  // Adding ON_REMOTE_VIDEO_STATS native listener
1463
- const rmVideoStatsSubscription = HmsEventEmitter.addListener(
1457
+ const rmVideoStatsSubscription = HMSNativeEventListener.addListener(
1464
1458
  this.id,
1465
1459
  HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS,
1466
1460
  this.onRemoteVideoStatsListener
@@ -1481,7 +1475,7 @@ export class HMSSDK {
1481
1475
  ]
1482
1476
  ) {
1483
1477
  // Adding ON_AUDIO_DEVICE_CHANGED native listener
1484
- const audDeviceChgSubscription = HmsEventEmitter.addListener(
1478
+ const audDeviceChgSubscription = HMSNativeEventListener.addListener(
1485
1479
  this.id,
1486
1480
  HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED,
1487
1481
  this.onAudioDeviceChangedListener
@@ -1502,11 +1496,12 @@ export class HMSSDK {
1502
1496
  ]
1503
1497
  ) {
1504
1498
  // Adding ON_SESSION_STORE_AVAILABLE native listener
1505
- const sessionStoreAvailableSubscription = HmsEventEmitter.addListener(
1506
- this.id,
1507
- HMSUpdateListenerActions.ON_SESSION_STORE_AVAILABLE,
1508
- this.onSessionStoreAvailableListener
1509
- );
1499
+ const sessionStoreAvailableSubscription =
1500
+ HMSNativeEventListener.addListener(
1501
+ this.id,
1502
+ HMSUpdateListenerActions.ON_SESSION_STORE_AVAILABLE,
1503
+ this.onSessionStoreAvailableListener
1504
+ );
1510
1505
  this.emitterSubscriptions[
1511
1506
  HMSUpdateListenerActions.ON_SESSION_STORE_AVAILABLE
1512
1507
  ] = sessionStoreAvailableSubscription;
@@ -1522,7 +1517,7 @@ export class HMSSDK {
1522
1517
  !this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_ROOM_LEAVE]
1523
1518
  ) {
1524
1519
  // Adding ON_PIP_ROOM_LEAVE native listener
1525
- const pipRoomLeaveSubscription = HmsEventEmitter.addListener(
1520
+ const pipRoomLeaveSubscription = HMSNativeEventListener.addListener(
1526
1521
  this.id,
1527
1522
  HMSPIPListenerActions.ON_PIP_ROOM_LEAVE,
1528
1523
  this.onPIPRoomLeaveListener
@@ -1,16 +1,14 @@
1
- import {
2
- NativeModules,
3
- DeviceEventEmitter,
4
- EmitterSubscription as RNEmitterSubscription,
5
- } from 'react-native';
1
+ import { DeviceEventEmitter } from 'react-native';
2
+ import type { EmitterSubscription as RNEmitterSubscription } from 'react-native';
3
+
4
+ import HMSManager from './HMSManagerModule';
5
+
6
6
  import { HMSConstants } from './HMSConstants';
7
7
  import { getLogger } from './HMSLogger';
8
8
  import { HMSUpdateListenerActions } from './HMSUpdateListenerActions';
9
9
  import { EventEmitter } from '../utils';
10
10
  import type { EmitterSubscription } from '../utils';
11
11
 
12
- const { HMSManager } = NativeModules;
13
-
14
12
  type Nullable<T> = T | null | undefined;
15
13
 
16
14
  export type HMSSessionStoreValue = Nullable<string>;
@@ -148,7 +146,7 @@ export class HMSSessionStore {
148
146
  // this `uniqueId` will be used to remove 'KeyChangeListener' from native side
149
147
  const uniqueId =
150
148
  subscriptionsToRemove.length > 0
151
- ? (subscriptionsToRemove[0].context as { uniqueId: string }).uniqueId
149
+ ? (subscriptionsToRemove[0]!.context as { uniqueId: string }).uniqueId
152
150
  : null;
153
151
 
154
152
  // Removing required subscriptions from 'eventEmitter'
@@ -1,8 +1,9 @@
1
+ import type { HMSTrackSource } from './HMSTrackSource';
1
2
  import type { HMSTrackType } from './HMSTrackType';
2
3
 
3
4
  export class HMSTrack {
4
5
  trackId: string;
5
- source?: number | string;
6
+ source?: HMSTrackSource;
6
7
  trackDescription?: string;
7
8
  mute?: boolean;
8
9
  id: string;
@@ -14,7 +15,7 @@ export class HMSTrack {
14
15
 
15
16
  constructor(params: {
16
17
  trackId: string;
17
- source?: number | string;
18
+ source?: HMSTrackSource;
18
19
  trackDescription?: string;
19
20
  isMute?: boolean;
20
21
  id: string;
@@ -1,4 +1,5 @@
1
1
  import { HMSTrack } from './HMSTrack';
2
+ import type { HMSTrackSource } from './HMSTrackSource';
2
3
  import type { HMSTrackType } from './HMSTrackType';
3
4
 
4
5
  export class HMSVideoTrack extends HMSTrack {
@@ -6,7 +7,7 @@ export class HMSVideoTrack extends HMSTrack {
6
7
 
7
8
  constructor(params: {
8
9
  trackId: string;
9
- source?: number | string;
10
+ source?: HMSTrackSource;
10
11
  trackDescription?: string;
11
12
  isMute?: boolean;
12
13
  id: string;
@@ -4,9 +4,9 @@ import {
4
4
  requireNativeComponent,
5
5
  StyleSheet,
6
6
  UIManager,
7
- ViewStyle,
8
7
  Platform,
9
8
  } from 'react-native';
9
+ import type { ViewStyle } from 'react-native';
10
10
  import { HMSConstants } from './HMSConstants';
11
11
  import { HMSVideoViewMode } from './HMSVideoViewMode';
12
12
 
@@ -89,6 +89,8 @@ export const HmsViewComponent = React.forwardRef<any, HmsComponentProps>(
89
89
  };
90
90
 
91
91
  const capture = async () => {
92
+ const viewManagerConfig = UIManager.getViewManagerConfig('HMSView');
93
+
92
94
  let requestId = _nextRequestId++;
93
95
  let requestMap = _requestMap;
94
96
 
@@ -97,7 +99,7 @@ export const HmsViewComponent = React.forwardRef<any, HmsComponentProps>(
97
99
  let promise = new Promise(function (resolve, reject) {
98
100
  requestMap.set(requestId, { resolve, reject });
99
101
  });
100
- const viewManagerConfig = UIManager.getViewManagerConfig('HMSView');
102
+
101
103
  UIManager.dispatchViewManagerCommand(
102
104
  findNodeHandle(hmsViewRef.current),
103
105
  viewManagerConfig.Commands.capture,
@@ -10,11 +10,13 @@ import {
10
10
  setHMSHLSPlayerStatsError,
11
11
  } from './hooks';
12
12
  import {
13
+ RCTHMSHLSPlayer,
14
+ RCTHMSHLSPlayerViewManagerConfig,
15
+ } from './RCTHMSHLSPlayer';
16
+ import type {
13
17
  HmsHlsPlaybackEventHandler,
14
18
  HmsHlsStatsEventHandler,
15
- RCTHMSHLSPlayer,
16
19
  RCTHMSHLSPlayerRef,
17
- RCTHMSHLSPlayerViewManagerConfig,
18
20
  } from './RCTHMSHLSPlayer';
19
21
  import {
20
22
  HMSHLSPlayerPlaybackEventTypes,
@@ -64,7 +66,10 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
64
66
  ref,
65
67
  () => ({
66
68
  play: (url?: string) => {
67
- if (hmsHlsPlayerRef.current) {
69
+ if (
70
+ hmsHlsPlayerRef.current &&
71
+ RCTHMSHLSPlayerViewManagerConfig.Commands.play
72
+ ) {
68
73
  UIManager.dispatchViewManagerCommand(
69
74
  findNodeHandle(hmsHlsPlayerRef.current),
70
75
  RCTHMSHLSPlayerViewManagerConfig.Commands.play,
@@ -73,7 +78,10 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
73
78
  }
74
79
  },
75
80
  stop: () => {
76
- if (hmsHlsPlayerRef.current) {
81
+ if (
82
+ hmsHlsPlayerRef.current &&
83
+ RCTHMSHLSPlayerViewManagerConfig.Commands.stop
84
+ ) {
77
85
  UIManager.dispatchViewManagerCommand(
78
86
  findNodeHandle(hmsHlsPlayerRef.current),
79
87
  RCTHMSHLSPlayerViewManagerConfig.Commands.stop,
@@ -82,7 +90,10 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
82
90
  }
83
91
  },
84
92
  pause: () => {
85
- if (hmsHlsPlayerRef.current) {
93
+ if (
94
+ hmsHlsPlayerRef.current &&
95
+ RCTHMSHLSPlayerViewManagerConfig.Commands.pause
96
+ ) {
86
97
  UIManager.dispatchViewManagerCommand(
87
98
  findNodeHandle(hmsHlsPlayerRef.current),
88
99
  RCTHMSHLSPlayerViewManagerConfig.Commands.pause,
@@ -91,7 +102,10 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
91
102
  }
92
103
  },
93
104
  resume: () => {
94
- if (hmsHlsPlayerRef.current) {
105
+ if (
106
+ hmsHlsPlayerRef.current &&
107
+ RCTHMSHLSPlayerViewManagerConfig.Commands.resume
108
+ ) {
95
109
  UIManager.dispatchViewManagerCommand(
96
110
  findNodeHandle(hmsHlsPlayerRef.current),
97
111
  RCTHMSHLSPlayerViewManagerConfig.Commands.resume,
@@ -108,7 +122,10 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
108
122
  );
109
123
  }
110
124
 
111
- if (hmsHlsPlayerRef.current) {
125
+ if (
126
+ hmsHlsPlayerRef.current &&
127
+ RCTHMSHLSPlayerViewManagerConfig.Commands.seekForward
128
+ ) {
112
129
  UIManager.dispatchViewManagerCommand(
113
130
  findNodeHandle(hmsHlsPlayerRef.current),
114
131
  RCTHMSHLSPlayerViewManagerConfig.Commands.seekForward,
@@ -125,7 +142,10 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
125
142
  );
126
143
  }
127
144
 
128
- if (hmsHlsPlayerRef.current) {
145
+ if (
146
+ hmsHlsPlayerRef.current &&
147
+ RCTHMSHLSPlayerViewManagerConfig.Commands.seekBackward
148
+ ) {
129
149
  UIManager.dispatchViewManagerCommand(
130
150
  findNodeHandle(hmsHlsPlayerRef.current),
131
151
  RCTHMSHLSPlayerViewManagerConfig.Commands.seekBackward,
@@ -134,7 +154,10 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
134
154
  }
135
155
  },
136
156
  seekToLivePosition: () => {
137
- if (hmsHlsPlayerRef.current) {
157
+ if (
158
+ hmsHlsPlayerRef.current &&
159
+ RCTHMSHLSPlayerViewManagerConfig.Commands.seekToLivePosition
160
+ ) {
138
161
  UIManager.dispatchViewManagerCommand(
139
162
  findNodeHandle(hmsHlsPlayerRef.current),
140
163
  RCTHMSHLSPlayerViewManagerConfig.Commands.seekToLivePosition,
@@ -149,7 +172,10 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
149
172
  );
150
173
  }
151
174
 
152
- if (hmsHlsPlayerRef.current) {
175
+ if (
176
+ hmsHlsPlayerRef.current &&
177
+ RCTHMSHLSPlayerViewManagerConfig.Commands.setVolume
178
+ ) {
153
179
  UIManager.dispatchViewManagerCommand(
154
180
  findNodeHandle(hmsHlsPlayerRef.current),
155
181
  RCTHMSHLSPlayerViewManagerConfig.Commands.setVolume,
@@ -1,9 +1,8 @@
1
- import {
2
- requireNativeComponent,
1
+ import { requireNativeComponent, UIManager } from 'react-native';
2
+ import type {
3
3
  StyleProp,
4
4
  NativeSyntheticEvent,
5
5
  ViewStyle,
6
- UIManager,
7
6
  NativeMethods,
8
7
  } from 'react-native';
9
8
  import type {
@@ -1,4 +1,5 @@
1
- import { DependencyList, useEffect } from 'react';
1
+ import { useEffect } from 'react';
2
+ import type { DependencyList } from 'react';
2
3
  import { shallow } from 'zustand/shallow';
3
4
 
4
5
  import { useHMSHLSPlayerStatsStore } from '../../stores/hls-player-stats-store';
@@ -27,7 +28,7 @@ export const useHMSHLSPlayerStats = () => {
27
28
  };
28
29
 
29
30
  export const useHMSHLSPlayerStat = <
30
- T extends keyof HMSHLSPlayerStatsUpdateEventData
31
+ T extends keyof HMSHLSPlayerStatsUpdateEventData,
31
32
  >(
32
33
  stat: T
33
34
  ) => {
@@ -0,0 +1,85 @@
1
+ import * as React from 'react';
2
+
3
+ import { HMSConstants } from '../classes/HMSConstants';
4
+ import { HMSEncoder } from '../classes/HMSEncoder';
5
+ import { HMSEventEmitter } from '../classes/HMSEventEmitter';
6
+ import { getLogger } from '../classes/HMSLogger';
7
+ import HMSNativeEventListener from '../classes/HMSNativeEventListener';
8
+ import type { HMSNativeEventSubscription } from '../classes/HMSNativeEventListener';
9
+ import type { HMSPeer } from '../classes/HMSPeer';
10
+ import { HMSPeerUpdate, HMSPeerUpdateOrdinals } from '../classes/HMSPeerUpdate';
11
+ import { getHmsPeersCache } from '../classes/HMSPeersCache';
12
+ import { HMSUpdateListenerActions } from '../classes/HMSUpdateListenerActions';
13
+
14
+ const eventType = HMSUpdateListenerActions.ON_PEER_UPDATE;
15
+
16
+ // TODO: How to handle events which have already been received?
17
+ // TODO(DOUBT): add HMSInstance as dependency because of actions enabling/disabling events on HMSInstance?
18
+ export const useHMSPeerUpdates = (
19
+ effect: (data: { peer: HMSPeer; type: HMSPeerUpdate }) => void,
20
+ deps: React.DependencyList | undefined = []
21
+ ) => {
22
+ React.useEffect(() => {
23
+ if (HMSEventEmitter.listenerCount(eventType) <= 0) {
24
+ addPeerUpdateSubscription();
25
+ }
26
+
27
+ const subscription = HMSEventEmitter.addListener(eventType, effect, null);
28
+
29
+ return () => {
30
+ subscription.remove();
31
+
32
+ if (HMSEventEmitter.listenerCount(eventType) <= 0) {
33
+ removePeerUpdateSubscription();
34
+ }
35
+ };
36
+ }, deps);
37
+ };
38
+
39
+ let peerUpdateSubscription: HMSNativeEventSubscription | null = null;
40
+
41
+ function addPeerUpdateSubscription() {
42
+ if (peerUpdateSubscription !== null) {
43
+ return;
44
+ }
45
+
46
+ peerUpdateSubscription = HMSNativeEventListener.addListener(
47
+ HMSConstants.DEFAULT_SDK_ID,
48
+ HMSUpdateListenerActions.ON_PEER_UPDATE,
49
+ (peerData: any) => {
50
+ const data: { peer: any; type: any } = {
51
+ peer: peerData,
52
+ type: null,
53
+ };
54
+
55
+ for (const ordinal of HMSPeerUpdateOrdinals.keys()) {
56
+ if (ordinal in peerData) {
57
+ data.peer.peerID = peerData[ordinal];
58
+ data.type = ordinal;
59
+ break;
60
+ }
61
+ }
62
+
63
+ const peer: HMSPeer = HMSEncoder.encodeHmsPeer(data.peer);
64
+ const type = HMSEncoder.encodeHmsPeerUpdate(data.type) || data.type;
65
+
66
+ getHmsPeersCache()?.updatePeerCache(data.peer.peerID, data.peer, type);
67
+
68
+ getLogger()?.verbose('#Listener ON_PEER_LISTENER_CALL', {
69
+ peer,
70
+ type,
71
+ });
72
+
73
+ HMSEventEmitter.emit(eventType, { peer, type });
74
+ }
75
+ );
76
+ }
77
+
78
+ function removePeerUpdateSubscription() {
79
+ if (peerUpdateSubscription === null) {
80
+ return;
81
+ }
82
+
83
+ peerUpdateSubscription.remove();
84
+ peerUpdateSubscription = null;
85
+ }