@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,39 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ import { EventSubscription } from './_EventSubscription';
5
+ /**
6
+ * EmitterSubscription represents a subscription with listener and context data.
7
+ */
8
+ export class EmitterSubscription extends EventSubscription {
9
+ /**
10
+ * @param {EventEmitter} emitter - The event emitter that registered this
11
+ * subscription
12
+ * @param {EventSubscriptionVendor} subscriber - The subscriber that controls
13
+ * this subscription
14
+ * @param {function} listener - Function to invoke when the specified event is
15
+ * emitted
16
+ * @param {*} context - Optional context object to use when invoking the
17
+ * listener
18
+ */
19
+ constructor(emitter, subscriber, listener, context) {
20
+ super(subscriber);
21
+ _defineProperty(this, "emitter", void 0);
22
+ _defineProperty(this, "listener", void 0);
23
+ _defineProperty(this, "context", void 0);
24
+ this.emitter = emitter;
25
+ this.listener = listener;
26
+ this.context = context;
27
+ }
28
+
29
+ /**
30
+ * Removes this subscription from the emitter that registered it.
31
+ * Note: we're overriding the `remove()` method of EventSubscription here
32
+ * but deliberately not calling `super.remove()` as the responsibility
33
+ * for removing the subscription lies with the EventEmitter.
34
+ */
35
+ remove() {
36
+ this.emitter.removeSubscription(this);
37
+ }
38
+ }
39
+ //# sourceMappingURL=_EmitterSubscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EventSubscription","EmitterSubscription","constructor","emitter","subscriber","listener","context","_defineProperty","remove","removeSubscription"],"sources":["_EmitterSubscription.ts"],"sourcesContent":["import { EventSubscription } from './_EventSubscription';\nimport type { EventEmitter } from './EventEmitter';\nimport type { EventSubscriptionVendor } from './_EventSubscriptionVendor';\n\n/**\n * EmitterSubscription represents a subscription with listener and context data.\n */\nexport class EmitterSubscription extends EventSubscription {\n emitter: EventEmitter;\n listener: Function;\n context: Object | null | undefined;\n\n /**\n * @param {EventEmitter} emitter - The event emitter that registered this\n * subscription\n * @param {EventSubscriptionVendor} subscriber - The subscriber that controls\n * this subscription\n * @param {function} listener - Function to invoke when the specified event is\n * emitted\n * @param {*} context - Optional context object to use when invoking the\n * listener\n */\n constructor(\n emitter: EventEmitter,\n subscriber: EventSubscriptionVendor,\n listener: Function,\n context: Object | undefined | null\n ) {\n super(subscriber);\n this.emitter = emitter;\n this.listener = listener;\n this.context = context;\n }\n\n /**\n * Removes this subscription from the emitter that registered it.\n * Note: we're overriding the `remove()` method of EventSubscription here\n * but deliberately not calling `super.remove()` as the responsibility\n * for removing the subscription lies with the EventEmitter.\n */\n remove() {\n this.emitter.removeSubscription(this);\n }\n}\n"],"mappings":";;;AAAA,SAASA,iBAAiB,QAAQ,sBAAsB;AAIxD;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,SAASD,iBAAiB,CAAC;EAKzD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,WAAWA,CACTC,OAAqB,EACrBC,UAAmC,EACnCC,QAAkB,EAClBC,OAAkC,EAClC;IACA,KAAK,CAACF,UAAU,CAAC;IAACG,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAClB,IAAI,CAACJ,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACE,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,OAAO,GAAGA,OAAO;EACxB;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEE,MAAMA,CAAA,EAAG;IACP,IAAI,CAACL,OAAO,CAACM,kBAAkB,CAAC,IAAI,CAAC;EACvC;AACF"}
@@ -0,0 +1,29 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ /**
5
+ * EventSubscription represents a subscription to a particular event. It can
6
+ * remove its own subscription.
7
+ */
8
+ export class EventSubscription {
9
+ /**
10
+ * @param {EventSubscriptionVendor} subscriber the subscriber that controls
11
+ * this subscription.
12
+ */
13
+ constructor(subscriber) {
14
+ // @ts-ignore this value is assigned after creating instance of class
15
+ _defineProperty(this, "eventType", void 0);
16
+ // @ts-ignore this value is assigned after creating instance of class
17
+ _defineProperty(this, "key", void 0);
18
+ _defineProperty(this, "subscriber", void 0);
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
+ }
29
+ //# sourceMappingURL=_EventSubscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EventSubscription","constructor","subscriber","_defineProperty","remove","removeSubscription"],"sources":["_EventSubscription.ts"],"sourcesContent":["import type { EventSubscriptionVendor } from './_EventSubscriptionVendor';\n\n/**\n * EventSubscription represents a subscription to a particular event. It can\n * remove its own subscription.\n */\nexport class EventSubscription {\n // @ts-ignore this value is assigned after creating instance of class\n eventType: string;\n // @ts-ignore this value is assigned after creating instance of class\n key: number;\n subscriber: EventSubscriptionVendor;\n\n /**\n * @param {EventSubscriptionVendor} subscriber the subscriber that controls\n * this subscription.\n */\n constructor(subscriber: EventSubscriptionVendor) {\n this.subscriber = subscriber;\n }\n\n /**\n * Removes this subscription from the subscriber that controls it.\n */\n remove() {\n this.subscriber.removeSubscription(this);\n }\n}\n"],"mappings":";;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,iBAAiB,CAAC;EAO7B;AACF;AACA;AACA;EACEC,WAAWA,CAACC,UAAmC,EAAE;IAVjD;IAAAC,eAAA;IAEA;IAAAA,eAAA;IAAAA,eAAA;IASE,IAAI,CAACD,UAAU,GAAGA,UAAU;EAC9B;;EAEA;AACF;AACA;EACEE,MAAMA,CAAA,EAAG;IACP,IAAI,CAACF,UAAU,CAACG,kBAAkB,CAAC,IAAI,CAAC;EAC1C;AACF"}
@@ -0,0 +1,83 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ /**
5
+ * EventSubscriptionVendor stores a set of EventSubscriptions that are
6
+ * subscribed to a particular event type.
7
+ */
8
+ export class EventSubscriptionVendor {
9
+ constructor() {
10
+ _defineProperty(this, "_subscriptionsForType", void 0);
11
+ _defineProperty(this, "_currentSubscription", void 0);
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(eventType, subscription) {
23
+ if (subscription.subscriber !== this) {
24
+ console.warn('The subscriber of the subscription is incorrectly set.'); // TODO: throw error or use logger?
25
+ }
26
+
27
+ if (!this._subscriptionsForType[eventType]) {
28
+ this._subscriptionsForType[eventType] = [];
29
+ }
30
+ const eventSubscriptions = this._subscriptionsForType[eventType];
31
+ const key = eventSubscriptions.length;
32
+ eventSubscriptions.push(subscription);
33
+ subscription.eventType = eventType;
34
+ subscription.key = key;
35
+ return subscription;
36
+ }
37
+
38
+ /**
39
+ * Removes a bulk set of the subscriptions.
40
+ *
41
+ * @param {?string} eventType - Optional name of the event type whose
42
+ * registered supscriptions to remove, if null or undefined remove all subscriptions.
43
+ */
44
+ removeAllSubscriptions(eventType) {
45
+ if (eventType === undefined || eventType === null) {
46
+ this._subscriptionsForType = {};
47
+ } else {
48
+ delete this._subscriptionsForType[eventType];
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Removes a specific subscription. Instead of calling this function, call
54
+ * `subscription.remove()` directly.
55
+ *
56
+ * @param {object} subscription
57
+ */
58
+ removeSubscription(subscription) {
59
+ const eventType = subscription.eventType;
60
+ const key = subscription.key;
61
+ const subscriptionsForType = this._subscriptionsForType[eventType];
62
+ if (subscriptionsForType) {
63
+ delete subscriptionsForType[key];
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Returns the array of subscriptions that are currently registered for the
69
+ * given event type.
70
+ *
71
+ * Note: This array can be potentially sparse as subscriptions are deleted
72
+ * from it when they are removed.
73
+ *
74
+ * TODO: This returns a nullable array. wat?
75
+ *
76
+ * @param {string} eventType
77
+ * @returns {?array}
78
+ */
79
+ getSubscriptionsForType(eventType) {
80
+ return this._subscriptionsForType[eventType];
81
+ }
82
+ }
83
+ //# sourceMappingURL=_EventSubscriptionVendor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EventSubscriptionVendor","constructor","_defineProperty","_subscriptionsForType","_currentSubscription","addSubscription","eventType","subscription","subscriber","console","warn","eventSubscriptions","key","length","push","removeAllSubscriptions","undefined","removeSubscription","subscriptionsForType","getSubscriptionsForType"],"sources":["_EventSubscriptionVendor.ts"],"sourcesContent":["import type { EventSubscription } from './_EventSubscription';\n\n/**\n * EventSubscriptionVendor stores a set of EventSubscriptions that are\n * subscribed to a particular event type.\n */\nexport class EventSubscriptionVendor {\n _subscriptionsForType: Record<string, EventSubscription[] | null | undefined>;\n _currentSubscription: EventSubscription | null | undefined;\n\n constructor() {\n this._subscriptionsForType = {};\n this._currentSubscription = null;\n }\n\n /**\n * Adds a subscription keyed by an event type.\n *\n * @param {string} eventType\n * @param {EventSubscription} subscription\n */\n addSubscription(\n eventType: string,\n subscription: EventSubscription\n ): EventSubscription {\n if (subscription.subscriber !== this) {\n console.warn('The subscriber of the subscription is incorrectly set.'); // TODO: throw error or use logger?\n }\n if (!this._subscriptionsForType[eventType]) {\n this._subscriptionsForType[eventType] = [];\n }\n const eventSubscriptions = this._subscriptionsForType[\n eventType\n ] as EventSubscription[];\n const key = eventSubscriptions.length;\n eventSubscriptions.push(subscription);\n subscription.eventType = eventType;\n subscription.key = key;\n return subscription;\n }\n\n /**\n * Removes a bulk set of the subscriptions.\n *\n * @param {?string} eventType - Optional name of the event type whose\n * registered supscriptions to remove, if null or undefined remove all subscriptions.\n */\n removeAllSubscriptions(eventType: string | undefined | null) {\n if (eventType === undefined || eventType === null) {\n this._subscriptionsForType = {};\n } else {\n delete this._subscriptionsForType[eventType];\n }\n }\n\n /**\n * Removes a specific subscription. Instead of calling this function, call\n * `subscription.remove()` directly.\n *\n * @param {object} subscription\n */\n removeSubscription(subscription: EventSubscription) {\n const eventType = subscription.eventType;\n const key = subscription.key;\n\n const subscriptionsForType = this._subscriptionsForType[eventType];\n if (subscriptionsForType) {\n delete subscriptionsForType[key];\n }\n }\n\n /**\n * Returns the array of subscriptions that are currently registered for the\n * given event type.\n *\n * Note: This array can be potentially sparse as subscriptions are deleted\n * from it when they are removed.\n *\n * TODO: This returns a nullable array. wat?\n *\n * @param {string} eventType\n * @returns {?array}\n */\n getSubscriptionsForType(\n eventType: string\n ): EventSubscription[] | null | undefined {\n return this._subscriptionsForType[eventType];\n }\n}\n"],"mappings":";;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,uBAAuB,CAAC;EAInCC,WAAWA,CAAA,EAAG;IAAAC,eAAA;IAAAA,eAAA;IACZ,IAAI,CAACC,qBAAqB,GAAG,CAAC,CAAC;IAC/B,IAAI,CAACC,oBAAoB,GAAG,IAAI;EAClC;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEC,eAAeA,CACbC,SAAiB,EACjBC,YAA+B,EACZ;IACnB,IAAIA,YAAY,CAACC,UAAU,KAAK,IAAI,EAAE;MACpCC,OAAO,CAACC,IAAI,CAAC,wDAAwD,CAAC,CAAC,CAAC;IAC1E;;IACA,IAAI,CAAC,IAAI,CAACP,qBAAqB,CAACG,SAAS,CAAC,EAAE;MAC1C,IAAI,CAACH,qBAAqB,CAACG,SAAS,CAAC,GAAG,EAAE;IAC5C;IACA,MAAMK,kBAAkB,GAAG,IAAI,CAACR,qBAAqB,CACnDG,SAAS,CACa;IACxB,MAAMM,GAAG,GAAGD,kBAAkB,CAACE,MAAM;IACrCF,kBAAkB,CAACG,IAAI,CAACP,YAAY,CAAC;IACrCA,YAAY,CAACD,SAAS,GAAGA,SAAS;IAClCC,YAAY,CAACK,GAAG,GAAGA,GAAG;IACtB,OAAOL,YAAY;EACrB;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEQ,sBAAsBA,CAACT,SAAoC,EAAE;IAC3D,IAAIA,SAAS,KAAKU,SAAS,IAAIV,SAAS,KAAK,IAAI,EAAE;MACjD,IAAI,CAACH,qBAAqB,GAAG,CAAC,CAAC;IACjC,CAAC,MAAM;MACL,OAAO,IAAI,CAACA,qBAAqB,CAACG,SAAS,CAAC;IAC9C;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEW,kBAAkBA,CAACV,YAA+B,EAAE;IAClD,MAAMD,SAAS,GAAGC,YAAY,CAACD,SAAS;IACxC,MAAMM,GAAG,GAAGL,YAAY,CAACK,GAAG;IAE5B,MAAMM,oBAAoB,GAAG,IAAI,CAACf,qBAAqB,CAACG,SAAS,CAAC;IAClE,IAAIY,oBAAoB,EAAE;MACxB,OAAOA,oBAAoB,CAACN,GAAG,CAAC;IAClC;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEO,uBAAuBA,CACrBb,SAAiB,EACuB;IACxC,OAAO,IAAI,CAACH,qBAAqB,CAACG,SAAS,CAAC;EAC9C;AACF"}
@@ -0,0 +1,2 @@
1
+ export * from './emitter/EventEmitter';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './emitter/EventEmitter';\n"],"mappings":"AAAA,cAAc,wBAAwB"}
@@ -1,11 +1,25 @@
1
+ import type { HMSIOSAudioMode } from './HMSIOSAudioMode';
1
2
  import type { HMSTrackSettingsInitState } from './HMSTrackSettingsInitState';
3
+ /**
4
+ * Customize local peer's Audio track settings before Joining the Room.
5
+ *
6
+ * Checkout Track Settings docs for more details {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/track/track-settings}
7
+ */
2
8
  export declare class HMSAudioTrackSettings {
3
9
  initialState?: HMSTrackSettingsInitState;
4
10
  useHardwareEchoCancellation?: boolean;
5
11
  audioSource?: string[];
12
+ /**
13
+ * [iOS only] `audioMode` allows you to capture audio in its highest quality
14
+ * by disabling voice processing and increasing the maximum bandwidth limit
15
+ *
16
+ * Checkout Music Mode docs for more details {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/configure-your-device/microphone/music-mode}
17
+ */
18
+ audioMode?: HMSIOSAudioMode;
6
19
  constructor(params: {
7
20
  initialState?: HMSTrackSettingsInitState;
8
21
  useHardwareEchoCancellation?: boolean;
9
22
  audioSource?: string[];
23
+ audioMode?: HMSIOSAudioMode;
10
24
  });
11
25
  }
@@ -0,0 +1,4 @@
1
+ export declare enum HMSIOSAudioMode {
2
+ VOICE = "voice",
3
+ MUSIC = "music"
4
+ }
@@ -49,6 +49,7 @@ export declare class HMSSDK {
49
49
  private onRemoteAudioStatsDelegate?;
50
50
  private onRemoteVideoStatsDelegate?;
51
51
  private onAudioDeviceChangedDelegate?;
52
+ private onSessionStoreAvailableDelegate?;
52
53
  private onPIPRoomLeaveDelegate?;
53
54
  private emitterSubscriptions;
54
55
  private constructor();
@@ -501,7 +502,19 @@ export declare class HMSSDK {
501
502
  * @memberof HMSSDK
502
503
  */
503
504
  setAudioDeviceChangeListener: (callback: Function) => any;
505
+ /**
506
+ * @deprecated Older SessionMetaData APIs has been deprecated in favour of newer Session Store APIs.
507
+ * You can subscribe to `ON_SESSION_STORE_AVAILABLE` event to get notified when the `HMSSessionStore`
508
+ * is available and use `set` method on `HMSSessionStore` instance
509
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/}
510
+ */
504
511
  setSessionMetaData: (sessionMetaData: string | null) => Promise<any>;
512
+ /**
513
+ * @deprecated Older SessionMetaData APIs has been deprecated in favour of newer Session Store APIs.
514
+ * You can subscribe to `ON_SESSION_STORE_AVAILABLE` event to get notified when the `HMSSessionStore`
515
+ * is available and use `get` or `addKeyChangeListener` method on `HMSSessionStore` instance
516
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/}
517
+ */
505
518
  getSessionMetaData: () => Promise<any>;
506
519
  getRemoteVideoTrackFromTrackId: (trackId: string) => Promise<import("./HMSRemoteVideoTrack").HMSRemoteVideoTrack>;
507
520
  getRemoteAudioTrackFromTrackId: (trackId: string) => Promise<import("./HMSRemoteAudioTrack").HMSRemoteAudioTrack>;
@@ -564,6 +577,9 @@ export declare class HMSSDK {
564
577
  device: string;
565
578
  audioDevicesList: string[];
566
579
  }) => void;
580
+ onSessionStoreAvailableListener: (data: {
581
+ id: string;
582
+ }) => void;
567
583
  onPIPRoomLeaveListener: (data: {
568
584
  id: string;
569
585
  }) => void;
@@ -0,0 +1,63 @@
1
+ type Nullable<T> = T | null | undefined;
2
+ export type HMSSessionStoreValue = Nullable<string>;
3
+ /**
4
+ * Session store is a shared realtime key-value store that is accessible by everyone in the room.
5
+ * It can be utilized to implement features such as pinned text, spotlight (which brings a particular
6
+ * peer to the center stage for everyone in the room) and more.
7
+ *
8
+ * To get an instance of `HMSSessionStore` class, You can add an event listener for `ON_SESSION_STORE_AVAILABLE`
9
+ * event on the `HMSSDK` instance
10
+ *
11
+ * For example:
12
+ * ```
13
+ * hmsInstance.addEventListener(HMSUpdateListenerActions.ON_SESSION_STORE_AVAILABLE, <your callback function>);
14
+ * ```
15
+ *
16
+ * Checkout Session Store docs fore more details ${@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/room/session-store}
17
+ */
18
+ export declare class HMSSessionStore {
19
+ private _deviceEventEmitterSubscription?;
20
+ private _eventEmitter?;
21
+ private _addedKeyChangeListenerCount;
22
+ /**
23
+ * This method sets a value for a specific key on session store.
24
+ * Once a value is assigned, it will be available for other peers in the room
25
+ * who are listening for changes in value for that specific key.
26
+ *
27
+ * @param {HMSSessionStoreValue} value
28
+ * @param {string} key
29
+ * @returns {Promise}
30
+ */
31
+ set(value: HMSSessionStoreValue, key: string): Promise<{
32
+ success: true;
33
+ finalValue: HMSSessionStoreValue;
34
+ }>;
35
+ /**
36
+ * This method returns the value of any specified key on session store.
37
+ * Note that you will not get updates for any change in value of the specified key,
38
+ * It returns the latest value at the time it was called.
39
+ *
40
+ * To listen to value change updates use `addKeyChangeListener` method instead.
41
+ *
42
+ * @param {string} key
43
+ * @returns {Promise}
44
+ */
45
+ get(key: string): Promise<HMSSessionStoreValue>;
46
+ /**
47
+ * This method registers a callback function for listening to value changes of a particular key.
48
+ * Registered Callback function will be called initially with latest value and whenever the value updates
49
+ *
50
+ * @param {string[]} forKeys
51
+ * @param {Function} callback
52
+ * @returns {Object} subscription object
53
+ */
54
+ addKeyChangeListener<T extends string[]>(forKeys: T, callback: (error: string | null, data: {
55
+ key: T[number];
56
+ value: HMSSessionStoreValue;
57
+ } | null) => void): {
58
+ remove: () => void;
59
+ };
60
+ private _cleanup;
61
+ private _deviceEventEmitterListener;
62
+ }
63
+ export {};
@@ -1,3 +1,9 @@
1
+ /**
2
+ * These are the available events emitted by the `HMSSDK`
3
+ *
4
+ * For more info about these events, checkout Event Listener docs
5
+ * {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/listen-to-room-updates/event-listeners}
6
+ */
1
7
  export declare enum HMSUpdateListenerActions {
2
8
  ON_PREVIEW = "ON_PREVIEW",
3
9
  ON_JOIN = "ON_JOIN",
@@ -17,5 +23,7 @@ export declare enum HMSUpdateListenerActions {
17
23
  ON_LOCAL_VIDEO_STATS = "ON_LOCAL_VIDEO_STATS",
18
24
  ON_REMOTE_AUDIO_STATS = "ON_REMOTE_AUDIO_STATS",
19
25
  ON_REMOTE_VIDEO_STATS = "ON_REMOTE_VIDEO_STATS",
20
- ON_AUDIO_DEVICE_CHANGED = "ON_AUDIO_DEVICE_CHANGED"
26
+ ON_AUDIO_DEVICE_CHANGED = "ON_AUDIO_DEVICE_CHANGED",
27
+ ON_SESSION_STORE_AVAILABLE = "ON_SESSION_STORE_AVAILABLE",
28
+ ON_SESSION_STORE_CHANGED = "ON_SESSION_STORE_CHANGED"
21
29
  }
@@ -1,6 +1,11 @@
1
1
  import type { HMSSimulcastLayerSettings } from './HMSSimulcastLayerSettings';
2
2
  import type { HMSCameraFacing } from './HMSCameraFacing';
3
3
  import type { HMSTrackSettingsInitState } from './HMSTrackSettingsInitState';
4
+ /**
5
+ * Customize local peer's Video track settings before Joining the Room.
6
+ *
7
+ * Checkout Track Settings docs for more details {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/track/track-settings}
8
+ */
4
9
  export declare class HMSVideoTrackSettings {
5
10
  readonly simulcastSettings?: HMSSimulcastLayerSettings[];
6
11
  initialState?: HMSTrackSettingsInitState;
@@ -80,6 +80,8 @@ export * from './classes/HMSSimulcastLayerDefinition';
80
80
  export * from './classes/HMSQualityLimitationReasons';
81
81
  export * from './classes/HMSQualityLimitationReason';
82
82
  export * from './classes/HMSCameraControl';
83
+ export * from './classes/HMSIOSAudioMode';
84
+ export type { HMSSessionStore, HMSSessionStoreValue, } from './classes/HMSSessionStore';
83
85
  export type { HmsViewComponent as HMSView } from './classes/HmsView';
84
86
  import { HMSSDK as HmsManager } from './classes/HMSSDK';
85
87
  export default HmsManager;
@@ -0,0 +1,91 @@
1
+ import { EmitterSubscription } from './_EmitterSubscription';
2
+ import { EventSubscriptionVendor } from './_EventSubscriptionVendor';
3
+ export { EmitterSubscription } from './_EmitterSubscription';
4
+ /**
5
+ * @class EventEmitter
6
+ * @description
7
+ * An EventEmitter is responsible for managing a set of listeners and publishing
8
+ * events to them when it is told that such events happened. In addition to the
9
+ * data for the given event it also sends a event control object which allows
10
+ * the listeners/handlers to prevent the default behavior of the given event.
11
+ *
12
+ * The emitter is designed to be generic enough to support all the different
13
+ * contexts in which one might want to emit events. It is a simple multicast
14
+ * mechanism on top of which extra functionality can be composed. For example, a
15
+ * more advanced emitter may use an EventHolder and EventFactory.
16
+ */
17
+ export declare class EventEmitter {
18
+ _subscriber: EventSubscriptionVendor;
19
+ /**
20
+ * @constructor
21
+ *
22
+ * @param {EventSubscriptionVendor} subscriber - Optional subscriber instance
23
+ * to use. If omitted, a new subscriber will be created for the emitter.
24
+ */
25
+ constructor(subscriber?: EventSubscriptionVendor | null);
26
+ /**
27
+ * Adds a listener to be invoked when events of the specified type are
28
+ * emitted. An optional calling context may be provided. The data arguments
29
+ * emitted will be passed to the listener function.
30
+ *
31
+ * TODO: Annotate the listener arg's type. This is tricky because listeners
32
+ * can be invoked with varargs.
33
+ *
34
+ * @param {string} eventType - Name of the event to listen to
35
+ * @param {function} listener - Function to invoke when the specified event is
36
+ * emitted
37
+ * @param {*} context - Optional context object to use when invoking the
38
+ * listener
39
+ */
40
+ addListener(eventType: string, listener: Function, context: Object | null | undefined): EmitterSubscription;
41
+ /**
42
+ * Removes all of the registered listeners, including those registered as
43
+ * listener maps.
44
+ *
45
+ * @param {?string} eventType - Optional name of the event whose registered
46
+ * listeners to remove
47
+ */
48
+ removeAllListeners(eventType: string | undefined | null): void;
49
+ /**
50
+ * Removes a specific subscription. Called by the `remove()` method of the
51
+ * subscription itself to ensure any necessary cleanup is performed.
52
+ */
53
+ removeSubscription(subscription: EmitterSubscription): void;
54
+ /**
55
+ * Returns the number of listeners that are currently registered for the given
56
+ * event.
57
+ *
58
+ * @param {string} eventType - Name of the event to query
59
+ * @returns {number}
60
+ */
61
+ listenerCount(eventType: string): number;
62
+ /**
63
+ * Emits an event of the given type with the given data. All handlers of that
64
+ * particular type will be notified.
65
+ *
66
+ * @param {string} eventType - Name of the event to emit
67
+ * @param {...*} Arbitrary arguments to be passed to each registered listener
68
+ *
69
+ * @example
70
+ * emitter.addListener('someEvent', function(message) {
71
+ * console.log(message);
72
+ * });
73
+ *
74
+ * emitter.emit('someEvent', 'abc'); // logs 'abc'
75
+ */
76
+ emit(eventType: string, ...args: any[]): void;
77
+ /**
78
+ * Removes the given listener for event of specific type.
79
+ *
80
+ * @param {string} eventType - Name of the event to emit
81
+ * @param {function} listener - Function to invoke when the specified event is
82
+ * emitted
83
+ *
84
+ * @example
85
+ * emitter.removeListener('someEvent', function(message) {
86
+ * console.log(message);
87
+ * }); // removes the listener if already registered
88
+ *
89
+ */
90
+ removeListener(eventType: string, listener: Function): void;
91
+ }
@@ -0,0 +1,29 @@
1
+ import { EventSubscription } from './_EventSubscription';
2
+ import type { EventEmitter } from './EventEmitter';
3
+ import type { EventSubscriptionVendor } from './_EventSubscriptionVendor';
4
+ /**
5
+ * EmitterSubscription represents a subscription with listener and context data.
6
+ */
7
+ export declare class EmitterSubscription extends EventSubscription {
8
+ emitter: EventEmitter;
9
+ listener: Function;
10
+ context: Object | null | undefined;
11
+ /**
12
+ * @param {EventEmitter} emitter - The event emitter that registered this
13
+ * subscription
14
+ * @param {EventSubscriptionVendor} subscriber - The subscriber that controls
15
+ * this subscription
16
+ * @param {function} listener - Function to invoke when the specified event is
17
+ * emitted
18
+ * @param {*} context - Optional context object to use when invoking the
19
+ * listener
20
+ */
21
+ constructor(emitter: EventEmitter, subscriber: EventSubscriptionVendor, listener: Function, context: Object | undefined | null);
22
+ /**
23
+ * Removes this subscription from the emitter that registered it.
24
+ * Note: we're overriding the `remove()` method of EventSubscription here
25
+ * but deliberately not calling `super.remove()` as the responsibility
26
+ * for removing the subscription lies with the EventEmitter.
27
+ */
28
+ remove(): void;
29
+ }
@@ -0,0 +1,19 @@
1
+ import type { EventSubscriptionVendor } from './_EventSubscriptionVendor';
2
+ /**
3
+ * EventSubscription represents a subscription to a particular event. It can
4
+ * remove its own subscription.
5
+ */
6
+ export declare class EventSubscription {
7
+ eventType: string;
8
+ key: number;
9
+ subscriber: EventSubscriptionVendor;
10
+ /**
11
+ * @param {EventSubscriptionVendor} subscriber the subscriber that controls
12
+ * this subscription.
13
+ */
14
+ constructor(subscriber: EventSubscriptionVendor);
15
+ /**
16
+ * Removes this subscription from the subscriber that controls it.
17
+ */
18
+ remove(): void;
19
+ }
@@ -0,0 +1,44 @@
1
+ import type { EventSubscription } from './_EventSubscription';
2
+ /**
3
+ * EventSubscriptionVendor stores a set of EventSubscriptions that are
4
+ * subscribed to a particular event type.
5
+ */
6
+ export declare class EventSubscriptionVendor {
7
+ _subscriptionsForType: Record<string, EventSubscription[] | null | undefined>;
8
+ _currentSubscription: EventSubscription | null | undefined;
9
+ constructor();
10
+ /**
11
+ * Adds a subscription keyed by an event type.
12
+ *
13
+ * @param {string} eventType
14
+ * @param {EventSubscription} subscription
15
+ */
16
+ addSubscription(eventType: string, subscription: EventSubscription): EventSubscription;
17
+ /**
18
+ * Removes a bulk set of the subscriptions.
19
+ *
20
+ * @param {?string} eventType - Optional name of the event type whose
21
+ * registered supscriptions to remove, if null or undefined remove all subscriptions.
22
+ */
23
+ removeAllSubscriptions(eventType: string | undefined | null): void;
24
+ /**
25
+ * Removes a specific subscription. Instead of calling this function, call
26
+ * `subscription.remove()` directly.
27
+ *
28
+ * @param {object} subscription
29
+ */
30
+ removeSubscription(subscription: EventSubscription): void;
31
+ /**
32
+ * Returns the array of subscriptions that are currently registered for the
33
+ * given event type.
34
+ *
35
+ * Note: This array can be potentially sparse as subscriptions are deleted
36
+ * from it when they are removed.
37
+ *
38
+ * TODO: This returns a nullable array. wat?
39
+ *
40
+ * @param {string} eventType
41
+ * @returns {?array}
42
+ */
43
+ getSubscriptionsForType(eventType: string): EventSubscription[] | null | undefined;
44
+ }
@@ -0,0 +1 @@
1
+ export * from './emitter/EventEmitter';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@100mslive/react-native-hms",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
4
4
  "description": "Integrate Real Time Audio and Video conferencing, Interactive Live Streaming, and Chat in your apps with 100ms React Native SDK. With support for HLS and RTMP Live Streaming and Recording, Picture-in-Picture (PiP), one-to-one Video Call Modes, Audio Rooms, Video Player and much more, add immersive real-time communications to your apps.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -68,7 +68,26 @@
68
68
  "ios",
69
69
  "android",
70
70
  "web",
71
- "interactive"
71
+ "interactive",
72
+ "hls",
73
+ "rtmp",
74
+ "pip",
75
+ "voip",
76
+ "player",
77
+ "webrtc",
78
+ "stream",
79
+ "communication",
80
+ "conference",
81
+ "whiteboard",
82
+ "session",
83
+ "polls",
84
+ "quiz",
85
+ "call",
86
+ "callkit",
87
+ "connection",
88
+ "service",
89
+ "telecom",
90
+ "reaction"
72
91
  ],
73
92
  "repository": "https://github.com/100mslive/100ms-react-native",
74
93
  "author": "Yogesh <yogesh@100ms.live> (https://www.100ms.live/)",
package/sdk-versions.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "ios": "0.9.2",
2
+ "ios": "0.9.4",
3
3
  "iOSBroadcastExtension": "0.0.9",
4
- "android": "2.6.1"
4
+ "android": "2.6.3"
5
5
  }
@@ -1,17 +1,33 @@
1
+ import type { HMSIOSAudioMode } from './HMSIOSAudioMode';
1
2
  import type { HMSTrackSettingsInitState } from './HMSTrackSettingsInitState';
2
3
 
4
+ /**
5
+ * Customize local peer's Audio track settings before Joining the Room.
6
+ *
7
+ * Checkout Track Settings docs for more details {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/track/track-settings}
8
+ */
3
9
  export class HMSAudioTrackSettings {
4
10
  initialState?: HMSTrackSettingsInitState;
5
11
  useHardwareEchoCancellation?: boolean; // android only
6
12
  audioSource?: string[]; // ios only
7
13
 
14
+ /**
15
+ * [iOS only] `audioMode` allows you to capture audio in its highest quality
16
+ * by disabling voice processing and increasing the maximum bandwidth limit
17
+ *
18
+ * Checkout Music Mode docs for more details {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/configure-your-device/microphone/music-mode}
19
+ */
20
+ audioMode?: HMSIOSAudioMode; // ios only
21
+
8
22
  constructor(params: {
9
23
  initialState?: HMSTrackSettingsInitState;
10
24
  useHardwareEchoCancellation?: boolean;
11
25
  audioSource?: string[];
26
+ audioMode?: HMSIOSAudioMode;
12
27
  }) {
13
28
  this.useHardwareEchoCancellation = params.useHardwareEchoCancellation;
14
29
  this.initialState = params.initialState;
15
30
  this.audioSource = params.audioSource;
31
+ this.audioMode = params.audioMode;
16
32
  }
17
33
  }
@@ -196,6 +196,7 @@ export class HMSEncoder {
196
196
  const encodedObj = {
197
197
  useHardwareEchoCancellation: settings?.useHardwareAcousticEchoCanceler,
198
198
  initialState: settings?.initialState,
199
+ audioMode: settings?.audioMode,
199
200
  };
200
201
 
201
202
  return new HMSAudioTrackSettings(encodedObj);
@@ -0,0 +1,4 @@
1
+ export enum HMSIOSAudioMode {
2
+ VOICE = 'voice',
3
+ MUSIC = 'music',
4
+ }