@100mslive/react-native-hms 0.9.0 → 0.9.3

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 (206) hide show
  1. package/README.md +242 -21
  2. package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
  3. package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
  4. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  5. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  6. package/android/.gradle/checksums/checksums.lock +0 -0
  7. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  8. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  9. package/android/.idea/gradle.xml +13 -0
  10. package/android/.idea/misc.xml +9 -0
  11. package/android/.idea/modules/android.iml +18 -0
  12. package/android/.idea/modules.xml +8 -0
  13. package/android/.idea/sonarlint/issuestore/f/0/f07866736216be0ee2aba49e392191aeae700a35 +0 -0
  14. package/android/.idea/sonarlint/issuestore/index.pb +3 -0
  15. package/android/.idea/vcs.xml +6 -0
  16. package/android/build.gradle +2 -2
  17. package/android/local.properties +8 -0
  18. package/android/src/main/java/com/reactnativehmssdk/HmsDecoder.kt +53 -4
  19. package/android/src/main/java/com/reactnativehmssdk/HmsHelper.kt +138 -64
  20. package/android/src/main/java/com/reactnativehmssdk/HmsModule.kt +19 -5
  21. package/android/src/main/java/com/reactnativehmssdk/HmsSDK.kt +133 -109
  22. package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +11 -0
  23. package/android/src/main/java/com/reactnativehmssdk/HmsView.kt +3 -27
  24. package/android/src/main/java/com/reactnativehmssdk/HmssdkViewManager.kt +0 -2
  25. package/ios/HmsDecoder.swift +218 -137
  26. package/ios/HmsHelper.swift +51 -40
  27. package/ios/HmsManager.m +7 -1
  28. package/ios/HmsManager.swift +111 -68
  29. package/ios/HmsSDK.swift +345 -203
  30. package/ios/HmsView.swift +45 -31
  31. package/ios/VideoCollectionViewCell.swift +4 -4
  32. package/lib/commonjs/classes/HMSBrowserRecordingState.js +6 -0
  33. package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
  34. package/lib/commonjs/classes/HMSConfig.js +3 -0
  35. package/lib/commonjs/classes/HMSConfig.js.map +1 -1
  36. package/lib/commonjs/classes/HMSEncoder.js +196 -5
  37. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  38. package/lib/commonjs/classes/HMSHLSConfig.js +3 -0
  39. package/lib/commonjs/classes/HMSHLSConfig.js.map +1 -1
  40. package/lib/commonjs/classes/HMSHLSRecordingConfig.js +23 -0
  41. package/lib/commonjs/classes/HMSHLSRecordingConfig.js.map +1 -0
  42. package/lib/commonjs/classes/HMSHLSRecordingState.js +29 -0
  43. package/lib/commonjs/classes/HMSHLSRecordingState.js.map +1 -0
  44. package/lib/commonjs/classes/HMSHLSVariant.js.map +1 -1
  45. package/lib/commonjs/classes/HMSLocalAudioStats.js +26 -0
  46. package/lib/commonjs/classes/HMSLocalAudioStats.js.map +1 -0
  47. package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
  48. package/lib/commonjs/classes/HMSLocalVideoStats.js +32 -0
  49. package/lib/commonjs/classes/HMSLocalVideoStats.js.map +1 -0
  50. package/lib/commonjs/classes/HMSLogger.js +21 -21
  51. package/lib/commonjs/classes/HMSLogger.js.map +1 -1
  52. package/lib/commonjs/classes/HMSMessage.js +4 -1
  53. package/lib/commonjs/classes/HMSMessage.js.map +1 -1
  54. package/lib/commonjs/classes/HMSMessageRecipient.js +26 -0
  55. package/lib/commonjs/classes/HMSMessageRecipient.js.map +1 -0
  56. package/lib/commonjs/classes/HMSMessageRecipientType.js +15 -0
  57. package/lib/commonjs/classes/HMSMessageRecipientType.js.map +1 -0
  58. package/lib/commonjs/classes/HMSNetworkQuality.js +20 -0
  59. package/lib/commonjs/classes/HMSNetworkQuality.js.map +1 -0
  60. package/lib/commonjs/classes/HMSPeer.js +3 -0
  61. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  62. package/lib/commonjs/classes/HMSPeerUpdate.js +2 -7
  63. package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
  64. package/lib/commonjs/classes/HMSPermissions.js +2 -2
  65. package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
  66. package/lib/commonjs/classes/HMSRTCStats.js +38 -0
  67. package/lib/commonjs/classes/HMSRTCStats.js.map +1 -0
  68. package/lib/commonjs/classes/HMSRTCStatsReport.js +26 -0
  69. package/lib/commonjs/classes/HMSRTCStatsReport.js.map +1 -0
  70. package/lib/commonjs/classes/HMSRemoteAudioStats.js +32 -0
  71. package/lib/commonjs/classes/HMSRemoteAudioStats.js.map +1 -0
  72. package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
  73. package/lib/commonjs/classes/HMSRemoteVideoStats.js +38 -0
  74. package/lib/commonjs/classes/HMSRemoteVideoStats.js.map +1 -0
  75. package/lib/commonjs/classes/HMSRoom.js +6 -0
  76. package/lib/commonjs/classes/HMSRoom.js.map +1 -1
  77. package/lib/commonjs/classes/HMSRoomUpdate.js +1 -0
  78. package/lib/commonjs/classes/HMSRoomUpdate.js.map +1 -1
  79. package/lib/commonjs/classes/HMSRtmpStreamingState.js +6 -0
  80. package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -1
  81. package/lib/commonjs/classes/HMSSDK.js +381 -114
  82. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  83. package/lib/commonjs/classes/HMSServerRecordingState.js +3 -0
  84. package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -1
  85. package/lib/commonjs/classes/HMSUpdateListenerActions.js +5 -0
  86. package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
  87. package/lib/commonjs/index.js +154 -0
  88. package/lib/commonjs/index.js.map +1 -1
  89. package/lib/module/classes/HMSBrowserRecordingState.js +6 -0
  90. package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -1
  91. package/lib/module/classes/HMSConfig.js +3 -0
  92. package/lib/module/classes/HMSConfig.js.map +1 -1
  93. package/lib/module/classes/HMSEncoder.js +187 -5
  94. package/lib/module/classes/HMSEncoder.js.map +1 -1
  95. package/lib/module/classes/HMSHLSConfig.js +3 -0
  96. package/lib/module/classes/HMSHLSConfig.js.map +1 -1
  97. package/lib/module/classes/HMSHLSRecordingConfig.js +14 -0
  98. package/lib/module/classes/HMSHLSRecordingConfig.js.map +1 -0
  99. package/lib/module/classes/HMSHLSRecordingState.js +20 -0
  100. package/lib/module/classes/HMSHLSRecordingState.js.map +1 -0
  101. package/lib/module/classes/HMSHLSVariant.js.map +1 -1
  102. package/lib/module/classes/HMSLocalAudioStats.js +17 -0
  103. package/lib/module/classes/HMSLocalAudioStats.js.map +1 -0
  104. package/lib/module/classes/HMSLocalPeer.js.map +1 -1
  105. package/lib/module/classes/HMSLocalVideoStats.js +23 -0
  106. package/lib/module/classes/HMSLocalVideoStats.js.map +1 -0
  107. package/lib/module/classes/HMSLogger.js +21 -21
  108. package/lib/module/classes/HMSLogger.js.map +1 -1
  109. package/lib/module/classes/HMSMessage.js +4 -1
  110. package/lib/module/classes/HMSMessage.js.map +1 -1
  111. package/lib/module/classes/HMSMessageRecipient.js +17 -0
  112. package/lib/module/classes/HMSMessageRecipient.js.map +1 -0
  113. package/lib/module/classes/HMSMessageRecipientType.js +8 -0
  114. package/lib/module/classes/HMSMessageRecipientType.js.map +1 -0
  115. package/lib/module/classes/HMSNetworkQuality.js +11 -0
  116. package/lib/module/classes/HMSNetworkQuality.js.map +1 -0
  117. package/lib/module/classes/HMSPeer.js +3 -0
  118. package/lib/module/classes/HMSPeer.js.map +1 -1
  119. package/lib/module/classes/HMSPeerUpdate.js +2 -7
  120. package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
  121. package/lib/module/classes/HMSPermissions.js +2 -2
  122. package/lib/module/classes/HMSPermissions.js.map +1 -1
  123. package/lib/module/classes/HMSRTCStats.js +29 -0
  124. package/lib/module/classes/HMSRTCStats.js.map +1 -0
  125. package/lib/module/classes/HMSRTCStatsReport.js +17 -0
  126. package/lib/module/classes/HMSRTCStatsReport.js.map +1 -0
  127. package/lib/module/classes/HMSRemoteAudioStats.js +23 -0
  128. package/lib/module/classes/HMSRemoteAudioStats.js.map +1 -0
  129. package/lib/module/classes/HMSRemotePeer.js.map +1 -1
  130. package/lib/module/classes/HMSRemoteVideoStats.js +29 -0
  131. package/lib/module/classes/HMSRemoteVideoStats.js.map +1 -0
  132. package/lib/module/classes/HMSRoom.js +6 -0
  133. package/lib/module/classes/HMSRoom.js.map +1 -1
  134. package/lib/module/classes/HMSRoomUpdate.js +1 -0
  135. package/lib/module/classes/HMSRoomUpdate.js.map +1 -1
  136. package/lib/module/classes/HMSRtmpStreamingState.js +6 -0
  137. package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -1
  138. package/lib/module/classes/HMSSDK.js +368 -114
  139. package/lib/module/classes/HMSSDK.js.map +1 -1
  140. package/lib/module/classes/HMSServerRecordingState.js +3 -0
  141. package/lib/module/classes/HMSServerRecordingState.js.map +1 -1
  142. package/lib/module/classes/HMSUpdateListenerActions.js +5 -0
  143. package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
  144. package/lib/module/index.js +11 -0
  145. package/lib/module/index.js.map +1 -1
  146. package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +4 -0
  147. package/lib/typescript/classes/HMSConfig.d.ts +2 -0
  148. package/lib/typescript/classes/HMSEncoder.d.ts +25 -0
  149. package/lib/typescript/classes/HMSHLSConfig.d.ts +5 -2
  150. package/lib/typescript/classes/HMSHLSRecordingConfig.d.ts +8 -0
  151. package/lib/typescript/classes/HMSHLSRecordingState.d.ts +12 -0
  152. package/lib/typescript/classes/HMSHLSVariant.d.ts +8 -8
  153. package/lib/typescript/classes/HMSLocalAudioStats.d.ts +10 -0
  154. package/lib/typescript/classes/HMSLocalPeer.d.ts +2 -0
  155. package/lib/typescript/classes/HMSLocalVideoStats.d.ts +15 -0
  156. package/lib/typescript/classes/HMSMessage.d.ts +8 -4
  157. package/lib/typescript/classes/HMSMessageRecipient.d.ts +13 -0
  158. package/lib/typescript/classes/HMSMessageRecipientType.d.ts +5 -0
  159. package/lib/typescript/classes/HMSNetworkQuality.d.ts +6 -0
  160. package/lib/typescript/classes/HMSPeer.d.ts +3 -0
  161. package/lib/typescript/classes/HMSPeerUpdate.d.ts +3 -8
  162. package/lib/typescript/classes/HMSPermissions.d.ts +2 -2
  163. package/lib/typescript/classes/HMSRTCStats.d.ts +18 -0
  164. package/lib/typescript/classes/HMSRTCStatsReport.d.ts +11 -0
  165. package/lib/typescript/classes/HMSRemoteAudioStats.d.ts +14 -0
  166. package/lib/typescript/classes/HMSRemotePeer.d.ts +2 -0
  167. package/lib/typescript/classes/HMSRemoteVideoStats.d.ts +19 -0
  168. package/lib/typescript/classes/HMSRoom.d.ts +5 -0
  169. package/lib/typescript/classes/HMSRoomUpdate.d.ts +2 -1
  170. package/lib/typescript/classes/HMSRtmpStreamingState.d.ts +4 -0
  171. package/lib/typescript/classes/HMSSDK.d.ts +310 -8
  172. package/lib/typescript/classes/HMSServerRecordingState.d.ts +2 -0
  173. package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +6 -1
  174. package/lib/typescript/index.d.ts +11 -0
  175. package/package.json +1 -1
  176. package/react-native-hms.podspec +1 -1
  177. package/src/classes/HMSBrowserRecordingState.ts +10 -1
  178. package/src/classes/HMSConfig.ts +3 -0
  179. package/src/classes/HMSEncoder.ts +208 -5
  180. package/src/classes/HMSHLSConfig.ts +8 -2
  181. package/src/classes/HMSHLSRecordingConfig.ts +9 -0
  182. package/src/classes/HMSHLSRecordingState.ts +18 -0
  183. package/src/classes/HMSHLSVariant.ts +8 -8
  184. package/src/classes/HMSLocalAudioStats.ts +15 -0
  185. package/src/classes/HMSLocalPeer.ts +2 -0
  186. package/src/classes/HMSLocalVideoStats.ts +23 -0
  187. package/src/classes/HMSLogger.ts +3 -3
  188. package/src/classes/HMSMessage.ts +11 -5
  189. package/src/classes/HMSMessageRecipient.ts +19 -0
  190. package/src/classes/HMSMessageRecipientType.ts +5 -0
  191. package/src/classes/HMSNetworkQuality.ts +7 -0
  192. package/src/classes/HMSPeer.ts +4 -2
  193. package/src/classes/HMSPeerUpdate.ts +2 -7
  194. package/src/classes/HMSPermissions.ts +3 -3
  195. package/src/classes/HMSRTCStats.ts +27 -0
  196. package/src/classes/HMSRTCStatsReport.ts +17 -0
  197. package/src/classes/HMSRemoteAudioStats.ts +21 -0
  198. package/src/classes/HMSRemotePeer.ts +2 -0
  199. package/src/classes/HMSRemoteVideoStats.ts +29 -0
  200. package/src/classes/HMSRoom.ts +7 -0
  201. package/src/classes/HMSRoomUpdate.ts +1 -0
  202. package/src/classes/HMSRtmpStreamingState.ts +10 -1
  203. package/src/classes/HMSSDK.tsx +530 -18
  204. package/src/classes/HMSServerRecordingState.ts +7 -1
  205. package/src/classes/HMSUpdateListenerActions.ts +5 -0
  206. package/src/index.ts +11 -0
@@ -24,6 +24,10 @@ import { HMSVideoViewMode } from './HMSVideoViewMode';
24
24
  import type { HMSTrackSettings } from './HMSTrackSettings';
25
25
  import type { HMSRTMPConfig } from './HMSRTMPConfig';
26
26
  import type { HMSHLSConfig } from './HMSHLSConfig';
27
+ import { HMSLocalAudioStats } from './HMSLocalAudioStats';
28
+ import { HMSLocalVideoStats } from './HMSLocalVideoStats';
29
+ import { HMSRemoteVideoStats } from './HMSRemoteVideoStats';
30
+ import { HMSRemoteAudioStats } from './HMSRemoteAudioStats';
27
31
 
28
32
  interface HmsComponentProps {
29
33
  trackId: string;
@@ -69,6 +73,11 @@ export class HMSSDK {
69
73
  onRoleChangeRequestDelegate?: any;
70
74
  onChangeTrackStateRequestDelegate?: any;
71
75
  onRemovedFromRoomDelegate?: any;
76
+ onRtcStatsDelegate?: any;
77
+ onLocalAudioStatsDelegate?: any;
78
+ onLocalVideoStatsDelegate?: any;
79
+ onRemoteAudioStatsDelegate?: any;
80
+ onRemoteVideoStatsDelegate?: any;
72
81
 
73
82
  constructor(id: string) {
74
83
  this.id = id;
@@ -76,7 +85,7 @@ export class HMSSDK {
76
85
 
77
86
  /**
78
87
  * - Returns an instance of [HMSSDK]{@link HMSSDK}
79
- * - This function must be called to get an instance of HMSSDK class and only then user can interact with its methods
88
+ * - This function must be called to get an instance of HMSSDK class and only then user can interact with its methods.
80
89
  *
81
90
  * @static
82
91
  * @returns
@@ -90,19 +99,40 @@ export class HMSSDK {
90
99
  return HmsSdk;
91
100
  }
92
101
 
102
+ /**
103
+ * - Returns the instance of logger which can be used to manipulate log levels.
104
+ * @returns @instance HMSLogger
105
+ * @memberof HMSSDK
106
+ */
93
107
  static getLogger() {
94
108
  return logger;
95
109
  }
96
110
 
111
+ /**
112
+ * - Updates the logger for this instance of HMSSDK
113
+ * @param {HMSLogger} hmsLogger
114
+ * @memberof HMSSDK
115
+ */
97
116
  setLogger = (hmsLogger: HMSLogger) => {
98
117
  logger = hmsLogger;
99
118
  hmsLogger.verbose('#Function setLogger', { id: this.id });
100
119
  };
101
120
 
121
+ /**
122
+ * - Calls removeListeners that in turn breaks all connections with native listeners.
123
+ *
124
+ * @memberof HMSSDK
125
+ */
102
126
  destroy = () => {
103
127
  this.removeListeners();
104
128
  };
105
129
 
130
+ /**
131
+ * - Attaches preview listener for native callbacks.
132
+ * Note:this function connects sdk to native side and not app to sdk.
133
+ *
134
+ * @memberof HMSSDK
135
+ */
106
136
  attachPreviewListener = () => {
107
137
  HmsEventEmitter.addListener(
108
138
  HMSUpdateListenerActions.ON_PREVIEW,
@@ -110,6 +140,11 @@ export class HMSSDK {
110
140
  );
111
141
  };
112
142
 
143
+ /**
144
+ * - Attaches all the listeners to native callbacks.
145
+ * Note: this function connects sdk to native side and not app to sdk.
146
+ * @memberof HMSSDK
147
+ */
113
148
  attachListeners = () => {
114
149
  HmsEventEmitter.addListener(
115
150
  HMSUpdateListenerActions.ON_JOIN,
@@ -170,8 +205,38 @@ export class HMSSDK {
170
205
  HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM,
171
206
  this.onRemovedFromRoomListener
172
207
  );
208
+
209
+ HmsEventEmitter.addListener(
210
+ HMSUpdateListenerActions.ON_RTC_STATS,
211
+ this.RTCStatsListener
212
+ );
213
+
214
+ HmsEventEmitter.addListener(
215
+ HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS,
216
+ this.onLocalAudioStatsListener
217
+ );
218
+
219
+ HmsEventEmitter.addListener(
220
+ HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS,
221
+ this.onLocalVideoStatsListener
222
+ );
223
+
224
+ HmsEventEmitter.addListener(
225
+ HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS,
226
+ this.onRemoteAudioStatsListener
227
+ );
228
+
229
+ HmsEventEmitter.addListener(
230
+ HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS,
231
+ this.onRemoteVideoStatsListener
232
+ );
173
233
  };
174
234
 
235
+ /**
236
+ * Disconnects all the listeners of this sdk from native listeners.
237
+ * 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.
238
+ * @memberof HMSSDK
239
+ */
175
240
  removeListeners = () => {
176
241
  HmsEventEmitter.removeListener(
177
242
  HMSUpdateListenerActions.ON_JOIN,
@@ -232,11 +297,38 @@ export class HMSSDK {
232
297
  HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM,
233
298
  this.onRemovedFromRoomListener
234
299
  );
300
+
301
+ HmsEventEmitter.removeListener(
302
+ HMSUpdateListenerActions.ON_RTC_STATS,
303
+ this.RTCStatsListener
304
+ );
305
+
306
+ HmsEventEmitter.removeListener(
307
+ HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS,
308
+ this.onLocalAudioStatsListener
309
+ );
310
+
311
+ HmsEventEmitter.removeListener(
312
+ HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS,
313
+ this.onLocalVideoStatsListener
314
+ );
315
+
316
+ HmsEventEmitter.removeListener(
317
+ HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS,
318
+ this.onRemoteAudioStatsListener
319
+ );
320
+
321
+ HmsEventEmitter.removeListener(
322
+ HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS,
323
+ this.onRemoteVideoStatsListener
324
+ );
235
325
  };
236
326
 
237
327
  /**
238
- * takes an instance of [HMSConfig]{@link HMSConfig} and joins the room
239
- * after joining the room user will start receiving the events and updates of the room
328
+ * takes an instance of [HMSConfig]{@link HMSConfig} and joins the room.
329
+ * after joining the room user will start receiving the events and updates of the room.
330
+ *
331
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/join} for more info
240
332
  *
241
333
  * @param {HMSConfig} config
242
334
  * @memberof HMSSDK
@@ -247,11 +339,55 @@ export class HMSSDK {
247
339
  await HmsManager.join({ ...config, id: this.id });
248
340
  };
249
341
 
342
+ /**
343
+ * - preview function is used to initiate a preview for the localPeer.
344
+ * - We can call this function and wait for a response in previewListener, the response will contain previewTracks for local peer.
345
+ *
346
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/preview} for more info
347
+ *
348
+ * @param {HMSConfig} config
349
+ * @memberof HMSSDK
350
+ */
250
351
  preview = (config: HMSConfig) => {
251
352
  logger?.verbose('#Function preview', { config, id: this.id });
252
353
  HmsManager.preview({ ...config, id: this.id });
253
354
  };
254
355
 
356
+ /**
357
+ * - previewForRole can be used when there is role change request for current localPeer and we want
358
+ * to show the localPeer how the tracks look before publishing them to room.
359
+ *
360
+ * - It requires a role of type [HMSRole]{@link HMSRole} for which we want to preview the tracks.
361
+ *
362
+ * checkout {@link https://www.100ms.live/docs/react-native} for more info
363
+ *
364
+ * @param {HMSRole}
365
+ * @memberof HMSSDK
366
+ */
367
+ previewForRole = async (role: HMSRole) => {
368
+ logger?.verbose('#Function previewForRole', {
369
+ role,
370
+ id: this.id,
371
+ });
372
+ if (Platform.OS === 'ios') {
373
+ return await HmsManager.previewForRole({ role: role?.name, id: this.id });
374
+ } else {
375
+ console.log('API currently not available for android');
376
+ return 'API currently not available for android';
377
+ }
378
+ };
379
+
380
+ /**
381
+ * - HmsView is react component that takes one track and starts showing that track on a tile.
382
+ * - The appearance of tile is completely customizable with style prop.
383
+ * - setting sink true or false for a video tile will add or remove sink for a video.
384
+ * - scale type can determine how the incoming video will fit in the canvas check {@link HMSVideoViewMode} for more information.
385
+ *
386
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/render-video} for more info
387
+ *
388
+ * @param {HmsComponentProps}
389
+ * @memberof HMSSDK
390
+ */
255
391
  HmsView = ({
256
392
  sink,
257
393
  trackId,
@@ -272,7 +408,9 @@ export class HMSSDK {
272
408
  };
273
409
 
274
410
  /**
275
- * Calls leave function of native sdk and session of current user is invalidated
411
+ * Calls leave function of native sdk and session of current user is invalidated.
412
+ *
413
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/leave} for more info
276
414
  *
277
415
  * @memberof HMSSDK
278
416
  */
@@ -292,6 +430,14 @@ export class HMSSDK {
292
430
  return op;
293
431
  };
294
432
 
433
+ /**
434
+ * - This function sends message to all the peers in the room, the get the message in onMessage listener.
435
+ *
436
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
437
+ *
438
+ * @param {message: string} and @param {type: string}
439
+ * @memberof HMSSDK
440
+ */
295
441
  sendBroadcastMessage = async (message: string, type: string = 'chat') => {
296
442
  logger?.verbose('#Function sendBroadcastMessage', {
297
443
  message,
@@ -305,6 +451,14 @@ export class HMSSDK {
305
451
  });
306
452
  };
307
453
 
454
+ /**
455
+ * - sendGroupMessage sends a message to specific set of roles, whoever has any of those role in room
456
+ * will get the message in onMessage listener.
457
+ *
458
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
459
+ *
460
+ * @memberof HMSSDK
461
+ */
308
462
  sendGroupMessage = async (
309
463
  message: string,
310
464
  roles: HMSRole[],
@@ -324,6 +478,14 @@ export class HMSSDK {
324
478
  });
325
479
  };
326
480
 
481
+ /**
482
+ * - sendDirectMessage sends a private message to a single peer, only that peer will get the message
483
+ * in onMessage Listener.
484
+ *
485
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
486
+ *
487
+ * @memberof HMSSDK
488
+ */
327
489
  sendDirectMessage = async (
328
490
  message: string,
329
491
  peer: HMSPeer,
@@ -343,11 +505,32 @@ export class HMSSDK {
343
505
  });
344
506
  };
345
507
 
508
+ /**
509
+ * - changeMetadata changes a specific field in localPeer which is [metadata] it is a string that can
510
+ * be used for various functionalities like raiseHand, beRightBack and many more that explains the
511
+ * current status of the peer.
512
+ *
513
+ * - it is advised to use a json object in string format to store multiple dataPoints in metadata.
514
+ *
515
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-metadata} for more info
516
+ *
517
+ * @param {string}
518
+ * @memberof HMSSDK
519
+ */
346
520
  changeMetadata = (metadata: string) => {
347
521
  logger?.verbose('#Function changeMetadata', { metadata, id: this.id });
348
522
  HmsManager.changeMetadata({ metadata, id: this.id });
349
523
  };
350
524
 
525
+ /**
526
+ * - startRTMPOrRecording takes a configuration object {@link HMSRTMPConfig} and stats the RTMP recording
527
+ * - this object of {@link HMSRTMPConfig} sets the urls for streaming and weather to set recording on or not
528
+ * - we get the response of this function in onRoomUpdate as RTMP_STREAMING_STATE_UPDATED.
529
+ *
530
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/recording} for more info
531
+ *
532
+ * @memberof HMSSDK
533
+ */
351
534
  startRTMPOrRecording = async (data: HMSRTMPConfig) => {
352
535
  logger?.verbose('#Function startRTMPOrRecording', {
353
536
  ...data,
@@ -358,12 +541,29 @@ export class HMSSDK {
358
541
  return op;
359
542
  };
360
543
 
544
+ /**
545
+ * - this function stops all the ongoing RTMP streaming and recording.
546
+ * - we get the response of this function in onRoomUpdate as RTMP_STREAMING_STATE_UPDATED.
547
+ *
548
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/recording} for more info
549
+ *
550
+ * @memberof HMSSDK
551
+ */
361
552
  stopRtmpAndRecording = async () => {
362
553
  logger?.verbose('#Function stopRtmpAndRecording', {});
363
554
  const op = await HmsManager.stopRtmpAndRecording({ id: this.id });
364
555
  return op;
365
556
  };
366
557
 
558
+ /**
559
+ * - This function starts HLSStreaming.
560
+ * - we get the response of this function in onRoomUpdate as HLS_STREAMING_STATE_UPDATED.
561
+ *
562
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/hls-streaming} for more info
563
+ *
564
+ * @param {HMSHLSConfig}
565
+ * @memberof HMSSDK
566
+ */
367
567
  startHLSStreaming = async (data: HMSHLSConfig) => {
368
568
  logger?.verbose('#Function startHLSStreaming', {
369
569
  ...data,
@@ -372,11 +572,33 @@ export class HMSSDK {
372
572
  return await HmsManager.startHLSStreaming({ ...data, id: this.id });
373
573
  };
374
574
 
575
+ /**
576
+ * - stopHLSStreaming function stops the ongoing HLSStreams.
577
+ * - we get the response of this function in onRoomUpdate as HLS_STREAMING_STATE_UPDATED.
578
+ *
579
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/hls-streaming} for more info
580
+ *
581
+ * @memberof HMSSDK
582
+ */
375
583
  stopHLSStreaming = async () => {
376
584
  logger?.verbose('#Function stopHLSStreaming', {});
377
585
  return await HmsManager.stopHLSStreaming({ id: this.id });
378
586
  };
379
587
 
588
+ /**
589
+ * - This function can be used in a situation when we want to change role hence manipulate their
590
+ * access and rights in the current room, it takes the peer {@link HMSPeer} whom role we want to change,
591
+ * role {@link HMSRole} which will be the new role for that peer and weather to forcefully change
592
+ * the role or ask the to accept the role change request using a boolean force.
593
+ *
594
+ * - if we change the role forcefully the peer's role will be updated without asking the peer
595
+ * otherwise the user will get the roleChangeRequest in roleChangeRequest listener.
596
+ * for more information on this checkout {@link onRoleChangeRequestListener}
597
+ *
598
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
599
+ *
600
+ * @memberof HMSSDK
601
+ */
380
602
  changeRole = async (peer: HMSPeer, role: HMSRole, force: boolean = false) => {
381
603
  const data = {
382
604
  peerId: peer?.peerID,
@@ -388,6 +610,15 @@ export class HMSSDK {
388
610
  return await HmsManager.changeRole(data);
389
611
  };
390
612
 
613
+ /**
614
+ * - This function can be used to manipulate mute status of any track.
615
+ * - Targeted peer affected by this action will get a callback in {@link onChangeTrackStateRequestListener}.
616
+ *
617
+ * * checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-track-state} for more info
618
+ *
619
+ * @param {HMSTrack}
620
+ * @memberof HMSSDK
621
+ */
391
622
  changeTrackState = async (track: HMSTrack, mute: boolean) => {
392
623
  logger?.verbose('#Function changeTrackState', {
393
624
  track,
@@ -403,6 +634,14 @@ export class HMSSDK {
403
634
  return await HmsManager.changeTrackState(data);
404
635
  };
405
636
 
637
+ /**
638
+ * - changeTrackStateForRoles is an enhancement on the functionality of {@link changeTrackState}.
639
+ * - We can change mute status for all the tracks of peers having a particular role.
640
+ * - @param source determines the source of the track ex. video, audio etc.
641
+ * - The peers affected by this action will get a callback in {@link onChangeTrackStateRequestListener}.
642
+ *
643
+ * @memberof HMSSDK
644
+ */
406
645
  changeTrackStateForRoles = async (
407
646
  mute: boolean,
408
647
  type?: HMSTrackType,
@@ -431,6 +670,14 @@ export class HMSSDK {
431
670
  return await HmsManager.changeTrackStateForRoles(data);
432
671
  };
433
672
 
673
+ /**
674
+ * - removePeer can forcefully disconnect a Peer from the room.
675
+ * - the user who's removed from this action will get a callback in {@link onRemovedFromRoomListener}.
676
+ *
677
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/remove-peer} for more info
678
+ *
679
+ * @memberof HMSSDK
680
+ */
434
681
  removePeer = async (peer: HMSPeer, reason: string) => {
435
682
  logger?.verbose('#Function removePeer', {
436
683
  peerId: peer.peerID,
@@ -446,6 +693,15 @@ export class HMSSDK {
446
693
  return await HmsManager.removePeer(data);
447
694
  };
448
695
 
696
+ /**
697
+ * - endRoom can be used in a situation where we want to disconnect all the peers from current room
698
+ * and end the call.
699
+ * - everyone in the room will get an update of this action in {@link onRemovedFromRoomListener}.
700
+ *
701
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/end-room} for more info
702
+ *
703
+ * @memberof HMSSDK
704
+ */
449
705
  endRoom = async (reason: string, lock: boolean = false) => {
450
706
  logger?.verbose('#Function endRoom', { lock, reason, id: this.id });
451
707
  const data = {
@@ -457,17 +713,68 @@ export class HMSSDK {
457
713
  return await HmsManager.endRoom(data);
458
714
  };
459
715
 
716
+ /**
717
+ * - This function can be used to change name of localPeer.
718
+ *
719
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-name} for more info
720
+ *
721
+ * @memberof HMSSDK
722
+ */
723
+ changeName = async (name: string) => {
724
+ logger?.verbose('#Function changeName', { name, id: this.id });
725
+ const data = {
726
+ name,
727
+ id: this.id,
728
+ };
729
+
730
+ return await HmsManager.changeName(data);
731
+ };
732
+
733
+ /**
734
+ * - Calling this function will accept the most recent roleChange request made by anyone in the room
735
+ *
736
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
737
+ *
738
+ * @memberof HMSSDK
739
+ */
460
740
  acceptRoleChange = async () => {
461
741
  logger?.verbose('#Function acceptRoleChange', { id: this.id });
462
742
  return await HmsManager.acceptRoleChange({ id: this.id });
463
743
  };
464
744
 
465
- muteAllPeersAudio = (mute: boolean) => {
466
- logger?.verbose('#Function muteAllPeersAudio', { mute, id: this.id });
745
+ /**
746
+ * - setPlaybackForAllAudio is an extension of the abilities of {@link setPlaybackAllowed} in
747
+ * {@link HMSRemoteAudioTrack}, it sets mute status for all peers in the room
748
+ *
749
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/playback-allowed} for more info
750
+ *
751
+ * @memberof HMSSDK
752
+ */
753
+ setPlaybackForAllAudio = (mute: boolean) => {
754
+ logger?.verbose('#Function setPlaybackForAllAudio', { mute, id: this.id });
467
755
  this.muteStatus = mute;
468
- HmsManager.muteAllPeersAudio({ mute, id: this.id });
756
+ HmsManager.setPlaybackForAllAudio({ mute, id: this.id });
469
757
  };
470
758
 
759
+ /**
760
+ * - This function mutes audio for all peers in the room.
761
+ *
762
+ * @memberof HMSSDK
763
+ */
764
+ remoteMuteAllAudio = () => {
765
+ logger?.verbose('#Function remoteMuteAllAudio', { id: this.id });
766
+ HmsManager.remoteMuteAllAudio({ id: this.id });
767
+ };
768
+
769
+ /**
770
+ * - getRoom is a wrapper function on an existing native function also known as getRoom the returns
771
+ * current room object which is of type {@link HMSRoom}
772
+ *
773
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/room} for more info
774
+ *
775
+ * @memberof HMSSDK
776
+ * @return HMSRoom
777
+ */
471
778
  getRoom = async () => {
472
779
  logger?.verbose('#Function getRoom', {
473
780
  roomID: this.room?.id,
@@ -479,6 +786,13 @@ export class HMSSDK {
479
786
  return encodedHmsRoom;
480
787
  };
481
788
 
789
+ /**
790
+ * - This function sets the volume of any peer in the room
791
+ *
792
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/set-volume} for more info
793
+ *
794
+ * @memberof HMSSDK
795
+ */
482
796
  setVolume = (track: HMSTrack, volume: number) => {
483
797
  logger?.verbose('#Function setVolume', {
484
798
  track,
@@ -497,6 +811,13 @@ export class HMSSDK {
497
811
  if (Platform.OS === 'android') HmsManager.resetVolume({ id: this.id });
498
812
  };
499
813
 
814
+ /**
815
+ * - This is a temporary solution for the situation when mic access is taken from the app and
816
+ * user returns to the app with no mic access. It will re-acquire the mic by setting the volume
817
+ * from native side
818
+ *
819
+ * @memberof HMSSDK
820
+ */
500
821
  addAppStateListener = () => {
501
822
  logger?.verbose('#Function addAppStateListener', { id: this.id });
502
823
  this.appStateSubscription = AppState.addEventListener(
@@ -509,38 +830,97 @@ export class HMSSDK {
509
830
  );
510
831
  };
511
832
 
512
- startScreenshare = () => {
833
+ /**
834
+ * - This function is used to start screenshare, currently available only for android
835
+ *
836
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/screenshare} for more info
837
+ *
838
+ * @memberof HMSSDK
839
+ */
840
+ startScreenshare = async () => {
513
841
  logger?.verbose('#Function startScreenshare', { id: this.id });
514
842
  if (Platform.OS === 'android') {
515
- HmsManager.startScreenshare({ id: this.id });
843
+ return await HmsManager.startScreenshare({ id: this.id });
516
844
  } else {
517
- console.log('API currently not avaialble for iOS');
845
+ console.log('API currently not available for iOS');
846
+ return 'API currently not available for iOS';
518
847
  }
519
848
  };
520
849
 
850
+ /**
851
+ * - Returns a boolean stating if the screen is currently shared or not
852
+ *
853
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/screenshare} for more info
854
+ *
855
+ * @memberof HMSSDK
856
+ */
521
857
  isScreenShared = async () => {
522
858
  logger?.verbose('#Function isScreenShared', { id: this.id });
523
859
  if (Platform.OS === 'android') {
524
860
  return await HmsManager.isScreenShared({ id: this.id });
525
861
  } else {
526
- console.log('API currently not avaialble for iOS');
527
- return 'API currently not avaialble for iOS';
862
+ console.log('API currently not available for iOS');
863
+ return 'API currently not available for iOS';
528
864
  }
529
865
  };
530
866
 
867
+ /**
868
+ * - stops the screenShare, currently available for android only.
869
+ *
870
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/screenshare} for more info
871
+ *
872
+ * @memberof HMSSDK
873
+ */
531
874
  stopScreenshare = async () => {
532
875
  logger?.verbose('#Function stopScreenshare', { id: this.id });
533
876
  if (Platform.OS === 'android') {
534
877
  return await HmsManager.stopScreenshare({ id: this.id });
535
878
  } else {
536
- console.log('API currently not avaialble for iOS');
537
- return 'API currently not avaialble for iOS';
879
+ console.log('API currently not available for iOS');
880
+ return 'API currently not available for iOS';
881
+ }
882
+ };
883
+
884
+ /**
885
+ * - enableRTCStats sets a boolean in native side which in turn allows several events to be passed
886
+ * through the bridge these events are {@link RTCStatsListener}, {@link onRemoteVideoStatsListener},
887
+ * {@link onRemoteAudioStatsListener}, {@link onLocalAudioStatsListener} and {@link onLocalVideoStatsListener}
888
+ *
889
+ * - These listeners get various dataPoints for current peers and their connectivity to the room
890
+ * such as jitter, latency etc.
891
+ *
892
+ * - currently available for iOS only
893
+ *
894
+ * @memberof HMSSDK
895
+ */
896
+ enableRTCStats = () => {
897
+ logger?.verbose('#Function enableRTCStats', { id: this.id });
898
+ if (Platform.OS === 'ios') {
899
+ HmsManager.enableRTCStats({ id: this.id });
900
+ } else {
901
+ console.log('API currently not avaialble for android');
902
+ }
903
+ };
904
+
905
+ /**
906
+ * - disable RTCStats sets the same boolean to false that was set true by enableRTCStats.
907
+ * that activates a check which filters out the events acquired in native listeners and don't
908
+ * let them pass through bridge
909
+ *
910
+ * - currently available for iOS only.
911
+ * @memberof HMSSDK
912
+ */
913
+ disableRTCStats = () => {
914
+ logger?.verbose('#Function disableRTCStats', { id: this.id });
915
+ if (Platform.OS === 'ios') {
916
+ HmsManager.disableRTCStats({ id: this.id });
917
+ } else {
918
+ console.log('API currently not avaialble for android');
538
919
  }
539
920
  };
540
921
 
541
922
  /**
542
923
  * - This is a prototype event listener that takes action and listens for updates related to that particular action
543
- * - This method will be @deprecated in future and event listener will be passed in join method
544
924
  *
545
925
  * @param {string} action
546
926
  * @param {*} callback
@@ -591,13 +971,27 @@ export class HMSSDK {
591
971
  case HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM:
592
972
  this.onRemovedFromRoomDelegate = callback;
593
973
  break;
974
+ case HMSUpdateListenerActions.ON_RTC_STATS:
975
+ this.onRtcStatsDelegate = callback;
976
+ break;
977
+ case HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS:
978
+ this.onLocalAudioStatsDelegate = callback;
979
+ break;
980
+ case HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS:
981
+ this.onLocalVideoStatsDelegate = callback;
982
+ break;
983
+ case HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS:
984
+ this.onRemoteAudioStatsDelegate = callback;
985
+ break;
986
+ case HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS:
987
+ this.onRemoteVideoStatsDelegate = callback;
988
+ break;
594
989
  default:
595
990
  }
596
991
  };
597
992
 
598
993
  /**
599
994
  * - This is a prototype event listener that takes action and listens for updates related to that particular action
600
- * - This method will be @deprecated in future and event listener will be passed in join method
601
995
  *
602
996
  * @param {string} action
603
997
  * @param {*} callback
@@ -645,6 +1039,21 @@ export class HMSSDK {
645
1039
  case HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM:
646
1040
  this.onRemovedFromRoomDelegate = null;
647
1041
  break;
1042
+ case HMSUpdateListenerActions.ON_RTC_STATS:
1043
+ this.onRtcStatsDelegate = null;
1044
+ break;
1045
+ case HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS:
1046
+ this.onLocalAudioStatsDelegate = null;
1047
+ break;
1048
+ case HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS:
1049
+ this.onLocalVideoStatsDelegate = null;
1050
+ break;
1051
+ case HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS:
1052
+ this.onRemoteAudioStatsDelegate = null;
1053
+ break;
1054
+ case HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS:
1055
+ this.onRemoteVideoStatsDelegate = null;
1056
+ break;
648
1057
  default:
649
1058
  }
650
1059
  };
@@ -672,6 +1081,21 @@ export class HMSSDK {
672
1081
  logger?.verbose('#Function REMOVE_ALL_LISTENER', { id: this.id });
673
1082
  };
674
1083
 
1084
+ /**
1085
+ * - Below are all the listeners that are connected to native side.
1086
+ *
1087
+ * - All of the are connected when build function is called, we can connect them to the app by
1088
+ * calling {@link addEventListener} with corresponding event type.
1089
+ *
1090
+ * - Before passing the data to the eventListener of the app these listeners encode the data in
1091
+ * ts classes for a proper structuring of the data.
1092
+ *
1093
+ * - Even When event listeners of the app are disconnected using {@link removeEventListener} or
1094
+ * {@link removeAllListeners} or not even connected in first place, these functions still run to
1095
+ * maintain the current state of the instance of {@link HMSSDK}.
1096
+ *
1097
+ */
1098
+
675
1099
  onPreviewListener = (data: any) => {
676
1100
  if (data.id !== this.id) {
677
1101
  return;
@@ -799,7 +1223,7 @@ export class HMSSDK {
799
1223
  this.id
800
1224
  );
801
1225
  if (this.muteStatus && data?.type === 'TRACK_ADDED') {
802
- this.muteAllPeersAudio(this.muteStatus);
1226
+ this.setPlaybackForAllAudio(this.muteStatus);
803
1227
  }
804
1228
  this.room = room;
805
1229
  this.localPeer = localPeer;
@@ -836,7 +1260,7 @@ export class HMSSDK {
836
1260
  logger?.verbose('#Listener ON_SPEAKER', data);
837
1261
  if (this.onSpeakerDelegate) {
838
1262
  logger?.verbose('#Listener ON_SPEAKER_LISTENER_CALL', data);
839
- this.onSpeakerDelegate(data);
1263
+ this.onSpeakerDelegate(HMSEncoder.encodeHmsSpeakerUpdate(data, this.id));
840
1264
  }
841
1265
  };
842
1266
 
@@ -929,4 +1353,92 @@ export class HMSSDK {
929
1353
  this.onReconnectedDelegate(data);
930
1354
  }
931
1355
  };
1356
+
1357
+ RTCStatsListener = (data: any) => {
1358
+ if (data.id !== this.id) {
1359
+ return;
1360
+ }
1361
+
1362
+ logger?.verbose('#Listener RTCStatsListener', data);
1363
+
1364
+ let rtcStats = HMSEncoder.encodeRTCStats(data);
1365
+
1366
+ if (this.onRtcStatsDelegate) {
1367
+ this.onRtcStatsDelegate({ rtcStats });
1368
+ }
1369
+ };
1370
+
1371
+ onLocalAudioStatsListener = (data: any) => {
1372
+ if (data.id !== this.id) {
1373
+ return;
1374
+ }
1375
+
1376
+ logger?.verbose('#Listener onLocalAudioStatsListener', data);
1377
+
1378
+ let localAudioStats = new HMSLocalAudioStats(data.localAudioStats);
1379
+ let peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1380
+ let track = HMSEncoder.encodeHmsLocalAudioTrack(data.track, this.id);
1381
+
1382
+ if (this.onLocalAudioStatsDelegate) {
1383
+ this.onLocalAudioStatsDelegate({ ...data, localAudioStats, peer, track });
1384
+ }
1385
+ };
1386
+
1387
+ onLocalVideoStatsListener = (data: any) => {
1388
+ if (data.id !== this.id) {
1389
+ return;
1390
+ }
1391
+
1392
+ logger?.verbose('#Listener onLocalVideoStatsListener', data);
1393
+
1394
+ let localVideoStats = new HMSLocalVideoStats(data.localVideoStats);
1395
+ let peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1396
+ let track = HMSEncoder.encodeHmsLocalVideoTrack(data.track, this.id);
1397
+
1398
+ if (this.onLocalVideoStatsDelegate) {
1399
+ this.onLocalVideoStatsDelegate({ ...data, localVideoStats, peer, track });
1400
+ }
1401
+ };
1402
+
1403
+ onRemoteAudioStatsListener = (data: any) => {
1404
+ if (data.id !== this.id) {
1405
+ return;
1406
+ }
1407
+
1408
+ logger?.verbose('#Listener onRemoteAudioStatsListener', data);
1409
+
1410
+ let remoteAudioStats = new HMSRemoteAudioStats(data.remoteAudioStats);
1411
+ let peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1412
+ let track = HMSEncoder.encodeHmsRemoteAudioTrack(data.track, this.id);
1413
+
1414
+ if (this.onRemoteAudioStatsDelegate) {
1415
+ this.onRemoteAudioStatsDelegate({
1416
+ ...data,
1417
+ remoteAudioStats,
1418
+ peer,
1419
+ track,
1420
+ });
1421
+ }
1422
+ };
1423
+
1424
+ onRemoteVideoStatsListener = (data: any) => {
1425
+ if (data.id !== this.id) {
1426
+ return;
1427
+ }
1428
+
1429
+ logger?.verbose('#Listener onRemoteVideoStatsListener', data);
1430
+
1431
+ let remoteVideoStats = new HMSRemoteVideoStats(data.remoteVideoStats);
1432
+ let peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1433
+ let track = HMSEncoder.encodeHmsRemoteVideoTrack(data.track, this.id);
1434
+
1435
+ if (this.onRemoteVideoStatsDelegate) {
1436
+ this.onRemoteVideoStatsDelegate({
1437
+ ...data,
1438
+ remoteVideoStats,
1439
+ peer,
1440
+ track,
1441
+ });
1442
+ }
1443
+ };
932
1444
  }