@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
@@ -16,9 +16,9 @@ import { clearHmsPeersCache, getHmsPeersCache, HMSPeersCache, setHmsPeersCache }
16
16
  import { clearHmsRoomCache, getHmsRoomCache, HMSRoomCache, setHmsRoomCache } from './HMSRoomCache';
17
17
  import { HMSPeerUpdateOrdinals } from './HMSPeerUpdate';
18
18
  import { HMSSessionStore } from './HMSSessionStore';
19
-
19
+ // import type { HMSPeerListIteratorOptions } from './HMSPeerListIteratorOptions';
20
+ // import { HMSPeerListIterator } from './HMSPeerListIterator';
20
21
  // TODO: Rename to HMSPIPConfig & to be moved to a separate file
21
-
22
22
  const ReactNativeVersion = require('react-native/Libraries/Core/ReactNativeVersion');
23
23
  let HmsSdk;
24
24
  export class HMSSDK {
@@ -31,6 +31,7 @@ export class HMSSDK {
31
31
  _defineProperty(this, "onJoinDelegate", void 0);
32
32
  _defineProperty(this, "onRoomDelegate", void 0);
33
33
  _defineProperty(this, "onPeerDelegate", void 0);
34
+ _defineProperty(this, "onPeerListUpdatedDelegate", void 0);
34
35
  _defineProperty(this, "onTrackDelegate", void 0);
35
36
  _defineProperty(this, "onErrorDelegate", void 0);
36
37
  _defineProperty(this, "onMessageDelegate", void 0);
@@ -48,6 +49,7 @@ export class HMSSDK {
48
49
  _defineProperty(this, "onAudioDeviceChangedDelegate", void 0);
49
50
  _defineProperty(this, "onSessionStoreAvailableDelegate", void 0);
50
51
  _defineProperty(this, "onPIPRoomLeaveDelegate", void 0);
52
+ _defineProperty(this, "onPIPModeChangedDelegate", void 0);
51
53
  _defineProperty(this, "emitterSubscriptions", {});
52
54
  /**
53
55
  * - Calls removeListeners that in turn breaks all connections with native listeners.
@@ -127,32 +129,6 @@ export class HMSSDK {
127
129
  id: this.id
128
130
  });
129
131
  });
130
- /**
131
- * - previewForRole can be used when there is role change request for current localPeer and we want
132
- * to show the localPeer how the tracks look before publishing them to room.
133
- *
134
- * - It requires a role of type [HMSRole]{@link HMSRole} for which we want to preview the tracks.
135
- *
136
- * checkout {@link https://www.100ms.live/docs/react-native} for more info
137
- *
138
- * @param {HMSRole}
139
- * @memberof HMSSDK
140
- */
141
- _defineProperty(this, "previewForRole", async role => {
142
- logger === null || logger === void 0 || logger.verbose('#Function previewForRole', {
143
- role,
144
- id: this.id
145
- });
146
- if (Platform.OS === 'ios') {
147
- return await HMSManager.previewForRole({
148
- role: role === null || role === void 0 ? void 0 : role.name,
149
- id: this.id
150
- });
151
- } else {
152
- console.log('API currently not available for android');
153
- return 'API currently not available for android';
154
- }
155
- });
156
132
  /**
157
133
  * - HmsView is react component that takes trackId and starts showing that track on a tile.
158
134
  * - The appearance of tile is completely customizable with style prop.
@@ -559,6 +535,46 @@ export class HMSSDK {
559
535
  };
560
536
  return await HMSManager.changeName(data);
561
537
  });
538
+ /**
539
+ * -Preview for a specific Role before changing it.
540
+ *
541
+ * 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.
542
+ *
543
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-role} for more info
544
+ *
545
+ * @param {role: string}
546
+ * @memberof HMSSDK
547
+ */
548
+ _defineProperty(this, "previewForRole", async role => {
549
+ logger === null || logger === void 0 || logger.verbose('#Function previewForRole', {
550
+ role,
551
+ id: this.id
552
+ });
553
+ const data = await HMSManager.previewForRole({
554
+ role,
555
+ id: this.id
556
+ });
557
+ const previewTracks = HMSEncoder.encodeHmsPreviewForRoleTracks(data.tracks, this.id);
558
+ return previewTracks;
559
+ });
560
+ /**
561
+ * Cancel the Previewing for Role invocation.
562
+ *
563
+ * If a [previewForRole] call was performed previously then calling this method clears the tracks created anticipating a Change of Role
564
+ *
565
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-role} for more info
566
+ *
567
+ * @memberof HMSSDK
568
+ */
569
+ _defineProperty(this, "cancelPreview", async () => {
570
+ logger === null || logger === void 0 || logger.verbose('#Function cancelPreview', {
571
+ id: this.id
572
+ });
573
+ const data = await HMSManager.cancelPreview({
574
+ id: this.id
575
+ });
576
+ return data;
577
+ });
562
578
  /**
563
579
  * - Calling this function will accept the most recent roleChange request made by anyone in the room
564
580
  *
@@ -1052,6 +1068,60 @@ export class HMSSDK {
1052
1068
  peerID: peerId
1053
1069
  });
1054
1070
  });
1071
+ /**
1072
+ * - This function is used to raise hand for the local peer
1073
+ * @memberof HMSSDK
1074
+ */
1075
+ _defineProperty(this, "raiseLocalPeerHand", async () => {
1076
+ const data = {
1077
+ id: this.id
1078
+ };
1079
+ logger === null || logger === void 0 || logger.verbose('#Function raiseLocalPeerHand', data);
1080
+ return HMSManager.raiseLocalPeerHand(data);
1081
+ });
1082
+ /**
1083
+ * - This function is used to lower hand for the local peer
1084
+ * @memberof HMSSDK
1085
+ */
1086
+ _defineProperty(this, "lowerLocalPeerHand", async () => {
1087
+ const data = {
1088
+ id: this.id
1089
+ };
1090
+ logger === null || logger === void 0 || logger.verbose('#Function lowerLocalPeerHand', data);
1091
+ return HMSManager.lowerLocalPeerHand(data);
1092
+ });
1093
+ /**
1094
+ * - This function is used to lower hand for the remote peer
1095
+ * @param peer
1096
+ */
1097
+ _defineProperty(this, "lowerRemotePeerHand", async peer => {
1098
+ const data = {
1099
+ peerId: peer.peerID,
1100
+ id: this.id
1101
+ };
1102
+ logger === null || logger === void 0 || logger.verbose('#Function lowerRemotePeerHand', data);
1103
+ return HMSManager.lowerRemotePeerHand(data);
1104
+ });
1105
+ // getPeerListIterator = (
1106
+ // options?: HMSPeerListIteratorOptions
1107
+ // ): HMSPeerListIterator => {
1108
+ // logger?.verbose('#Function getPeerListIterator', {
1109
+ // id: this.id,
1110
+ // options,
1111
+ // });
1112
+ // const uniqueId = Date.now();
1113
+ // const data: null | { sucess: boolean; uniqueId: number } =
1114
+ // HMSManager.getPeerListIterator({
1115
+ // id: this.id,
1116
+ // ...options,
1117
+ // limit: options?.limit ?? 10,
1118
+ // uniqueId: uniqueId,
1119
+ // });
1120
+ // if (!data) {
1121
+ // throw new Error('Unable to create PeerListIterator');
1122
+ // }
1123
+ // return new HMSPeerListIterator(data.uniqueId);
1124
+ // };
1055
1125
  /**
1056
1126
  * - This is a prototype event listener that takes action and listens for updates related to that particular action
1057
1127
  *
@@ -1113,6 +1183,18 @@ export class HMSSDK {
1113
1183
  this.onPeerDelegate = callback;
1114
1184
  break;
1115
1185
  }
1186
+ case HMSUpdateListenerActions.ON_PEER_LIST_UPDATED:
1187
+ {
1188
+ // Checking if we already have ON_PEER_LIST_UPDATED subscription
1189
+ if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_PEER_LIST_UPDATED]) {
1190
+ // Adding ON_PEER_LIST_UPDATED native listener
1191
+ const peerListUpdatedSubscription = HMSNativeEventListener.addListener(this.id, HMSUpdateListenerActions.ON_PEER_LIST_UPDATED, this.onPeerListUpdatedListener);
1192
+ this.emitterSubscriptions[HMSUpdateListenerActions.ON_PEER_LIST_UPDATED] = peerListUpdatedSubscription;
1193
+ }
1194
+ // Adding App Delegate listener
1195
+ this.onPeerListUpdatedDelegate = callback;
1196
+ break;
1197
+ }
1116
1198
  case HMSUpdateListenerActions.ON_TRACK_UPDATE:
1117
1199
  {
1118
1200
  // Checking if we already have ON_TRACK_UPDATE subscription
@@ -1319,6 +1401,19 @@ export class HMSSDK {
1319
1401
  }
1320
1402
  break;
1321
1403
  }
1404
+ case HMSPIPListenerActions.ON_PIP_MODE_CHANGED:
1405
+ {
1406
+ if (Platform.OS === 'android') {
1407
+ // Checking if we already have ON_PIP_MODE_CHANGED subscription
1408
+ if (!this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED]) {
1409
+ const pipModeChangedSubscription = HMSNativeEventListener.addListener(this.id, HMSPIPListenerActions.ON_PIP_MODE_CHANGED, this.onPIPModeChangedListener);
1410
+ this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED] = pipModeChangedSubscription;
1411
+ }
1412
+ // Adding PIP mode changed Delegate listener
1413
+ this.onPIPModeChangedDelegate = callback;
1414
+ }
1415
+ break;
1416
+ }
1322
1417
  default:
1323
1418
  }
1324
1419
  });
@@ -1589,6 +1684,20 @@ export class HMSSDK {
1589
1684
  }
1590
1685
  break;
1591
1686
  }
1687
+ case HMSPIPListenerActions.ON_PIP_MODE_CHANGED:
1688
+ {
1689
+ if (Platform.OS === 'android') {
1690
+ const subscription = this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED];
1691
+ // Removing ON_PIP_MODE_CHANGED native listener
1692
+ if (subscription) {
1693
+ subscription.remove();
1694
+ this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED] = undefined;
1695
+ }
1696
+ // Removing App Delegate listener
1697
+ this.onPIPModeChangedDelegate = null;
1698
+ }
1699
+ break;
1700
+ }
1592
1701
  default:
1593
1702
  }
1594
1703
  });
@@ -1715,6 +1824,23 @@ export class HMSSDK {
1715
1824
  });
1716
1825
  }
1717
1826
  });
1827
+ _defineProperty(this, "onPeerListUpdatedListener", data => {
1828
+ if (data.id !== this.id) {
1829
+ return;
1830
+ }
1831
+ const addedPeers = HMSEncoder.encodeHmsPeers(data.addedPeers);
1832
+ const removedPeers = HMSEncoder.encodeHmsPeers(data.removedPeers);
1833
+ if (this.onPeerListUpdatedDelegate) {
1834
+ logger === null || logger === void 0 || logger.verbose('#Listener ON_PEER_LIST_UPDATED_LISTENER_CALL', {
1835
+ totalAddedPeers: addedPeers.length,
1836
+ totalRemovedPeers: removedPeers.length
1837
+ });
1838
+ this.onPeerListUpdatedDelegate({
1839
+ addedPeers,
1840
+ removedPeers
1841
+ });
1842
+ }
1843
+ });
1718
1844
  _defineProperty(this, "onTrackListener", data => {
1719
1845
  var _getHmsPeersCache2;
1720
1846
  if (data.id !== this.id) {
@@ -1971,6 +2097,12 @@ export class HMSSDK {
1971
2097
  });
1972
2098
  }
1973
2099
  });
2100
+ _defineProperty(this, "onPIPModeChangedListener", data => {
2101
+ if (this.onPIPModeChangedDelegate) {
2102
+ logger === null || logger === void 0 || logger.verbose('#Listener onPIPModeChanged_CALL', data);
2103
+ this.onPIPModeChangedDelegate(data);
2104
+ }
2105
+ });
1974
2106
  /**
1975
2107
  * - Updates the logger for this instance of HMSSDK
1976
2108
  * @param {HMSLogger} hmsLogger
@@ -2029,8 +2161,8 @@ export class HMSSDK {
2029
2161
  id: this.id
2030
2162
  });
2031
2163
  }
2032
- async enablePipMode(data) {
2033
- return HMSManager.handlePipActions('enablePipMode', {
2164
+ async enterPipMode(data) {
2165
+ return HMSManager.handlePipActions('enterPipMode', {
2034
2166
  ...data,
2035
2167
  id: this.id
2036
2168
  });