@100mslive/react-native-hms 1.4.0 → 1.6.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 (205) hide show
  1. package/android/build.gradle +3 -2
  2. package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +189 -55
  3. package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +1 -0
  4. package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +94 -38
  5. package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +446 -107
  6. package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +5 -0
  7. package/android/src/main/java/com/reactnativehmssdk/HMSView.kt +42 -25
  8. package/android/src/main/res/layout/hms_view.xml +2 -2
  9. package/ios/HMSConstants.swift +33 -0
  10. package/ios/HMSDecoder.swift +372 -157
  11. package/ios/HMSHelper.swift +44 -7
  12. package/ios/HMSManager.m +17 -2
  13. package/ios/HMSManager.swift +177 -75
  14. package/ios/HMSRNSDK.swift +641 -199
  15. package/ios/HMSView.m +1 -0
  16. package/ios/HMSView.swift +21 -19
  17. package/lib/commonjs/classes/HMSAudioTrackSettings.js +14 -0
  18. package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
  19. package/lib/commonjs/classes/HMSCameraControl.js +28 -0
  20. package/lib/commonjs/classes/HMSCameraControl.js.map +1 -0
  21. package/lib/commonjs/classes/HMSEncoder.js +97 -14
  22. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  23. package/lib/commonjs/classes/HMSIOSAudioMode.js +13 -0
  24. package/lib/commonjs/classes/HMSIOSAudioMode.js.map +1 -0
  25. package/lib/commonjs/classes/HMSLayer.js +14 -0
  26. package/lib/commonjs/classes/HMSLayer.js.map +1 -0
  27. package/lib/commonjs/classes/HMSLocalVideoStats.js +11 -0
  28. package/lib/commonjs/classes/HMSLocalVideoStats.js.map +1 -1
  29. package/lib/commonjs/classes/HMSPeer.js +1 -1
  30. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  31. package/lib/commonjs/classes/HMSPublishSettings.js +2 -0
  32. package/lib/commonjs/classes/HMSPublishSettings.js.map +1 -1
  33. package/lib/commonjs/classes/HMSQualityLimitationReason.js +16 -0
  34. package/lib/commonjs/classes/HMSQualityLimitationReason.js.map +1 -0
  35. package/lib/commonjs/classes/HMSQualityLimitationReasons.js +27 -0
  36. package/lib/commonjs/classes/HMSQualityLimitationReasons.js.map +1 -0
  37. package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
  38. package/lib/commonjs/classes/HMSRemoteVideoTrack.js +39 -3
  39. package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
  40. package/lib/commonjs/classes/HMSRoom.js +4 -0
  41. package/lib/commonjs/classes/HMSRoom.js.map +1 -1
  42. package/lib/commonjs/classes/HMSRoomUpdate.js +1 -0
  43. package/lib/commonjs/classes/HMSRoomUpdate.js.map +1 -1
  44. package/lib/commonjs/classes/HMSSDK.js +82 -45
  45. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  46. package/lib/commonjs/classes/HMSSessionStore.js +173 -0
  47. package/lib/commonjs/classes/HMSSessionStore.js.map +1 -0
  48. package/lib/commonjs/classes/HMSSimulcastLayerDefinition.js +19 -0
  49. package/lib/commonjs/classes/HMSSimulcastLayerDefinition.js.map +1 -0
  50. package/lib/commonjs/classes/HMSSimulcastLayerSettingsPolicy.js +23 -0
  51. package/lib/commonjs/classes/HMSSimulcastLayerSettingsPolicy.js.map +1 -0
  52. package/lib/commonjs/classes/HMSSimulcastSettings.js +5 -4
  53. package/lib/commonjs/classes/HMSSimulcastSettings.js.map +1 -1
  54. package/lib/commonjs/classes/HMSSimulcastSettingsPolicy.js +17 -0
  55. package/lib/commonjs/classes/HMSSimulcastSettingsPolicy.js.map +1 -0
  56. package/lib/commonjs/classes/HMSSubscribeDegradationPolicy.js +21 -0
  57. package/lib/commonjs/classes/HMSSubscribeDegradationPolicy.js.map +1 -0
  58. package/lib/commonjs/classes/HMSSubscribeSettings.js +2 -0
  59. package/lib/commonjs/classes/HMSSubscribeSettings.js.map +1 -1
  60. package/lib/commonjs/classes/HMSUpdateListenerActions.js +8 -0
  61. package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
  62. package/lib/commonjs/classes/HMSVideoResolution.js.map +1 -1
  63. package/lib/commonjs/classes/HMSVideoTrackSettings.js +5 -0
  64. package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
  65. package/lib/commonjs/classes/HmsView.js +2 -0
  66. package/lib/commonjs/classes/HmsView.js.map +1 -1
  67. package/lib/commonjs/index.js +72 -0
  68. package/lib/commonjs/index.js.map +1 -1
  69. package/lib/commonjs/utils/emitter/EventEmitter.js +162 -0
  70. package/lib/commonjs/utils/emitter/EventEmitter.js.map +1 -0
  71. package/lib/commonjs/utils/emitter/_EmitterSubscription.js +46 -0
  72. package/lib/commonjs/utils/emitter/_EmitterSubscription.js.map +1 -0
  73. package/lib/commonjs/utils/emitter/_EventSubscription.js +36 -0
  74. package/lib/commonjs/utils/emitter/_EventSubscription.js.map +1 -0
  75. package/lib/commonjs/utils/emitter/_EventSubscriptionVendor.js +90 -0
  76. package/lib/commonjs/utils/emitter/_EventSubscriptionVendor.js.map +1 -0
  77. package/lib/commonjs/utils/index.js +17 -0
  78. package/lib/commonjs/utils/index.js.map +1 -0
  79. package/lib/module/classes/HMSAudioTrackSettings.js +14 -0
  80. package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
  81. package/lib/module/classes/HMSCameraControl.js +21 -0
  82. package/lib/module/classes/HMSCameraControl.js.map +1 -0
  83. package/lib/module/classes/HMSEncoder.js +97 -14
  84. package/lib/module/classes/HMSEncoder.js.map +1 -1
  85. package/lib/module/classes/HMSIOSAudioMode.js +6 -0
  86. package/lib/module/classes/HMSIOSAudioMode.js.map +1 -0
  87. package/lib/module/classes/HMSLayer.js +7 -0
  88. package/lib/module/classes/HMSLayer.js.map +1 -0
  89. package/lib/module/classes/HMSLocalVideoStats.js +11 -0
  90. package/lib/module/classes/HMSLocalVideoStats.js.map +1 -1
  91. package/lib/module/classes/HMSPeer.js +1 -1
  92. package/lib/module/classes/HMSPeer.js.map +1 -1
  93. package/lib/module/classes/HMSPublishSettings.js +2 -0
  94. package/lib/module/classes/HMSPublishSettings.js.map +1 -1
  95. package/lib/module/classes/HMSQualityLimitationReason.js +9 -0
  96. package/lib/module/classes/HMSQualityLimitationReason.js.map +1 -0
  97. package/lib/module/classes/HMSQualityLimitationReasons.js +20 -0
  98. package/lib/module/classes/HMSQualityLimitationReasons.js.map +1 -0
  99. package/lib/module/classes/HMSRemotePeer.js.map +1 -1
  100. package/lib/module/classes/HMSRemoteVideoTrack.js +39 -3
  101. package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
  102. package/lib/module/classes/HMSRoom.js +4 -0
  103. package/lib/module/classes/HMSRoom.js.map +1 -1
  104. package/lib/module/classes/HMSRoomUpdate.js +1 -0
  105. package/lib/module/classes/HMSRoomUpdate.js.map +1 -1
  106. package/lib/module/classes/HMSSDK.js +83 -45
  107. package/lib/module/classes/HMSSDK.js.map +1 -1
  108. package/lib/module/classes/HMSSessionStore.js +166 -0
  109. package/lib/module/classes/HMSSessionStore.js.map +1 -0
  110. package/lib/module/classes/HMSSimulcastLayerDefinition.js +12 -0
  111. package/lib/module/classes/HMSSimulcastLayerDefinition.js.map +1 -0
  112. package/lib/module/classes/HMSSimulcastLayerSettingsPolicy.js +16 -0
  113. package/lib/module/classes/HMSSimulcastLayerSettingsPolicy.js.map +1 -0
  114. package/lib/module/classes/HMSSimulcastSettings.js +5 -4
  115. package/lib/module/classes/HMSSimulcastSettings.js.map +1 -1
  116. package/lib/module/classes/HMSSimulcastSettingsPolicy.js +10 -0
  117. package/lib/module/classes/HMSSimulcastSettingsPolicy.js.map +1 -0
  118. package/lib/module/classes/HMSSubscribeDegradationPolicy.js +14 -0
  119. package/lib/module/classes/HMSSubscribeDegradationPolicy.js.map +1 -0
  120. package/lib/module/classes/HMSSubscribeSettings.js +2 -0
  121. package/lib/module/classes/HMSSubscribeSettings.js.map +1 -1
  122. package/lib/module/classes/HMSUpdateListenerActions.js +8 -0
  123. package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
  124. package/lib/module/classes/HMSVideoResolution.js.map +1 -1
  125. package/lib/module/classes/HMSVideoTrackSettings.js +5 -0
  126. package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
  127. package/lib/module/classes/HmsView.js +2 -0
  128. package/lib/module/classes/HmsView.js.map +1 -1
  129. package/lib/module/index.js +6 -0
  130. package/lib/module/index.js.map +1 -1
  131. package/lib/module/utils/emitter/EventEmitter.js +151 -0
  132. package/lib/module/utils/emitter/EventEmitter.js.map +1 -0
  133. package/lib/module/utils/emitter/_EmitterSubscription.js +39 -0
  134. package/lib/module/utils/emitter/_EmitterSubscription.js.map +1 -0
  135. package/lib/module/utils/emitter/_EventSubscription.js +29 -0
  136. package/lib/module/utils/emitter/_EventSubscription.js.map +1 -0
  137. package/lib/module/utils/emitter/_EventSubscriptionVendor.js +83 -0
  138. package/lib/module/utils/emitter/_EventSubscriptionVendor.js.map +1 -0
  139. package/lib/module/utils/index.js +2 -0
  140. package/lib/module/utils/index.js.map +1 -0
  141. package/lib/typescript/classes/HMSAudioTrackSettings.d.ts +14 -0
  142. package/lib/typescript/classes/HMSCameraControl.d.ts +9 -0
  143. package/lib/typescript/classes/HMSEncoder.d.ts +13 -1
  144. package/lib/typescript/classes/HMSIOSAudioMode.d.ts +4 -0
  145. package/lib/typescript/classes/HMSLayer.d.ts +5 -0
  146. package/lib/typescript/classes/HMSLocalVideoStats.d.ts +6 -0
  147. package/lib/typescript/classes/HMSPeer.d.ts +1 -1
  148. package/lib/typescript/classes/HMSPublishSettings.d.ts +3 -0
  149. package/lib/typescript/classes/HMSQualityLimitationReason.d.ts +7 -0
  150. package/lib/typescript/classes/HMSQualityLimitationReasons.d.ts +17 -0
  151. package/lib/typescript/classes/HMSRemotePeer.d.ts +0 -1
  152. package/lib/typescript/classes/HMSRemoteVideoTrack.d.ts +6 -2
  153. package/lib/typescript/classes/HMSRoomUpdate.d.ts +2 -1
  154. package/lib/typescript/classes/HMSSDK.d.ts +21 -31
  155. package/lib/typescript/classes/HMSSessionStore.d.ts +63 -0
  156. package/lib/typescript/classes/HMSSimulcastLayerDefinition.d.ts +10 -0
  157. package/lib/typescript/classes/HMSSimulcastLayerSettingsPolicy.d.ts +12 -0
  158. package/lib/typescript/classes/HMSSimulcastSettings.d.ts +7 -3
  159. package/lib/typescript/classes/HMSSimulcastSettingsPolicy.d.ts +7 -0
  160. package/lib/typescript/classes/HMSSubscribeDegradationPolicy.d.ts +10 -0
  161. package/lib/typescript/classes/HMSSubscribeSettings.d.ts +5 -2
  162. package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +9 -1
  163. package/lib/typescript/classes/HMSVideoResolution.d.ts +2 -2
  164. package/lib/typescript/classes/HMSVideoTrackSettings.d.ts +5 -0
  165. package/lib/typescript/classes/HmsView.d.ts +2 -2
  166. package/lib/typescript/index.d.ts +7 -0
  167. package/lib/typescript/utils/emitter/EventEmitter.d.ts +91 -0
  168. package/lib/typescript/utils/emitter/_EmitterSubscription.d.ts +29 -0
  169. package/lib/typescript/utils/emitter/_EventSubscription.d.ts +19 -0
  170. package/lib/typescript/utils/emitter/_EventSubscriptionVendor.d.ts +44 -0
  171. package/lib/typescript/utils/index.d.ts +1 -0
  172. package/package.json +21 -2
  173. package/sdk-versions.json +3 -3
  174. package/src/classes/HMSAudioTrackSettings.ts +16 -0
  175. package/src/classes/HMSCameraControl.ts +21 -0
  176. package/src/classes/HMSEncoder.ts +126 -11
  177. package/src/classes/HMSIOSAudioMode.ts +4 -0
  178. package/src/classes/HMSLayer.ts +5 -0
  179. package/src/classes/HMSLocalVideoStats.ts +21 -0
  180. package/src/classes/HMSPeer.ts +1 -1
  181. package/src/classes/HMSPublishSettings.ts +4 -0
  182. package/src/classes/HMSQualityLimitationReason.ts +7 -0
  183. package/src/classes/HMSQualityLimitationReasons.ts +27 -0
  184. package/src/classes/HMSRemotePeer.ts +0 -1
  185. package/src/classes/HMSRemoteVideoTrack.ts +52 -4
  186. package/src/classes/HMSRoom.ts +2 -0
  187. package/src/classes/HMSRoomUpdate.ts +1 -0
  188. package/src/classes/HMSSDK.tsx +124 -52
  189. package/src/classes/HMSSessionStore.ts +209 -0
  190. package/src/classes/HMSSimulcastLayerDefinition.ts +12 -0
  191. package/src/classes/HMSSimulcastLayerSettingsPolicy.ts +18 -0
  192. package/src/classes/HMSSimulcastSettings.ts +12 -3
  193. package/src/classes/HMSSimulcastSettingsPolicy.ts +9 -0
  194. package/src/classes/HMSSubscribeDegradationPolicy.ts +15 -0
  195. package/src/classes/HMSSubscribeSettings.ts +10 -2
  196. package/src/classes/HMSUpdateListenerActions.ts +8 -0
  197. package/src/classes/HMSVideoResolution.ts +1 -1
  198. package/src/classes/HMSVideoTrackSettings.ts +5 -0
  199. package/src/classes/HmsView.tsx +5 -1
  200. package/src/index.ts +10 -0
  201. package/src/utils/emitter/EventEmitter.ts +160 -0
  202. package/src/utils/emitter/_EmitterSubscription.ts +44 -0
  203. package/src/utils/emitter/_EventSubscription.ts +28 -0
  204. package/src/utils/emitter/_EventSubscriptionVendor.ts +89 -0
  205. package/src/utils/index.ts +1 -0
@@ -32,6 +32,13 @@ import { HMSMessageRecipient } from './HMSMessageRecipient';
32
32
  import { HMSException } from './HMSException';
33
33
  import { HMSConstants } from './HMSConstants';
34
34
  import { HMSPeerUpdateOrdinals } from './HMSPeerUpdate';
35
+ import { HMSLocalAudioStats } from './HMSLocalAudioStats';
36
+ import { HMSLocalVideoStats } from './HMSLocalVideoStats';
37
+ import { HMSRemoteAudioStats } from './HMSRemoteAudioStats';
38
+ import { HMSRemoteVideoStats } from './HMSRemoteVideoStats';
39
+ import { HMSLayer } from './HMSLayer';
40
+ import { HMSSimulcastLayerDefinition } from './HMSSimulcastLayerDefinition';
41
+ import { HMSQualityLimitationReasons } from './HMSQualityLimitationReasons';
35
42
 
36
43
  const { HMSManager } = NativeModules;
37
44
 
@@ -46,10 +53,10 @@ export class HMSEncoder {
46
53
  this.data = { roles: {} };
47
54
  }
48
55
 
49
- static encodeHmsRoom(room: HMSRoom, id: string) {
56
+ static encodeHmsRoom(room: any, id: string) {
50
57
  const encodedObj = {
51
58
  id: room?.id,
52
- sessionId: room?.sessionId,
59
+ sessionId: room?.sessionId || undefined,
53
60
  metaData: room?.metaData,
54
61
  name: room?.name,
55
62
  peerCount: room?.peerCount,
@@ -70,6 +77,7 @@ export class HMSEncoder {
70
77
  room?.hlsRecordingState
71
78
  ),
72
79
  localPeer: HMSEncoder.encodeHmsLocalPeer(room?.localPeer, id),
80
+ // startedAt: HMSEncoder.encodeDate(room?.startedAt),
73
81
  };
74
82
 
75
83
  return new HMSRoom(encodedObj);
@@ -188,6 +196,7 @@ export class HMSEncoder {
188
196
  const encodedObj = {
189
197
  useHardwareEchoCancellation: settings?.useHardwareAcousticEchoCanceler,
190
198
  initialState: settings?.initialState,
199
+ audioMode: settings?.audioMode,
191
200
  };
192
201
 
193
202
  return new HMSAudioTrackSettings(encodedObj);
@@ -278,7 +287,6 @@ export class HMSEncoder {
278
287
  trackId: peer?.remoteVideoTrackData?.trackId,
279
288
  source: peer?.remoteVideoTrackData?.source,
280
289
  trackDescription: peer?.remoteVideoTrackData?.trackDescription,
281
- layer: peer?.remoteVideoTrackData?.layer,
282
290
  isMute: peer?.remoteVideoTrackData?.isMute,
283
291
  playbackAllowed: peer?.remoteVideoTrackData?.playbackAllowed,
284
292
  }
@@ -307,7 +315,6 @@ export class HMSEncoder {
307
315
  trackId: track?.trackId,
308
316
  source: track?.source,
309
317
  trackDescription: track?.trackDescription,
310
- layer: track?.layer,
311
318
  isMute: track?.isMute,
312
319
  playbackAllowed: track?.playbackAllowed,
313
320
  };
@@ -393,14 +400,24 @@ export class HMSEncoder {
393
400
  }
394
401
 
395
402
  static encodeRTCStatsUnit(data: any) {
403
+ const [
404
+ bitrateReceived,
405
+ bitrateSent,
406
+ bytesReceived,
407
+ bytesSent,
408
+ packetsLost,
409
+ packetsReceived,
410
+ roundTripTime,
411
+ ] = data;
412
+
396
413
  return new HMSRTCStats({
397
- bitrateReceived: data?.bitrateReceived,
398
- bitrateSent: data?.bitrateSent,
399
- bytesReceived: data?.bytesReceived,
400
- bytesSent: data?.bytesSent,
401
- packetsLost: data?.packetsLost,
402
- packetsReceived: data?.packetsReceived,
403
- roundTripTime: data?.roundTripTime,
414
+ bitrateReceived,
415
+ bitrateSent,
416
+ bytesReceived,
417
+ bytesSent,
418
+ packetsLost,
419
+ packetsReceived,
420
+ roundTripTime,
404
421
  });
405
422
  }
406
423
 
@@ -544,4 +561,102 @@ export class HMSEncoder {
544
561
  canRetry: data?.error?.canRetry,
545
562
  });
546
563
  }
564
+
565
+ static encodeHMSLocalAudioStats(data: any) {
566
+ const [bitrate, bytesSent, roundTripTime] = data;
567
+
568
+ return new HMSLocalAudioStats({
569
+ bitrate: bitrate >= 0 ? bitrate : undefined,
570
+ bytesSent: bytesSent ? bytesSent : undefined,
571
+ roundTripTime: roundTripTime >= 0 ? roundTripTime : undefined,
572
+ });
573
+ }
574
+
575
+ static encodeHMSLocalVideoStats(data: any[]) {
576
+ return data.map((item: any) => {
577
+ const [
578
+ bitrate,
579
+ bytesSent,
580
+ roundTripTime,
581
+ frameRate,
582
+ resolution,
583
+ layer,
584
+ qualityLimitationReasons,
585
+ ] = item;
586
+
587
+ return new HMSLocalVideoStats({
588
+ bitrate: bitrate >= 0 ? bitrate : undefined,
589
+ bytesSent: bytesSent ? bytesSent : undefined,
590
+ roundTripTime: roundTripTime >= 0 ? roundTripTime : undefined,
591
+ frameRate: frameRate >= 0 ? frameRate : undefined,
592
+ resolution: resolution
593
+ ? { width: resolution[0], height: resolution[1] }
594
+ : undefined, // resolution: [width, height]
595
+ layer: layer ? layer : undefined,
596
+ qualityLimitationReasons: qualityLimitationReasons
597
+ ? this.encodeHMSQualityLimitationReasons(qualityLimitationReasons)
598
+ : undefined,
599
+ });
600
+ });
601
+ }
602
+
603
+ static encodeHMSRemoteAudioStats(data: any) {
604
+ const [bitrate, bytesReceived, jitter, packetsLost, packetsReceived] = data;
605
+
606
+ return new HMSRemoteAudioStats({
607
+ bitrate: bitrate >= 0 ? bitrate : undefined,
608
+ bytesReceived: bytesReceived ? bytesReceived : undefined,
609
+ jitter: jitter >= 0 ? jitter : undefined,
610
+ packetsLost: packetsLost >= 0 ? packetsLost : undefined,
611
+ packetsReceived: packetsReceived ? packetsReceived : undefined,
612
+ });
613
+ }
614
+
615
+ static encodeHMSRemoteVideoStats(data: any) {
616
+ const [
617
+ bitrate,
618
+ bytesReceived,
619
+ frameRate,
620
+ jitter,
621
+ packetsLost,
622
+ packetsReceived,
623
+ resolution,
624
+ ] = data;
625
+
626
+ return new HMSRemoteVideoStats({
627
+ bitrate: bitrate >= 0 ? bitrate : undefined,
628
+ bytesReceived: bytesReceived ? bytesReceived : undefined,
629
+ frameRate: frameRate >= 0 ? frameRate : undefined,
630
+ jitter: jitter >= 0 ? jitter : undefined,
631
+ packetsLost: packetsLost >= 0 ? packetsLost : undefined,
632
+ packetsReceived: packetsReceived ? packetsReceived : undefined,
633
+ resolution: resolution
634
+ ? { width: resolution[0], height: resolution[1] }
635
+ : undefined, // resolution: [width, height]
636
+ });
637
+ }
638
+
639
+ static encodeHMSSimulcastLayerDefinition(data: any[]) {
640
+ return data.map((sld) => {
641
+ return new HMSSimulcastLayerDefinition({
642
+ layer: HMSLayer[sld.layer as HMSLayer], // DOUBT: This can be invalid. Should we throw error?
643
+ resolution: this.encodeHmsVideoResolution({
644
+ width: sld.resolution[0],
645
+ height: sld.resolution[1],
646
+ }),
647
+ });
648
+ });
649
+ }
650
+
651
+ static encodeHMSQualityLimitationReasons(data: any) {
652
+ return new HMSQualityLimitationReasons({
653
+ reason: data.reason,
654
+ bandwidth: data.bandwidth,
655
+ cpu: data.cpu,
656
+ none: data.none,
657
+ other: data.other,
658
+ qualityLimitationResolutionChanges:
659
+ data.qualityLimitationResolutionChanges,
660
+ });
661
+ }
547
662
  }
@@ -0,0 +1,4 @@
1
+ export enum HMSIOSAudioMode {
2
+ VOICE = 'voice',
3
+ MUSIC = 'music',
4
+ }
@@ -0,0 +1,5 @@
1
+ export enum HMSLayer {
2
+ LOW = 'LOW',
3
+ MEDIUM = 'MEDIUM',
4
+ HIGH = 'HIGH',
5
+ }
@@ -1,23 +1,44 @@
1
+ import type { HMSLayer } from './HMSLayer';
2
+ import type { HMSQualityLimitationReasons } from './HMSQualityLimitationReasons';
1
3
  import type { HMSVideoResolution } from './HMSVideoResolution';
2
4
 
3
5
  export class HMSLocalVideoStats {
6
+ // Outgoing bitrate of this track observed since previous report in Kb/s.
4
7
  bitrate?: number;
8
+
9
+ // Total bytes sent by this track in the current session.
5
10
  bytesSent?: number;
11
+
12
+ // Round trip time observed since previous report
6
13
  roundTripTime?: number;
14
+
15
+ // Frame rate of video frames being sent (FPS)
7
16
  frameRate?: number;
17
+
18
+ // Resolution of video frames being sent
8
19
  resolution?: HMSVideoResolution;
9
20
 
21
+ // Reason for quality limitations
22
+ qualityLimitationReasons?: HMSQualityLimitationReasons;
23
+
24
+ /// Simulcast Layer
25
+ layer?: HMSLayer;
26
+
10
27
  constructor(params: {
11
28
  bitrate?: number;
12
29
  bytesSent?: number;
13
30
  roundTripTime?: number;
14
31
  frameRate?: number;
15
32
  resolution?: HMSVideoResolution;
33
+ qualityLimitationReasons?: HMSQualityLimitationReasons;
34
+ layer?: HMSLayer;
16
35
  }) {
17
36
  this.bitrate = params.bitrate;
18
37
  this.bytesSent = params.bytesSent;
19
38
  this.roundTripTime = params.roundTripTime;
20
39
  this.frameRate = params.frameRate;
21
40
  this.resolution = params.resolution;
41
+ this.qualityLimitationReasons = params.qualityLimitationReasons;
42
+ this.layer = params.layer;
22
43
  }
23
44
  }
@@ -9,7 +9,7 @@ import { HMSConstants } from './HMSConstants';
9
9
  export class HMSPeer {
10
10
  peerID: string;
11
11
  /**
12
- * @deprecated customerDescription has been deprecated in favor of metadata
12
+ * @deprecated customerDescription property has been deprecated in favor of metadata property
13
13
  */
14
14
  customerDescription?: string;
15
15
 
@@ -1,21 +1,25 @@
1
1
  import type { HMSAudioSettings } from './HMSAudioSettings';
2
2
  import type { HMSVideoSettings } from './HMSVideoSettings';
3
+ import type { HMSSimulcastSettings } from './HMSSimulcastSettings';
3
4
 
4
5
  export class HMSPublishSettings {
5
6
  audio?: HMSAudioSettings;
6
7
  video?: HMSVideoSettings;
7
8
  screen?: HMSVideoSettings;
8
9
  allowed?: string[];
10
+ simulcast?: HMSSimulcastSettings;
9
11
 
10
12
  constructor(params: {
11
13
  audio?: HMSAudioSettings;
12
14
  video?: HMSVideoSettings;
13
15
  screen?: HMSVideoSettings;
14
16
  allowed?: string[];
17
+ simulcast?: HMSSimulcastSettings;
15
18
  }) {
16
19
  this.audio = params.audio;
17
20
  this.video = params.video;
18
21
  this.screen = params.screen;
19
22
  this.allowed = params.allowed;
23
+ this.simulcast = params.simulcast;
20
24
  }
21
25
  }
@@ -0,0 +1,7 @@
1
+ export enum HMSQualityLimitationReason {
2
+ BANDWIDTH = 'BANDWIDTH',
3
+ CPU = 'CPU',
4
+ NONE = 'NONE',
5
+ OTHER = 'OTHER',
6
+ UNKNOWN = 'UNKNOWN',
7
+ }
@@ -0,0 +1,27 @@
1
+ import type { HMSQualityLimitationReason } from './HMSQualityLimitationReason';
2
+
3
+ export class HMSQualityLimitationReasons {
4
+ bandwidth?: number;
5
+ cpu?: number;
6
+ none?: number;
7
+ other?: number;
8
+ qualityLimitationResolutionChanges?: number;
9
+ reason: HMSQualityLimitationReason;
10
+
11
+ constructor(params: {
12
+ bandwidth?: number;
13
+ cpu?: number;
14
+ none?: number;
15
+ other?: number;
16
+ qualityLimitationResolutionChanges?: number;
17
+ reason: HMSQualityLimitationReason;
18
+ }) {
19
+ this.bandwidth = params.bandwidth;
20
+ this.cpu = params.cpu;
21
+ this.none = params.none;
22
+ this.other = params.other;
23
+ this.qualityLimitationResolutionChanges =
24
+ params.qualityLimitationResolutionChanges;
25
+ this.reason = params.reason;
26
+ }
27
+ }
@@ -30,7 +30,6 @@ export class HMSRemotePeer extends HMSPeer {
30
30
  source?: number | string;
31
31
  trackDescription?: string;
32
32
  isMute?: boolean;
33
- layer?: any;
34
33
  playbackAllowed?: boolean;
35
34
  id: string;
36
35
  };
@@ -2,6 +2,9 @@ import { NativeModules } from 'react-native';
2
2
  import { getLogger } from './HMSLogger';
3
3
  import { HMSVideoTrack } from './HMSVideoTrack';
4
4
  import type { HMSTrackType } from './HMSTrackType';
5
+ import type { HMSLayer } from './HMSLayer';
6
+ import type { HMSSimulcastLayerDefinition } from './HMSSimulcastLayerDefinition';
7
+ import { HMSEncoder } from './HMSEncoder';
5
8
 
6
9
  const {
7
10
  /**
@@ -11,8 +14,6 @@ const {
11
14
  } = NativeModules;
12
15
 
13
16
  export class HMSRemoteVideoTrack extends HMSVideoTrack {
14
- layer?: any; //TODO: layer to be made HMSSimulcastLayer type
15
-
16
17
  /**
17
18
  * Switches Video of remote user on/off depending upon the value of playbackAllowed
18
19
  *
@@ -54,17 +55,64 @@ export class HMSRemoteVideoTrack extends HMSVideoTrack {
54
55
  }
55
56
  };
56
57
 
58
+ async getLayer() {
59
+ const logger = getLogger();
60
+ logger?.verbose('#Function getLayer', {
61
+ id: this.id,
62
+ trackId: this.trackId,
63
+ });
64
+
65
+ const layer: HMSLayer = await HMSManager.getVideoTrackLayer({
66
+ id: this.id,
67
+ trackId: this.trackId,
68
+ });
69
+
70
+ return layer;
71
+ }
72
+
73
+ async getLayerDefinition() {
74
+ const logger = getLogger();
75
+ logger?.verbose('#Function getLayerDefinition', {
76
+ id: this.id,
77
+ trackId: this.trackId,
78
+ });
79
+
80
+ const layerDefinition: HMSSimulcastLayerDefinition[] =
81
+ await HMSManager.getVideoTrackLayerDefinition({
82
+ id: this.id,
83
+ trackId: this.trackId,
84
+ });
85
+
86
+ return HMSEncoder.encodeHMSSimulcastLayerDefinition(layerDefinition);
87
+ }
88
+
89
+ async setLayer(layer: HMSLayer) {
90
+ const logger = getLogger();
91
+ logger?.verbose('#Function setVideoTrackLayer', {
92
+ id: this.id,
93
+ trackId: this.trackId,
94
+ layer,
95
+ });
96
+
97
+ const success = await HMSManager.setVideoTrackLayer({
98
+ id: this.id,
99
+ trackId: this.trackId,
100
+ layer,
101
+ });
102
+
103
+ return success;
104
+ }
105
+
57
106
  constructor(params: {
58
107
  trackId: string;
59
108
  source?: number | string;
60
109
  trackDescription?: string;
61
110
  isMute?: boolean;
62
- layer?: any;
63
111
  playbackAllowed?: boolean;
64
112
  id: string;
113
+ isDegraded?: boolean;
65
114
  type?: HMSTrackType;
66
115
  }) {
67
116
  super(params);
68
- this.layer = params.layer;
69
117
  }
70
118
  }
@@ -10,9 +10,11 @@ import { HMSConstants } from './HMSConstants';
10
10
 
11
11
  export class HMSRoom {
12
12
  id: string;
13
+ // startedAt?: Date;
13
14
 
14
15
  constructor(params: { id: string }) {
15
16
  this.id = params.id;
17
+ // this.startedAt = params.startedAt;
16
18
  }
17
19
 
18
20
  get sessionId(): string {
@@ -6,4 +6,5 @@ export enum HMSRoomUpdate {
6
6
  BROWSER_RECORDING_STATE_UPDATED = 'BROWSER_RECORDING_STATE_UPDATED',
7
7
  HLS_STREAMING_STATE_UPDATED = 'HLS_STREAMING_STATE_UPDATED',
8
8
  HLS_RECORDING_STATE_UPDATED = 'HLS_RECORDING_STATE_UPDATED',
9
+ ROOM_PEER_COUNT_UPDATED = 'ROOM_PEER_COUNT_UPDATED',
9
10
  }