@100mslive/react-native-room-kit 1.2.0 → 1.2.2

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 (120) hide show
  1. package/README.md +5 -4
  2. package/lib/commonjs/HMSInstanceSetup.js +2 -1
  3. package/lib/commonjs/HMSInstanceSetup.js.map +1 -1
  4. package/lib/commonjs/HMSRoomSetup.js +31 -1
  5. package/lib/commonjs/HMSRoomSetup.js.map +1 -1
  6. package/lib/commonjs/components/Chat/ChatBanner.js +8 -7
  7. package/lib/commonjs/components/Chat/ChatBanner.js.map +1 -1
  8. package/lib/commonjs/components/CustomButton.js +2 -0
  9. package/lib/commonjs/components/CustomButton.js.map +1 -1
  10. package/lib/commonjs/components/DisplayView.js +1 -1
  11. package/lib/commonjs/components/DisplayView.js.map +1 -1
  12. package/lib/commonjs/components/HMSManageNoiseCancellation.js +11 -0
  13. package/lib/commonjs/components/HMSManageNoiseCancellation.js.map +1 -1
  14. package/lib/commonjs/components/HMSPreviewHLSLiveIndicator.js +2 -0
  15. package/lib/commonjs/components/HMSPreviewHLSLiveIndicator.js.map +1 -1
  16. package/lib/commonjs/components/MeetingScreenContent.js +13 -2
  17. package/lib/commonjs/components/MeetingScreenContent.js.map +1 -1
  18. package/lib/commonjs/components/MenuModal/MenuDivider.js +2 -0
  19. package/lib/commonjs/components/MenuModal/MenuDivider.js.map +1 -1
  20. package/lib/commonjs/components/Modals.js +45 -24
  21. package/lib/commonjs/components/Modals.js.map +1 -1
  22. package/lib/commonjs/components/Participants/ParticipantsItemOptions.js +26 -0
  23. package/lib/commonjs/components/Participants/ParticipantsItemOptions.js.map +1 -1
  24. package/lib/commonjs/components/PeerSettingsModalContent.js +13 -1
  25. package/lib/commonjs/components/PeerSettingsModalContent.js.map +1 -1
  26. package/lib/commonjs/components/RoomSettingsModalContent.js +1 -1
  27. package/lib/commonjs/components/VirtualBackgroundModalContent.js +1 -1
  28. package/lib/commonjs/components/VirtualBackgroundModalContent.js.map +1 -1
  29. package/lib/commonjs/components/WebrtcView.js +1 -1
  30. package/lib/commonjs/components/WebrtcView.js.map +1 -1
  31. package/lib/commonjs/components/styles.js +1 -0
  32. package/lib/commonjs/components/styles.js.map +1 -1
  33. package/lib/commonjs/hooks-util.js +48 -21
  34. package/lib/commonjs/hooks-util.js.map +1 -1
  35. package/lib/commonjs/utils.js +2 -2
  36. package/lib/module/HMSInstanceSetup.js +2 -1
  37. package/lib/module/HMSInstanceSetup.js.map +1 -1
  38. package/lib/module/HMSRoomSetup.js +32 -2
  39. package/lib/module/HMSRoomSetup.js.map +1 -1
  40. package/lib/module/components/Chat/ChatBanner.js +2 -1
  41. package/lib/module/components/Chat/ChatBanner.js.map +1 -1
  42. package/lib/module/components/CustomButton.js +1 -0
  43. package/lib/module/components/CustomButton.js.map +1 -1
  44. package/lib/module/components/DisplayView.js +2 -2
  45. package/lib/module/components/DisplayView.js.map +1 -1
  46. package/lib/module/components/HMSManageNoiseCancellation.js +11 -0
  47. package/lib/module/components/HMSManageNoiseCancellation.js.map +1 -1
  48. package/lib/module/components/HMSPreviewHLSLiveIndicator.js +1 -0
  49. package/lib/module/components/HMSPreviewHLSLiveIndicator.js.map +1 -1
  50. package/lib/module/components/MeetingScreenContent.js +14 -3
  51. package/lib/module/components/MeetingScreenContent.js.map +1 -1
  52. package/lib/module/components/MenuModal/MenuDivider.js +1 -0
  53. package/lib/module/components/MenuModal/MenuDivider.js.map +1 -1
  54. package/lib/module/components/Modals.js +47 -25
  55. package/lib/module/components/Modals.js.map +1 -1
  56. package/lib/module/components/Participants/ParticipantsItemOptions.js +28 -2
  57. package/lib/module/components/Participants/ParticipantsItemOptions.js.map +1 -1
  58. package/lib/module/components/PeerSettingsModalContent.js +14 -2
  59. package/lib/module/components/PeerSettingsModalContent.js.map +1 -1
  60. package/lib/module/components/RoomSettingsModalContent.js +1 -1
  61. package/lib/module/components/VirtualBackgroundModalContent.js +1 -1
  62. package/lib/module/components/VirtualBackgroundModalContent.js.map +1 -1
  63. package/lib/module/components/WebrtcView.js +2 -2
  64. package/lib/module/components/WebrtcView.js.map +1 -1
  65. package/lib/module/components/styles.js +1 -0
  66. package/lib/module/components/styles.js.map +1 -1
  67. package/lib/module/hooks-util.js +53 -29
  68. package/lib/module/hooks-util.js.map +1 -1
  69. package/lib/module/utils.js +2 -2
  70. package/lib/typescript/HMSInstanceSetup.d.ts.map +1 -1
  71. package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
  72. package/lib/typescript/components/Chat/ChatBanner.d.ts +1 -1
  73. package/lib/typescript/components/Chat/ChatBanner.d.ts.map +1 -1
  74. package/lib/typescript/components/CustomButton.d.ts.map +1 -1
  75. package/lib/typescript/components/HMSManageNoiseCancellation.d.ts.map +1 -1
  76. package/lib/typescript/components/HMSPreviewHLSLiveIndicator.d.ts.map +1 -1
  77. package/lib/typescript/components/MeetingScreenContent.d.ts.map +1 -1
  78. package/lib/typescript/components/MenuModal/MenuDivider.d.ts.map +1 -1
  79. package/lib/typescript/components/Modals.d.ts +1 -1
  80. package/lib/typescript/components/Modals.d.ts.map +1 -1
  81. package/lib/typescript/components/Participants/ParticipantsItemOptions.d.ts.map +1 -1
  82. package/lib/typescript/components/PeerSettingsModalContent.d.ts.map +1 -1
  83. package/lib/typescript/components/styles.d.ts +1 -0
  84. package/lib/typescript/components/styles.d.ts.map +1 -1
  85. package/lib/typescript/hooks-sdk-selectors.d.ts +2 -2
  86. package/lib/typescript/hooks-sdk.d.ts.map +1 -1
  87. package/lib/typescript/hooks-util.d.ts +8 -9
  88. package/lib/typescript/hooks-util.d.ts.map +1 -1
  89. package/lib/typescript/redux/actions/index.d.ts +39 -39
  90. package/lib/typescript/redux/actions/index.d.ts.map +1 -1
  91. package/lib/typescript/redux/index.d.ts +13 -15
  92. package/lib/typescript/redux/index.d.ts.map +1 -1
  93. package/lib/typescript/redux/reducers/index.d.ts +13 -15
  94. package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
  95. package/lib/typescript/types.d.ts +0 -1
  96. package/lib/typescript/types.d.ts.map +1 -1
  97. package/lib/typescript/utils/dimension.d.ts.map +1 -1
  98. package/lib/typescript/utils/functions.d.ts +1 -1
  99. package/lib/typescript/utils/functions.d.ts.map +1 -1
  100. package/lib/typescript/utils/hooks.d.ts +2 -2
  101. package/lib/typescript/utils.d.ts.map +1 -1
  102. package/package.json +3 -3
  103. package/src/HMSInstanceSetup.tsx +2 -1
  104. package/src/HMSRoomSetup.tsx +49 -2
  105. package/src/components/Chat/ChatBanner.tsx +2 -2
  106. package/src/components/CustomButton.tsx +1 -0
  107. package/src/components/DisplayView.tsx +2 -2
  108. package/src/components/HMSManageNoiseCancellation.tsx +15 -0
  109. package/src/components/HMSPreviewHLSLiveIndicator.tsx +1 -0
  110. package/src/components/MeetingScreenContent.tsx +23 -3
  111. package/src/components/MenuModal/MenuDivider.tsx +1 -0
  112. package/src/components/Modals.tsx +56 -31
  113. package/src/components/Participants/ParticipantsItemOptions.tsx +28 -1
  114. package/src/components/PeerSettingsModalContent.tsx +17 -1
  115. package/src/components/RoomSettingsModalContent.tsx +1 -1
  116. package/src/components/VirtualBackgroundModalContent.tsx +1 -1
  117. package/src/components/WebrtcView.tsx +2 -2
  118. package/src/components/styles.ts +1 -0
  119. package/src/hooks-util.ts +89 -48
  120. package/src/utils.ts +2 -2
package/src/hooks-util.ts CHANGED
@@ -1,12 +1,24 @@
1
+ import type {
2
+ HMSHLSPlayer,
3
+ HMSPIPConfig,
4
+ HMSRole,
5
+ HMSSessionStore,
6
+ HMSSpeaker,
7
+ JsonValue,
8
+ } from '@100mslive/react-native-hms';
1
9
  import {
10
+ getSoftInputMode,
2
11
  HMSChangeTrackStateRequest,
3
12
  HMSConfig,
13
+ HMSHLSPlayerPlaybackState,
4
14
  HMSLocalPeer,
5
15
  HMSMessage,
16
+ HMSMessageRecipient,
6
17
  HMSMessageRecipientType,
7
- HMSPIPListenerActions,
8
18
  HMSPeer,
9
19
  HMSPeerUpdate,
20
+ HMSPIPListenerActions,
21
+ HMSPollUpdateType,
10
22
  HMSRoleChangeRequest,
11
23
  HMSRoom,
12
24
  HMSRoomUpdate,
@@ -16,29 +28,18 @@ import {
16
28
  HMSTrackType,
17
29
  HMSTrackUpdate,
18
30
  HMSUpdateListenerActions,
19
- HMSMessageRecipient,
20
- useHMSHLSPlayerResolution,
21
- useHmsViewsResolutionsState,
31
+ HMSVideoViewMode,
22
32
  setSoftInputMode,
23
- getSoftInputMode,
24
- WindowController,
25
- useHMSHLSPlayerCue,
26
- HMSPollUpdateType,
27
- useHMSHLSPlayerPlaybackState,
28
- HMSHLSPlayerPlaybackState,
33
+ SoftInputModes,
29
34
  TranscriptionsMode,
30
35
  TranscriptionState,
36
+ useHMSHLSPlayerCue,
37
+ useHMSHLSPlayerPlaybackState,
38
+ useHMSHLSPlayerResolution,
39
+ useHmsViewsResolutionsState,
40
+ WindowController,
31
41
  } from '@100mslive/react-native-hms';
32
42
  import type { Chat as ChatConfig } from '@100mslive/types-prebuilt/elements/chat';
33
- import { SoftInputModes } from '@100mslive/react-native-hms';
34
- import type {
35
- HMSHLSPlayer,
36
- HMSPIPConfig,
37
- HMSRole,
38
- HMSSessionStore,
39
- HMSSpeaker,
40
- JsonValue,
41
- } from '@100mslive/react-native-hms';
42
43
  import type {
43
44
  ColorPalette,
44
45
  DefaultConferencingScreen,
@@ -48,25 +49,25 @@ import type {
48
49
  Typography,
49
50
  } from '@100mslive/types-prebuilt';
50
51
  import Toast from 'react-native-simple-toast';
52
+ import type { DependencyList } from 'react';
51
53
  import {
52
- useRef,
53
54
  useCallback,
55
+ useContext,
54
56
  useEffect,
55
- useState,
56
57
  useMemo,
57
- useContext,
58
+ useRef,
59
+ useState,
58
60
  } from 'react';
59
- import type { DependencyList } from 'react';
60
61
 
62
+ import type { OnLeaveHandler, PeerTrackNode } from './utils/types';
61
63
  import {
64
+ ChatBroadcastFilter,
62
65
  MaxTilesInOnePage,
63
66
  ModalTypes,
64
67
  OnLeaveReason,
65
68
  PeerListRefreshInterval,
66
69
  PipModes,
67
70
  } from './utils/types';
68
- import { ChatBroadcastFilter } from './utils/types';
69
- import type { OnLeaveHandler, PeerTrackNode } from './utils/types';
70
71
  import { createPeerTrackNode, parseMetadata } from './utils/functions';
71
72
  import {
72
73
  batch,
@@ -104,10 +105,10 @@ import {
104
105
  setChatState,
105
106
  setEditUsernameDisabled,
106
107
  setFullScreenPeerTrackNode,
108
+ setHandleBackButton,
107
109
  setHMSLocalPeerState,
108
110
  setHMSRoleState,
109
111
  setHMSRoomState,
110
- setHandleBackButton,
111
112
  setIsLocalAudioMutedState,
112
113
  setIsLocalVideoMutedState,
113
114
  setLayoutConfig,
@@ -134,15 +135,15 @@ import {
134
135
  replacePeerTrackNodes,
135
136
  replacePeerTrackNodesWithTrack,
136
137
  } from './peerTrackNodeUtils';
137
- import { MeetingState } from './types';
138
138
  import type { ChatState, HMSPrebuiltProps, PinnedMessage } from './types';
139
+ import { MeetingState, NotificationTypes } from './types';
140
+ import type { ImageStyle, StyleProp, TextStyle, ViewStyle } from 'react-native';
139
141
  import {
140
142
  BackHandler,
141
143
  InteractionManager,
142
144
  Keyboard,
143
145
  Platform,
144
146
  } from 'react-native';
145
- import type { ImageStyle, StyleProp, ViewStyle, TextStyle } from 'react-native';
146
147
  import { NavigationContext } from '@react-navigation/native';
147
148
  import {
148
149
  useIsLandscapeOrientation,
@@ -159,7 +160,6 @@ import {
159
160
  import type { GridViewRefAttrs } from './components/GridView';
160
161
  import { getRoomLayout } from './modules/HMSManager';
161
162
  import { DEFAULT_THEME, DEFAULT_TYPOGRAPHY } from './utils/theme';
162
- import { NotificationTypes } from './types';
163
163
  import { KeyboardState, useSharedValue } from 'react-native-reanimated';
164
164
  import {
165
165
  useCanPublishAudio,
@@ -217,9 +217,10 @@ const useHMSRoomUpdate = (hmsInstance: HMSSDK) => {
217
217
  if (captionTranscription?.state === TranscriptionState.STARTED) {
218
218
  batch(() => {
219
219
  dispatch(removeNotification('enable-cc'));
220
+ dispatch(removeNotification('TranscriptionState.STARTED'));
220
221
  dispatch(
221
222
  addNotification({
222
- id: Math.random().toString(16).slice(2),
223
+ id: 'TranscriptionState.STARTED',
223
224
  type: NotificationTypes.INFO,
224
225
  icon: 'cc',
225
226
  title: 'Closed Captioning enabled for everyone',
@@ -287,6 +288,8 @@ const useHMSPeersUpdate = (
287
288
  // );
288
289
  const hmsActions = useHMSActions();
289
290
 
291
+ const isFirstRunForRoleChangeModal = useRef(true);
292
+
290
293
  useEffect(() => {
291
294
  const peerUpdateHandler = ({ peer, type }: PeerUpdate) => {
292
295
  // Handle State from Preview screen
@@ -428,6 +431,18 @@ const useHMSPeersUpdate = (
428
431
  .catch((e) => {
429
432
  console.log('Metadata change failed', e);
430
433
  });
434
+
435
+ if (isFirstRunForRoleChangeModal.current) {
436
+ isFirstRunForRoleChangeModal.current = false;
437
+ } else {
438
+ dispatch(
439
+ addNotification({
440
+ id: Math.random().toString(16).slice(2),
441
+ type: NotificationTypes.INFO,
442
+ title: `You are now a ${peer.role?.name}`,
443
+ })
444
+ );
445
+ }
431
446
  }
432
447
  }
433
448
  return;
@@ -785,6 +800,7 @@ const useHMSTrackUpdate = (
785
800
  if (type === HMSTrackUpdate.TRACK_REMOVED) {
786
801
  if (track.source === HMSTrackSource.SCREEN) {
787
802
  if (!peer.isLocal && track.type === HMSTrackType.VIDEO) {
803
+ hmsInstance.setActiveSpeakerInIOSPIP(true);
788
804
  const screensharePeerTrackNodes =
789
805
  reduxState.app.screensharePeerTrackNodes;
790
806
  const nodeToRemove = screensharePeerTrackNodes.find(
@@ -1577,32 +1593,50 @@ export const useHMSNetworkQualityUpdate = () => {
1577
1593
  }, [hmsInstance]);
1578
1594
  };
1579
1595
 
1580
- export type PIPConfig = Omit<HMSPIPConfig, 'autoEnterPipMode'>;
1596
+ const pipConfig: HMSPIPConfig = {
1597
+ scaleType: HMSVideoViewMode.ASPECT_FILL,
1598
+ aspectRatio: [9, 16],
1599
+ autoEnterPipMode: true,
1600
+ useActiveSpeaker: true,
1601
+ endButton: false,
1602
+ audioButton: false,
1603
+ videoButton: false,
1604
+ };
1581
1605
 
1582
1606
  export const useEnableAutoPip = () => {
1583
1607
  const hmsInstance = useHMSInstance();
1584
1608
 
1585
- const enableAutoPip = useCallback(
1586
- (data?: PIPConfig) => {
1587
- hmsInstance.setPipParams({ ...data, autoEnterPipMode: true });
1609
+ return useCallback(
1610
+ (data: HMSPIPConfig) => {
1611
+ hmsInstance
1612
+ .setPipParams({
1613
+ ...pipConfig,
1614
+ ...data,
1615
+ autoEnterPipMode: true,
1616
+ })
1617
+ .then((r) => console.log('Enable Auto PIP: ', r))
1618
+ .catch((e) => console.log('Enable Auto PIP Error: ', e));
1588
1619
  },
1589
1620
  [hmsInstance]
1590
1621
  );
1591
-
1592
- return enableAutoPip;
1593
1622
  };
1594
1623
 
1595
1624
  export const useDisableAutoPip = () => {
1596
1625
  const hmsInstance = useHMSInstance();
1597
1626
 
1598
- const disableAutoPip = useCallback(
1599
- (data?: PIPConfig) => {
1600
- hmsInstance.setPipParams({ ...data, autoEnterPipMode: false });
1627
+ return useCallback(
1628
+ (data: HMSPIPConfig) => {
1629
+ hmsInstance
1630
+ .setPipParams({
1631
+ ...pipConfig,
1632
+ ...data,
1633
+ autoEnterPipMode: false,
1634
+ })
1635
+ .then((r) => console.log('Disable Auto PIP: ', r))
1636
+ .catch((e) => console.log('Disable Auto PIP Error: ', e));
1601
1637
  },
1602
1638
  [hmsInstance]
1603
1639
  );
1604
-
1605
- return disableAutoPip;
1606
1640
  };
1607
1641
 
1608
1642
  export const useAutoPip = (oneToOneCall: boolean) => {
@@ -1621,9 +1655,14 @@ export const useAutoPip = (oneToOneCall: boolean) => {
1621
1655
 
1622
1656
  useEffect(() => {
1623
1657
  if (autoEnterPipMode && remotePeersPresent) {
1624
- enableAutoPip({ aspectRatio: [numerator, denominator] });
1658
+ enableAutoPip({
1659
+ scaleType: HMSVideoViewMode.ASPECT_FILL,
1660
+ aspectRatio: [numerator, denominator],
1661
+ });
1625
1662
 
1626
- return disableAutoPip;
1663
+ return () => {
1664
+ disableAutoPip({});
1665
+ };
1627
1666
  }
1628
1667
  }, [
1629
1668
  remotePeersPresent,
@@ -1651,7 +1690,7 @@ export const usePipAspectRatio = (oneToOneCall: boolean): [number, number] => {
1651
1690
  if (isHLSViewer && hlsPlayerResolution) {
1652
1691
  return [hlsPlayerResolution.width, hlsPlayerResolution.height];
1653
1692
  }
1654
- // When user is hlsviewer and we don't have stream resolution
1693
+ // When user is hlsviewer, and we don't have stream resolution
1655
1694
  if (isHLSViewer) {
1656
1695
  return [9, 16];
1657
1696
  }
@@ -1664,7 +1703,11 @@ export const usePipAspectRatio = (oneToOneCall: boolean): [number, number] => {
1664
1703
  return [9, 16];
1665
1704
  }
1666
1705
  // default aspect ratio
1667
- return [16, 9];
1706
+ return Platform.select({
1707
+ ios: [9, 16],
1708
+ android: [16, 9],
1709
+ default: [16, 9],
1710
+ });
1668
1711
  }, [
1669
1712
  isHLSViewer,
1670
1713
  firstSSNodeId,
@@ -2719,9 +2762,7 @@ export const useSavePropsToStore = (
2719
2762
  }, [handleBackButton]);
2720
2763
 
2721
2764
  useEffect(() => {
2722
- if (Platform.OS === 'android') {
2723
- dispatch(setAutoEnterPipMode(autoEnterPipMode));
2724
- }
2765
+ dispatch(setAutoEnterPipMode(autoEnterPipMode));
2725
2766
  }, [autoEnterPipMode]);
2726
2767
  };
2727
2768
 
package/src/utils.ts CHANGED
@@ -4,8 +4,8 @@ const DEFAULT_JOINING_CONFIG = {
4
4
  mutedAudio: true,
5
5
  mutedVideo: true,
6
6
  skipPreview: false,
7
- audioMixer: false, // IOS only
8
- musicMode: false, // IOS only
7
+ audioMixer: false, // iOS only
8
+ musicMode: false, // iOS only
9
9
  softwareDecoder: true, // Android only
10
10
  autoResize: false, // Android only
11
11
  };