@100mslive/react-native-hms 1.5.0 → 1.6.1

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 (121) hide show
  1. package/android/src/main/java/com/reactnativehmssdk/HMSAudioshareActivity.kt +44 -44
  2. package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +12 -12
  3. package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +35 -35
  4. package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +52 -24
  5. package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +245 -62
  6. package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +4 -3
  7. package/android/src/main/java/com/reactnativehmssdk/HMSView.kt +40 -33
  8. package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +41 -41
  9. package/android/src/main/java/com/reactnativehmssdk/PipActionReceiver.kt +2 -2
  10. package/ios/HMSConstants.swift +3 -1
  11. package/ios/HMSDecoder.swift +1 -1
  12. package/ios/HMSHelper.swift +44 -7
  13. package/ios/HMSManager.m +8 -0
  14. package/ios/HMSManager.swift +35 -1
  15. package/ios/HMSRNSDK.swift +268 -38
  16. package/lib/commonjs/classes/HMSAudioMixerSource.js.map +1 -1
  17. package/lib/commonjs/classes/HMSAudioTrackSettings.js +14 -0
  18. package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
  19. package/lib/commonjs/classes/HMSEncoder.js +2 -1
  20. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  21. package/lib/commonjs/classes/HMSIOSAudioMode.js +13 -0
  22. package/lib/commonjs/classes/HMSIOSAudioMode.js.map +1 -0
  23. package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
  24. package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
  25. package/lib/commonjs/classes/HMSLogger.js.map +1 -1
  26. package/lib/commonjs/classes/HMSNativeEventEmitter.js.map +1 -1
  27. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  28. package/lib/commonjs/classes/HMSPeersCache.js.map +1 -1
  29. package/lib/commonjs/classes/HMSRemoteAudioTrack.js.map +1 -1
  30. package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
  31. package/lib/commonjs/classes/HMSRoom.js.map +1 -1
  32. package/lib/commonjs/classes/HMSRoomCache.js.map +1 -1
  33. package/lib/commonjs/classes/HMSSDK.js +50 -0
  34. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  35. package/lib/commonjs/classes/HMSSessionStore.js +173 -0
  36. package/lib/commonjs/classes/HMSSessionStore.js.map +1 -0
  37. package/lib/commonjs/classes/HMSUpdateListenerActions.js +8 -0
  38. package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
  39. package/lib/commonjs/classes/HMSVideoTrackSettings.js +5 -0
  40. package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
  41. package/lib/commonjs/classes/HmsView.js +19 -29
  42. package/lib/commonjs/classes/HmsView.js.map +1 -1
  43. package/lib/commonjs/index.js +12 -0
  44. package/lib/commonjs/index.js.map +1 -1
  45. package/lib/commonjs/utils/emitter/EventEmitter.js +162 -0
  46. package/lib/commonjs/utils/emitter/EventEmitter.js.map +1 -0
  47. package/lib/commonjs/utils/emitter/_EmitterSubscription.js +46 -0
  48. package/lib/commonjs/utils/emitter/_EmitterSubscription.js.map +1 -0
  49. package/lib/commonjs/utils/emitter/_EventSubscription.js +36 -0
  50. package/lib/commonjs/utils/emitter/_EventSubscription.js.map +1 -0
  51. package/lib/commonjs/utils/emitter/_EventSubscriptionVendor.js +90 -0
  52. package/lib/commonjs/utils/emitter/_EventSubscriptionVendor.js.map +1 -0
  53. package/lib/commonjs/utils/index.js +17 -0
  54. package/lib/commonjs/utils/index.js.map +1 -0
  55. package/lib/module/classes/HMSAudioMixerSource.js.map +1 -1
  56. package/lib/module/classes/HMSAudioTrackSettings.js +14 -0
  57. package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
  58. package/lib/module/classes/HMSEncoder.js +2 -1
  59. package/lib/module/classes/HMSEncoder.js.map +1 -1
  60. package/lib/module/classes/HMSIOSAudioMode.js +6 -0
  61. package/lib/module/classes/HMSIOSAudioMode.js.map +1 -0
  62. package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
  63. package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
  64. package/lib/module/classes/HMSLogger.js.map +1 -1
  65. package/lib/module/classes/HMSNativeEventEmitter.js.map +1 -1
  66. package/lib/module/classes/HMSPeer.js.map +1 -1
  67. package/lib/module/classes/HMSPeersCache.js.map +1 -1
  68. package/lib/module/classes/HMSRemoteAudioTrack.js.map +1 -1
  69. package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
  70. package/lib/module/classes/HMSRoom.js.map +1 -1
  71. package/lib/module/classes/HMSRoomCache.js.map +1 -1
  72. package/lib/module/classes/HMSSDK.js +50 -0
  73. package/lib/module/classes/HMSSDK.js.map +1 -1
  74. package/lib/module/classes/HMSSessionStore.js +166 -0
  75. package/lib/module/classes/HMSSessionStore.js.map +1 -0
  76. package/lib/module/classes/HMSUpdateListenerActions.js +8 -0
  77. package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
  78. package/lib/module/classes/HMSVideoTrackSettings.js +5 -0
  79. package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
  80. package/lib/module/classes/HmsView.js +21 -31
  81. package/lib/module/classes/HmsView.js.map +1 -1
  82. package/lib/module/index.js +1 -0
  83. package/lib/module/index.js.map +1 -1
  84. package/lib/module/utils/emitter/EventEmitter.js +151 -0
  85. package/lib/module/utils/emitter/EventEmitter.js.map +1 -0
  86. package/lib/module/utils/emitter/_EmitterSubscription.js +39 -0
  87. package/lib/module/utils/emitter/_EmitterSubscription.js.map +1 -0
  88. package/lib/module/utils/emitter/_EventSubscription.js +29 -0
  89. package/lib/module/utils/emitter/_EventSubscription.js.map +1 -0
  90. package/lib/module/utils/emitter/_EventSubscriptionVendor.js +83 -0
  91. package/lib/module/utils/emitter/_EventSubscriptionVendor.js.map +1 -0
  92. package/lib/module/utils/index.js +2 -0
  93. package/lib/module/utils/index.js.map +1 -0
  94. package/lib/typescript/classes/HMSAudioTrackSettings.d.ts +14 -0
  95. package/lib/typescript/classes/HMSIOSAudioMode.d.ts +4 -0
  96. package/lib/typescript/classes/HMSSDK.d.ts +16 -0
  97. package/lib/typescript/classes/HMSSessionStore.d.ts +63 -0
  98. package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +9 -1
  99. package/lib/typescript/classes/HMSVideoTrackSettings.d.ts +5 -0
  100. package/lib/typescript/index.d.ts +2 -0
  101. package/lib/typescript/utils/emitter/EventEmitter.d.ts +91 -0
  102. package/lib/typescript/utils/emitter/_EmitterSubscription.d.ts +29 -0
  103. package/lib/typescript/utils/emitter/_EventSubscription.d.ts +19 -0
  104. package/lib/typescript/utils/emitter/_EventSubscriptionVendor.d.ts +44 -0
  105. package/lib/typescript/utils/index.d.ts +1 -0
  106. package/package.json +21 -2
  107. package/sdk-versions.json +2 -2
  108. package/src/classes/HMSAudioTrackSettings.ts +16 -0
  109. package/src/classes/HMSEncoder.ts +1 -0
  110. package/src/classes/HMSIOSAudioMode.ts +4 -0
  111. package/src/classes/HMSSDK.tsx +70 -4
  112. package/src/classes/HMSSessionStore.ts +209 -0
  113. package/src/classes/HMSUpdateListenerActions.ts +8 -0
  114. package/src/classes/HMSVideoTrackSettings.ts +5 -0
  115. package/src/classes/HmsView.tsx +21 -32
  116. package/src/index.ts +5 -0
  117. package/src/utils/emitter/EventEmitter.ts +160 -0
  118. package/src/utils/emitter/_EmitterSubscription.ts +44 -0
  119. package/src/utils/emitter/_EventSubscription.ts +28 -0
  120. package/src/utils/emitter/_EventSubscriptionVendor.ts +89 -0
  121. package/src/utils/index.ts +1 -0
@@ -0,0 +1,28 @@
1
+ import type { EventSubscriptionVendor } from './_EventSubscriptionVendor';
2
+
3
+ /**
4
+ * EventSubscription represents a subscription to a particular event. It can
5
+ * remove its own subscription.
6
+ */
7
+ export class EventSubscription {
8
+ // @ts-ignore this value is assigned after creating instance of class
9
+ eventType: string;
10
+ // @ts-ignore this value is assigned after creating instance of class
11
+ key: number;
12
+ subscriber: EventSubscriptionVendor;
13
+
14
+ /**
15
+ * @param {EventSubscriptionVendor} subscriber the subscriber that controls
16
+ * this subscription.
17
+ */
18
+ constructor(subscriber: EventSubscriptionVendor) {
19
+ this.subscriber = subscriber;
20
+ }
21
+
22
+ /**
23
+ * Removes this subscription from the subscriber that controls it.
24
+ */
25
+ remove() {
26
+ this.subscriber.removeSubscription(this);
27
+ }
28
+ }
@@ -0,0 +1,89 @@
1
+ import type { EventSubscription } from './_EventSubscription';
2
+
3
+ /**
4
+ * EventSubscriptionVendor stores a set of EventSubscriptions that are
5
+ * subscribed to a particular event type.
6
+ */
7
+ export class EventSubscriptionVendor {
8
+ _subscriptionsForType: Record<string, EventSubscription[] | null | undefined>;
9
+ _currentSubscription: EventSubscription | null | undefined;
10
+
11
+ constructor() {
12
+ this._subscriptionsForType = {};
13
+ this._currentSubscription = null;
14
+ }
15
+
16
+ /**
17
+ * Adds a subscription keyed by an event type.
18
+ *
19
+ * @param {string} eventType
20
+ * @param {EventSubscription} subscription
21
+ */
22
+ addSubscription(
23
+ eventType: string,
24
+ subscription: EventSubscription
25
+ ): EventSubscription {
26
+ if (subscription.subscriber !== this) {
27
+ console.warn('The subscriber of the subscription is incorrectly set.'); // TODO: throw error or use logger?
28
+ }
29
+ if (!this._subscriptionsForType[eventType]) {
30
+ this._subscriptionsForType[eventType] = [];
31
+ }
32
+ const eventSubscriptions = this._subscriptionsForType[
33
+ eventType
34
+ ] as EventSubscription[];
35
+ const key = eventSubscriptions.length;
36
+ eventSubscriptions.push(subscription);
37
+ subscription.eventType = eventType;
38
+ subscription.key = key;
39
+ return subscription;
40
+ }
41
+
42
+ /**
43
+ * Removes a bulk set of the subscriptions.
44
+ *
45
+ * @param {?string} eventType - Optional name of the event type whose
46
+ * registered supscriptions to remove, if null or undefined remove all subscriptions.
47
+ */
48
+ removeAllSubscriptions(eventType: string | undefined | null) {
49
+ if (eventType === undefined || eventType === null) {
50
+ this._subscriptionsForType = {};
51
+ } else {
52
+ delete this._subscriptionsForType[eventType];
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Removes a specific subscription. Instead of calling this function, call
58
+ * `subscription.remove()` directly.
59
+ *
60
+ * @param {object} subscription
61
+ */
62
+ removeSubscription(subscription: EventSubscription) {
63
+ const eventType = subscription.eventType;
64
+ const key = subscription.key;
65
+
66
+ const subscriptionsForType = this._subscriptionsForType[eventType];
67
+ if (subscriptionsForType) {
68
+ delete subscriptionsForType[key];
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Returns the array of subscriptions that are currently registered for the
74
+ * given event type.
75
+ *
76
+ * Note: This array can be potentially sparse as subscriptions are deleted
77
+ * from it when they are removed.
78
+ *
79
+ * TODO: This returns a nullable array. wat?
80
+ *
81
+ * @param {string} eventType
82
+ * @returns {?array}
83
+ */
84
+ getSubscriptionsForType(
85
+ eventType: string
86
+ ): EventSubscription[] | null | undefined {
87
+ return this._subscriptionsForType[eventType];
88
+ }
89
+ }
@@ -0,0 +1 @@
1
+ export * from './emitter/EventEmitter';