@100mslive/react-native-hms 1.7.2 → 2.0.0-alpha.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 (119) hide show
  1. package/android/.gradle/6.7.1/executionHistory/executionHistory.lock +0 -0
  2. package/android/.gradle/6.7.1/fileHashes/fileHashes.lock +0 -0
  3. package/android/.gradle/6.9/executionHistory/executionHistory.bin +0 -0
  4. package/android/.gradle/6.9/executionHistory/executionHistory.lock +0 -0
  5. package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
  6. package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
  7. package/android/.gradle/{6.7.1/fileHashes/fileHashes.bin → 6.9/fileHashes/resourceHashesCache.bin} +0 -0
  8. package/android/.gradle/6.9/javaCompile/classAnalysis.bin +0 -0
  9. package/android/.gradle/6.9/javaCompile/jarAnalysis.bin +0 -0
  10. package/android/.gradle/6.9/javaCompile/javaCompile.lock +0 -0
  11. package/android/.gradle/6.9/javaCompile/taskHistory.bin +0 -0
  12. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  13. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  14. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  15. package/android/.gradle/checksums/checksums.lock +0 -0
  16. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  17. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  18. package/android/.idea/compiler.xml +6 -0
  19. package/android/.idea/gradle.xml +18 -0
  20. package/android/.idea/jarRepositories.xml +45 -0
  21. package/android/.idea/misc.xml +10 -0
  22. package/android/.idea/vcs.xml +6 -0
  23. package/android/build.gradle +3 -3
  24. package/android/local.properties +8 -1
  25. package/android/src/main/java/com/reactnativehmssdk/HMSAudioshareActivity.kt +1 -0
  26. package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +42 -14
  27. package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayer.kt +113 -68
  28. package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayerManager.kt +17 -4
  29. package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +46 -18
  30. package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +483 -184
  31. package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +551 -151
  32. package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +26 -7
  33. package/android/src/main/java/com/reactnativehmssdk/HMSView.kt +32 -12
  34. package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +1 -0
  35. package/android/src/main/java/com/reactnativehmssdk/PipActionReceiver.kt +10 -6
  36. package/android/src/main/res/layout/player_view.xml +3 -2
  37. package/ios/HMSConstants.swift +1 -0
  38. package/ios/HMSDecoder.swift +18 -7
  39. package/ios/HMSHLSPlayerManager.swift +18 -2
  40. package/ios/HMSManager.m +239 -70
  41. package/ios/HMSManager.swift +24 -3
  42. package/ios/HMSRNSDK.swift +129 -126
  43. package/ios/HMSView.swift +17 -3
  44. package/ios/Hmssdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  45. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  46. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/jatinnagar.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  47. package/ios/Hmssdk.xcodeproj/xcuserdata/jatinnagar.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  48. package/lib/commonjs/classes/HMSEncoder.js +6 -0
  49. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  50. package/lib/commonjs/classes/HMSPIPListenerActions.js +1 -0
  51. package/lib/commonjs/classes/HMSPIPListenerActions.js.map +1 -1
  52. package/lib/commonjs/classes/HMSPeer.js +15 -0
  53. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  54. package/lib/commonjs/classes/HMSPeerListIterator.js +46 -0
  55. package/lib/commonjs/classes/HMSPeerListIterator.js.map +1 -0
  56. package/lib/commonjs/classes/HMSPeerListIteratorOptions.js +2 -0
  57. package/lib/commonjs/classes/HMSPeerListIteratorOptions.js.map +1 -0
  58. package/lib/commonjs/classes/HMSPeerUpdate.js +2 -1
  59. package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
  60. package/lib/commonjs/classes/HMSPeersCache.js +7 -0
  61. package/lib/commonjs/classes/HMSPeersCache.js.map +1 -1
  62. package/lib/commonjs/classes/HMSSDK.js +162 -29
  63. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  64. package/lib/commonjs/classes/HMSUpdateListenerActions.js +1 -0
  65. package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
  66. package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js +10 -5
  67. package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
  68. package/lib/commonjs/index.js.map +1 -1
  69. package/lib/commonjs/types.js +1 -0
  70. package/lib/commonjs/types.js.map +1 -1
  71. package/lib/module/classes/HMSEncoder.js +6 -0
  72. package/lib/module/classes/HMSEncoder.js.map +1 -1
  73. package/lib/module/classes/HMSPIPListenerActions.js +1 -0
  74. package/lib/module/classes/HMSPIPListenerActions.js.map +1 -1
  75. package/lib/module/classes/HMSPeer.js +15 -0
  76. package/lib/module/classes/HMSPeer.js.map +1 -1
  77. package/lib/module/classes/HMSPeerListIterator.js +40 -0
  78. package/lib/module/classes/HMSPeerListIterator.js.map +1 -0
  79. package/lib/module/classes/HMSPeerListIteratorOptions.js +2 -0
  80. package/lib/module/classes/HMSPeerListIteratorOptions.js.map +1 -0
  81. package/lib/module/classes/HMSPeerUpdate.js +2 -1
  82. package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
  83. package/lib/module/classes/HMSPeersCache.js +7 -0
  84. package/lib/module/classes/HMSPeersCache.js.map +1 -1
  85. package/lib/module/classes/HMSSDK.js +162 -30
  86. package/lib/module/classes/HMSSDK.js.map +1 -1
  87. package/lib/module/classes/HMSUpdateListenerActions.js +1 -0
  88. package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
  89. package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js +11 -6
  90. package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
  91. package/lib/module/index.js.map +1 -1
  92. package/lib/module/types.js +1 -0
  93. package/lib/module/types.js.map +1 -1
  94. package/lib/typescript/classes/HMSEncoder.d.ts +1 -0
  95. package/lib/typescript/classes/HMSPIPListenerActions.d.ts +1 -0
  96. package/lib/typescript/classes/HMSPeer.d.ts +3 -0
  97. package/lib/typescript/classes/HMSPeerListIterator.d.ts +7 -0
  98. package/lib/typescript/classes/HMSPeerListIteratorOptions.d.ts +5 -0
  99. package/lib/typescript/classes/HMSPeerUpdate.d.ts +2 -1
  100. package/lib/typescript/classes/HMSPeersCache.d.ts +1 -0
  101. package/lib/typescript/classes/HMSSDK.d.ts +46 -13
  102. package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +2 -1
  103. package/lib/typescript/index.d.ts +1 -1
  104. package/lib/typescript/types.d.ts +3 -1
  105. package/package.json +1 -1
  106. package/sdk-versions.json +2 -2
  107. package/src/classes/HMSEncoder.ts +9 -0
  108. package/src/classes/HMSPIPListenerActions.ts +1 -0
  109. package/src/classes/HMSPeer.ts +25 -0
  110. package/src/classes/HMSPeerListIterator.ts +40 -0
  111. package/src/classes/HMSPeerListIteratorOptions.ts +5 -0
  112. package/src/classes/HMSPeerUpdate.ts +2 -0
  113. package/src/classes/HMSPeersCache.ts +7 -0
  114. package/src/classes/HMSSDK.tsx +202 -26
  115. package/src/classes/HMSUpdateListenerActions.ts +1 -0
  116. package/src/components/HMSHLSPlayer/HMSHLSPlayer.tsx +15 -13
  117. package/src/index.ts +4 -1
  118. package/src/types.ts +2 -0
  119. package/android/.gradle/6.7.1/executionHistory/executionHistory.bin +0 -0
@@ -23,8 +23,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
23
23
  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; }
24
24
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
25
25
  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); }
26
+ // import type { HMSPeerListIteratorOptions } from './HMSPeerListIteratorOptions';
27
+ // import { HMSPeerListIterator } from './HMSPeerListIterator';
26
28
  // TODO: Rename to HMSPIPConfig & to be moved to a separate file
27
-
28
29
  const ReactNativeVersion = require('react-native/Libraries/Core/ReactNativeVersion');
29
30
  let HmsSdk;
30
31
  class HMSSDK {
@@ -37,6 +38,7 @@ class HMSSDK {
37
38
  _defineProperty(this, "onJoinDelegate", void 0);
38
39
  _defineProperty(this, "onRoomDelegate", void 0);
39
40
  _defineProperty(this, "onPeerDelegate", void 0);
41
+ _defineProperty(this, "onPeerListUpdatedDelegate", void 0);
40
42
  _defineProperty(this, "onTrackDelegate", void 0);
41
43
  _defineProperty(this, "onErrorDelegate", void 0);
42
44
  _defineProperty(this, "onMessageDelegate", void 0);
@@ -54,6 +56,7 @@ class HMSSDK {
54
56
  _defineProperty(this, "onAudioDeviceChangedDelegate", void 0);
55
57
  _defineProperty(this, "onSessionStoreAvailableDelegate", void 0);
56
58
  _defineProperty(this, "onPIPRoomLeaveDelegate", void 0);
59
+ _defineProperty(this, "onPIPModeChangedDelegate", void 0);
57
60
  _defineProperty(this, "emitterSubscriptions", {});
58
61
  /**
59
62
  * - Calls removeListeners that in turn breaks all connections with native listeners.
@@ -133,32 +136,6 @@ class HMSSDK {
133
136
  id: this.id
134
137
  });
135
138
  });
136
- /**
137
- * - previewForRole can be used when there is role change request for current localPeer and we want
138
- * to show the localPeer how the tracks look before publishing them to room.
139
- *
140
- * - It requires a role of type [HMSRole]{@link HMSRole} for which we want to preview the tracks.
141
- *
142
- * checkout {@link https://www.100ms.live/docs/react-native} for more info
143
- *
144
- * @param {HMSRole}
145
- * @memberof HMSSDK
146
- */
147
- _defineProperty(this, "previewForRole", async role => {
148
- _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function previewForRole', {
149
- role,
150
- id: this.id
151
- });
152
- if (_reactNative.Platform.OS === 'ios') {
153
- return await _HMSManagerModule.default.previewForRole({
154
- role: role === null || role === void 0 ? void 0 : role.name,
155
- id: this.id
156
- });
157
- } else {
158
- console.log('API currently not available for android');
159
- return 'API currently not available for android';
160
- }
161
- });
162
139
  /**
163
140
  * - HmsView is react component that takes trackId and starts showing that track on a tile.
164
141
  * - The appearance of tile is completely customizable with style prop.
@@ -565,6 +542,46 @@ class HMSSDK {
565
542
  };
566
543
  return await _HMSManagerModule.default.changeName(data);
567
544
  });
545
+ /**
546
+ * -Preview for a specific Role before changing it.
547
+ *
548
+ * By previewing before doing a Role Change, users can see their expected Audio & Video tracks which will be visible to other Peers in Room post changing the Role.
549
+ *
550
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-role} for more info
551
+ *
552
+ * @param {role: string}
553
+ * @memberof HMSSDK
554
+ */
555
+ _defineProperty(this, "previewForRole", async role => {
556
+ _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function previewForRole', {
557
+ role,
558
+ id: this.id
559
+ });
560
+ const data = await _HMSManagerModule.default.previewForRole({
561
+ role,
562
+ id: this.id
563
+ });
564
+ const previewTracks = _HMSEncoder.HMSEncoder.encodeHmsPreviewForRoleTracks(data.tracks, this.id);
565
+ return previewTracks;
566
+ });
567
+ /**
568
+ * Cancel the Previewing for Role invocation.
569
+ *
570
+ * If a [previewForRole] call was performed previously then calling this method clears the tracks created anticipating a Change of Role
571
+ *
572
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-role} for more info
573
+ *
574
+ * @memberof HMSSDK
575
+ */
576
+ _defineProperty(this, "cancelPreview", async () => {
577
+ _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function cancelPreview', {
578
+ id: this.id
579
+ });
580
+ const data = await _HMSManagerModule.default.cancelPreview({
581
+ id: this.id
582
+ });
583
+ return data;
584
+ });
568
585
  /**
569
586
  * - Calling this function will accept the most recent roleChange request made by anyone in the room
570
587
  *
@@ -1058,6 +1075,60 @@ class HMSSDK {
1058
1075
  peerID: peerId
1059
1076
  });
1060
1077
  });
1078
+ /**
1079
+ * - This function is used to raise hand for the local peer
1080
+ * @memberof HMSSDK
1081
+ */
1082
+ _defineProperty(this, "raiseLocalPeerHand", async () => {
1083
+ const data = {
1084
+ id: this.id
1085
+ };
1086
+ _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function raiseLocalPeerHand', data);
1087
+ return _HMSManagerModule.default.raiseLocalPeerHand(data);
1088
+ });
1089
+ /**
1090
+ * - This function is used to lower hand for the local peer
1091
+ * @memberof HMSSDK
1092
+ */
1093
+ _defineProperty(this, "lowerLocalPeerHand", async () => {
1094
+ const data = {
1095
+ id: this.id
1096
+ };
1097
+ _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function lowerLocalPeerHand', data);
1098
+ return _HMSManagerModule.default.lowerLocalPeerHand(data);
1099
+ });
1100
+ /**
1101
+ * - This function is used to lower hand for the remote peer
1102
+ * @param peer
1103
+ */
1104
+ _defineProperty(this, "lowerRemotePeerHand", async peer => {
1105
+ const data = {
1106
+ peerId: peer.peerID,
1107
+ id: this.id
1108
+ };
1109
+ _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function lowerRemotePeerHand', data);
1110
+ return _HMSManagerModule.default.lowerRemotePeerHand(data);
1111
+ });
1112
+ // getPeerListIterator = (
1113
+ // options?: HMSPeerListIteratorOptions
1114
+ // ): HMSPeerListIterator => {
1115
+ // logger?.verbose('#Function getPeerListIterator', {
1116
+ // id: this.id,
1117
+ // options,
1118
+ // });
1119
+ // const uniqueId = Date.now();
1120
+ // const data: null | { sucess: boolean; uniqueId: number } =
1121
+ // HMSManager.getPeerListIterator({
1122
+ // id: this.id,
1123
+ // ...options,
1124
+ // limit: options?.limit ?? 10,
1125
+ // uniqueId: uniqueId,
1126
+ // });
1127
+ // if (!data) {
1128
+ // throw new Error('Unable to create PeerListIterator');
1129
+ // }
1130
+ // return new HMSPeerListIterator(data.uniqueId);
1131
+ // };
1061
1132
  /**
1062
1133
  * - This is a prototype event listener that takes action and listens for updates related to that particular action
1063
1134
  *
@@ -1119,6 +1190,18 @@ class HMSSDK {
1119
1190
  this.onPeerDelegate = callback;
1120
1191
  break;
1121
1192
  }
1193
+ case _HMSUpdateListenerActions.HMSUpdateListenerActions.ON_PEER_LIST_UPDATED:
1194
+ {
1195
+ // Checking if we already have ON_PEER_LIST_UPDATED subscription
1196
+ if (!this.emitterSubscriptions[_HMSUpdateListenerActions.HMSUpdateListenerActions.ON_PEER_LIST_UPDATED]) {
1197
+ // Adding ON_PEER_LIST_UPDATED native listener
1198
+ const peerListUpdatedSubscription = _HMSNativeEventListener.default.addListener(this.id, _HMSUpdateListenerActions.HMSUpdateListenerActions.ON_PEER_LIST_UPDATED, this.onPeerListUpdatedListener);
1199
+ this.emitterSubscriptions[_HMSUpdateListenerActions.HMSUpdateListenerActions.ON_PEER_LIST_UPDATED] = peerListUpdatedSubscription;
1200
+ }
1201
+ // Adding App Delegate listener
1202
+ this.onPeerListUpdatedDelegate = callback;
1203
+ break;
1204
+ }
1122
1205
  case _HMSUpdateListenerActions.HMSUpdateListenerActions.ON_TRACK_UPDATE:
1123
1206
  {
1124
1207
  // Checking if we already have ON_TRACK_UPDATE subscription
@@ -1325,6 +1408,19 @@ class HMSSDK {
1325
1408
  }
1326
1409
  break;
1327
1410
  }
1411
+ case _HMSPIPListenerActions.HMSPIPListenerActions.ON_PIP_MODE_CHANGED:
1412
+ {
1413
+ if (_reactNative.Platform.OS === 'android') {
1414
+ // Checking if we already have ON_PIP_MODE_CHANGED subscription
1415
+ if (!this.emitterSubscriptions[_HMSPIPListenerActions.HMSPIPListenerActions.ON_PIP_MODE_CHANGED]) {
1416
+ const pipModeChangedSubscription = _HMSNativeEventListener.default.addListener(this.id, _HMSPIPListenerActions.HMSPIPListenerActions.ON_PIP_MODE_CHANGED, this.onPIPModeChangedListener);
1417
+ this.emitterSubscriptions[_HMSPIPListenerActions.HMSPIPListenerActions.ON_PIP_MODE_CHANGED] = pipModeChangedSubscription;
1418
+ }
1419
+ // Adding PIP mode changed Delegate listener
1420
+ this.onPIPModeChangedDelegate = callback;
1421
+ }
1422
+ break;
1423
+ }
1328
1424
  default:
1329
1425
  }
1330
1426
  });
@@ -1595,6 +1691,20 @@ class HMSSDK {
1595
1691
  }
1596
1692
  break;
1597
1693
  }
1694
+ case _HMSPIPListenerActions.HMSPIPListenerActions.ON_PIP_MODE_CHANGED:
1695
+ {
1696
+ if (_reactNative.Platform.OS === 'android') {
1697
+ const subscription = this.emitterSubscriptions[_HMSPIPListenerActions.HMSPIPListenerActions.ON_PIP_MODE_CHANGED];
1698
+ // Removing ON_PIP_MODE_CHANGED native listener
1699
+ if (subscription) {
1700
+ subscription.remove();
1701
+ this.emitterSubscriptions[_HMSPIPListenerActions.HMSPIPListenerActions.ON_PIP_MODE_CHANGED] = undefined;
1702
+ }
1703
+ // Removing App Delegate listener
1704
+ this.onPIPModeChangedDelegate = null;
1705
+ }
1706
+ break;
1707
+ }
1598
1708
  default:
1599
1709
  }
1600
1710
  });
@@ -1721,6 +1831,23 @@ class HMSSDK {
1721
1831
  });
1722
1832
  }
1723
1833
  });
1834
+ _defineProperty(this, "onPeerListUpdatedListener", data => {
1835
+ if (data.id !== this.id) {
1836
+ return;
1837
+ }
1838
+ const addedPeers = _HMSEncoder.HMSEncoder.encodeHmsPeers(data.addedPeers);
1839
+ const removedPeers = _HMSEncoder.HMSEncoder.encodeHmsPeers(data.removedPeers);
1840
+ if (this.onPeerListUpdatedDelegate) {
1841
+ _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Listener ON_PEER_LIST_UPDATED_LISTENER_CALL', {
1842
+ totalAddedPeers: addedPeers.length,
1843
+ totalRemovedPeers: removedPeers.length
1844
+ });
1845
+ this.onPeerListUpdatedDelegate({
1846
+ addedPeers,
1847
+ removedPeers
1848
+ });
1849
+ }
1850
+ });
1724
1851
  _defineProperty(this, "onTrackListener", data => {
1725
1852
  var _getHmsPeersCache2;
1726
1853
  if (data.id !== this.id) {
@@ -1977,6 +2104,12 @@ class HMSSDK {
1977
2104
  });
1978
2105
  }
1979
2106
  });
2107
+ _defineProperty(this, "onPIPModeChangedListener", data => {
2108
+ if (this.onPIPModeChangedDelegate) {
2109
+ _HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Listener onPIPModeChanged_CALL', data);
2110
+ this.onPIPModeChangedDelegate(data);
2111
+ }
2112
+ });
1980
2113
  /**
1981
2114
  * - Updates the logger for this instance of HMSSDK
1982
2115
  * @param {HMSLogger} hmsLogger
@@ -2035,8 +2168,8 @@ class HMSSDK {
2035
2168
  id: this.id
2036
2169
  });
2037
2170
  }
2038
- async enablePipMode(data) {
2039
- return _HMSManagerModule.default.handlePipActions('enablePipMode', {
2171
+ async enterPipMode(data) {
2172
+ return _HMSManagerModule.default.handlePipActions('enterPipMode', {
2040
2173
  ...data,
2041
2174
  id: this.id
2042
2175
  });