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

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 (70) hide show
  1. package/lib/commonjs/components/Chat/ChatBanner.js +8 -7
  2. package/lib/commonjs/components/Chat/ChatBanner.js.map +1 -1
  3. package/lib/commonjs/components/CustomButton.js +2 -0
  4. package/lib/commonjs/components/CustomButton.js.map +1 -1
  5. package/lib/commonjs/components/DisplayView.js +1 -1
  6. package/lib/commonjs/components/DisplayView.js.map +1 -1
  7. package/lib/commonjs/components/HMSPreviewHLSLiveIndicator.js +2 -0
  8. package/lib/commonjs/components/HMSPreviewHLSLiveIndicator.js.map +1 -1
  9. package/lib/commonjs/components/MeetingScreenContent.js +2 -2
  10. package/lib/commonjs/components/MeetingScreenContent.js.map +1 -1
  11. package/lib/commonjs/components/MenuModal/MenuDivider.js +2 -0
  12. package/lib/commonjs/components/MenuModal/MenuDivider.js.map +1 -1
  13. package/lib/commonjs/components/VirtualBackgroundModalContent.js +1 -1
  14. package/lib/commonjs/components/VirtualBackgroundModalContent.js.map +1 -1
  15. package/lib/commonjs/components/WebrtcView.js +1 -1
  16. package/lib/commonjs/components/WebrtcView.js.map +1 -1
  17. package/lib/commonjs/hooks-util.js +23 -6
  18. package/lib/commonjs/hooks-util.js.map +1 -1
  19. package/lib/module/components/Chat/ChatBanner.js +2 -1
  20. package/lib/module/components/Chat/ChatBanner.js.map +1 -1
  21. package/lib/module/components/CustomButton.js +1 -0
  22. package/lib/module/components/CustomButton.js.map +1 -1
  23. package/lib/module/components/DisplayView.js +2 -2
  24. package/lib/module/components/DisplayView.js.map +1 -1
  25. package/lib/module/components/HMSPreviewHLSLiveIndicator.js +1 -0
  26. package/lib/module/components/HMSPreviewHLSLiveIndicator.js.map +1 -1
  27. package/lib/module/components/MeetingScreenContent.js +2 -2
  28. package/lib/module/components/MeetingScreenContent.js.map +1 -1
  29. package/lib/module/components/MenuModal/MenuDivider.js +1 -0
  30. package/lib/module/components/MenuModal/MenuDivider.js.map +1 -1
  31. package/lib/module/components/VirtualBackgroundModalContent.js +1 -1
  32. package/lib/module/components/VirtualBackgroundModalContent.js.map +1 -1
  33. package/lib/module/components/WebrtcView.js +2 -2
  34. package/lib/module/components/WebrtcView.js.map +1 -1
  35. package/lib/module/hooks-util.js +28 -14
  36. package/lib/module/hooks-util.js.map +1 -1
  37. package/lib/typescript/components/Chat/ChatBanner.d.ts +1 -1
  38. package/lib/typescript/components/Chat/ChatBanner.d.ts.map +1 -1
  39. package/lib/typescript/components/CustomButton.d.ts.map +1 -1
  40. package/lib/typescript/components/HMSPreviewHLSLiveIndicator.d.ts.map +1 -1
  41. package/lib/typescript/components/MenuModal/MenuDivider.d.ts.map +1 -1
  42. package/lib/typescript/components/Modals.d.ts +1 -1
  43. package/lib/typescript/components/Modals.d.ts.map +1 -1
  44. package/lib/typescript/hooks-sdk-selectors.d.ts +2 -2
  45. package/lib/typescript/hooks-sdk.d.ts.map +1 -1
  46. package/lib/typescript/hooks-util.d.ts +8 -9
  47. package/lib/typescript/hooks-util.d.ts.map +1 -1
  48. package/lib/typescript/redux/actions/index.d.ts +39 -39
  49. package/lib/typescript/redux/actions/index.d.ts.map +1 -1
  50. package/lib/typescript/redux/index.d.ts +13 -15
  51. package/lib/typescript/redux/index.d.ts.map +1 -1
  52. package/lib/typescript/redux/reducers/index.d.ts +13 -15
  53. package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
  54. package/lib/typescript/types.d.ts +0 -1
  55. package/lib/typescript/types.d.ts.map +1 -1
  56. package/lib/typescript/utils/dimension.d.ts.map +1 -1
  57. package/lib/typescript/utils/functions.d.ts +1 -1
  58. package/lib/typescript/utils/functions.d.ts.map +1 -1
  59. package/lib/typescript/utils/hooks.d.ts +2 -2
  60. package/lib/typescript/utils.d.ts.map +1 -1
  61. package/package.json +2 -2
  62. package/src/components/Chat/ChatBanner.tsx +2 -2
  63. package/src/components/CustomButton.tsx +1 -0
  64. package/src/components/DisplayView.tsx +2 -2
  65. package/src/components/HMSPreviewHLSLiveIndicator.tsx +1 -0
  66. package/src/components/MeetingScreenContent.tsx +2 -2
  67. package/src/components/MenuModal/MenuDivider.tsx +1 -0
  68. package/src/components/VirtualBackgroundModalContent.tsx +1 -1
  69. package/src/components/WebrtcView.tsx +2 -2
  70. package/src/hooks-util.ts +65 -41
@@ -24,7 +24,7 @@ import { OverlayContainer } from './OverlayContainer';
24
24
  import { OverlayedViews } from './OverlayedViews';
25
25
  import { useFooterHeight } from './Footer';
26
26
  import { useHeaderHeight } from './Header';
27
- import { View } from 'react-native';
27
+ import { Platform, View } from 'react-native';
28
28
  import { WebrtcTranscriptOverlayView } from './WebrtcTranscriptOverlayView';
29
29
 
30
30
  interface WebrtcViewProps {
@@ -111,7 +111,7 @@ export const WebrtcView = React.forwardRef<GridViewRefAttrs, WebrtcViewProps>(
111
111
  };
112
112
  }, [isPortrait, bottom]);
113
113
 
114
- if (isPipModeActive) {
114
+ if (isPipModeActive && Platform.OS === 'android') {
115
115
  return (
116
116
  <PIPView
117
117
  peerTrackNodes={peerTrackNodes}
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,
@@ -785,6 +785,7 @@ const useHMSTrackUpdate = (
785
785
  if (type === HMSTrackUpdate.TRACK_REMOVED) {
786
786
  if (track.source === HMSTrackSource.SCREEN) {
787
787
  if (!peer.isLocal && track.type === HMSTrackType.VIDEO) {
788
+ hmsInstance.setActiveSpeakerInIOSPIP(true);
788
789
  const screensharePeerTrackNodes =
789
790
  reduxState.app.screensharePeerTrackNodes;
790
791
  const nodeToRemove = screensharePeerTrackNodes.find(
@@ -1577,14 +1578,26 @@ export const useHMSNetworkQualityUpdate = () => {
1577
1578
  }, [hmsInstance]);
1578
1579
  };
1579
1580
 
1580
- export type PIPConfig = Omit<HMSPIPConfig, 'autoEnterPipMode'>;
1581
+ const pipConfig: HMSPIPConfig = {
1582
+ scaleType: HMSVideoViewMode.ASPECT_FILL,
1583
+ aspectRatio: [9, 16],
1584
+ autoEnterPipMode: true,
1585
+ useActiveSpeaker: true,
1586
+ endButton: false,
1587
+ audioButton: false,
1588
+ videoButton: false,
1589
+ };
1581
1590
 
1582
1591
  export const useEnableAutoPip = () => {
1583
1592
  const hmsInstance = useHMSInstance();
1584
1593
 
1585
1594
  const enableAutoPip = useCallback(
1586
- (data?: PIPConfig) => {
1587
- hmsInstance.setPipParams({ ...data, autoEnterPipMode: true });
1595
+ (data: HMSPIPConfig) => {
1596
+ hmsInstance.setPipParams({
1597
+ ...pipConfig,
1598
+ ...data,
1599
+ autoEnterPipMode: true,
1600
+ });
1588
1601
  },
1589
1602
  [hmsInstance]
1590
1603
  );
@@ -1596,8 +1609,12 @@ export const useDisableAutoPip = () => {
1596
1609
  const hmsInstance = useHMSInstance();
1597
1610
 
1598
1611
  const disableAutoPip = useCallback(
1599
- (data?: PIPConfig) => {
1600
- hmsInstance.setPipParams({ ...data, autoEnterPipMode: false });
1612
+ (data: HMSPIPConfig) => {
1613
+ hmsInstance.setPipParams({
1614
+ ...pipConfig,
1615
+ ...data,
1616
+ autoEnterPipMode: false,
1617
+ });
1601
1618
  },
1602
1619
  [hmsInstance]
1603
1620
  );
@@ -1621,9 +1638,14 @@ export const useAutoPip = (oneToOneCall: boolean) => {
1621
1638
 
1622
1639
  useEffect(() => {
1623
1640
  if (autoEnterPipMode && remotePeersPresent) {
1624
- enableAutoPip({ aspectRatio: [numerator, denominator] });
1641
+ enableAutoPip({
1642
+ scaleType: HMSVideoViewMode.ASPECT_FILL,
1643
+ aspectRatio: [numerator, denominator],
1644
+ });
1625
1645
 
1626
- return disableAutoPip;
1646
+ return () => {
1647
+ disableAutoPip({});
1648
+ };
1627
1649
  }
1628
1650
  }, [
1629
1651
  remotePeersPresent,
@@ -1651,7 +1673,7 @@ export const usePipAspectRatio = (oneToOneCall: boolean): [number, number] => {
1651
1673
  if (isHLSViewer && hlsPlayerResolution) {
1652
1674
  return [hlsPlayerResolution.width, hlsPlayerResolution.height];
1653
1675
  }
1654
- // When user is hlsviewer and we don't have stream resolution
1676
+ // When user is hlsviewer, and we don't have stream resolution
1655
1677
  if (isHLSViewer) {
1656
1678
  return [9, 16];
1657
1679
  }
@@ -1664,7 +1686,11 @@ export const usePipAspectRatio = (oneToOneCall: boolean): [number, number] => {
1664
1686
  return [9, 16];
1665
1687
  }
1666
1688
  // default aspect ratio
1667
- return [16, 9];
1689
+ return Platform.select({
1690
+ ios: [9, 16],
1691
+ android: [16, 9],
1692
+ default: [16, 9],
1693
+ });
1668
1694
  }, [
1669
1695
  isHLSViewer,
1670
1696
  firstSSNodeId,
@@ -2719,9 +2745,7 @@ export const useSavePropsToStore = (
2719
2745
  }, [handleBackButton]);
2720
2746
 
2721
2747
  useEffect(() => {
2722
- if (Platform.OS === 'android') {
2723
- dispatch(setAutoEnterPipMode(autoEnterPipMode));
2724
- }
2748
+ dispatch(setAutoEnterPipMode(autoEnterPipMode));
2725
2749
  }, [autoEnterPipMode]);
2726
2750
  };
2727
2751