@100mslive/react-native-hms 0.8.4 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/README.md +247 -26
  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 +4 -2
  17. package/android/local.properties +8 -0
  18. package/android/src/main/java/com/reactnativehmssdk/HmsDecoder.kt +67 -5
  19. package/android/src/main/java/com/reactnativehmssdk/HmsHelper.kt +67 -64
  20. package/android/src/main/java/com/reactnativehmssdk/HmsModule.kt +97 -6
  21. package/android/src/main/java/com/reactnativehmssdk/HmsSDK.kt +302 -118
  22. package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +77 -0
  23. package/android/src/main/java/com/reactnativehmssdk/HmsView.kt +28 -3
  24. package/android/src/main/java/com/reactnativehmssdk/HmssdkViewManager.kt +10 -1
  25. package/android/src/main/res/layout/hms_view.xml +19 -0
  26. package/ios/HmsDecoder.swift +250 -123
  27. package/ios/HmsHelper.swift +70 -38
  28. package/ios/HmsManager.m +11 -3
  29. package/ios/HmsManager.swift +123 -66
  30. package/ios/HmsSDK.swift +384 -195
  31. package/ios/HmsView.swift +50 -68
  32. package/ios/VideoCollectionViewCell.swift +4 -4
  33. package/lib/commonjs/classes/HMSBrowserRecordingState.js +6 -0
  34. package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
  35. package/lib/commonjs/classes/HMSEncoder.js +180 -3
  36. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  37. package/lib/commonjs/classes/HMSHLSConfig.js +23 -0
  38. package/lib/commonjs/classes/HMSHLSConfig.js.map +1 -0
  39. package/lib/commonjs/classes/HMSHLSMeetingURLVariant.js +23 -0
  40. package/lib/commonjs/classes/HMSHLSMeetingURLVariant.js.map +1 -0
  41. package/lib/commonjs/classes/HMSHLSRecordingConfig.js +23 -0
  42. package/lib/commonjs/classes/HMSHLSRecordingConfig.js.map +1 -0
  43. package/lib/commonjs/classes/HMSHLSRecordingState.js +29 -0
  44. package/lib/commonjs/classes/HMSHLSRecordingState.js.map +1 -0
  45. package/lib/commonjs/classes/HMSHLSStreamingState.js +23 -0
  46. package/lib/commonjs/classes/HMSHLSStreamingState.js.map +1 -0
  47. package/lib/commonjs/classes/HMSHLSVariant.js +29 -0
  48. package/lib/commonjs/classes/HMSHLSVariant.js.map +1 -0
  49. package/lib/commonjs/classes/HMSLocalAudioStats.js +26 -0
  50. package/lib/commonjs/classes/HMSLocalAudioStats.js.map +1 -0
  51. package/lib/commonjs/classes/HMSLocalVideoStats.js +32 -0
  52. package/lib/commonjs/classes/HMSLocalVideoStats.js.map +1 -0
  53. package/lib/commonjs/classes/HMSLogger.js +48 -21
  54. package/lib/commonjs/classes/HMSLogger.js.map +1 -1
  55. package/lib/commonjs/classes/HMSMessage.js +4 -1
  56. package/lib/commonjs/classes/HMSMessage.js.map +1 -1
  57. package/lib/commonjs/classes/HMSMessageRecipient.js +26 -0
  58. package/lib/commonjs/classes/HMSMessageRecipient.js.map +1 -0
  59. package/lib/commonjs/classes/HMSMessageRecipientType.js +15 -0
  60. package/lib/commonjs/classes/HMSMessageRecipientType.js.map +1 -0
  61. package/lib/commonjs/classes/HMSPeerUpdate.js +1 -7
  62. package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
  63. package/lib/commonjs/classes/HMSPermissions.js +2 -2
  64. package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
  65. package/lib/commonjs/classes/HMSRTCStats.js +38 -0
  66. package/lib/commonjs/classes/HMSRTCStats.js.map +1 -0
  67. package/lib/commonjs/classes/HMSRTCStatsReport.js +26 -0
  68. package/lib/commonjs/classes/HMSRTCStatsReport.js.map +1 -0
  69. package/lib/commonjs/classes/HMSRemoteAudioStats.js +32 -0
  70. package/lib/commonjs/classes/HMSRemoteAudioStats.js.map +1 -0
  71. package/lib/commonjs/classes/HMSRemoteVideoStats.js +38 -0
  72. package/lib/commonjs/classes/HMSRemoteVideoStats.js.map +1 -0
  73. package/lib/commonjs/classes/HMSRoom.js +9 -0
  74. package/lib/commonjs/classes/HMSRoom.js.map +1 -1
  75. package/lib/commonjs/classes/HMSRoomUpdate.js +7 -0
  76. package/lib/commonjs/classes/HMSRoomUpdate.js.map +1 -1
  77. package/lib/commonjs/classes/HMSRtmpStreamingState.js +6 -0
  78. package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -1
  79. package/lib/commonjs/classes/HMSSDK.js +488 -114
  80. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  81. package/lib/commonjs/classes/HMSServerRecordingState.js +3 -0
  82. package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -1
  83. package/lib/commonjs/classes/HMSUpdateListenerActions.js +5 -0
  84. package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
  85. package/lib/commonjs/classes/HmsView.js +26 -4
  86. package/lib/commonjs/classes/HmsView.js.map +1 -1
  87. package/lib/commonjs/index.js +196 -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/HMSEncoder.js +172 -3
  92. package/lib/module/classes/HMSEncoder.js.map +1 -1
  93. package/lib/module/classes/HMSHLSConfig.js +14 -0
  94. package/lib/module/classes/HMSHLSConfig.js.map +1 -0
  95. package/lib/module/classes/HMSHLSMeetingURLVariant.js +14 -0
  96. package/lib/module/classes/HMSHLSMeetingURLVariant.js.map +1 -0
  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/HMSHLSStreamingState.js +14 -0
  102. package/lib/module/classes/HMSHLSStreamingState.js.map +1 -0
  103. package/lib/module/classes/HMSHLSVariant.js +20 -0
  104. package/lib/module/classes/HMSHLSVariant.js.map +1 -0
  105. package/lib/module/classes/HMSLocalAudioStats.js +17 -0
  106. package/lib/module/classes/HMSLocalAudioStats.js.map +1 -0
  107. package/lib/module/classes/HMSLocalVideoStats.js +23 -0
  108. package/lib/module/classes/HMSLocalVideoStats.js.map +1 -0
  109. package/lib/module/classes/HMSLogger.js +48 -21
  110. package/lib/module/classes/HMSLogger.js.map +1 -1
  111. package/lib/module/classes/HMSMessage.js +4 -1
  112. package/lib/module/classes/HMSMessage.js.map +1 -1
  113. package/lib/module/classes/HMSMessageRecipient.js +17 -0
  114. package/lib/module/classes/HMSMessageRecipient.js.map +1 -0
  115. package/lib/module/classes/HMSMessageRecipientType.js +8 -0
  116. package/lib/module/classes/HMSMessageRecipientType.js.map +1 -0
  117. package/lib/module/classes/HMSPeerUpdate.js +1 -7
  118. package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
  119. package/lib/module/classes/HMSPermissions.js +2 -2
  120. package/lib/module/classes/HMSPermissions.js.map +1 -1
  121. package/lib/module/classes/HMSRTCStats.js +29 -0
  122. package/lib/module/classes/HMSRTCStats.js.map +1 -0
  123. package/lib/module/classes/HMSRTCStatsReport.js +17 -0
  124. package/lib/module/classes/HMSRTCStatsReport.js.map +1 -0
  125. package/lib/module/classes/HMSRemoteAudioStats.js +23 -0
  126. package/lib/module/classes/HMSRemoteAudioStats.js.map +1 -0
  127. package/lib/module/classes/HMSRemoteVideoStats.js +29 -0
  128. package/lib/module/classes/HMSRemoteVideoStats.js.map +1 -0
  129. package/lib/module/classes/HMSRoom.js +9 -0
  130. package/lib/module/classes/HMSRoom.js.map +1 -1
  131. package/lib/module/classes/HMSRoomUpdate.js +7 -0
  132. package/lib/module/classes/HMSRoomUpdate.js.map +1 -1
  133. package/lib/module/classes/HMSRtmpStreamingState.js +6 -0
  134. package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -1
  135. package/lib/module/classes/HMSSDK.js +476 -115
  136. package/lib/module/classes/HMSSDK.js.map +1 -1
  137. package/lib/module/classes/HMSServerRecordingState.js +3 -0
  138. package/lib/module/classes/HMSServerRecordingState.js.map +1 -1
  139. package/lib/module/classes/HMSUpdateListenerActions.js +5 -0
  140. package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
  141. package/lib/module/classes/HmsView.js +23 -4
  142. package/lib/module/classes/HmsView.js.map +1 -1
  143. package/lib/module/index.js +14 -0
  144. package/lib/module/index.js.map +1 -1
  145. package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +4 -0
  146. package/lib/typescript/classes/HMSEncoder.d.ts +23 -0
  147. package/lib/typescript/classes/HMSHLSConfig.d.ts +10 -0
  148. package/lib/typescript/classes/HMSHLSMeetingURLVariant.d.ts +8 -0
  149. package/lib/typescript/classes/HMSHLSRecordingConfig.d.ts +8 -0
  150. package/lib/typescript/classes/HMSHLSRecordingState.d.ts +12 -0
  151. package/lib/typescript/classes/HMSHLSStreamingState.d.ts +9 -0
  152. package/lib/typescript/classes/HMSHLSVariant.d.ts +12 -0
  153. package/lib/typescript/classes/HMSLocalAudioStats.d.ts +10 -0
  154. package/lib/typescript/classes/HMSLocalVideoStats.d.ts +15 -0
  155. package/lib/typescript/classes/HMSLogger.d.ts +2 -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/HMSPeerUpdate.d.ts +2 -8
  160. package/lib/typescript/classes/HMSPermissions.d.ts +2 -2
  161. package/lib/typescript/classes/HMSRTCStats.d.ts +18 -0
  162. package/lib/typescript/classes/HMSRTCStatsReport.d.ts +11 -0
  163. package/lib/typescript/classes/HMSRemoteAudioStats.d.ts +14 -0
  164. package/lib/typescript/classes/HMSRemoteVideoStats.d.ts +19 -0
  165. package/lib/typescript/classes/HMSRoom.d.ts +8 -0
  166. package/lib/typescript/classes/HMSRoomUpdate.d.ts +8 -1
  167. package/lib/typescript/classes/HMSRtmpStreamingState.d.ts +4 -0
  168. package/lib/typescript/classes/HMSSDK.d.ts +325 -14
  169. package/lib/typescript/classes/HMSServerRecordingState.d.ts +2 -0
  170. package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +6 -1
  171. package/lib/typescript/index.d.ts +14 -0
  172. package/package.json +1 -2
  173. package/react-native-hms.podspec +1 -1
  174. package/src/classes/HMSBrowserRecordingState.ts +10 -1
  175. package/src/classes/HMSEncoder.ts +193 -3
  176. package/src/classes/HMSHLSConfig.ts +15 -0
  177. package/src/classes/HMSHLSMeetingURLVariant.ts +9 -0
  178. package/src/classes/HMSHLSRecordingConfig.ts +9 -0
  179. package/src/classes/HMSHLSRecordingState.ts +18 -0
  180. package/src/classes/HMSHLSStreamingState.ts +11 -0
  181. package/src/classes/HMSHLSVariant.ts +18 -0
  182. package/src/classes/HMSLocalAudioStats.ts +15 -0
  183. package/src/classes/HMSLocalVideoStats.ts +23 -0
  184. package/src/classes/HMSLogger.ts +17 -3
  185. package/src/classes/HMSMessage.ts +11 -5
  186. package/src/classes/HMSMessageRecipient.ts +19 -0
  187. package/src/classes/HMSMessageRecipientType.ts +5 -0
  188. package/src/classes/HMSPeerUpdate.ts +1 -7
  189. package/src/classes/HMSPermissions.ts +3 -3
  190. package/src/classes/HMSRTCStats.ts +27 -0
  191. package/src/classes/HMSRTCStatsReport.ts +17 -0
  192. package/src/classes/HMSRemoteAudioStats.ts +21 -0
  193. package/src/classes/HMSRemoteVideoStats.ts +29 -0
  194. package/src/classes/HMSRoom.ts +11 -0
  195. package/src/classes/HMSRoomUpdate.ts +7 -0
  196. package/src/classes/HMSRtmpStreamingState.ts +10 -1
  197. package/src/classes/HMSSDK.tsx +618 -30
  198. package/src/classes/HMSServerRecordingState.ts +7 -1
  199. package/src/classes/HMSUpdateListenerActions.ts +5 -0
  200. package/src/classes/HmsView.tsx +32 -4
  201. package/src/index.ts +14 -0
@@ -46,6 +46,20 @@ export * from './classes/HMSRtmpStreamingState';
46
46
  export * from './classes/HMSServerRecordingState';
47
47
  export * from './classes/HMSBrowserRecordingState';
48
48
  export * from './classes/HMSRTMPConfig';
49
+ export * from './classes/HMSHLSConfig';
50
+ export * from './classes/HMSHLSMeetingURLVariant';
51
+ export * from './classes/HMSHLSVariant';
52
+ export * from './classes/HMSHLSStreamingState';
49
53
  export * from './classes/HMSVideoResolution';
54
+ export * from './classes/HMSLocalAudioStats';
55
+ export * from './classes/HMSLocalVideoStats';
56
+ export * from './classes/HMSRTCStats';
57
+ export * from './classes/HMSRTCStatsReport';
58
+ export * from './classes/HMSRemoteAudioStats';
59
+ export * from './classes/HMSRemoteVideoStats';
60
+ export * from './classes/HMSHLSRecordingConfig';
61
+ export * from './classes/HMSHLSRecordingState';
62
+ export * from './classes/HMSMessageRecipient';
63
+ export * from './classes/HMSMessageRecipientType';
50
64
  import { HMSSDK as HmsManager } from './classes/HMSSDK';
51
65
  export default HmsManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@100mslive/react-native-hms",
3
- "version": "0.8.4",
3
+ "version": "0.9.2",
4
4
  "description": "The React Native package for 100ms SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -95,7 +95,6 @@
95
95
  "prettier": "^2.0.5",
96
96
  "react-native-builder-bob": "^0.18.0",
97
97
  "release-it": "^14.2.2",
98
- "typedoc": "^0.22.10",
99
98
  "typescript": "^4.1.3"
100
99
  },
101
100
  "peerDependencies": {
@@ -16,5 +16,5 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,m,mm,swift}"
17
17
 
18
18
  s.dependency "React-Core"
19
- s.dependency "HMSSDK"
19
+ s.dependency "HMSSDK", "0.2.8"
20
20
  end
@@ -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
  }
@@ -15,6 +15,20 @@ 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';
18
32
 
19
33
  export class HMSEncoder {
20
34
  static encodeHmsRoom(room: HMSRoom, id: string) {
@@ -22,10 +36,23 @@ export class HMSEncoder {
22
36
  id: room?.id,
23
37
  metaData: room?.metaData,
24
38
  name: room?.name,
39
+ peerCount: room?.peerCount,
25
40
  peers: HMSEncoder.encodeHmsPeers(room?.peers, id),
26
- browserRecordingState: room?.browserRecordingState,
27
- rtmpHMSRtmpStreamingState: room?.rtmpHMSRtmpStreamingState,
28
- serverRecordingState: room?.serverRecordingState,
41
+ browserRecordingState: HMSEncoder.encodeBrowserRecordingState(
42
+ room?.browserRecordingState
43
+ ),
44
+ rtmpHMSRtmpStreamingState: HMSEncoder.encodeRTMPStreamingState(
45
+ room?.rtmpHMSRtmpStreamingState
46
+ ),
47
+ serverRecordingState: HMSEncoder.encodeServerRecordingState(
48
+ room?.serverRecordingState
49
+ ),
50
+ hlsStreamingState: HMSEncoder.encodeHLSStreamingState(
51
+ room?.hlsStreamingState
52
+ ),
53
+ hlsRecordingState: HMSEncoder.encodeHLSRecordingState(
54
+ room?.hlsRecordingState
55
+ ),
29
56
  };
30
57
 
31
58
  return new HMSRoom(encodedObj);
@@ -182,6 +209,34 @@ export class HMSEncoder {
182
209
  return new HMSVideoResolution(encodedObj);
183
210
  }
184
211
 
212
+ static encodeHmsLocalAudioTrack(track: any, id: string) {
213
+ const encodedObj = {
214
+ id: id,
215
+ trackId: track?.trackId,
216
+ source: track?.source,
217
+ trackDescription: track?.trackDescription,
218
+ isMute: track?.isMute,
219
+ settings: HMSEncoder.encodeHmsAudioTrackSettings(track?.settings),
220
+ type: track?.type,
221
+ };
222
+
223
+ return new HMSLocalAudioTrack(encodedObj);
224
+ }
225
+
226
+ static encodeHmsLocalVideoTrack(track: any, id: string) {
227
+ const encodedObj = {
228
+ id: id,
229
+ trackId: track?.trackId,
230
+ source: track?.source,
231
+ trackDescription: track?.trackDescription,
232
+ isMute: track?.isMute,
233
+ settings: HMSEncoder.encodeHmsVideoTrackSettings(track?.settings),
234
+ type: track?.type,
235
+ };
236
+
237
+ return new HMSLocalVideoTrack(encodedObj);
238
+ }
239
+
185
240
  static encodeHmsRemotePeers(peers: any, id: string) {
186
241
  const hmsPeers: any[] = [];
187
242
 
@@ -231,6 +286,33 @@ export class HMSEncoder {
231
286
  return new HMSRemotePeer(encodedObj);
232
287
  }
233
288
 
289
+ static encodeHmsRemoteAudioTrack(track: any, id: string) {
290
+ const encodedObj = {
291
+ id: id,
292
+ trackId: track?.trackId,
293
+ source: track?.source,
294
+ trackDescription: track?.trackDescription,
295
+ isMute: track?.isMute,
296
+ playbackAllowed: track?.playbackAllowed,
297
+ };
298
+
299
+ return new HMSRemoteAudioTrack(encodedObj);
300
+ }
301
+
302
+ static encodeHmsRemoteVideoTrack(track: any, id: string) {
303
+ const encodedObj = {
304
+ id: id,
305
+ trackId: track?.trackId,
306
+ source: track?.source,
307
+ trackDescription: track?.trackDescription,
308
+ layer: track?.layer,
309
+ isMute: track?.isMute,
310
+ playbackAllowed: track?.playbackAllowed,
311
+ };
312
+
313
+ return new HMSRemoteVideoTrack(encodedObj);
314
+ }
315
+
234
316
  static encodeHmsPreviewTracks(previewTracks: any) {
235
317
  const encodedObj = {
236
318
  audioTrack: previewTracks.audioTrack
@@ -281,4 +363,112 @@ export class HMSEncoder {
281
363
 
282
364
  return new HMSChangeTrackStateRequest(encodedChangeTrackStateRequest);
283
365
  }
366
+
367
+ static encodeRTCStats(data: any) {
368
+ let video = this.encodeRTCStatsUnit(data?.video);
369
+ let audio = this.encodeRTCStatsUnit(data?.audio);
370
+ let combined = this.encodeRTCStatsUnit(data?.combined);
371
+
372
+ return new HMSRTCStatsReport({ video, audio, combined });
373
+ }
374
+
375
+ static encodeRTCStatsUnit(data: any) {
376
+ return new HMSRTCStats({
377
+ bitrateReceived: data?.bitrateReceived,
378
+ bitrateSent: data?.bitrateSent,
379
+ bytesReceived: data?.bytesReceived,
380
+ bytesSent: data?.bytesSent,
381
+ packetsLost: data?.packetsLost,
382
+ packetsReceived: data?.packetsReceived,
383
+ roundTripTime: data?.roundTripTime,
384
+ });
385
+ }
386
+
387
+ static encodeHmsSpeakerUpdate(data: any, id: string) {
388
+ return new HMSSpeakerUpdate({
389
+ event: data?.event,
390
+ count: data?.count,
391
+ peers: HMSEncoder.encodeHmsSpeakers(data?.peers, id),
392
+ });
393
+ }
394
+
395
+ static encodeHmsSpeakers(data: any, id: string) {
396
+ let encodedSpeakers: Array<HMSSpeaker> = [];
397
+
398
+ data?.map((item: any) => {
399
+ encodedSpeakers.push(HMSEncoder.encodeHmsSpeaker(item, id));
400
+ });
401
+
402
+ return encodedSpeakers;
403
+ }
404
+
405
+ static encodeHmsSpeaker(data: any, id: string) {
406
+ return new HMSSpeaker({
407
+ level: data?.level,
408
+ peer: HMSEncoder.encodeHmsPeer(data?.peer, id),
409
+ track: HMSEncoder.encodeHmsTrack(data?.track, id),
410
+ });
411
+ }
412
+
413
+ static encodeBrowserRecordingState(data: any) {
414
+ return new HMSBrowserRecordingState({
415
+ running: data?.running,
416
+ startedAt: new Date(parseInt(data?.startedAt)),
417
+ stoppedAt: new Date(parseInt(data?.stoppedAt)),
418
+ error: data?.error,
419
+ });
420
+ }
421
+
422
+ static encodeServerRecordingState(data: any) {
423
+ return new HMSServerRecordingState({
424
+ running: data?.running,
425
+ error: data?.error,
426
+ startedAt: new Date(parseInt(data?.startedAt)),
427
+ });
428
+ }
429
+
430
+ static encodeRTMPStreamingState(data: any) {
431
+ return new HMSRtmpStreamingState({
432
+ running: data?.running,
433
+ startedAt: new Date(parseInt(data?.startedAt)),
434
+ stoppedAt: new Date(parseInt(data?.stoppedAt)),
435
+ error: data?.error,
436
+ });
437
+ }
438
+
439
+ static encodeHLSStreamingState(data: any) {
440
+ return new HMSHLSStreamingState({
441
+ running: data?.running,
442
+ variants: this.encodeHLSVariants(data?.variants),
443
+ });
444
+ }
445
+
446
+ static encodeHLSRecordingState(data: any) {
447
+ if (data) {
448
+ return new HMSHLSRecordingState({
449
+ running: data?.running,
450
+ startedAt: new Date(parseInt(data?.startedAt)),
451
+ singleFilePerLayer: data?.singleFilePerLayer,
452
+ videoOnDemand: data?.videoOnDemand,
453
+ });
454
+ } else {
455
+ return undefined;
456
+ }
457
+ }
458
+
459
+ static encodeHLSVariants(data: any) {
460
+ let variants: HMSHLSVariant[] = [];
461
+
462
+ data?.map((item: any) => {
463
+ let variant = new HMSHLSVariant({
464
+ hlsStreamUrl: item.hlsStreamUrl,
465
+ meetingUrl: item.meetingUrl,
466
+ metadata: item?.metadata,
467
+ startedAt: new Date(parseInt(item?.startedAt)),
468
+ });
469
+ variants.push(variant);
470
+ });
471
+
472
+ return variants;
473
+ }
284
474
  }
@@ -0,0 +1,15 @@
1
+ import type { HMSHLSMeetingURLVariant } from './HMSHLSMeetingURLVariant';
2
+ import type { HMSHLSRecordingConfig } from './HMSHLSRecordingConfig';
3
+
4
+ export class HMSHLSConfig {
5
+ hlsRecordingConfig?: HMSHLSRecordingConfig;
6
+ meetingURLVariants: Array<HMSHLSMeetingURLVariant>;
7
+
8
+ constructor(params: {
9
+ hlsRecordingConfig?: HMSHLSRecordingConfig;
10
+ meetingURLVariants: Array<HMSHLSMeetingURLVariant>;
11
+ }) {
12
+ this.hlsRecordingConfig = params.hlsRecordingConfig;
13
+ this.meetingURLVariants = params.meetingURLVariants;
14
+ }
15
+ }
@@ -0,0 +1,9 @@
1
+ export class HMSHLSMeetingURLVariant {
2
+ meetingUrl: string;
3
+ metadata: string;
4
+
5
+ constructor(params: { meetingUrl: string; metadata: string }) {
6
+ this.meetingUrl = params.meetingUrl;
7
+ this.metadata = params.metadata;
8
+ }
9
+ }
@@ -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
+ }
@@ -0,0 +1,11 @@
1
+ import type { HMSHLSVariant } from './HMSHLSVariant';
2
+
3
+ export class HMSHLSStreamingState {
4
+ running: boolean;
5
+ variants: Array<HMSHLSVariant>;
6
+
7
+ constructor(params: { running: boolean; variants: Array<HMSHLSVariant> }) {
8
+ this.running = params.running;
9
+ this.variants = params.variants;
10
+ }
11
+ }
@@ -0,0 +1,18 @@
1
+ export class HMSHLSVariant {
2
+ hlsStreamUrl?: string;
3
+ meetingUrl?: string;
4
+ metadata?: string;
5
+ startedAt?: Date;
6
+
7
+ constructor(params: {
8
+ hlsStreamUrl?: string;
9
+ meetingUrl?: string;
10
+ metadata?: string;
11
+ startedAt?: Date;
12
+ }) {
13
+ this.hlsStreamUrl = params.hlsStreamUrl;
14
+ this.meetingUrl = params.meetingUrl;
15
+ this.metadata = params.metadata;
16
+ this.startedAt = params.startedAt;
17
+ }
18
+ }
@@ -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
+ }
@@ -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
+ }
@@ -10,6 +10,7 @@ export class HMSLogger {
10
10
  data: any;
11
11
  id: string;
12
12
  }[] = [];
13
+ private onLog?: Function;
13
14
 
14
15
  constructor(params?: { verbose: boolean; warning: boolean; error: boolean }) {
15
16
  if (params) {
@@ -22,28 +23,41 @@ export class HMSLogger {
22
23
  verbose(message: string, data: any) {
23
24
  if (this._verbose) {
24
25
  console.log(message, data);
26
+ if (this.onLog) {
27
+ this?.onLog({ message, data });
28
+ }
29
+ this.logs.push({ type: 'verbose', message, data, id: data?.id });
25
30
  }
26
- this.logs.push({ type: 'verbose', message, data, id: data?.id });
27
31
  }
28
32
 
29
33
  warn(message: string, data: any) {
30
34
  if (this._warning) {
31
35
  console.warn(message, data);
36
+ if (this.onLog) {
37
+ this?.onLog({ message, data });
38
+ }
39
+ this.logs.push({ type: 'warn', message, data, id: data?.id });
32
40
  }
33
- this.logs.push({ type: 'warn', message, data, id: data?.id });
34
41
  }
35
42
 
36
43
  error(message: string, data: any) {
37
44
  if (this._error) {
38
45
  console.error(message, data);
46
+ if (this.onLog) {
47
+ this?.onLog({ message, data });
48
+ }
49
+ this.logs.push({ type: 'error', message, data, id: data?.id });
39
50
  }
40
- this.logs.push({ type: 'error', message, data, id: data?.id });
41
51
  }
42
52
 
43
53
  getLogs() {
44
54
  return this.logs;
45
55
  }
46
56
 
57
+ setLogListener(callback: Function) {
58
+ this.onLog = callback;
59
+ }
60
+
47
61
  updateLogLevel(level: HMSLogLevel, value: boolean) {
48
62
  switch (level) {
49
63
  case HMSLogLevel.VERBOSE: {
@@ -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
+ }
@@ -1,13 +1,7 @@
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',
13
7
  }
@@ -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
+ }
@@ -0,0 +1,29 @@
1
+ import type { HMSVideoResolution } from './HMSVideoResolution';
2
+
3
+ export class HMSRemoteVideoStats {
4
+ bitrate?: number;
5
+ packetsReceived?: number;
6
+ packetsLost?: number;
7
+ bytesReceived?: number;
8
+ jitter?: number;
9
+ resolution?: HMSVideoResolution;
10
+ frameRate?: number;
11
+
12
+ constructor(params: {
13
+ bitrate?: number;
14
+ packetsReceived?: number;
15
+ packetsLost?: number;
16
+ bytesReceived?: number;
17
+ jitter?: number;
18
+ resolution?: HMSVideoResolution;
19
+ frameRate?: number;
20
+ }) {
21
+ this.bitrate = params.bitrate;
22
+ this.packetsReceived = params.packetsReceived;
23
+ this.packetsLost = params.packetsLost;
24
+ this.bytesReceived = params.bytesReceived;
25
+ this.jitter = params.jitter;
26
+ this.resolution = params.resolution;
27
+ this.frameRate = params.frameRate;
28
+ }
29
+ }