@100mslive/react-native-hms 1.9.1 → 1.9.3-beta.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 (88) hide show
  1. package/README.md +0 -1
  2. package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +21 -11
  3. package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +72 -20
  4. package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +63 -28
  5. package/ios/HMSDecoder.swift +1 -3
  6. package/ios/HMSHelper.swift +2 -2
  7. package/ios/HMSRNSDK.swift +23 -7
  8. package/lib/commonjs/classes/HMSCameraControl.js +2 -3
  9. package/lib/commonjs/classes/HMSCameraControl.js.map +1 -1
  10. package/lib/commonjs/classes/HMSEncoder.js +1 -1
  11. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  12. package/lib/commonjs/classes/HMSNativeEventListener.js +1 -1
  13. package/lib/commonjs/classes/HMSNativeEventListener.js.map +1 -1
  14. package/lib/commonjs/classes/HMSPeerListIterator.js +1 -1
  15. package/lib/commonjs/classes/HMSPeerListIterator.js.map +1 -1
  16. package/lib/commonjs/classes/HMSPeersCache.js +1 -1
  17. package/lib/commonjs/classes/HMSPeersCache.js.map +1 -1
  18. package/lib/commonjs/classes/HMSRoomCache.js +1 -1
  19. package/lib/commonjs/classes/HMSRoomCache.js.map +1 -1
  20. package/lib/commonjs/classes/HMSSDK.js +17 -57
  21. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  22. package/lib/commonjs/classes/HMSSessionStore.js +1 -1
  23. package/lib/commonjs/classes/HMSSessionStore.js.map +1 -1
  24. package/lib/commonjs/classes/HmsView.js +3 -4
  25. package/lib/commonjs/classes/HmsView.js.map +1 -1
  26. package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js +13 -16
  27. package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
  28. package/lib/commonjs/hooks/useHMSPeerUpdates.js +1 -2
  29. package/lib/commonjs/hooks/useHMSPeerUpdates.js.map +1 -1
  30. package/lib/commonjs/index.js +11 -2
  31. package/lib/commonjs/index.js.map +1 -1
  32. package/lib/commonjs/stores/hms-store.js +4 -6
  33. package/lib/commonjs/stores/hms-store.js.map +1 -1
  34. package/lib/commonjs/utils/emitter/EventEmitter.js +1 -4
  35. package/lib/commonjs/utils/emitter/EventEmitter.js.map +1 -1
  36. package/lib/commonjs/utils/notification.js +13 -0
  37. package/lib/commonjs/utils/notification.js.map +1 -0
  38. package/lib/module/classes/HMSCameraControl.js +2 -3
  39. package/lib/module/classes/HMSCameraControl.js.map +1 -1
  40. package/lib/module/classes/HMSEncoder.js +1 -1
  41. package/lib/module/classes/HMSEncoder.js.map +1 -1
  42. package/lib/module/classes/HMSNativeEventListener.js +1 -1
  43. package/lib/module/classes/HMSNativeEventListener.js.map +1 -1
  44. package/lib/module/classes/HMSPeerListIterator.js +1 -1
  45. package/lib/module/classes/HMSPeerListIterator.js.map +1 -1
  46. package/lib/module/classes/HMSPeersCache.js +1 -1
  47. package/lib/module/classes/HMSPeersCache.js.map +1 -1
  48. package/lib/module/classes/HMSRoomCache.js +1 -1
  49. package/lib/module/classes/HMSRoomCache.js.map +1 -1
  50. package/lib/module/classes/HMSSDK.js +18 -58
  51. package/lib/module/classes/HMSSDK.js.map +1 -1
  52. package/lib/module/classes/HMSSessionStore.js +1 -1
  53. package/lib/module/classes/HMSSessionStore.js.map +1 -1
  54. package/lib/module/classes/HmsView.js +3 -4
  55. package/lib/module/classes/HmsView.js.map +1 -1
  56. package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js +13 -16
  57. package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
  58. package/lib/module/hooks/useHMSPeerUpdates.js +1 -2
  59. package/lib/module/hooks/useHMSPeerUpdates.js.map +1 -1
  60. package/lib/module/index.js +5 -1
  61. package/lib/module/index.js.map +1 -1
  62. package/lib/module/stores/hms-store.js +4 -6
  63. package/lib/module/stores/hms-store.js.map +1 -1
  64. package/lib/module/utils/emitter/EventEmitter.js +1 -4
  65. package/lib/module/utils/emitter/EventEmitter.js.map +1 -1
  66. package/lib/module/utils/notification.js +5 -0
  67. package/lib/module/utils/notification.js.map +1 -0
  68. package/lib/typescript/classes/HMSSDK.d.ts +1 -11
  69. package/lib/typescript/index.d.ts +3 -1
  70. package/lib/typescript/utils/notification.d.ts +5 -0
  71. package/package.json +1 -1
  72. package/sdk-versions.json +2 -2
  73. package/src/classes/HMSCameraControl.ts +1 -1
  74. package/src/classes/HMSEncoder.ts +1 -1
  75. package/src/classes/HMSNativeEventListener.ts +1 -1
  76. package/src/classes/HMSPeerListIterator.ts +8 -6
  77. package/src/classes/HMSPeersCache.ts +1 -1
  78. package/src/classes/HMSRoomCache.ts +1 -1
  79. package/src/classes/HMSSDK.tsx +35 -61
  80. package/src/classes/HMSSessionStore.ts +1 -1
  81. package/src/index.ts +5 -1
  82. package/src/utils/notification.ts +10 -0
  83. /package/lib/commonjs/{classes → modules}/HMSManagerModule.js +0 -0
  84. /package/lib/commonjs/{classes → modules}/HMSManagerModule.js.map +0 -0
  85. /package/lib/module/{classes → modules}/HMSManagerModule.js +0 -0
  86. /package/lib/module/{classes → modules}/HMSManagerModule.js.map +0 -0
  87. /package/lib/typescript/{classes → modules}/HMSManagerModule.d.ts +0 -0
  88. /package/src/{classes → modules}/HMSManagerModule.ts +0 -0
@@ -9,10 +9,9 @@ var _reactNative = require("react-native");
9
9
  var _HMSEncoder = require("./HMSEncoder");
10
10
  var _HMSHelper = require("./HMSHelper");
11
11
  var _HMSLogger = require("./HMSLogger");
12
- var _HMSTrackType = require("./HMSTrackType");
13
12
  var _HMSUpdateListenerActions = require("./HMSUpdateListenerActions");
14
13
  var _HmsView = require("./HmsView");
15
- var _HMSManagerModule = _interopRequireDefault(require("./HMSManagerModule"));
14
+ var _HMSManagerModule = _interopRequireDefault(require("../modules/HMSManagerModule"));
16
15
  var _HMSPIPListenerActions = require("./HMSPIPListenerActions");
17
16
  var _HMSNativeEventListener = _interopRequireDefault(require("./HMSNativeEventListener"));
18
17
  var _HMSPeersCache = require("./HMSPeersCache");
@@ -28,9 +27,7 @@ const ReactNativeVersion = require('react-native/Libraries/Core/ReactNativeVersi
28
27
  let HmsSdk;
29
28
  class HMSSDK {
30
29
  constructor(id) {
31
- var _this = this;
32
30
  _defineProperty(this, "id", void 0);
33
- _defineProperty(this, "muteStatus", void 0);
34
31
  _defineProperty(this, "appStateSubscription", void 0);
35
32
  _defineProperty(this, "onPreviewDelegate", void 0);
36
33
  _defineProperty(this, "onJoinDelegate", void 0);
@@ -107,7 +104,6 @@ class HMSSDK {
107
104
  config,
108
105
  id: this.id
109
106
  });
110
- this.addAppStateListener();
111
107
  (0, _HMSPeersCache.setHmsPeersCache)(new _HMSPeersCache.HMSPeersCache(this.id));
112
108
  (0, _HMSRoomCache.setHmsRoomCache)(new _HMSRoomCache.HMSRoomCache(this.id));
113
109
  await _HMSManagerModule.default.join({
@@ -168,7 +164,6 @@ class HMSSDK {
168
164
  }));
169
165
  _defineProperty(this, "roomLeaveCleanup", () => {
170
166
  var _this$appStateSubscri;
171
- this.muteStatus = undefined;
172
167
  this === null || this === void 0 || (_this$appStateSubscri = this.appStateSubscription) === null || _this$appStateSubscri === void 0 || _this$appStateSubscri.remove();
173
168
  (0, _HMSPeersCache.clearHmsPeersCache)();
174
169
  (0, _HMSRoomCache.clearHmsRoomCache)();
@@ -201,17 +196,16 @@ class HMSSDK {
201
196
  * @param message the message that is to be sent
202
197
  * @param type the default type is set to CHAT. You can pass a custom type here for sending events like Emoji Reactions, Notifications, etc
203
198
  */
204
- _defineProperty(this, "sendBroadcastMessage", async function (message) {
205
- let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'chat';
199
+ _defineProperty(this, "sendBroadcastMessage", async (message, type = 'chat') => {
206
200
  _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function sendBroadcastMessage', {
207
201
  message,
208
202
  type: type || null,
209
- id: _this.id
203
+ id: this.id
210
204
  });
211
205
  const data = await _HMSManagerModule.default.sendBroadcastMessage({
212
206
  message,
213
207
  type: type || null,
214
- id: _this.id
208
+ id: this.id
215
209
  });
216
210
  return data;
217
211
  });
@@ -223,18 +217,17 @@ class HMSSDK {
223
217
  *
224
218
  * @memberof HMSSDK
225
219
  */
226
- _defineProperty(this, "sendGroupMessage", async function (message, roles) {
227
- let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'chat';
220
+ _defineProperty(this, "sendGroupMessage", async (message, roles, type = 'chat') => {
228
221
  _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function sendGroupMessage', {
229
222
  message,
230
223
  roles,
231
- id: _this.id,
224
+ id: this.id,
232
225
  type: type || null
233
226
  });
234
227
  const data = await _HMSManagerModule.default.sendGroupMessage({
235
228
  message,
236
229
  roles: _HMSHelper.HMSHelper.getRoleNames(roles),
237
- id: _this.id,
230
+ id: this.id,
238
231
  type: type || null
239
232
  });
240
233
  return data;
@@ -247,18 +240,17 @@ class HMSSDK {
247
240
  *
248
241
  * @memberof HMSSDK
249
242
  */
250
- _defineProperty(this, "sendDirectMessage", async function (message, peer) {
251
- let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'chat';
243
+ _defineProperty(this, "sendDirectMessage", async (message, peer, type = 'chat') => {
252
244
  _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function sendDirectMessage', {
253
245
  message,
254
246
  peerId: peer.peerID,
255
- id: _this.id,
247
+ id: this.id,
256
248
  type: type || null
257
249
  });
258
250
  const data = await _HMSManagerModule.default.sendDirectMessage({
259
251
  message,
260
252
  peerId: peer.peerID,
261
- id: _this.id,
253
+ id: this.id,
262
254
  type: type || null
263
255
  });
264
256
  return data;
@@ -369,13 +361,12 @@ class HMSSDK {
369
361
  *
370
362
  * @memberof HMSSDK
371
363
  */
372
- _defineProperty(this, "changeRole", async function (peer, role) {
373
- let force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
364
+ _defineProperty(this, "changeRole", async (peer, role, force = false) => {
374
365
  const data = {
375
366
  peerId: peer === null || peer === void 0 ? void 0 : peer.peerID,
376
367
  role: role === null || role === void 0 ? void 0 : role.name,
377
368
  force: force,
378
- id: _this.id
369
+ id: this.id
379
370
  };
380
371
  _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function changeRole', data);
381
372
  return await _HMSManagerModule.default.changeRole(data);
@@ -394,13 +385,12 @@ class HMSSDK {
394
385
  *
395
386
  * @memberof HMSSDK
396
387
  */
397
- _defineProperty(this, "changeRoleOfPeer", async function (peer, role) {
398
- let force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
388
+ _defineProperty(this, "changeRoleOfPeer", async (peer, role, force = false) => {
399
389
  const data = {
400
390
  peerId: peer.peerID,
401
391
  role: role.name,
402
392
  force: force,
403
- id: _this.id
393
+ id: this.id
404
394
  };
405
395
  _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function changeRoleOfPeer', data);
406
396
  return _HMSManagerModule.default.changeRoleOfPeer(data);
@@ -508,17 +498,16 @@ class HMSSDK {
508
498
  *
509
499
  * @memberof HMSSDK
510
500
  */
511
- _defineProperty(this, "endRoom", async function (reason) {
512
- let lock = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
501
+ _defineProperty(this, "endRoom", async (reason, lock = false) => {
513
502
  _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function endRoom', {
514
503
  lock,
515
504
  reason,
516
- id: _this.id
505
+ id: this.id
517
506
  });
518
507
  const data = {
519
508
  lock,
520
509
  reason,
521
- id: _this.id
510
+ id: this.id
522
511
  };
523
512
  return await _HMSManagerModule.default.endRoom(data);
524
513
  });
@@ -608,7 +597,6 @@ class HMSSDK {
608
597
  mute,
609
598
  id: this.id
610
599
  });
611
- this.muteStatus = mute;
612
600
  _HMSManagerModule.default.setPlaybackForAllAudio({
613
601
  mute,
614
602
  id: this.id
@@ -718,31 +706,6 @@ class HMSSDK {
718
706
  volume
719
707
  });
720
708
  });
721
- _defineProperty(this, "resetVolume", () => {
722
- _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function resetVolume', {
723
- id: this.id
724
- });
725
- if (_reactNative.Platform.OS === 'android') _HMSManagerModule.default.resetVolume({
726
- id: this.id
727
- });
728
- });
729
- /**
730
- * - This is a temporary solution for the situation when mic access is taken from the app and
731
- * user returns to the app with no mic access. It will re-acquire the mic by setting the volume
732
- * from native side
733
- *
734
- * @memberof HMSSDK
735
- */
736
- _defineProperty(this, "addAppStateListener", () => {
737
- _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function addAppStateListener', {
738
- id: this.id
739
- });
740
- this.appStateSubscription = _reactNative.AppState.addEventListener('change', nextAppState => {
741
- if (nextAppState === 'active' && _reactNative.Platform.OS === 'android') {
742
- this.resetVolume();
743
- }
744
- });
745
- });
746
709
  /**
747
710
  * - This function is used to start screenshare, currently available only for android
748
711
  *
@@ -1884,9 +1847,6 @@ class HMSSDK {
1884
1847
  (_getHmsPeersCache3 = (0, _HMSPeersCache.getHmsPeersCache)()) === null || _getHmsPeersCache3 === void 0 || _getHmsPeersCache3.updatePeerCache(data.peer.peerID, {
1885
1848
  track
1886
1849
  }, data.type);
1887
- if (this.muteStatus && (data === null || data === void 0 ? void 0 : data.type) === 'TRACK_ADDED' && track.type === _HMSTrackType.HMSTrackType.AUDIO) {
1888
- this.setPlaybackForAllAudio(this.muteStatus);
1889
- }
1890
1850
  if (this.onTrackDelegate) {
1891
1851
  _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Listener ON_TRACK_LISTENER_CALL', {
1892
1852
  peer,