@100mslive/react-native-hms 1.2.0 → 1.4.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.
Files changed (279) hide show
  1. package/README.md +61 -7
  2. package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +121 -53
  3. package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +21 -0
  4. package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +177 -31
  5. package/ios/HMSDecoder.swift +113 -50
  6. package/ios/HMSManager.m +5 -0
  7. package/ios/HMSManager.swift +22 -1
  8. package/ios/HMSRNSDK.swift +157 -26
  9. package/ios/HMSView.swift +1 -1
  10. package/lib/commonjs/classes/HMSAudioCodec.js +4 -4
  11. package/lib/commonjs/classes/HMSAudioCodec.js.map +1 -1
  12. package/lib/commonjs/classes/HMSAudioDevice.js +4 -4
  13. package/lib/commonjs/classes/HMSAudioDevice.js.map +1 -1
  14. package/lib/commonjs/classes/HMSAudioFilePlayerNode.js.map +1 -1
  15. package/lib/commonjs/classes/HMSAudioMixerSource.js.map +1 -1
  16. package/lib/commonjs/classes/HMSAudioMixingMode.js +4 -4
  17. package/lib/commonjs/classes/HMSAudioMixingMode.js.map +1 -1
  18. package/lib/commonjs/classes/HMSAudioMode.js +4 -4
  19. package/lib/commonjs/classes/HMSAudioMode.js.map +1 -1
  20. package/lib/commonjs/classes/HMSAudioNode.js +2 -1
  21. package/lib/commonjs/classes/HMSAudioNode.js.map +1 -1
  22. package/lib/commonjs/classes/HMSAudioSettings.js.map +1 -1
  23. package/lib/commonjs/classes/HMSAudioTrack.js.map +1 -1
  24. package/lib/commonjs/classes/HMSAudioTrackSettings.js +1 -1
  25. package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
  26. package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
  27. package/lib/commonjs/classes/HMSCameraFacing.js +4 -4
  28. package/lib/commonjs/classes/HMSCameraFacing.js.map +1 -1
  29. package/lib/commonjs/classes/HMSChangeTrackStateRequest.js.map +1 -1
  30. package/lib/commonjs/classes/HMSConfig.js.map +1 -1
  31. package/lib/commonjs/classes/HMSConstants.js +11 -0
  32. package/lib/commonjs/classes/HMSConstants.js.map +1 -0
  33. package/lib/commonjs/classes/HMSEncoder.js +21 -43
  34. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  35. package/lib/commonjs/classes/HMSException.js +3 -4
  36. package/lib/commonjs/classes/HMSException.js.map +1 -1
  37. package/lib/commonjs/classes/HMSHLSConfig.js.map +1 -1
  38. package/lib/commonjs/classes/HMSHLSMeetingURLVariant.js.map +1 -1
  39. package/lib/commonjs/classes/HMSHLSRecordingConfig.js.map +1 -1
  40. package/lib/commonjs/classes/HMSHLSRecordingState.js.map +1 -1
  41. package/lib/commonjs/classes/HMSHLSStreamingState.js.map +1 -1
  42. package/lib/commonjs/classes/HMSHLSVariant.js.map +1 -1
  43. package/lib/commonjs/classes/HMSHelper.js.map +1 -1
  44. package/lib/commonjs/classes/HMSLocalAudioStats.js.map +1 -1
  45. package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
  46. package/lib/commonjs/classes/HMSLocalPeer.js +0 -1
  47. package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
  48. package/lib/commonjs/classes/HMSLocalVideoStats.js.map +1 -1
  49. package/lib/commonjs/classes/HMSLocalVideoTrack.js +5 -6
  50. package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
  51. package/lib/commonjs/classes/HMSLogAlarmManager.js +4 -4
  52. package/lib/commonjs/classes/HMSLogAlarmManager.js.map +1 -1
  53. package/lib/commonjs/classes/HMSLogLevel.js +4 -4
  54. package/lib/commonjs/classes/HMSLogLevel.js.map +1 -1
  55. package/lib/commonjs/classes/HMSLogSettings.js.map +1 -1
  56. package/lib/commonjs/classes/HMSLogger.js +17 -25
  57. package/lib/commonjs/classes/HMSLogger.js.map +1 -1
  58. package/lib/commonjs/classes/HMSMessage.js +1 -2
  59. package/lib/commonjs/classes/HMSMessage.js.map +1 -1
  60. package/lib/commonjs/classes/HMSMessageRecipient.js.map +1 -1
  61. package/lib/commonjs/classes/HMSMessageRecipientType.js +4 -4
  62. package/lib/commonjs/classes/HMSMessageRecipientType.js.map +1 -1
  63. package/lib/commonjs/classes/HMSMessageType.js +4 -4
  64. package/lib/commonjs/classes/HMSMessageType.js.map +1 -1
  65. package/lib/commonjs/classes/HMSMicNode.js.map +1 -1
  66. package/lib/commonjs/classes/HMSNativeEventEmitter.js +0 -5
  67. package/lib/commonjs/classes/HMSNativeEventEmitter.js.map +1 -1
  68. package/lib/commonjs/classes/HMSNetworkQuality.js.map +1 -1
  69. package/lib/commonjs/classes/HMSPIPListenerActions.js +4 -4
  70. package/lib/commonjs/classes/HMSPIPListenerActions.js.map +1 -1
  71. package/lib/commonjs/classes/HMSPeer.js +68 -22
  72. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  73. package/lib/commonjs/classes/HMSPeerUpdate.js +7 -5
  74. package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
  75. package/lib/commonjs/classes/HMSPeersCache.js +229 -0
  76. package/lib/commonjs/classes/HMSPeersCache.js.map +1 -0
  77. package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
  78. package/lib/commonjs/classes/HMSPublishSettings.js.map +1 -1
  79. package/lib/commonjs/classes/HMSRTCStats.js.map +1 -1
  80. package/lib/commonjs/classes/HMSRTCStatsReport.js.map +1 -1
  81. package/lib/commonjs/classes/HMSRTMPConfig.js.map +1 -1
  82. package/lib/commonjs/classes/HMSRemoteAudioStats.js.map +1 -1
  83. package/lib/commonjs/classes/HMSRemoteAudioTrack.js.map +1 -1
  84. package/lib/commonjs/classes/HMSRemotePeer.js +0 -1
  85. package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
  86. package/lib/commonjs/classes/HMSRemoteVideoStats.js.map +1 -1
  87. package/lib/commonjs/classes/HMSRemoteVideoTrack.js +0 -1
  88. package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
  89. package/lib/commonjs/classes/HMSRole.js.map +1 -1
  90. package/lib/commonjs/classes/HMSRoleChangeRequest.js.map +1 -1
  91. package/lib/commonjs/classes/HMSRoom.js +79 -22
  92. package/lib/commonjs/classes/HMSRoom.js.map +1 -1
  93. package/lib/commonjs/classes/HMSRoomCache.js +128 -0
  94. package/lib/commonjs/classes/HMSRoomCache.js.map +1 -0
  95. package/lib/commonjs/classes/HMSRoomUpdate.js +4 -4
  96. package/lib/commonjs/classes/HMSRoomUpdate.js.map +1 -1
  97. package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -1
  98. package/lib/commonjs/classes/HMSRtmpVideoResolution.js.map +1 -1
  99. package/lib/commonjs/classes/HMSSDK.js +501 -33
  100. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  101. package/lib/commonjs/classes/HMSScreenBroadcastAudioReceiverNode.js.map +1 -1
  102. package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -1
  103. package/lib/commonjs/classes/HMSSimulcastLayerSettings.js.map +1 -1
  104. package/lib/commonjs/classes/HMSSimulcastSettings.js.map +1 -1
  105. package/lib/commonjs/classes/HMSSpeaker.js.map +1 -1
  106. package/lib/commonjs/classes/HMSSubscribeSettings.js.map +1 -1
  107. package/lib/commonjs/classes/HMSTrack.js.map +1 -1
  108. package/lib/commonjs/classes/HMSTrackSettings.js.map +1 -1
  109. package/lib/commonjs/classes/HMSTrackSettingsInitState.js +4 -4
  110. package/lib/commonjs/classes/HMSTrackSettingsInitState.js.map +1 -1
  111. package/lib/commonjs/classes/HMSTrackSource.js +4 -4
  112. package/lib/commonjs/classes/HMSTrackSource.js.map +1 -1
  113. package/lib/commonjs/classes/HMSTrackType.js +4 -4
  114. package/lib/commonjs/classes/HMSTrackType.js.map +1 -1
  115. package/lib/commonjs/classes/HMSTrackUpdate.js +4 -4
  116. package/lib/commonjs/classes/HMSTrackUpdate.js.map +1 -1
  117. package/lib/commonjs/classes/HMSUpdateListenerActions.js +5 -5
  118. package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
  119. package/lib/commonjs/classes/HMSVideoCodec.js +4 -4
  120. package/lib/commonjs/classes/HMSVideoCodec.js.map +1 -1
  121. package/lib/commonjs/classes/HMSVideoResolution.js.map +1 -1
  122. package/lib/commonjs/classes/HMSVideoSettings.js.map +1 -1
  123. package/lib/commonjs/classes/HMSVideoTrack.js.map +1 -1
  124. package/lib/commonjs/classes/HMSVideoTrackSettings.js +1 -1
  125. package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
  126. package/lib/commonjs/classes/HMSVideoViewMode.js +4 -4
  127. package/lib/commonjs/classes/HMSVideoViewMode.js.map +1 -1
  128. package/lib/commonjs/classes/HmsView.js +2 -1
  129. package/lib/commonjs/classes/HmsView.js.map +1 -1
  130. package/lib/commonjs/index.js.map +1 -1
  131. package/lib/module/classes/HMSAudioCodec.js +3 -3
  132. package/lib/module/classes/HMSAudioCodec.js.map +1 -1
  133. package/lib/module/classes/HMSAudioDevice.js +3 -3
  134. package/lib/module/classes/HMSAudioDevice.js.map +1 -1
  135. package/lib/module/classes/HMSAudioFilePlayerNode.js.map +1 -1
  136. package/lib/module/classes/HMSAudioMixerSource.js.map +1 -1
  137. package/lib/module/classes/HMSAudioMixingMode.js +3 -3
  138. package/lib/module/classes/HMSAudioMixingMode.js.map +1 -1
  139. package/lib/module/classes/HMSAudioMode.js +3 -3
  140. package/lib/module/classes/HMSAudioMode.js.map +1 -1
  141. package/lib/module/classes/HMSAudioNode.js +2 -1
  142. package/lib/module/classes/HMSAudioNode.js.map +1 -1
  143. package/lib/module/classes/HMSAudioSettings.js.map +1 -1
  144. package/lib/module/classes/HMSAudioTrack.js.map +1 -1
  145. package/lib/module/classes/HMSAudioTrackSettings.js +1 -1
  146. package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
  147. package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -1
  148. package/lib/module/classes/HMSCameraFacing.js +3 -3
  149. package/lib/module/classes/HMSCameraFacing.js.map +1 -1
  150. package/lib/module/classes/HMSChangeTrackStateRequest.js.map +1 -1
  151. package/lib/module/classes/HMSConfig.js.map +1 -1
  152. package/lib/module/classes/HMSConstants.js +4 -0
  153. package/lib/module/classes/HMSConstants.js.map +1 -0
  154. package/lib/module/classes/HMSEncoder.js +21 -43
  155. package/lib/module/classes/HMSEncoder.js.map +1 -1
  156. package/lib/module/classes/HMSException.js +3 -4
  157. package/lib/module/classes/HMSException.js.map +1 -1
  158. package/lib/module/classes/HMSHLSConfig.js.map +1 -1
  159. package/lib/module/classes/HMSHLSMeetingURLVariant.js.map +1 -1
  160. package/lib/module/classes/HMSHLSRecordingConfig.js.map +1 -1
  161. package/lib/module/classes/HMSHLSRecordingState.js.map +1 -1
  162. package/lib/module/classes/HMSHLSStreamingState.js.map +1 -1
  163. package/lib/module/classes/HMSHLSVariant.js.map +1 -1
  164. package/lib/module/classes/HMSHelper.js.map +1 -1
  165. package/lib/module/classes/HMSLocalAudioStats.js.map +1 -1
  166. package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
  167. package/lib/module/classes/HMSLocalPeer.js +0 -1
  168. package/lib/module/classes/HMSLocalPeer.js.map +1 -1
  169. package/lib/module/classes/HMSLocalVideoStats.js.map +1 -1
  170. package/lib/module/classes/HMSLocalVideoTrack.js +5 -6
  171. package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
  172. package/lib/module/classes/HMSLogAlarmManager.js +3 -3
  173. package/lib/module/classes/HMSLogAlarmManager.js.map +1 -1
  174. package/lib/module/classes/HMSLogLevel.js +3 -3
  175. package/lib/module/classes/HMSLogLevel.js.map +1 -1
  176. package/lib/module/classes/HMSLogSettings.js.map +1 -1
  177. package/lib/module/classes/HMSLogger.js +17 -25
  178. package/lib/module/classes/HMSLogger.js.map +1 -1
  179. package/lib/module/classes/HMSMessage.js +1 -2
  180. package/lib/module/classes/HMSMessage.js.map +1 -1
  181. package/lib/module/classes/HMSMessageRecipient.js.map +1 -1
  182. package/lib/module/classes/HMSMessageRecipientType.js +3 -3
  183. package/lib/module/classes/HMSMessageRecipientType.js.map +1 -1
  184. package/lib/module/classes/HMSMessageType.js +3 -3
  185. package/lib/module/classes/HMSMessageType.js.map +1 -1
  186. package/lib/module/classes/HMSMicNode.js.map +1 -1
  187. package/lib/module/classes/HMSNativeEventEmitter.js +1 -6
  188. package/lib/module/classes/HMSNativeEventEmitter.js.map +1 -1
  189. package/lib/module/classes/HMSNetworkQuality.js.map +1 -1
  190. package/lib/module/classes/HMSPIPListenerActions.js +3 -3
  191. package/lib/module/classes/HMSPIPListenerActions.js.map +1 -1
  192. package/lib/module/classes/HMSPeer.js +68 -22
  193. package/lib/module/classes/HMSPeer.js.map +1 -1
  194. package/lib/module/classes/HMSPeerUpdate.js +4 -3
  195. package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
  196. package/lib/module/classes/HMSPeersCache.js +216 -0
  197. package/lib/module/classes/HMSPeersCache.js.map +1 -0
  198. package/lib/module/classes/HMSPermissions.js.map +1 -1
  199. package/lib/module/classes/HMSPublishSettings.js.map +1 -1
  200. package/lib/module/classes/HMSRTCStats.js.map +1 -1
  201. package/lib/module/classes/HMSRTCStatsReport.js.map +1 -1
  202. package/lib/module/classes/HMSRTMPConfig.js.map +1 -1
  203. package/lib/module/classes/HMSRemoteAudioStats.js.map +1 -1
  204. package/lib/module/classes/HMSRemoteAudioTrack.js.map +1 -1
  205. package/lib/module/classes/HMSRemotePeer.js +0 -1
  206. package/lib/module/classes/HMSRemotePeer.js.map +1 -1
  207. package/lib/module/classes/HMSRemoteVideoStats.js.map +1 -1
  208. package/lib/module/classes/HMSRemoteVideoTrack.js +0 -1
  209. package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
  210. package/lib/module/classes/HMSRole.js.map +1 -1
  211. package/lib/module/classes/HMSRoleChangeRequest.js.map +1 -1
  212. package/lib/module/classes/HMSRoom.js +79 -22
  213. package/lib/module/classes/HMSRoom.js.map +1 -1
  214. package/lib/module/classes/HMSRoomCache.js +115 -0
  215. package/lib/module/classes/HMSRoomCache.js.map +1 -0
  216. package/lib/module/classes/HMSRoomUpdate.js +3 -3
  217. package/lib/module/classes/HMSRoomUpdate.js.map +1 -1
  218. package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -1
  219. package/lib/module/classes/HMSRtmpVideoResolution.js.map +1 -1
  220. package/lib/module/classes/HMSSDK.js +501 -33
  221. package/lib/module/classes/HMSSDK.js.map +1 -1
  222. package/lib/module/classes/HMSScreenBroadcastAudioReceiverNode.js.map +1 -1
  223. package/lib/module/classes/HMSServerRecordingState.js.map +1 -1
  224. package/lib/module/classes/HMSSimulcastLayerSettings.js.map +1 -1
  225. package/lib/module/classes/HMSSimulcastSettings.js.map +1 -1
  226. package/lib/module/classes/HMSSpeaker.js.map +1 -1
  227. package/lib/module/classes/HMSSubscribeSettings.js.map +1 -1
  228. package/lib/module/classes/HMSTrack.js.map +1 -1
  229. package/lib/module/classes/HMSTrackSettings.js.map +1 -1
  230. package/lib/module/classes/HMSTrackSettingsInitState.js +3 -3
  231. package/lib/module/classes/HMSTrackSettingsInitState.js.map +1 -1
  232. package/lib/module/classes/HMSTrackSource.js +3 -3
  233. package/lib/module/classes/HMSTrackSource.js.map +1 -1
  234. package/lib/module/classes/HMSTrackType.js +3 -3
  235. package/lib/module/classes/HMSTrackType.js.map +1 -1
  236. package/lib/module/classes/HMSTrackUpdate.js +3 -3
  237. package/lib/module/classes/HMSTrackUpdate.js.map +1 -1
  238. package/lib/module/classes/HMSUpdateListenerActions.js +4 -4
  239. package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
  240. package/lib/module/classes/HMSVideoCodec.js +3 -3
  241. package/lib/module/classes/HMSVideoCodec.js.map +1 -1
  242. package/lib/module/classes/HMSVideoResolution.js.map +1 -1
  243. package/lib/module/classes/HMSVideoSettings.js.map +1 -1
  244. package/lib/module/classes/HMSVideoTrack.js.map +1 -1
  245. package/lib/module/classes/HMSVideoTrackSettings.js +1 -1
  246. package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
  247. package/lib/module/classes/HMSVideoViewMode.js +3 -3
  248. package/lib/module/classes/HMSVideoViewMode.js.map +1 -1
  249. package/lib/module/classes/HmsView.js +2 -1
  250. package/lib/module/classes/HmsView.js.map +1 -1
  251. package/lib/typescript/classes/HMSConstants.d.ts +3 -0
  252. package/lib/typescript/classes/HMSEncoder.d.ts +7 -6
  253. package/lib/typescript/classes/HMSLocalPeer.d.ts +0 -14
  254. package/lib/typescript/classes/HMSLogger.d.ts +1 -7
  255. package/lib/typescript/classes/HMSPeer.d.ts +12 -18
  256. package/lib/typescript/classes/HMSPeerUpdate.d.ts +1 -0
  257. package/lib/typescript/classes/HMSPeersCache.d.ts +17 -0
  258. package/lib/typescript/classes/HMSRemotePeer.d.ts +0 -14
  259. package/lib/typescript/classes/HMSRoom.d.ts +11 -22
  260. package/lib/typescript/classes/HMSRoomCache.d.ts +16 -0
  261. package/lib/typescript/classes/HMSSDK.d.ts +20 -12
  262. package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +1 -1
  263. package/package.json +2 -2
  264. package/sdk-versions.json +3 -3
  265. package/src/classes/HMSAudioNode.ts +3 -1
  266. package/src/classes/HMSConstants.ts +3 -0
  267. package/src/classes/HMSEncoder.ts +24 -69
  268. package/src/classes/HMSLocalPeer.ts +0 -15
  269. package/src/classes/HMSLogger.ts +20 -19
  270. package/src/classes/HMSNativeEventEmitter.ts +35 -12
  271. package/src/classes/HMSPeer.ts +133 -34
  272. package/src/classes/HMSPeerUpdate.ts +9 -0
  273. package/src/classes/HMSPeersCache.ts +252 -0
  274. package/src/classes/HMSRemotePeer.ts +0 -16
  275. package/src/classes/HMSRoom.ts +141 -37
  276. package/src/classes/HMSRoomCache.ts +157 -0
  277. package/src/classes/HMSSDK.tsx +102 -43
  278. package/src/classes/HMSUpdateListenerActions.ts +1 -1
  279. package/src/classes/HmsView.tsx +2 -1
@@ -16,6 +16,9 @@ import { HmsViewComponent } from './HmsView';
16
16
  import { HMSMessageType } from './HMSMessageType';
17
17
  import { HMSPIPListenerActions } from './HMSPIPListenerActions';
18
18
  import { HMSNativeEventEmitter } from './HMSNativeEventEmitter';
19
+ import { clearHmsPeersCache, getHmsPeersCache, HMSPeersCache, setHmsPeersCache } from './HMSPeersCache';
20
+ import { clearHmsRoomCache, getHmsRoomCache, HMSRoomCache, setHmsRoomCache } from './HMSRoomCache';
21
+ import { HMSPeerUpdateOrdinals } from './HMSPeerUpdate';
19
22
  const {
20
23
  /**
21
24
  * @ignore
@@ -52,29 +55,74 @@ export class HMSSDK {
52
55
  _defineProperty(this, "onAudioDeviceChangedDelegate", void 0);
53
56
  _defineProperty(this, "onPIPRoomLeaveDelegate", void 0);
54
57
  _defineProperty(this, "emitterSubscriptions", {});
55
- _defineProperty(this, "setLogger", hmsLogger => {
56
- setLogger(this.id, hmsLogger);
57
- });
58
+ /**
59
+ * - Calls removeListeners that in turn breaks all connections with native listeners.
60
+ *
61
+ * @memberof HMSSDK
62
+ */
58
63
  _defineProperty(this, "destroy", async () => {
59
64
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function destroy', {
60
65
  id: this.id
61
66
  });
67
+ clearHmsPeersCache();
68
+ clearHmsRoomCache();
62
69
  this.removeAllListeners();
63
70
  return await HMSManager.destroy({
64
71
  id: this.id
65
72
  });
66
73
  });
74
+ /**
75
+ * - getAuthTokenByRoomCode function is used to get the Auth Token by Room Code
76
+ *
77
+ * checkout {@link https://www.100ms.live/docs/concepts/v2/concepts/rooms/room-codes/room-codes} for more info
78
+ *
79
+ * @memberof HMSSDK
80
+ */
81
+ _defineProperty(this, "getAuthTokenByRoomCode", async (roomCode, userId, endpoint) => {
82
+ logger === null || logger === void 0 ? void 0 : logger.verbose('#Function getAuthTokenByRoomCode', {
83
+ id: this.id,
84
+ roomCode,
85
+ userId,
86
+ endpoint
87
+ });
88
+ return HMSManager.getAuthTokenByRoomCode({
89
+ id: this.id,
90
+ roomCode,
91
+ userId,
92
+ endpoint
93
+ });
94
+ });
95
+ /**
96
+ * takes an instance of [HMSConfig]{@link HMSConfig} and joins the room.
97
+ * after joining the room user will start receiving the events and updates of the room.
98
+ *
99
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/join} for more info
100
+ *
101
+ * @param {HMSConfig} config
102
+ * @memberof HMSSDK
103
+ */
67
104
  _defineProperty(this, "join", async config => {
68
105
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function join', {
69
106
  config,
70
107
  id: this.id
71
108
  });
72
109
  this.addAppStateListener();
110
+ setHmsPeersCache(new HMSPeersCache(this.id));
111
+ setHmsRoomCache(new HMSRoomCache(this.id));
73
112
  await HMSManager.join({
74
113
  ...config,
75
114
  id: this.id
76
115
  });
77
116
  });
117
+ /**
118
+ * - preview function is used to initiate a preview for the localPeer.
119
+ * - We can call this function and wait for a response in previewListener, the response will contain previewTracks for local peer.
120
+ *
121
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/preview} for more info
122
+ *
123
+ * @param {HMSConfig} config
124
+ * @memberof HMSSDK
125
+ */
78
126
  _defineProperty(this, "preview", config => {
79
127
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function preview', {
80
128
  config,
@@ -85,6 +133,17 @@ export class HMSSDK {
85
133
  id: this.id
86
134
  });
87
135
  });
136
+ /**
137
+ * - previewForRole can be used when there is role change request for current localPeer and we want
138
+ * to show the localPeer how the tracks look before publishing them to room.
139
+ *
140
+ * - It requires a role of type [HMSRole]{@link HMSRole} for which we want to preview the tracks.
141
+ *
142
+ * checkout {@link https://www.100ms.live/docs/react-native} for more info
143
+ *
144
+ * @param {HMSRole}
145
+ * @memberof HMSSDK
146
+ */
88
147
  _defineProperty(this, "previewForRole", async role => {
89
148
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function previewForRole', {
90
149
  role,
@@ -100,6 +159,17 @@ export class HMSSDK {
100
159
  return 'API currently not available for android';
101
160
  }
102
161
  });
162
+ /**
163
+ * - HmsView is react component that takes trackId and starts showing that track on a tile.
164
+ * - The appearance of tile is completely customizable with style prop.
165
+ * - Scale type can determine how the incoming video will fit in the canvas check {@link HMSVideoViewMode} for more information.
166
+ * - Mirror to flip the video vertically.
167
+ *
168
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/render-video} for more info
169
+ *
170
+ * @param {HmsViewProps}
171
+ * @memberof HMSSDK
172
+ */
103
173
  _defineProperty(this, "HmsView", /*#__PURE__*/React.forwardRef((props, ref) => {
104
174
  const {
105
175
  trackId,
@@ -122,8 +192,17 @@ export class HMSSDK {
122
192
  var _this$appStateSubscri;
123
193
  this.muteStatus = undefined;
124
194
  this === null || this === void 0 ? void 0 : (_this$appStateSubscri = this.appStateSubscription) === null || _this$appStateSubscri === void 0 ? void 0 : _this$appStateSubscri.remove();
195
+ clearHmsPeersCache();
196
+ clearHmsRoomCache();
125
197
  HMSEncoder.clearData(); // Clearing cached data in encoder
126
198
  });
199
+ /**
200
+ * Calls leave function of native sdk and session of current user is invalidated.
201
+ *
202
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/leave} for more info
203
+ *
204
+ * @memberof HMSSDK
205
+ */
127
206
  _defineProperty(this, "leave", async () => {
128
207
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function leave', {
129
208
  id: this.id
@@ -135,6 +214,14 @@ export class HMSSDK {
135
214
  this.roomLeaveCleanup();
136
215
  return op;
137
216
  });
217
+ /**
218
+ * - This function sends message to all the peers in the room, the get the message in onMessage listener.
219
+ *
220
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
221
+ *
222
+ * @param {message: string} and @param {type: string}
223
+ * @memberof HMSSDK
224
+ */
138
225
  _defineProperty(this, "sendBroadcastMessage", async function (message) {
139
226
  let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : HMSMessageType.CHAT;
140
227
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function sendBroadcastMessage', {
@@ -148,6 +235,14 @@ export class HMSSDK {
148
235
  id: _this.id
149
236
  });
150
237
  });
238
+ /**
239
+ * - sendGroupMessage sends a message to specific set of roles, whoever has any of those role in room
240
+ * will get the message in onMessage listener.
241
+ *
242
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
243
+ *
244
+ * @memberof HMSSDK
245
+ */
151
246
  _defineProperty(this, "sendGroupMessage", async function (message, roles) {
152
247
  let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : HMSMessageType.CHAT;
153
248
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function sendGroupMessage', {
@@ -163,6 +258,14 @@ export class HMSSDK {
163
258
  type: type || null
164
259
  });
165
260
  });
261
+ /**
262
+ * - sendDirectMessage sends a private message to a single peer, only that peer will get the message
263
+ * in onMessage Listener.
264
+ *
265
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
266
+ *
267
+ * @memberof HMSSDK
268
+ */
166
269
  _defineProperty(this, "sendDirectMessage", async function (message, peer) {
167
270
  let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : HMSMessageType.CHAT;
168
271
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function sendDirectMessage', {
@@ -178,6 +281,18 @@ export class HMSSDK {
178
281
  type: type || null
179
282
  });
180
283
  });
284
+ /**
285
+ * - changeMetadata changes a specific field in localPeer which is [metadata] it is a string that can
286
+ * be used for various functionalities like raiseHand, beRightBack and many more that explains the
287
+ * current status of the peer.
288
+ *
289
+ * - it is advised to use a json object in string format to store multiple dataPoints in metadata.
290
+ *
291
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/advanced-features/change-metadata} for more info
292
+ *
293
+ * @param {string}
294
+ * @memberof HMSSDK
295
+ */
181
296
  _defineProperty(this, "changeMetadata", async metadata => {
182
297
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function changeMetadata', {
183
298
  metadata,
@@ -188,6 +303,15 @@ export class HMSSDK {
188
303
  id: this.id
189
304
  });
190
305
  });
306
+ /**
307
+ * - startRTMPOrRecording takes a configuration object {@link HMSRTMPConfig} and stats the RTMP recording
308
+ * - this object of {@link HMSRTMPConfig} sets the urls for streaming and weather to set recording on or not
309
+ * - we get the response of this function in onRoomUpdate as RTMP_STREAMING_STATE_UPDATED.
310
+ *
311
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/recording} for more info
312
+ *
313
+ * @memberof HMSSDK
314
+ */
191
315
  _defineProperty(this, "startRTMPOrRecording", async data => {
192
316
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function startRTMPOrRecording', {
193
317
  ...data,
@@ -199,6 +323,14 @@ export class HMSSDK {
199
323
  });
200
324
  return op;
201
325
  });
326
+ /**
327
+ * - this function stops all the ongoing RTMP streaming and recording.
328
+ * - we get the response of this function in onRoomUpdate as RTMP_STREAMING_STATE_UPDATED.
329
+ *
330
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/recording} for more info
331
+ *
332
+ * @memberof HMSSDK
333
+ */
202
334
  _defineProperty(this, "stopRtmpAndRecording", async () => {
203
335
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function stopRtmpAndRecording', {});
204
336
  const op = await HMSManager.stopRtmpAndRecording({
@@ -206,6 +338,15 @@ export class HMSSDK {
206
338
  });
207
339
  return op;
208
340
  });
341
+ /**
342
+ * - This function starts HLSStreaming.
343
+ * - we get the response of this function in onRoomUpdate as HLS_STREAMING_STATE_UPDATED.
344
+ *
345
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/hls-streaming} for more info
346
+ *
347
+ * @param {HMSHLSConfig}
348
+ * @memberof HMSSDK
349
+ */
209
350
  _defineProperty(this, "startHLSStreaming", async data => {
210
351
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function startHLSStreaming', {
211
352
  ...data,
@@ -216,12 +357,36 @@ export class HMSSDK {
216
357
  id: this.id
217
358
  });
218
359
  });
360
+ /**
361
+ * - stopHLSStreaming function stops the ongoing HLSStreams.
362
+ * - we get the response of this function in onRoomUpdate as HLS_STREAMING_STATE_UPDATED.
363
+ *
364
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/hls-streaming} for more info
365
+ *
366
+ * @memberof HMSSDK
367
+ */
219
368
  _defineProperty(this, "stopHLSStreaming", async () => {
220
369
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function stopHLSStreaming', {});
221
370
  return await HMSManager.stopHLSStreaming({
222
371
  id: this.id
223
372
  });
224
373
  });
374
+ /**
375
+ * @deprecated This function has been deprecated in favor of #Function changeRoleOfPeer
376
+ *
377
+ * - This function can be used in a situation when we want to change role hence manipulate their
378
+ * access and rights in the current room, it takes the peer {@link HMSPeer} whom role we want to change,
379
+ * role {@link HMSRole} which will be the new role for that peer and weather to forcefully change
380
+ * the role or ask the to accept the role change request using a boolean force.
381
+ *
382
+ * - if we change the role forcefully the peer's role will be updated without asking the peer
383
+ * otherwise the user will get the roleChangeRequest in roleChangeRequest listener.
384
+ * for more information on this checkout {@link onRoleChangeRequestListener}
385
+ *
386
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
387
+ *
388
+ * @memberof HMSSDK
389
+ */
225
390
  _defineProperty(this, "changeRole", async function (peer, role) {
226
391
  let force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
227
392
  const data = {
@@ -233,6 +398,20 @@ export class HMSSDK {
233
398
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function changeRole', data);
234
399
  return await HMSManager.changeRole(data);
235
400
  });
401
+ /**
402
+ * - This function can be used in a situation when we want to change role hence manipulate their
403
+ * access and rights in the current room, it takes the peer {@link HMSPeer} whom role we want to change,
404
+ * role {@link HMSRole} which will be the new role for that peer and weather to forcefully change
405
+ * the role or ask the to accept the role change request using a boolean force.
406
+ *
407
+ * - if we change the role forcefully the peer's role will be updated without asking the peer
408
+ * otherwise the user will get the roleChangeRequest in roleChangeRequest listener.
409
+ * for more information on this checkout {@link onRoleChangeRequestListener}
410
+ *
411
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
412
+ *
413
+ * @memberof HMSSDK
414
+ */
236
415
  _defineProperty(this, "changeRoleOfPeer", async function (peer, role) {
237
416
  let force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
238
417
  const data = {
@@ -244,6 +423,19 @@ export class HMSSDK {
244
423
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function changeRoleOfPeer', data);
245
424
  return HMSManager.changeRoleOfPeer(data);
246
425
  });
426
+ /**
427
+ * - This function can be used in a situation when we want to change role of multiple peers by specifying their roles.
428
+ * Hence manipulate their access and rights in the current room.
429
+ * It takes the list of roles {@link HMSRole} whom role we want to change
430
+ * and role {@link HMSRole} which will be the new role for peers.
431
+ *
432
+ * - Note that role will be updated without asking the peers.
433
+ * Meaning, Peers will not get the roleChangeRequest in roleChangeRequest listener.
434
+ *
435
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
436
+ *
437
+ * @memberof HMSSDK
438
+ */
247
439
  _defineProperty(this, "changeRoleOfPeersWithRoles", async (ofRoles, toRole) => {
248
440
  const data = {
249
441
  ofRoles: ofRoles.map(ofRole => ofRole.name).filter(Boolean),
@@ -253,6 +445,15 @@ export class HMSSDK {
253
445
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function changeRoleOfPeersWithRoles', data);
254
446
  return HMSManager.changeRoleOfPeersWithRoles(data);
255
447
  });
448
+ /**
449
+ * - This function can be used to manipulate mute status of any track.
450
+ * - Targeted peer affected by this action will get a callback in onChangeTrackStateRequestListener.
451
+ *
452
+ * * checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-track-state} for more info
453
+ *
454
+ * @param {HMSTrack}
455
+ * @memberof HMSSDK
456
+ */
256
457
  _defineProperty(this, "changeTrackState", async (track, mute) => {
257
458
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function changeTrackState', {
258
459
  track,
@@ -266,6 +467,14 @@ export class HMSSDK {
266
467
  };
267
468
  return await HMSManager.changeTrackState(data);
268
469
  });
470
+ /**
471
+ * - changeTrackStateForRoles is an enhancement on the functionality of {@link changeTrackState}.
472
+ * - We can change mute status for all the tracks of peers having a particular role.
473
+ * - @param source determines the source of the track ex. video, audio etc.
474
+ * - The peers affected by this action will get a callback in onChangeTrackStateRequestListener.
475
+ *
476
+ * @memberof HMSSDK
477
+ */
269
478
  _defineProperty(this, "changeTrackStateForRoles", async (mute, type, source, roles) => {
270
479
  let roleNames = null;
271
480
  if (roles) {
@@ -287,6 +496,14 @@ export class HMSSDK {
287
496
  };
288
497
  return await HMSManager.changeTrackStateForRoles(data);
289
498
  });
499
+ /**
500
+ * - removePeer can forcefully disconnect a Peer from the room.
501
+ * - the user who's removed from this action will get a callback in {@link onRemovedFromRoomListener}.
502
+ *
503
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/remove-peer} for more info
504
+ *
505
+ * @memberof HMSSDK
506
+ */
290
507
  _defineProperty(this, "removePeer", async (peer, reason) => {
291
508
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function removePeer', {
292
509
  peerId: peer.peerID,
@@ -300,6 +517,15 @@ export class HMSSDK {
300
517
  };
301
518
  return await HMSManager.removePeer(data);
302
519
  });
520
+ /**
521
+ * - endRoom can be used in a situation where we want to disconnect all the peers from current room
522
+ * and end the call.
523
+ * - everyone in the room will get an update of this action in {@link onRemovedFromRoomListener}.
524
+ *
525
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/end-room} for more info
526
+ *
527
+ * @memberof HMSSDK
528
+ */
303
529
  _defineProperty(this, "endRoom", async function (reason) {
304
530
  let lock = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
305
531
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function endRoom', {
@@ -314,6 +540,13 @@ export class HMSSDK {
314
540
  };
315
541
  return await HMSManager.endRoom(data);
316
542
  });
543
+ /**
544
+ * - This function can be used to change name of localPeer.
545
+ *
546
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-name} for more info
547
+ *
548
+ * @memberof HMSSDK
549
+ */
317
550
  _defineProperty(this, "changeName", async name => {
318
551
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function changeName', {
319
552
  name,
@@ -325,6 +558,13 @@ export class HMSSDK {
325
558
  };
326
559
  return await HMSManager.changeName(data);
327
560
  });
561
+ /**
562
+ * - Calling this function will accept the most recent roleChange request made by anyone in the room
563
+ *
564
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
565
+ *
566
+ * @memberof HMSSDK
567
+ */
328
568
  _defineProperty(this, "acceptRoleChange", async () => {
329
569
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function acceptRoleChange', {
330
570
  id: this.id
@@ -333,6 +573,14 @@ export class HMSSDK {
333
573
  id: this.id
334
574
  });
335
575
  });
576
+ /**
577
+ * - setPlaybackForAllAudio is an extension of the abilities of setPlaybackAllowed in
578
+ * HMSRemoteAudioTrack. It sets mute status for all peers in the room only for the local peer.
579
+ *
580
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/playback-allowed} for more info
581
+ *
582
+ * @memberof HMSSDK
583
+ */
336
584
  _defineProperty(this, "setPlaybackForAllAudio", mute => {
337
585
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function setPlaybackForAllAudio', {
338
586
  mute,
@@ -344,6 +592,11 @@ export class HMSSDK {
344
592
  id: this.id
345
593
  });
346
594
  });
595
+ /**
596
+ * - This function mutes audio for all peers in the room.
597
+ *
598
+ * @memberof HMSSDK
599
+ */
347
600
  _defineProperty(this, "remoteMuteAllAudio", async () => {
348
601
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function remoteMuteAllAudio', {
349
602
  id: this.id
@@ -352,16 +605,34 @@ export class HMSSDK {
352
605
  id: this.id
353
606
  });
354
607
  });
608
+ /**
609
+ * - getRoom is a wrapper function on an existing native function also known as getRoom the returns
610
+ * current room object which is of type {@link HMSRoom}
611
+ *
612
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/join#get-room} for more info
613
+ *
614
+ * @memberof HMSSDK
615
+ * @return Promise<HMSRoom>
616
+ */
355
617
  _defineProperty(this, "getRoom", async () => {
618
+ var _getHmsRoomCache;
356
619
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function getRoom', {
357
620
  id: this.id
358
621
  });
359
622
  const hmsRoom = await HMSManager.getRoom({
360
623
  id: this.id
361
624
  });
625
+ (_getHmsRoomCache = getHmsRoomCache()) === null || _getHmsRoomCache === void 0 ? void 0 : _getHmsRoomCache.updateRoomCache(hmsRoom);
362
626
  const encodedHmsRoom = HMSEncoder.encodeHmsRoom(hmsRoom, this.id);
363
627
  return encodedHmsRoom;
364
628
  });
629
+ /**
630
+ * - getLocalPeer is a wrapper function on an existing native function also known as getLocalPeer the returns
631
+ * current local peer object which is of type {@link HMSLocalPeer}
632
+ *
633
+ * @memberof HMSSDK
634
+ * @return Promise<HMSLocalPeer>
635
+ */
365
636
  _defineProperty(this, "getLocalPeer", async () => {
366
637
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function getLocalPeer', {
367
638
  id: this.id
@@ -372,6 +643,13 @@ export class HMSSDK {
372
643
  const encodedLocalPeer = HMSEncoder.encodeHmsLocalPeer(localPeer, this.id);
373
644
  return encodedLocalPeer;
374
645
  });
646
+ /**
647
+ * - getRemotePeers is a wrapper function on an existing native function also known as getRemotePeers the returns
648
+ * remote peers array which is of type {@link HMSRemotePeer}
649
+ *
650
+ * @memberof HMSSDK
651
+ * @return Promise<HMSRemotePeer[]>
652
+ */
375
653
  _defineProperty(this, "getRemotePeers", async () => {
376
654
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function getRemotePeers', {
377
655
  id: this.id
@@ -382,6 +660,13 @@ export class HMSSDK {
382
660
  const encodedRemotePeers = HMSEncoder.encodeHmsRemotePeers(remotePeers, this.id);
383
661
  return encodedRemotePeers;
384
662
  });
663
+ /**
664
+ * - getRoles is a wrapper function on an existing native function also known as getRoles the returns
665
+ * array of all present roles which is of type {@link HMSRole}
666
+ *
667
+ * @memberof HMSSDK
668
+ * @return Promise<HMSRole[]>
669
+ */
385
670
  _defineProperty(this, "getRoles", async () => {
386
671
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function getRoles', {
387
672
  id: this.id
@@ -392,6 +677,13 @@ export class HMSSDK {
392
677
  const encodedRoles = HMSEncoder.encodeHmsRoles(roles);
393
678
  return encodedRoles;
394
679
  });
680
+ /**
681
+ * - This function sets the volume of any peer in the room
682
+ *
683
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/advanced-features/set-volume} for more info
684
+ *
685
+ * @memberof HMSSDK
686
+ */
395
687
  _defineProperty(this, "setVolume", (track, volume) => {
396
688
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function setVolume', {
397
689
  track,
@@ -412,6 +704,13 @@ export class HMSSDK {
412
704
  id: this.id
413
705
  });
414
706
  });
707
+ /**
708
+ * - This is a temporary solution for the situation when mic access is taken from the app and
709
+ * user returns to the app with no mic access. It will re-acquire the mic by setting the volume
710
+ * from native side
711
+ *
712
+ * @memberof HMSSDK
713
+ */
415
714
  _defineProperty(this, "addAppStateListener", () => {
416
715
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function addAppStateListener', {
417
716
  id: this.id
@@ -422,6 +721,13 @@ export class HMSSDK {
422
721
  }
423
722
  });
424
723
  });
724
+ /**
725
+ * - This function is used to start screenshare, currently available only for android
726
+ *
727
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/screenshare} for more info
728
+ *
729
+ * @memberof HMSSDK
730
+ */
425
731
  _defineProperty(this, "startScreenshare", async () => {
426
732
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function startScreenshare', {
427
733
  id: this.id
@@ -430,6 +736,13 @@ export class HMSSDK {
430
736
  id: this.id
431
737
  });
432
738
  });
739
+ /**
740
+ * - Returns a boolean stating if the screen is currently shared or not
741
+ *
742
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/screenshare} for more info
743
+ *
744
+ * @memberof HMSSDK
745
+ */
433
746
  _defineProperty(this, "isScreenShared", async () => {
434
747
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function isScreenShared', {
435
748
  id: this.id
@@ -438,6 +751,13 @@ export class HMSSDK {
438
751
  id: this.id
439
752
  });
440
753
  });
754
+ /**
755
+ * - stops the screenShare, currently available for android only.
756
+ *
757
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/screenshare} for more info
758
+ *
759
+ * @memberof HMSSDK
760
+ */
441
761
  _defineProperty(this, "stopScreenshare", async () => {
442
762
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function stopScreenshare', {
443
763
  id: this.id
@@ -446,6 +766,18 @@ export class HMSSDK {
446
766
  id: this.id
447
767
  });
448
768
  });
769
+ /**
770
+ * - enableRTCStats sets a boolean in native side which in turn allows several events to be passed
771
+ * through the bridge these events are {@link RTCStatsListener}, {@link onRemoteVideoStatsListener},
772
+ * {@link onRemoteAudioStatsListener}, {@link onLocalAudioStatsListener} and {@link onLocalVideoStatsListener}
773
+ *
774
+ * - These listeners get various dataPoints for current peers and their connectivity to the room
775
+ * such as jitter, latency etc.
776
+ *
777
+ * - currently available for iOS only
778
+ *
779
+ * @memberof HMSSDK
780
+ */
449
781
  _defineProperty(this, "enableRTCStats", () => {
450
782
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function enableRTCStats', {
451
783
  id: this.id
@@ -454,6 +786,14 @@ export class HMSSDK {
454
786
  id: this.id
455
787
  });
456
788
  });
789
+ /**
790
+ * - disable RTCStats sets the same boolean to false that was set true by enableRTCStats.
791
+ * that activates a check which filters out the events acquired in native listeners and don't
792
+ * let them pass through bridge
793
+ *
794
+ * - currently available for iOS only.
795
+ * @memberof HMSSDK
796
+ */
457
797
  _defineProperty(this, "disableRTCStats", () => {
458
798
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function disableRTCStats', {
459
799
  id: this.id
@@ -478,6 +818,14 @@ export class HMSSDK {
478
818
  id: this.id
479
819
  });
480
820
  });
821
+ /**
822
+ * - This wrapper function is used to start streaming device audio, currently available only for android.
823
+ *
824
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/audio-share#how-to-stream-device-audio-from-the-app} for more info.
825
+ *
826
+ * @param {HMSAudioMixingMode}
827
+ * @memberof HMSSDK
828
+ */
481
829
  _defineProperty(this, "startAudioshare", async audioMixingMode => {
482
830
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function startAudioshare', {
483
831
  id: this.id,
@@ -493,6 +841,13 @@ export class HMSSDK {
493
841
  return 'API currently not available for iOS';
494
842
  }
495
843
  });
844
+ /**
845
+ * - This wrapper function returns true if audio is being shared and vice versa, currently available only for android.
846
+ *
847
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/audio-share#how-to-get-audio-share-status} for more info.
848
+ *
849
+ * @memberof HMSSDK
850
+ */
496
851
  _defineProperty(this, "isAudioShared", async () => {
497
852
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function isAudioShared', {
498
853
  id: this.id
@@ -506,6 +861,13 @@ export class HMSSDK {
506
861
  return 'API currently not available for iOS';
507
862
  }
508
863
  });
864
+ /**
865
+ * - This wrapper function is used to stop streaming device audio, currently available only for android.
866
+ *
867
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/audio-share#how-to-stop-audio-sharing} for more info.
868
+ *
869
+ * @memberof HMSSDK
870
+ */
509
871
  _defineProperty(this, "stopAudioshare", async () => {
510
872
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function stopAudioshare', {
511
873
  id: this.id
@@ -519,6 +881,12 @@ export class HMSSDK {
519
881
  return 'API currently not available for iOS';
520
882
  }
521
883
  });
884
+ /**
885
+ * - This wrapper function returns the current audio mixing mode, currently available only for android.
886
+ *
887
+ * @memberof HMSSDK
888
+ * @return HMSAudioMixingMode
889
+ */
522
890
  _defineProperty(this, "getAudioMixingMode", async () => {
523
891
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function getAudioMixingMode', {
524
892
  id: this.id
@@ -532,6 +900,14 @@ export class HMSSDK {
532
900
  return 'API currently not available for iOS';
533
901
  }
534
902
  });
903
+ /**
904
+ * - This wrapper function used to change the mode while the user is streaming audio, currently available only for android.
905
+ *
906
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/audio-share#how-to-change-mode} for more info
907
+ *
908
+ * @param {HMSAudioMixingMode}
909
+ * @memberof HMSSDK
910
+ */
535
911
  _defineProperty(this, "setAudioMixingMode", async audioMixingMode => {
536
912
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function setAudioMixingMode', {
537
913
  id: this.id,
@@ -547,6 +923,15 @@ export class HMSSDK {
547
923
  return 'API currently not available for iOS';
548
924
  }
549
925
  });
926
+ /**
927
+ * - This wrapper function returns the array of audio output devices which is of
928
+ * type {@link HMSAudioDevice[]}, currently available only for android.
929
+ *
930
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/audio-output-routing#get-list-of-audio-device} for more info
931
+ *
932
+ * @memberof HMSSDK
933
+ * @return HMSAudioDevice[]
934
+ */
550
935
  _defineProperty(this, "getAudioDevicesList", async () => {
551
936
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function getAudioDevicesList', {
552
937
  id: this.id
@@ -560,6 +945,15 @@ export class HMSSDK {
560
945
  return 'API currently not available for iOS';
561
946
  }
562
947
  });
948
+ /**
949
+ * - This wrapper function returns the current audio output device which is of
950
+ * type {@link HMSAudioDevice}, currently available only for android.
951
+ *
952
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/audio-output-routing#get-current-focussed-device} for more info
953
+ *
954
+ * @memberof HMSSDK
955
+ * @return HMSAudioDevice
956
+ */
563
957
  _defineProperty(this, "getAudioOutputRouteType", async () => {
564
958
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function getAudioOutputRouteType', {
565
959
  id: this.id
@@ -573,6 +967,14 @@ export class HMSSDK {
573
967
  return 'API currently not available for iOS';
574
968
  }
575
969
  });
970
+ /**
971
+ * - This wrapper function used to switch output to device other than the default, currently available only for android.
972
+ *
973
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/audio-output-routing#switch-audio-focus-to-another-device} for more info
974
+ *
975
+ * @param {HMSAudioDevice}
976
+ * @memberof HMSSDK
977
+ */
576
978
  _defineProperty(this, "switchAudioOutput", audioDevice => {
577
979
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function switchAudioOutput', {
578
980
  id: this.id,
@@ -588,6 +990,14 @@ export class HMSSDK {
588
990
  return 'API currently not available for iOS';
589
991
  }
590
992
  });
993
+ /**
994
+ * - This wrapper function used to change Audio Mode manually, currently available only for android.
995
+ *
996
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/audio-mode-change} for more info
997
+ *
998
+ * @param {HMSAudioMode}
999
+ * @memberof HMSSDK
1000
+ */
591
1001
  _defineProperty(this, "setAudioMode", audioMode => {
592
1002
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function setAudioMode', {
593
1003
  id: this.id,
@@ -603,6 +1013,14 @@ export class HMSSDK {
603
1013
  return 'API currently not available for iOS';
604
1014
  }
605
1015
  });
1016
+ /**
1017
+ * - This is a wrapper function which adds a listener which is triggered when audio output device is switched, currently available only for android.
1018
+ *
1019
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/features/audio-output-routing#adding-a-listener} for more info
1020
+ *
1021
+ * @param {Function}
1022
+ * @memberof HMSSDK
1023
+ */
606
1024
  _defineProperty(this, "setAudioDeviceChangeListener", callback => {
607
1025
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function setAudioDeviceChangeListener', {
608
1026
  id: this.id
@@ -635,6 +1053,13 @@ export class HMSSDK {
635
1053
  id: this.id
636
1054
  });
637
1055
  });
1056
+ /**
1057
+ * - This is a prototype event listener that takes action and listens for updates related to that particular action
1058
+ *
1059
+ * @param {string} action
1060
+ * @param {*} callback
1061
+ * @memberof HMSSDK
1062
+ */
638
1063
  _defineProperty(this, "addEventListener", (action, callback) => {
639
1064
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function addEventListener', {
640
1065
  action,
@@ -886,6 +1311,13 @@ export class HMSSDK {
886
1311
  default:
887
1312
  }
888
1313
  });
1314
+ /**
1315
+ * - This is a prototype event listener that takes action and listens for updates related to that particular action
1316
+ *
1317
+ * @param {string} action
1318
+ * @param {*} callback
1319
+ * @memberof HMSSDK
1320
+ */
889
1321
  _defineProperty(this, "removeEventListener", action => {
890
1322
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Function removeEventListener', {
891
1323
  action,
@@ -1137,6 +1569,11 @@ export class HMSSDK {
1137
1569
  default:
1138
1570
  }
1139
1571
  });
1572
+ /**
1573
+ * removes all the listeners
1574
+ *
1575
+ * @memberof HMSSDK
1576
+ */
1140
1577
  _defineProperty(this, "removeAllListeners", () => {
1141
1578
  this.onPreviewDelegate = null;
1142
1579
  this.onJoinDelegate = null;
@@ -1164,6 +1601,20 @@ export class HMSSDK {
1164
1601
  id: this.id
1165
1602
  });
1166
1603
  });
1604
+ /**
1605
+ * - Below are all the listeners that are connected to native side.
1606
+ *
1607
+ * - All of the are connected when build function is called, we can connect them to the app by
1608
+ * calling {@link addEventListener} with corresponding event type.
1609
+ *
1610
+ * - Before passing the data to the eventListener of the app these listeners encode the data in
1611
+ * ts classes for a proper structuring of the data.
1612
+ *
1613
+ * - Even When event listeners of the app are disconnected using {@link removeEventListener} or
1614
+ * {@link removeAllListeners} or not even connected in first place, these functions still run to
1615
+ * maintain the current state of the instance of {@link HMSSDK}.
1616
+ *
1617
+ */
1167
1618
  _defineProperty(this, "onPreviewListener", data => {
1168
1619
  if (data.id !== this.id) {
1169
1620
  return;
@@ -1196,11 +1647,13 @@ export class HMSSDK {
1196
1647
  }
1197
1648
  });
1198
1649
  _defineProperty(this, "onRoomListener", data => {
1650
+ var _getHmsRoomCache2;
1199
1651
  if (data.id !== this.id) {
1200
1652
  return;
1201
1653
  }
1202
1654
  const room = HMSEncoder.encodeHmsRoom(data.room, this.id);
1203
1655
  const type = data.type;
1656
+ (_getHmsRoomCache2 = getHmsRoomCache()) === null || _getHmsRoomCache2 === void 0 ? void 0 : _getHmsRoomCache2.updateRoomCache(data.room, data.type);
1204
1657
  if (this.onRoomDelegate) {
1205
1658
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Listener ON_ROOM_LISTENER_CALL', {
1206
1659
  room,
@@ -1212,12 +1665,22 @@ export class HMSSDK {
1212
1665
  });
1213
1666
  }
1214
1667
  });
1215
- _defineProperty(this, "onPeerListener", data => {
1216
- if (data.id !== this.id) {
1217
- return;
1668
+ _defineProperty(this, "onPeerListener", peerData => {
1669
+ var _getHmsPeersCache;
1670
+ const data = {
1671
+ peer: peerData,
1672
+ type: null
1673
+ };
1674
+ for (const ordinal of HMSPeerUpdateOrdinals.keys()) {
1675
+ if (ordinal in peerData) {
1676
+ data.peer.peerID = peerData[ordinal];
1677
+ data.type = ordinal;
1678
+ break;
1679
+ }
1218
1680
  }
1219
- const peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1220
- const type = data.type;
1681
+ const peer = HMSEncoder.encodeHmsPeer(data.peer);
1682
+ const type = HMSEncoder.encodeHmsPeerUpdate(data.type) || data.type;
1683
+ (_getHmsPeersCache = getHmsPeersCache()) === null || _getHmsPeersCache === void 0 ? void 0 : _getHmsPeersCache.updatePeerCache(data.peer.peerID, data.peer, type);
1221
1684
  if (this.onPeerDelegate) {
1222
1685
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Listener ON_PEER_LISTENER_CALL', {
1223
1686
  peer,
@@ -1230,12 +1693,16 @@ export class HMSSDK {
1230
1693
  }
1231
1694
  });
1232
1695
  _defineProperty(this, "onTrackListener", data => {
1696
+ var _getHmsPeersCache2;
1233
1697
  if (data.id !== this.id) {
1234
1698
  return;
1235
1699
  }
1236
1700
  const track = HMSEncoder.encodeHmsTrack(data.track, this.id);
1237
- const peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1701
+ const peer = HMSEncoder.encodeHmsPeer(data.peer);
1238
1702
  const type = data.type;
1703
+ (_getHmsPeersCache2 = getHmsPeersCache()) === null || _getHmsPeersCache2 === void 0 ? void 0 : _getHmsPeersCache2.updatePeerCache(data.peer.peerID, {
1704
+ track
1705
+ }, data.type);
1239
1706
  if (this.muteStatus && (data === null || data === void 0 ? void 0 : data.type) === 'TRACK_ADDED' && track.type === HMSTrackType.AUDIO) {
1240
1707
  this.setPlaybackForAllAudio(this.muteStatus);
1241
1708
  }
@@ -1256,7 +1723,7 @@ export class HMSSDK {
1256
1723
  if (data.id !== this.id) {
1257
1724
  return;
1258
1725
  }
1259
- const message = HMSEncoder.encodeHMSMessage(data, this.id);
1726
+ const message = HMSEncoder.encodeHMSMessage(data);
1260
1727
  if (this.onMessageDelegate) {
1261
1728
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Listener ON_MESSAGE_LISTENER_CALL', message);
1262
1729
  this.onMessageDelegate(message);
@@ -1286,7 +1753,7 @@ export class HMSSDK {
1286
1753
  return;
1287
1754
  }
1288
1755
  if (this.onRoleChangeRequestDelegate) {
1289
- const encodedRoleChangeRequest = HMSEncoder.encodeHmsRoleChangeRequest(data, this.id);
1756
+ const encodedRoleChangeRequest = HMSEncoder.encodeHmsRoleChangeRequest(data);
1290
1757
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Listener ON_ROLE_CHANGE_LISTENER_CALL', encodedRoleChangeRequest);
1291
1758
  this.onRoleChangeRequestDelegate(encodedRoleChangeRequest);
1292
1759
  }
@@ -1296,7 +1763,7 @@ export class HMSSDK {
1296
1763
  return;
1297
1764
  }
1298
1765
  if (this.onChangeTrackStateRequestDelegate) {
1299
- const encodedRoleChangeRequest = HMSEncoder.encodeHmsChangeTrackStateRequest(data, this.id);
1766
+ const encodedRoleChangeRequest = HMSEncoder.encodeHmsChangeTrackStateRequest(data);
1300
1767
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Listener ON_CHANGE_TRACK_STATE_REQUEST_LISTENER_CALL', encodedRoleChangeRequest);
1301
1768
  this.onChangeTrackStateRequestDelegate(encodedRoleChangeRequest);
1302
1769
  }
@@ -1309,7 +1776,7 @@ export class HMSSDK {
1309
1776
  if (this.onRemovedFromRoomDelegate) {
1310
1777
  let requestedBy = null;
1311
1778
  if (data.requestedBy) {
1312
- requestedBy = HMSEncoder.encodeHmsPeer(data.requestedBy, this.id);
1779
+ requestedBy = HMSEncoder.encodeHmsPeer(data.requestedBy);
1313
1780
  }
1314
1781
  const reason = data.reason;
1315
1782
  const roomEnded = data.roomEnded;
@@ -1363,7 +1830,7 @@ export class HMSSDK {
1363
1830
  return;
1364
1831
  }
1365
1832
  let localAudioStats = new HMSLocalAudioStats(data.localAudioStats);
1366
- let peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1833
+ let peer = HMSEncoder.encodeHmsPeer(data.peer);
1367
1834
  let track = HMSEncoder.encodeHmsLocalAudioTrack(data.track, this.id);
1368
1835
  if (this.onLocalAudioStatsDelegate) {
1369
1836
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Listener onLocalAudioStatsListener_CALL', {
@@ -1385,7 +1852,7 @@ export class HMSSDK {
1385
1852
  return;
1386
1853
  }
1387
1854
  let localVideoStats = new HMSLocalVideoStats(data.localVideoStats);
1388
- let peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1855
+ let peer = HMSEncoder.encodeHmsPeer(data.peer);
1389
1856
  let track = HMSEncoder.encodeHmsLocalVideoTrack(data.track, this.id);
1390
1857
  if (this.onLocalVideoStatsDelegate) {
1391
1858
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Listener onLocalVideoStatsListener_CALL', {
@@ -1407,7 +1874,7 @@ export class HMSSDK {
1407
1874
  return;
1408
1875
  }
1409
1876
  let remoteAudioStats = new HMSRemoteAudioStats(data.remoteAudioStats);
1410
- let peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1877
+ let peer = HMSEncoder.encodeHmsPeer(data.peer);
1411
1878
  let track = HMSEncoder.encodeHmsRemoteAudioTrack(data.track, this.id);
1412
1879
  if (this.onRemoteAudioStatsDelegate) {
1413
1880
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Listener onRemoteAudioStatsListener_CALL', {
@@ -1429,7 +1896,7 @@ export class HMSSDK {
1429
1896
  return;
1430
1897
  }
1431
1898
  let remoteVideoStats = new HMSRemoteVideoStats(data.remoteVideoStats);
1432
- let peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1899
+ let peer = HMSEncoder.encodeHmsPeer(data.peer);
1433
1900
  let track = HMSEncoder.encodeHmsRemoteVideoTrack(data.track, this.id);
1434
1901
  if (this.onRemoteVideoStatsDelegate) {
1435
1902
  logger === null || logger === void 0 ? void 0 : logger.verbose('#Listener onRemoteVideoStatsListener_CALL', {
@@ -1469,6 +1936,14 @@ export class HMSSDK {
1469
1936
  });
1470
1937
  }
1471
1938
  });
1939
+ /**
1940
+ * - Updates the logger for this instance of HMSSDK
1941
+ * @param {HMSLogger} hmsLogger
1942
+ * @memberof HMSSDK
1943
+ */
1944
+ _defineProperty(this, "setLogger", hmsLogger => {
1945
+ setLogger(this.id, hmsLogger);
1946
+ });
1472
1947
  this.id = id;
1473
1948
  }
1474
1949
 
@@ -1513,22 +1988,6 @@ export class HMSSDK {
1513
1988
  HmsSdk = new HMSSDK(id);
1514
1989
  return HmsSdk;
1515
1990
  }
1516
-
1517
- /**
1518
- * - Returns the instance of logger which can be used to manipulate log levels.
1519
- * @returns @instance HMSLogger
1520
- * @memberof HMSSDK
1521
- */
1522
- static getLogger() {
1523
- return getLogger();
1524
- }
1525
-
1526
- /**
1527
- * - Updates the logger for this instance of HMSSDK
1528
- * @param {HMSLogger} hmsLogger
1529
- * @memberof HMSSDK
1530
- */
1531
-
1532
1991
  async isPipModeSupported() {
1533
1992
  return HMSManager.handlePipActions('isPipModeSupported', {
1534
1993
  id: this.id
@@ -1546,5 +2005,14 @@ export class HMSSDK {
1546
2005
  id: this.id
1547
2006
  });
1548
2007
  }
2008
+
2009
+ /**
2010
+ * - Returns the instance of logger which can be used to manipulate log levels.
2011
+ * @returns @instance HMSLogger
2012
+ * @memberof HMSSDK
2013
+ */
2014
+ static getLogger() {
2015
+ return getLogger();
2016
+ }
1549
2017
  }
1550
2018
  //# sourceMappingURL=HMSSDK.js.map