@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
@@ -3,9 +3,18 @@ import type { HMSException } from './HMSException';
3
3
  export class HMSBrowserRecordingState {
4
4
  running: string;
5
5
  error: HMSException;
6
+ startedAt: Date;
7
+ stoppedAt: Date;
6
8
 
7
- constructor(params: { running: string; error: HMSException }) {
9
+ constructor(params: {
10
+ running: string;
11
+ error: HMSException;
12
+ startedAt: Date;
13
+ stoppedAt: Date;
14
+ }) {
8
15
  this.running = params.running;
9
16
  this.error = params.error;
17
+ this.startedAt = params.startedAt;
18
+ this.stoppedAt = params.stoppedAt;
10
19
  }
11
20
  }
@@ -3,16 +3,19 @@ export class HMSConfig {
3
3
  authToken: string;
4
4
  endpoint?: string;
5
5
  metadata?: string;
6
+ captureNetworkQualityInPreview?: boolean;
6
7
 
7
8
  constructor(params: {
8
9
  username: string;
9
10
  authToken: string;
10
11
  endpoint?: string;
11
12
  metadata?: string;
13
+ captureNetworkQualityInPreview?: boolean;
12
14
  }) {
13
15
  this.username = params.username;
14
16
  this.authToken = params.authToken;
15
17
  this.endpoint = params.endpoint;
16
18
  this.metadata = params.metadata;
19
+ this.captureNetworkQualityInPreview = params.captureNetworkQualityInPreview;
17
20
  }
18
21
  }
@@ -15,6 +15,21 @@ import { HMSRole } from './HMSRole';
15
15
  import { HMSRoleChangeRequest } from './HMSRoleChangeRequest';
16
16
  import { HMSChangeTrackStateRequest } from './HMSChangeTrackStateRequest';
17
17
  import { HMSVideoResolution } from './HMSVideoResolution';
18
+ import { HMSRTCStats } from './HMSRTCStats';
19
+ import { HMSRTCStatsReport } from './HMSRTCStatsReport';
20
+ import { HMSRemoteAudioTrack } from './HMSRemoteAudioTrack';
21
+ import { HMSRemoteVideoTrack } from './HMSRemoteVideoTrack';
22
+ import { HMSSpeaker } from './HMSSpeaker';
23
+ import { HMSSpeakerUpdate } from './HMSSpeakerUpdate';
24
+ import {
25
+ HMSBrowserRecordingState,
26
+ HMSHLSStreamingState,
27
+ HMSHLSVariant,
28
+ HMSRtmpStreamingState,
29
+ HMSServerRecordingState,
30
+ } from '..';
31
+ import { HMSHLSRecordingState } from './HMSHLSRecordingState';
32
+ import { HMSNetworkQuality } from './HMSNetworkQuality';
18
33
 
19
34
  export class HMSEncoder {
20
35
  static encodeHmsRoom(room: HMSRoom, id: string) {
@@ -22,11 +37,23 @@ export class HMSEncoder {
22
37
  id: room?.id,
23
38
  metaData: room?.metaData,
24
39
  name: room?.name,
40
+ peerCount: room?.peerCount,
25
41
  peers: HMSEncoder.encodeHmsPeers(room?.peers, id),
26
- browserRecordingState: room?.browserRecordingState,
27
- rtmpHMSRtmpStreamingState: room?.rtmpHMSRtmpStreamingState,
28
- serverRecordingState: room?.serverRecordingState,
29
- hlsStreamingState: room?.hlsStreamingState,
42
+ browserRecordingState: HMSEncoder.encodeBrowserRecordingState(
43
+ room?.browserRecordingState
44
+ ),
45
+ rtmpHMSRtmpStreamingState: HMSEncoder.encodeRTMPStreamingState(
46
+ room?.rtmpHMSRtmpStreamingState
47
+ ),
48
+ serverRecordingState: HMSEncoder.encodeServerRecordingState(
49
+ room?.serverRecordingState
50
+ ),
51
+ hlsStreamingState: HMSEncoder.encodeHLSStreamingState(
52
+ room?.hlsStreamingState
53
+ ),
54
+ hlsRecordingState: HMSEncoder.encodeHLSRecordingState(
55
+ room?.hlsRecordingState
56
+ ),
30
57
  };
31
58
 
32
59
  return new HMSRoom(encodedObj);
@@ -46,10 +73,11 @@ export class HMSEncoder {
46
73
  peerID: peer?.peerID,
47
74
  name: peer?.name,
48
75
  isLocal: peer?.isLocal,
49
- role: HMSEncoder.encodeHmsRole(peer?.role),
50
76
  customerUserID: peer?.customerUserID,
51
77
  customerDescription: peer?.customerDescription,
52
78
  metadata: peer?.metadata,
79
+ role: HMSEncoder.encodeHmsRole(peer?.role),
80
+ networkQuality: HMSEncoder.encodeHMSNetworkQuality(peer?.networkQuality),
53
81
  audioTrack: HMSEncoder.encodeHmsAudioTrack(peer?.audioTrack, id),
54
82
  videoTrack: HMSEncoder.encodeHmsVideoTrack(peer?.videoTrack, id),
55
83
  auxiliaryTracks: HMSEncoder.encodeHmsAuxiliaryTracks(
@@ -118,6 +146,7 @@ export class HMSEncoder {
118
146
  customerDescription: peer.customerDescription,
119
147
  metadata: peer.metadata,
120
148
  role: HMSEncoder.encodeHmsRole(peer?.role),
149
+ networkQuality: HMSEncoder.encodeHMSNetworkQuality(peer?.networkQuality),
121
150
  audioTrack: HMSEncoder.encodeHmsAudioTrack(peer.audioTrack, id),
122
151
  videoTrack: HMSEncoder.encodeHmsVideoTrack(peer.videoTrack, id),
123
152
  auxiliaryTracks: HMSEncoder.encodeHmsAuxiliaryTracks(
@@ -183,6 +212,34 @@ export class HMSEncoder {
183
212
  return new HMSVideoResolution(encodedObj);
184
213
  }
185
214
 
215
+ static encodeHmsLocalAudioTrack(track: any, id: string) {
216
+ const encodedObj = {
217
+ id: id,
218
+ trackId: track?.trackId,
219
+ source: track?.source,
220
+ trackDescription: track?.trackDescription,
221
+ isMute: track?.isMute,
222
+ settings: HMSEncoder.encodeHmsAudioTrackSettings(track?.settings),
223
+ type: track?.type,
224
+ };
225
+
226
+ return new HMSLocalAudioTrack(encodedObj);
227
+ }
228
+
229
+ static encodeHmsLocalVideoTrack(track: any, id: string) {
230
+ const encodedObj = {
231
+ id: id,
232
+ trackId: track?.trackId,
233
+ source: track?.source,
234
+ trackDescription: track?.trackDescription,
235
+ isMute: track?.isMute,
236
+ settings: HMSEncoder.encodeHmsVideoTrackSettings(track?.settings),
237
+ type: track?.type,
238
+ };
239
+
240
+ return new HMSLocalVideoTrack(encodedObj);
241
+ }
242
+
186
243
  static encodeHmsRemotePeers(peers: any, id: string) {
187
244
  const hmsPeers: any[] = [];
188
245
 
@@ -204,6 +261,7 @@ export class HMSEncoder {
204
261
  customerDescription: peer.customerDescription,
205
262
  metadata: peer.metadata,
206
263
  role: HMSEncoder.encodeHmsRole(peer?.role),
264
+ networkQuality: HMSEncoder.encodeHMSNetworkQuality(peer?.networkQuality),
207
265
  audioTrack: HMSEncoder.encodeHmsAudioTrack(peer.audioTrack, id),
208
266
  videoTrack: HMSEncoder.encodeHmsVideoTrack(peer.videoTrack, id),
209
267
  auxiliaryTracks: HMSEncoder.encodeHmsAuxiliaryTracks(
@@ -232,6 +290,33 @@ export class HMSEncoder {
232
290
  return new HMSRemotePeer(encodedObj);
233
291
  }
234
292
 
293
+ static encodeHmsRemoteAudioTrack(track: any, id: string) {
294
+ const encodedObj = {
295
+ id: id,
296
+ trackId: track?.trackId,
297
+ source: track?.source,
298
+ trackDescription: track?.trackDescription,
299
+ isMute: track?.isMute,
300
+ playbackAllowed: track?.playbackAllowed,
301
+ };
302
+
303
+ return new HMSRemoteAudioTrack(encodedObj);
304
+ }
305
+
306
+ static encodeHmsRemoteVideoTrack(track: any, id: string) {
307
+ const encodedObj = {
308
+ id: id,
309
+ trackId: track?.trackId,
310
+ source: track?.source,
311
+ trackDescription: track?.trackDescription,
312
+ layer: track?.layer,
313
+ isMute: track?.isMute,
314
+ playbackAllowed: track?.playbackAllowed,
315
+ };
316
+
317
+ return new HMSRemoteVideoTrack(encodedObj);
318
+ }
319
+
235
320
  static encodeHmsPreviewTracks(previewTracks: any) {
236
321
  const encodedObj = {
237
322
  audioTrack: previewTracks.audioTrack
@@ -282,4 +367,122 @@ export class HMSEncoder {
282
367
 
283
368
  return new HMSChangeTrackStateRequest(encodedChangeTrackStateRequest);
284
369
  }
370
+
371
+ static encodeRTCStats(data: any) {
372
+ let video = this.encodeRTCStatsUnit(data?.video);
373
+ let audio = this.encodeRTCStatsUnit(data?.audio);
374
+ let combined = this.encodeRTCStatsUnit(data?.combined);
375
+
376
+ return new HMSRTCStatsReport({ video, audio, combined });
377
+ }
378
+
379
+ static encodeRTCStatsUnit(data: any) {
380
+ return new HMSRTCStats({
381
+ bitrateReceived: data?.bitrateReceived,
382
+ bitrateSent: data?.bitrateSent,
383
+ bytesReceived: data?.bytesReceived,
384
+ bytesSent: data?.bytesSent,
385
+ packetsLost: data?.packetsLost,
386
+ packetsReceived: data?.packetsReceived,
387
+ roundTripTime: data?.roundTripTime,
388
+ });
389
+ }
390
+
391
+ static encodeHmsSpeakerUpdate(data: any, id: string) {
392
+ return new HMSSpeakerUpdate({
393
+ event: data?.event,
394
+ count: data?.count,
395
+ peers: HMSEncoder.encodeHmsSpeakers(data?.peers, id),
396
+ });
397
+ }
398
+
399
+ static encodeHmsSpeakers(data: any, id: string) {
400
+ let encodedSpeakers: Array<HMSSpeaker> = [];
401
+
402
+ data?.map((item: any) => {
403
+ encodedSpeakers.push(HMSEncoder.encodeHmsSpeaker(item, id));
404
+ });
405
+
406
+ return encodedSpeakers;
407
+ }
408
+
409
+ static encodeHmsSpeaker(data: any, id: string) {
410
+ return new HMSSpeaker({
411
+ level: data?.level,
412
+ peer: HMSEncoder.encodeHmsPeer(data?.peer, id),
413
+ track: HMSEncoder.encodeHmsTrack(data?.track, id),
414
+ });
415
+ }
416
+
417
+ static encodeBrowserRecordingState(data: any) {
418
+ return new HMSBrowserRecordingState({
419
+ running: data?.running,
420
+ startedAt: new Date(parseInt(data?.startedAt)),
421
+ stoppedAt: new Date(parseInt(data?.stoppedAt)),
422
+ error: data?.error,
423
+ });
424
+ }
425
+
426
+ static encodeServerRecordingState(data: any) {
427
+ return new HMSServerRecordingState({
428
+ running: data?.running,
429
+ error: data?.error,
430
+ startedAt: new Date(parseInt(data?.startedAt)),
431
+ });
432
+ }
433
+
434
+ static encodeRTMPStreamingState(data: any) {
435
+ return new HMSRtmpStreamingState({
436
+ running: data?.running,
437
+ startedAt: new Date(parseInt(data?.startedAt)),
438
+ stoppedAt: new Date(parseInt(data?.stoppedAt)),
439
+ error: data?.error,
440
+ });
441
+ }
442
+
443
+ static encodeHLSStreamingState(data: any) {
444
+ return new HMSHLSStreamingState({
445
+ running: data?.running,
446
+ variants: this.encodeHLSVariants(data?.variants),
447
+ });
448
+ }
449
+
450
+ static encodeHLSRecordingState(data: any) {
451
+ if (data) {
452
+ return new HMSHLSRecordingState({
453
+ running: data?.running,
454
+ startedAt: new Date(parseInt(data?.startedAt)),
455
+ singleFilePerLayer: data?.singleFilePerLayer,
456
+ videoOnDemand: data?.videoOnDemand,
457
+ });
458
+ } else {
459
+ return undefined;
460
+ }
461
+ }
462
+
463
+ static encodeHLSVariants(data: any) {
464
+ let variants: HMSHLSVariant[] = [];
465
+
466
+ data?.map((item: any) => {
467
+ let variant = new HMSHLSVariant({
468
+ hlsStreamUrl: item.hlsStreamUrl,
469
+ meetingUrl: item.meetingUrl,
470
+ metadata: item?.metadata,
471
+ startedAt: new Date(parseInt(item?.startedAt)),
472
+ });
473
+ variants.push(variant);
474
+ });
475
+
476
+ return variants;
477
+ }
478
+
479
+ static encodeHMSNetworkQuality(data: any) {
480
+ if (data) {
481
+ return new HMSNetworkQuality({
482
+ downlinkQuality: data?.downlinkQuality,
483
+ });
484
+ } else {
485
+ return undefined;
486
+ }
487
+ }
285
488
  }
@@ -1,9 +1,15 @@
1
1
  import type { HMSHLSMeetingURLVariant } from './HMSHLSMeetingURLVariant';
2
+ import type { HMSHLSRecordingConfig } from './HMSHLSRecordingConfig';
2
3
 
3
4
  export class HMSHLSConfig {
4
- meetingURLVariants?: Array<HMSHLSMeetingURLVariant>;
5
+ hlsRecordingConfig?: HMSHLSRecordingConfig;
6
+ meetingURLVariants: Array<HMSHLSMeetingURLVariant>;
5
7
 
6
- constructor(params: { meetingURLVariants?: Array<HMSHLSMeetingURLVariant> }) {
8
+ constructor(params: {
9
+ hlsRecordingConfig?: HMSHLSRecordingConfig;
10
+ meetingURLVariants: Array<HMSHLSMeetingURLVariant>;
11
+ }) {
12
+ this.hlsRecordingConfig = params.hlsRecordingConfig;
7
13
  this.meetingURLVariants = params.meetingURLVariants;
8
14
  }
9
15
  }
@@ -0,0 +1,9 @@
1
+ export class HMSHLSRecordingConfig {
2
+ singleFilePerLayer: boolean;
3
+ videoOnDemand: boolean;
4
+
5
+ constructor(params: { singleFilePerLayer: boolean; videoOnDemand: boolean }) {
6
+ this.singleFilePerLayer = params.singleFilePerLayer;
7
+ this.videoOnDemand = params.videoOnDemand;
8
+ }
9
+ }
@@ -0,0 +1,18 @@
1
+ export class HMSHLSRecordingState {
2
+ singleFilePerLayer: boolean;
3
+ videoOnDemand: boolean;
4
+ running: boolean;
5
+ startedAt?: Date;
6
+
7
+ constructor(params: {
8
+ singleFilePerLayer: boolean;
9
+ videoOnDemand: boolean;
10
+ running: boolean;
11
+ startedAt?: Date;
12
+ }) {
13
+ this.singleFilePerLayer = params.singleFilePerLayer;
14
+ this.videoOnDemand = params.videoOnDemand;
15
+ this.running = params.running;
16
+ this.startedAt = params.startedAt;
17
+ }
18
+ }
@@ -1,14 +1,14 @@
1
1
  export class HMSHLSVariant {
2
- hlsStreamUrl: string;
3
- meetingUrl: string;
4
- metadata: string;
5
- startedAt: number;
2
+ hlsStreamUrl?: string;
3
+ meetingUrl?: string;
4
+ metadata?: string;
5
+ startedAt?: Date;
6
6
 
7
7
  constructor(params: {
8
- hlsStreamUrl: string;
9
- meetingUrl: string;
10
- metadata: string;
11
- startedAt: number;
8
+ hlsStreamUrl?: string;
9
+ meetingUrl?: string;
10
+ metadata?: string;
11
+ startedAt?: Date;
12
12
  }) {
13
13
  this.hlsStreamUrl = params.hlsStreamUrl;
14
14
  this.meetingUrl = params.meetingUrl;
@@ -0,0 +1,15 @@
1
+ export class HMSLocalAudioStats {
2
+ bitrate?: number;
3
+ bytesSent?: number;
4
+ roundTripTime?: number;
5
+
6
+ constructor(params: {
7
+ bitrate?: number;
8
+ bytesSent?: number;
9
+ roundTripTime?: number;
10
+ }) {
11
+ this.bitrate = params.bitrate;
12
+ this.bytesSent = params.bytesSent;
13
+ this.roundTripTime = params.roundTripTime;
14
+ }
15
+ }
@@ -8,6 +8,7 @@ import { HMSLocalAudioTrack } from './HMSLocalAudioTrack';
8
8
  import { HMSLocalVideoTrack } from './HMSLocalVideoTrack';
9
9
  import type { HMSRole } from './HMSRole';
10
10
  import type { HMSTrackType } from './HMSTrackType';
11
+ import type { HMSNetworkQuality } from './HMSNetworkQuality';
11
12
 
12
13
  export class HMSLocalPeer extends HMSPeer {
13
14
  private localAudio?: HMSLocalAudioTrack;
@@ -29,6 +30,7 @@ export class HMSLocalPeer extends HMSPeer {
29
30
  metadata?: string;
30
31
  audioTrack?: HMSAudioTrack;
31
32
  videoTrack?: HMSVideoTrack;
33
+ networkQuality?: HMSNetworkQuality;
32
34
  role?: HMSRole;
33
35
  auxiliaryTracks?: HMSTrack[];
34
36
  localAudioTrackData?: {
@@ -0,0 +1,23 @@
1
+ import type { HMSVideoResolution } from './HMSVideoResolution';
2
+
3
+ export class HMSLocalVideoStats {
4
+ bitrate?: number;
5
+ bytesSent?: number;
6
+ roundTripTime?: number;
7
+ frameRate?: number;
8
+ resolution?: HMSVideoResolution;
9
+
10
+ constructor(params: {
11
+ bitrate?: number;
12
+ bytesSent?: number;
13
+ roundTripTime?: number;
14
+ frameRate?: number;
15
+ resolution?: HMSVideoResolution;
16
+ }) {
17
+ this.bitrate = params.bitrate;
18
+ this.bytesSent = params.bytesSent;
19
+ this.roundTripTime = params.roundTripTime;
20
+ this.frameRate = params.frameRate;
21
+ this.resolution = params.resolution;
22
+ }
23
+ }
@@ -26,8 +26,8 @@ export class HMSLogger {
26
26
  if (this.onLog) {
27
27
  this?.onLog({ message, data });
28
28
  }
29
+ this.logs.push({ type: 'verbose', message, data, id: data?.id });
29
30
  }
30
- this.logs.push({ type: 'verbose', message, data, id: data?.id });
31
31
  }
32
32
 
33
33
  warn(message: string, data: any) {
@@ -36,8 +36,8 @@ export class HMSLogger {
36
36
  if (this.onLog) {
37
37
  this?.onLog({ message, data });
38
38
  }
39
+ this.logs.push({ type: 'warn', message, data, id: data?.id });
39
40
  }
40
- this.logs.push({ type: 'warn', message, data, id: data?.id });
41
41
  }
42
42
 
43
43
  error(message: string, data: any) {
@@ -46,8 +46,8 @@ export class HMSLogger {
46
46
  if (this.onLog) {
47
47
  this?.onLog({ message, data });
48
48
  }
49
+ this.logs.push({ type: 'error', message, data, id: data?.id });
49
50
  }
50
- this.logs.push({ type: 'error', message, data, id: data?.id });
51
51
  }
52
52
 
53
53
  getLogs() {
@@ -1,19 +1,25 @@
1
+ import type { HMSMessageRecipient } from './HMSMessageRecipient';
2
+ import type { HMSPeer } from './HMSPeer';
3
+
1
4
  export class HMSMessage {
2
5
  // endpoint: string;
3
6
  public message: string;
4
7
  public type: string;
5
- public time?: string;
6
- public sender?: string;
8
+ public time: Date;
9
+ public sender: HMSPeer;
10
+ public recipient: HMSMessageRecipient;
7
11
 
8
12
  constructor(params: {
9
13
  message: string;
10
14
  type: string;
11
- time?: string;
12
- sender?: string;
15
+ time: string;
16
+ sender: HMSPeer;
17
+ recipient: HMSMessageRecipient;
13
18
  }) {
14
19
  this.message = params.message;
15
20
  this.type = params.type;
16
- this.time = params.time;
21
+ this.time = new Date(params.time);
17
22
  this.sender = params.sender;
23
+ this.recipient = params.recipient;
18
24
  }
19
25
  }
@@ -0,0 +1,19 @@
1
+ import type { HMSMessageRecipientType } from './HMSMessageRecipientType';
2
+ import type { HMSPeer } from './HMSPeer';
3
+ import type { HMSRole } from './HMSRole';
4
+
5
+ export class HMSMessageRecipient {
6
+ public recipientType?: HMSMessageRecipientType;
7
+ public recipientPeer?: HMSPeer;
8
+ public recipientRoles?: HMSRole[];
9
+
10
+ constructor(params: {
11
+ recipientType: HMSMessageRecipientType;
12
+ recipientPeer?: HMSPeer;
13
+ recipientRoles?: HMSRole[];
14
+ }) {
15
+ this.recipientType = params.recipientType;
16
+ this.recipientPeer = params.recipientPeer;
17
+ this.recipientRoles = params.recipientRoles;
18
+ }
19
+ }
@@ -0,0 +1,5 @@
1
+ export enum HMSMessageRecipientType {
2
+ BROADCAST = 'BROADCAST',
3
+ PEER = 'PEER',
4
+ ROLES = 'ROLES',
5
+ }
@@ -0,0 +1,7 @@
1
+ export class HMSNetworkQuality {
2
+ downlinkQuality: number;
3
+
4
+ constructor(params: { downlinkQuality: number }) {
5
+ this.downlinkQuality = params.downlinkQuality;
6
+ }
7
+ }
@@ -1,4 +1,5 @@
1
1
  import type { HMSAudioTrack } from './HMSAudioTrack';
2
+ import type { HMSNetworkQuality } from './HMSNetworkQuality';
2
3
  import type { HMSRole } from './HMSRole';
3
4
  import type { HMSTrack } from './HMSTrack';
4
5
  import type { HMSVideoTrack } from './HMSVideoTrack';
@@ -11,10 +12,9 @@ export class HMSPeer {
11
12
  customerDescription?: string;
12
13
  metadata?: string;
13
14
  role?: HMSRole;
14
-
15
+ networkQuality?: HMSNetworkQuality;
15
16
  audioTrack?: HMSAudioTrack;
16
17
  videoTrack?: HMSVideoTrack;
17
-
18
18
  auxiliaryTracks?: HMSTrack[];
19
19
 
20
20
  constructor(params: {
@@ -25,6 +25,7 @@ export class HMSPeer {
25
25
  customerDescription?: string;
26
26
  metadata?: string;
27
27
  role?: HMSRole;
28
+ networkQuality?: HMSNetworkQuality;
28
29
  audioTrack?: HMSAudioTrack;
29
30
  videoTrack?: HMSVideoTrack;
30
31
  auxiliaryTracks?: HMSTrack[];
@@ -38,6 +39,7 @@ export class HMSPeer {
38
39
  this.videoTrack = params.videoTrack;
39
40
  this.auxiliaryTracks = params.auxiliaryTracks;
40
41
  this.role = params.role;
42
+ this.networkQuality = params.networkQuality;
41
43
  this.metadata = params.metadata;
42
44
  }
43
45
  }
@@ -1,13 +1,8 @@
1
1
  export enum HMSPeerUpdate {
2
2
  PEER_JOINED = 'PEER_JOINED',
3
3
  PEER_LEFT = 'PEER_LEFT',
4
- AUDIO_TOGGLED = 'AUDIO_TOGGLED',
5
- VIDEO_TOGGLED = 'VIDEO_TOGGLED',
6
4
  METADATA_CHANGED = 'METADATA_CHANGED',
7
- BECAME_DOMINANT_SPEAKER = 'BECAME_DOMINANT_SPEAKER',
8
- NO_DOMINANT_SPEAKER = 'NO_DOMINANT_SPEAKER',
9
- RESIGNED_DOMINANT_SPEAKER = 'RESIGNED_DOMINANT_SPEAKER',
10
- STARTED_SPEAKING = 'STARTED_SPEAKING',
11
- STOPPED_SPEAKING = 'STOPPED_SPEAKING',
12
5
  ROLE_CHANGED = 'ROLE_CHANGED',
6
+ NAME_CHANGED = 'NAME_CHANGED',
7
+ NETWORK_QUALITY_UPDATED = 'NETWORK_QUALITY_UPDATED',
13
8
  }
@@ -5,7 +5,7 @@ export class HMSPermissions {
5
5
  mute?: boolean;
6
6
  changeRole?: boolean;
7
7
  recording?: boolean;
8
- rtmp?: boolean;
8
+ streaming?: boolean;
9
9
 
10
10
  constructor(params?: {
11
11
  endRoom?: boolean;
@@ -14,7 +14,7 @@ export class HMSPermissions {
14
14
  mute?: boolean;
15
15
  changeRole?: boolean;
16
16
  recording?: boolean;
17
- rtmp?: boolean;
17
+ streaming?: boolean;
18
18
  }) {
19
19
  if (params) {
20
20
  this.endRoom = params.endRoom;
@@ -23,7 +23,7 @@ export class HMSPermissions {
23
23
  this.mute = params.mute;
24
24
  this.changeRole = params.changeRole;
25
25
  this.recording = params.recording;
26
- this.rtmp = params.rtmp;
26
+ this.streaming = params.streaming;
27
27
  }
28
28
  }
29
29
  }
@@ -0,0 +1,27 @@
1
+ export class HMSRTCStats {
2
+ bitrateReceived?: number;
3
+ bitrateSent?: number;
4
+ bytesReceived?: number;
5
+ bytesSent?: number;
6
+ packetsLost?: number;
7
+ packetsReceived?: number;
8
+ roundTripTime?: number;
9
+
10
+ constructor(params: {
11
+ bitrateReceived?: number;
12
+ bitrateSent?: number;
13
+ bytesReceived?: number;
14
+ bytesSent?: number;
15
+ packetsLost?: number;
16
+ packetsReceived?: number;
17
+ roundTripTime?: number;
18
+ }) {
19
+ this.bitrateReceived = params.bitrateReceived;
20
+ this.bitrateSent = params.bitrateSent;
21
+ this.bytesReceived = params.bytesReceived;
22
+ this.bytesSent = params.bytesSent;
23
+ this.packetsLost = params.packetsLost;
24
+ this.packetsReceived = params.packetsReceived;
25
+ this.roundTripTime = params.roundTripTime;
26
+ }
27
+ }
@@ -0,0 +1,17 @@
1
+ import type { HMSRTCStats } from './HMSRTCStats';
2
+
3
+ export class HMSRTCStatsReport {
4
+ video?: HMSRTCStats;
5
+ audio?: HMSRTCStats;
6
+ combined?: HMSRTCStats;
7
+
8
+ constructor(params: {
9
+ video?: HMSRTCStats;
10
+ audio?: HMSRTCStats;
11
+ combined?: HMSRTCStats;
12
+ }) {
13
+ this.audio = params.audio;
14
+ this.video = params.video;
15
+ this.combined = params.combined;
16
+ }
17
+ }
@@ -0,0 +1,21 @@
1
+ export class HMSRemoteAudioStats {
2
+ bitrate?: number;
3
+ packetsReceived?: number;
4
+ packetsLost?: number;
5
+ bytesReceived?: number;
6
+ jitter?: number;
7
+
8
+ constructor(params: {
9
+ bitrate?: number;
10
+ packetsReceived?: number;
11
+ packetsLost?: number;
12
+ bytesReceived?: number;
13
+ jitter?: number;
14
+ }) {
15
+ this.bitrate = params.bitrate;
16
+ this.packetsReceived = params.packetsReceived;
17
+ this.jitter = params.jitter;
18
+ this.packetsLost = params.packetsLost;
19
+ this.bytesReceived = params.bytesReceived;
20
+ }
21
+ }