@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
@@ -1,15 +1,15 @@
1
1
  import React from 'react';
2
- import { AppState, Platform } from 'react-native';
2
+ import { Platform } from 'react-native';
3
3
  import { HMSEncoder } from './HMSEncoder';
4
4
  import { HMSHelper } from './HMSHelper';
5
5
  import { getLogger, logger, setLogger } from './HMSLogger';
6
- import { HMSTrackType } from './HMSTrackType';
7
6
  import { HMSUpdateListenerActions } from './HMSUpdateListenerActions';
8
7
  import { HmsViewComponent } from './HmsView';
9
- import type { HmsComponentProps } from './HmsView';
10
8
 
11
- import HMSManager from './HMSManagerModule';
9
+ import HMSManager from '../modules/HMSManagerModule';
12
10
 
11
+ import type { HMSTrackType } from './HMSTrackType';
12
+ import type { HmsComponentProps } from './HmsView';
13
13
  import type { HMSConfig } from './HMSConfig';
14
14
  import type { HMSLocalPeer } from './HMSLocalPeer';
15
15
  import type { HMSRemotePeer } from './HMSRemotePeer';
@@ -55,7 +55,6 @@ let HmsSdk: HMSSDK | undefined;
55
55
 
56
56
  export class HMSSDK {
57
57
  id: string;
58
- private muteStatus: boolean | undefined;
59
58
  private appStateSubscription?: any;
60
59
  private onPreviewDelegate?: any;
61
60
  private onJoinDelegate?: any;
@@ -184,7 +183,6 @@ export class HMSSDK {
184
183
  */
185
184
  join = async (config: HMSConfig) => {
186
185
  logger?.verbose('#Function join', { config, id: this.id });
187
- this.addAppStateListener();
188
186
  setHmsPeersCache(new HMSPeersCache(this.id));
189
187
  setHmsRoomCache(new HMSRoomCache(this.id));
190
188
  await HMSManager.join({ ...config, id: this.id });
@@ -240,7 +238,6 @@ export class HMSSDK {
240
238
  });
241
239
 
242
240
  roomLeaveCleanup = () => {
243
- this.muteStatus = undefined;
244
241
  this?.appStateSubscription?.remove();
245
242
  clearHmsPeersCache();
246
243
  clearHmsRoomCache();
@@ -699,7 +696,6 @@ export class HMSSDK {
699
696
  */
700
697
  setPlaybackForAllAudio = (mute: boolean) => {
701
698
  logger?.verbose('#Function setPlaybackForAllAudio', { mute, id: this.id });
702
- this.muteStatus = mute;
703
699
  HMSManager.setPlaybackForAllAudio({ mute, id: this.id });
704
700
  };
705
701
 
@@ -808,30 +804,6 @@ export class HMSSDK {
808
804
  });
809
805
  };
810
806
 
811
- resetVolume = () => {
812
- logger?.verbose('#Function resetVolume', { id: this.id });
813
- if (Platform.OS === 'android') HMSManager.resetVolume({ id: this.id });
814
- };
815
-
816
- /**
817
- * - This is a temporary solution for the situation when mic access is taken from the app and
818
- * user returns to the app with no mic access. It will re-acquire the mic by setting the volume
819
- * from native side
820
- *
821
- * @memberof HMSSDK
822
- */
823
- addAppStateListener = () => {
824
- logger?.verbose('#Function addAppStateListener', { id: this.id });
825
- this.appStateSubscription = AppState.addEventListener(
826
- 'change',
827
- (nextAppState) => {
828
- if (nextAppState === 'active' && Platform.OS === 'android') {
829
- this.resetVolume();
830
- }
831
- }
832
- );
833
- };
834
-
835
807
  /**
836
808
  * - This function is used to start screenshare, currently available only for android
837
809
  *
@@ -1207,13 +1179,16 @@ export class HMSSDK {
1207
1179
 
1208
1180
  const uniqueId = Math.random().toString(16).slice(2);
1209
1181
 
1210
- const data: null | { sucess: boolean; uniqueId: string; totalCount: number; } =
1211
- HMSManager.getPeerListIterator({
1212
- id: this.id,
1213
- ...options,
1214
- limit: options?.limit ?? 10,
1215
- uniqueId,
1216
- });
1182
+ const data: null | {
1183
+ sucess: boolean;
1184
+ uniqueId: string;
1185
+ totalCount: number;
1186
+ } = HMSManager.getPeerListIterator({
1187
+ id: this.id,
1188
+ ...options,
1189
+ limit: options?.limit ?? 10,
1190
+ uniqueId,
1191
+ });
1217
1192
 
1218
1193
  if (!data) {
1219
1194
  throw new Error('Unable to create PeerListIterator');
@@ -1657,15 +1632,19 @@ export class HMSSDK {
1657
1632
  if (Platform.OS === 'android') {
1658
1633
  // Checking if we already have ON_PIP_MODE_CHANGED subscription
1659
1634
  if (
1660
- !this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED]
1635
+ !this.emitterSubscriptions[
1636
+ HMSPIPListenerActions.ON_PIP_MODE_CHANGED
1637
+ ]
1661
1638
  ) {
1662
- const pipModeChangedSubscription = HMSNativeEventListener.addListener(
1663
- this.id,
1664
- HMSPIPListenerActions.ON_PIP_MODE_CHANGED,
1665
- this.onPIPModeChangedListener
1666
- );
1667
- this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED] =
1668
- pipModeChangedSubscription;
1639
+ const pipModeChangedSubscription =
1640
+ HMSNativeEventListener.addListener(
1641
+ this.id,
1642
+ HMSPIPListenerActions.ON_PIP_MODE_CHANGED,
1643
+ this.onPIPModeChangedListener
1644
+ );
1645
+ this.emitterSubscriptions[
1646
+ HMSPIPListenerActions.ON_PIP_MODE_CHANGED
1647
+ ] = pipModeChangedSubscription;
1669
1648
  }
1670
1649
  // Adding PIP mode changed Delegate listener
1671
1650
  this.onPIPModeChangedDelegate = callback;
@@ -2014,13 +1993,16 @@ export class HMSSDK {
2014
1993
  case HMSPIPListenerActions.ON_PIP_MODE_CHANGED: {
2015
1994
  if (Platform.OS === 'android') {
2016
1995
  const subscription =
2017
- this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED];
1996
+ this.emitterSubscriptions[
1997
+ HMSPIPListenerActions.ON_PIP_MODE_CHANGED
1998
+ ];
2018
1999
  // Removing ON_PIP_MODE_CHANGED native listener
2019
2000
  if (subscription) {
2020
2001
  subscription.remove();
2021
2002
 
2022
- this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED] =
2023
- undefined;
2003
+ this.emitterSubscriptions[
2004
+ HMSPIPListenerActions.ON_PIP_MODE_CHANGED
2005
+ ] = undefined;
2024
2006
  }
2025
2007
  // Removing App Delegate listener
2026
2008
  this.onPIPModeChangedDelegate = null;
@@ -2165,13 +2147,13 @@ export class HMSSDK {
2165
2147
  });
2166
2148
  this.onPeerDelegate({ peer, type });
2167
2149
  }
2168
- }
2150
+ };
2169
2151
 
2170
2152
  private sendPeerUpdateWhenPeerLeaves = (data: any, peer: any, type: any) => {
2171
2153
  this.sendPeerUpdate(peer, type);
2172
2154
 
2173
2155
  getHmsPeersCache()?.updatePeerCache(data.peer.peerID, data.peer, type);
2174
- }
2156
+ };
2175
2157
 
2176
2158
  onPeerListUpdatedListener = (data: any) => {
2177
2159
  if (data.id !== this.id) {
@@ -2203,14 +2185,6 @@ export class HMSSDK {
2203
2185
 
2204
2186
  getHmsPeersCache()?.updatePeerCache(data.peer.peerID, { track }, data.type);
2205
2187
 
2206
- if (
2207
- this.muteStatus &&
2208
- data?.type === 'TRACK_ADDED' &&
2209
- track.type === HMSTrackType.AUDIO
2210
- ) {
2211
- this.setPlaybackForAllAudio(this.muteStatus);
2212
- }
2213
-
2214
2188
  if (this.onTrackDelegate) {
2215
2189
  logger?.verbose('#Listener ON_TRACK_LISTENER_CALL', {
2216
2190
  peer,
@@ -2497,7 +2471,7 @@ export class HMSSDK {
2497
2471
 
2498
2472
  this.onPIPModeChangedDelegate(data);
2499
2473
  }
2500
- }
2474
+ };
2501
2475
 
2502
2476
  async isPipModeSupported(): Promise<undefined | boolean> {
2503
2477
  return HMSManager.handlePipActions('isPipModeSupported', { id: this.id });
@@ -1,7 +1,7 @@
1
1
  import { DeviceEventEmitter } from 'react-native';
2
2
  import type { EmitterSubscription as RNEmitterSubscription } from 'react-native';
3
3
 
4
- import HMSManager from './HMSManagerModule';
4
+ import HMSManager from '../modules/HMSManagerModule';
5
5
 
6
6
  import { HMSConstants } from './HMSConstants';
7
7
  import { getLogger } from './HMSLogger';
package/src/index.ts CHANGED
@@ -93,7 +93,7 @@ export type { HMSPIPConfig } from './classes/HMSPIPConfig';
93
93
  import { HMSSDK as HmsManager } from './classes/HMSSDK';
94
94
 
95
95
  // 100ms React Native Native Module
96
- export { default as HMSManagerModule } from './classes/HMSManagerModule';
96
+ export { default as HMSManagerModule } from './modules/HMSManagerModule';
97
97
 
98
98
  // 100ms Components
99
99
  export * from './components/HMSHLSPlayer';
@@ -102,6 +102,10 @@ export * from './components/HMSHLSPlayer';
102
102
  export * from './hooks/useHMSPeerUpdates';
103
103
  export { useHmsViewsResolutionsState } from './hooks/hmsviews';
104
104
 
105
+ // 100ms Utilities
106
+ export type { NotificationResult } from './utils/notification';
107
+ export { checkNotifications } from './utils/notification';
108
+
105
109
  // 100ms types
106
110
  export * from './types';
107
111
  export * from './stores/types';
@@ -0,0 +1,10 @@
1
+ import HMSManager from '../modules/HMSManagerModule';
2
+
3
+ export type NotificationResult = {
4
+ status: 'granted' | 'blocked';
5
+ settings: {};
6
+ };
7
+
8
+ export const checkNotifications = async (): Promise<NotificationResult> => {
9
+ return HMSManager.checkNotifications();
10
+ };
File without changes