@100mslive/roomkit-react 0.1.6-alpha.0 → 0.1.6-alpha.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. package/dist/{HLSView-PY2FKWX3.js → HLSView-QMU5JK7U.js} +208 -118
  2. package/dist/HLSView-QMU5JK7U.js.map +7 -0
  3. package/dist/Prebuilt/AppContext.d.ts +1 -1
  4. package/dist/Prebuilt/components/Chat/ChatFooter.d.ts +7 -0
  5. package/dist/Prebuilt/components/Connection/ConnectionIndicator.d.ts +6 -0
  6. package/dist/Prebuilt/components/Connection/TileConnection.d.ts +10 -0
  7. package/dist/Prebuilt/components/Footer/ChatToggle.d.ts +2 -0
  8. package/dist/Prebuilt/components/Footer/RoleAccordion.d.ts +14 -0
  9. package/dist/Prebuilt/components/Footer/RoleOptions.d.ts +6 -0
  10. package/dist/Prebuilt/components/Header/StreamActions.d.ts +11 -0
  11. package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +4 -3
  12. package/dist/Prebuilt/components/Leave/EndSessionContent.d.ts +4 -3
  13. package/dist/Prebuilt/components/Leave/LeaveCard.d.ts +1 -2
  14. package/dist/Prebuilt/components/Leave/LeaveSessionContent.d.ts +3 -1
  15. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +4 -3
  16. package/dist/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.d.ts +6 -0
  17. package/dist/Prebuilt/components/Preview/PreviewContainer.d.ts +3 -0
  18. package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +16 -0
  19. package/dist/Prebuilt/components/RoleChangeRequestModal.d.ts +2 -0
  20. package/dist/Prebuilt/components/SecondaryTiles.d.ts +1 -1
  21. package/dist/Prebuilt/components/SidePaneTabs.d.ts +7 -0
  22. package/dist/Prebuilt/components/VideoLayouts/EqualProminence.d.ts +1 -1
  23. package/dist/Prebuilt/components/VideoLayouts/Grid.d.ts +1 -0
  24. package/dist/Prebuilt/components/VideoLayouts/GridLayout.d.ts +5 -3
  25. package/dist/Prebuilt/components/VideoLayouts/ProminenceLayout.d.ts +6 -3
  26. package/dist/Prebuilt/components/VideoLayouts/RoleProminence.d.ts +1 -1
  27. package/dist/Prebuilt/components/VideoLayouts/ScreenshareLayout.d.ts +1 -1
  28. package/dist/Prebuilt/components/VideoLayouts/interface.d.ts +1 -0
  29. package/dist/Prebuilt/components/hooks/useAutoStartStreaming.d.ts +1 -0
  30. package/dist/Prebuilt/components/hooks/useRedirectToLeave.d.ts +3 -0
  31. package/dist/Prebuilt/components/hooks/useTileLayout.d.ts +2 -1
  32. package/dist/Prebuilt/components/hooks/useVideoTileLayout.d.ts +2 -0
  33. package/dist/Prebuilt/layouts/SidePane.d.ts +4 -1
  34. package/dist/Prebuilt/layouts/VideoStreamingSection.d.ts +2 -1
  35. package/dist/{VirtualBackground-AYDHYLIZ.js → VirtualBackground-37FXUPYO.js} +6 -6
  36. package/dist/VirtualBackground-37FXUPYO.js.map +7 -0
  37. package/dist/{chunk-GQD2AGWW.js → chunk-KBVIZGYW.js} +12 -2
  38. package/dist/{chunk-GQD2AGWW.js.map → chunk-KBVIZGYW.js.map} +2 -2
  39. package/dist/{chunk-RXTHJUMZ.js → chunk-WVGGQZK4.js} +986 -436
  40. package/dist/chunk-WVGGQZK4.js.map +7 -0
  41. package/dist/{chunk-E2M2ZSOL.js → chunk-ZKE2N5LH.js} +2 -2
  42. package/dist/{conference-V2XZGTKU.js → conference-FJJQ4TXX.js} +1136 -1301
  43. package/dist/conference-FJJQ4TXX.js.map +7 -0
  44. package/dist/index.cjs.js +3565 -3092
  45. package/dist/index.cjs.js.map +4 -4
  46. package/dist/index.js +2 -2
  47. package/dist/meta.cjs.json +773 -525
  48. package/dist/meta.esbuild.json +833 -579
  49. package/package.json +8 -7
  50. package/src/Prebuilt/App.tsx +10 -21
  51. package/src/Prebuilt/AppContext.tsx +1 -1
  52. package/src/Prebuilt/IconButton.jsx +10 -0
  53. package/src/Prebuilt/common/PeersSorter.ts +1 -1
  54. package/src/Prebuilt/common/constants.js +1 -2
  55. package/src/Prebuilt/common/utils.js +1 -1
  56. package/src/Prebuilt/components/AppData/AppData.jsx +8 -2
  57. package/src/Prebuilt/components/AppData/useUISettings.js +6 -6
  58. package/src/Prebuilt/components/AudioVideoToggle.jsx +8 -6
  59. package/src/Prebuilt/components/Chat/Chat.jsx +24 -11
  60. package/src/Prebuilt/components/Chat/ChatBody.jsx +20 -21
  61. package/src/Prebuilt/components/Chat/{ChatFooter.jsx → ChatFooter.tsx} +38 -13
  62. package/src/Prebuilt/components/Chat/useEmojiPickerStyles.js +5 -4
  63. package/src/Prebuilt/components/Connection/{ConnectionIndicator.jsx → ConnectionIndicator.tsx} +12 -4
  64. package/src/Prebuilt/components/Connection/{TileConnection.jsx → TileConnection.tsx} +20 -6
  65. package/src/Prebuilt/components/EmojiReaction.jsx +2 -6
  66. package/src/Prebuilt/components/Footer/{ChatToggle.jsx → ChatToggle.tsx} +4 -1
  67. package/src/Prebuilt/components/Footer/Footer.tsx +30 -5
  68. package/src/Prebuilt/components/Footer/ParticipantList.jsx +15 -49
  69. package/src/Prebuilt/components/Footer/{RoleAccordion.jsx → RoleAccordion.tsx} +33 -17
  70. package/src/Prebuilt/components/Footer/RoleOptions.tsx +155 -0
  71. package/src/Prebuilt/components/FullPageProgress.jsx +3 -3
  72. package/src/Prebuilt/components/HMSVideo/Controls.jsx +1 -0
  73. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +39 -17
  74. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +2 -2
  75. package/src/Prebuilt/components/HMSVideo/VideoProgress.jsx +5 -6
  76. package/src/Prebuilt/components/HMSVideo/VolumeControl.jsx +1 -1
  77. package/src/Prebuilt/components/Header/HeaderComponents.jsx +8 -1
  78. package/src/Prebuilt/components/Header/{StreamActions.jsx → StreamActions.tsx} +23 -9
  79. package/src/Prebuilt/components/Header/common.jsx +5 -2
  80. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +6 -1
  81. package/src/Prebuilt/components/InsetTile.tsx +15 -8
  82. package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +21 -11
  83. package/src/Prebuilt/components/Leave/EndSessionContent.tsx +2 -5
  84. package/src/Prebuilt/components/Leave/LeaveCard.tsx +1 -3
  85. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +28 -25
  86. package/src/Prebuilt/components/Leave/LeaveSessionContent.tsx +8 -2
  87. package/src/Prebuilt/components/Leave/MwebLeaveRoom.tsx +8 -8
  88. package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +4 -0
  89. package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +1 -1
  90. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +9 -23
  91. package/src/Prebuilt/components/MoreSettings/SplitComponents/{MwebOptions.jsx → MwebOptions.tsx} +89 -28
  92. package/src/Prebuilt/components/Notifications/Notifications.jsx +44 -28
  93. package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +5 -11
  94. package/src/Prebuilt/components/Pagination.tsx +14 -12
  95. package/src/Prebuilt/components/Preview/{PreviewContainer.jsx → PreviewContainer.tsx} +11 -2
  96. package/src/Prebuilt/components/Preview/PreviewForm.tsx +6 -8
  97. package/src/Prebuilt/components/Preview/{PreviewJoin.jsx → PreviewJoin.tsx} +44 -21
  98. package/src/Prebuilt/components/{RoleChangeRequestModal.jsx → RoleChangeRequestModal.tsx} +36 -17
  99. package/src/Prebuilt/components/ScreenshareTile.jsx +6 -7
  100. package/src/Prebuilt/components/SecondaryTiles.tsx +12 -10
  101. package/src/Prebuilt/components/SidePaneTabs.tsx +120 -0
  102. package/src/Prebuilt/components/TileMenu/TileMenu.jsx +1 -1
  103. package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +14 -10
  104. package/src/Prebuilt/components/Toast/ToastConfig.jsx +5 -4
  105. package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +13 -10
  106. package/src/Prebuilt/components/VideoLayouts/Grid.tsx +36 -34
  107. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +33 -15
  108. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +45 -31
  109. package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +12 -9
  110. package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +25 -9
  111. package/src/Prebuilt/components/VideoLayouts/interface.ts +1 -0
  112. package/src/Prebuilt/components/VideoTile.jsx +45 -53
  113. package/src/Prebuilt/components/conference.jsx +71 -74
  114. package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +57 -0
  115. package/src/Prebuilt/components/hooks/useMetadata.jsx +19 -28
  116. package/src/Prebuilt/components/hooks/useRedirectToLeave.tsx +34 -0
  117. package/src/Prebuilt/components/hooks/useRoleProminencePeers.tsx +1 -1
  118. package/src/Prebuilt/components/hooks/useTileLayout.tsx +24 -18
  119. package/src/Prebuilt/components/hooks/useVideoTileLayout.ts +4 -0
  120. package/src/Prebuilt/layouts/EmbedView.jsx +1 -11
  121. package/src/Prebuilt/layouts/HLSView.jsx +152 -82
  122. package/src/Prebuilt/layouts/SidePane.tsx +25 -11
  123. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +11 -47
  124. package/src/Prebuilt/plugins/FlyingEmoji.jsx +14 -2
  125. package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +3 -3
  126. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.ts +2 -2
  127. package/src/Prebuilt/services/FeatureFlags.jsx +0 -1
  128. package/src/VideoTile/StyledVideoTile.tsx +1 -0
  129. package/dist/HLSView-PY2FKWX3.js.map +0 -7
  130. package/dist/VirtualBackground-AYDHYLIZ.js.map +0 -7
  131. package/dist/chunk-RXTHJUMZ.js.map +0 -7
  132. package/dist/conference-V2XZGTKU.js.map +0 -7
  133. package/src/Prebuilt/components/AudioLevel/BeamSpeakerLabelsLogging.jsx +0 -16
  134. package/src/Prebuilt/components/Chat/ChatParticipantHeader.jsx +0 -73
  135. package/src/Prebuilt/components/VideoList.jsx +0 -73
  136. /package/dist/{chunk-E2M2ZSOL.js.map → chunk-ZKE2N5LH.js.map} +0 -0
@@ -1,5 +1,7 @@
1
1
  import React, { useEffect, useMemo, useState } from 'react';
2
+ import { useMedia } from 'react-use';
2
3
  import { selectPeersScreenSharing, useHMSStore } from '@100mslive/react-sdk';
4
+ import { config as cssConfig } from '../../../Theme';
3
5
  import { Pagination } from '../Pagination';
4
6
  // @ts-ignore: No implicit Any
5
7
  import ScreenshareTile from '../ScreenshareTile';
@@ -11,26 +13,40 @@ import { useSetAppDataByKey } from '../AppData/useUISettings';
11
13
  // @ts-ignore: No implicit Any
12
14
  import { APP_DATA } from '../../common/constants';
13
15
 
14
- export const ScreenshareLayout = ({ peers, onPageChange, onPageSize }: LayoutProps) => {
16
+ export const ScreenshareLayout = ({ peers, onPageChange, onPageSize, edgeToEdge }: LayoutProps) => {
15
17
  const peersSharing = useHMSStore(selectPeersScreenSharing);
16
18
  const [, setActiveScreenSharePeer] = useSetAppDataByKey(APP_DATA.activeScreensharePeerId);
17
19
  const [page, setPage] = useState(0);
18
- const activeSharePeerId = peersSharing[page]?.id;
19
- const secondaryPeers = useMemo(() => peers.filter(p => p.id !== activeSharePeerId), [activeSharePeerId, peers]);
20
+ const activeSharePeer = peersSharing[page];
21
+ const isMobile = useMedia(cssConfig.media.md);
22
+ const secondaryPeers = useMemo(
23
+ () =>
24
+ isMobile
25
+ ? activeSharePeer
26
+ ? [activeSharePeer, ...peers.filter(p => p.id !== activeSharePeer?.id)]
27
+ : peers //keep active sharing peer as first tile
28
+ : peers.filter(p => p.id !== activeSharePeer?.id),
29
+ [activeSharePeer, peers, isMobile],
30
+ );
20
31
  useEffect(() => {
21
- setActiveScreenSharePeer(activeSharePeerId);
32
+ setActiveScreenSharePeer(isMobile ? '' : activeSharePeer?.id);
22
33
  return () => {
23
34
  setActiveScreenSharePeer('');
24
35
  };
25
- }, [activeSharePeerId, setActiveScreenSharePeer]);
36
+ }, [activeSharePeer?.id, isMobile, setActiveScreenSharePeer]);
26
37
 
27
38
  return (
28
- <ProminenceLayout.Root>
39
+ <ProminenceLayout.Root edgeToEdge={edgeToEdge}>
29
40
  <ProminenceLayout.ProminentSection>
30
- <ScreenshareTile peerId={peersSharing[page].id} />
31
- <Pagination page={page} onPageChange={setPage} numPages={peersSharing.length} />
41
+ <ScreenshareTile peerId={peersSharing[page]?.id} />
42
+ {!edgeToEdge && <Pagination page={page} onPageChange={setPage} numPages={peersSharing.length} />}
32
43
  </ProminenceLayout.ProminentSection>
33
- <SecondaryTiles peers={secondaryPeers} onPageChange={onPageChange} onPageSize={onPageSize} />
44
+ <SecondaryTiles
45
+ peers={secondaryPeers}
46
+ onPageChange={onPageChange}
47
+ onPageSize={onPageSize}
48
+ edgeToEdge={edgeToEdge}
49
+ />
34
50
  </ProminenceLayout.Root>
35
51
  );
36
52
  };
@@ -2,6 +2,7 @@ import { HMSPeer } from '@100mslive/react-sdk';
2
2
 
3
3
  export interface LayoutProps {
4
4
  isInsetEnabled?: boolean;
5
+ edgeToEdge?: boolean;
5
6
  prominentRoles?: string[];
6
7
  peers: HMSPeer[];
7
8
  onPageChange?: (page: number) => void;
@@ -1,5 +1,4 @@
1
1
  import React, { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
- import { useMedia } from 'react-use';
3
2
  import {
4
3
  selectAudioTrackByPeerID,
5
4
  selectIsPeerAudioEnabled,
@@ -19,7 +18,7 @@ import TileMenu, { isSameTile } from './TileMenu/TileMenu';
19
18
  import { Avatar } from '../../Avatar';
20
19
  import { Box, Flex } from '../../Layout';
21
20
  import { VideoTileStats } from '../../Stats';
22
- import { config as cssConfig, keyframes } from '../../Theme';
21
+ import { keyframes } from '../../Theme';
23
22
  import { Video } from '../../Video';
24
23
  import { StyledVideoTile } from '../../VideoTile';
25
24
  import { getVideoTileLabel } from './peerTileUtils';
@@ -40,6 +39,7 @@ const Tile = ({
40
39
  hideParticipantNameOnTile = false,
41
40
  roundedVideoTile = true,
42
41
  hideAudioMuteOnTile = false,
42
+ hideMetadataOnTile = false,
43
43
  }) => {
44
44
  const trackSelector = trackId ? selectVideoTrackByID(trackId) : selectVideoTrackByPeerID(peerId);
45
45
  const track = useHMSStore(trackSelector);
@@ -81,7 +81,6 @@ const Tile = ({
81
81
  }
82
82
  return 'large';
83
83
  }, [width, height]);
84
- const isMobile = useMedia(cssConfig.media.md);
85
84
 
86
85
  return (
87
86
  <StyledVideoTile.Root
@@ -103,44 +102,42 @@ const Tile = ({
103
102
  <VideoTileStats audioTrackID={audioTrack?.id} videoTrackID={track?.id} peerID={peerId} isLocal={isLocal} />
104
103
  ) : null}
105
104
 
106
- {track ? (
107
- <Video
108
- trackId={track?.id}
109
- attach={isLocal ? undefined : !isAudioOnly}
110
- mirror={
111
- mirrorLocalVideo &&
112
- peerId === localPeerID &&
113
- track?.source === 'regular' &&
114
- track?.facingMode !== 'environment'
115
- }
116
- noRadius={!roundedVideoTile}
117
- data-testid="participant_video_tile"
118
- css={{
119
- objectFit,
120
- filter: isVideoDegraded ? 'blur($space$2)' : undefined,
121
- bg: 'transparent',
122
- }}
123
- />
124
- ) : null}
105
+ <Video
106
+ trackId={track?.id}
107
+ attach={isLocal ? undefined : !isAudioOnly}
108
+ mirror={
109
+ mirrorLocalVideo &&
110
+ peerId === localPeerID &&
111
+ track?.source === 'regular' &&
112
+ track?.facingMode !== 'environment'
113
+ }
114
+ noRadius={!roundedVideoTile}
115
+ data-testid="participant_video_tile"
116
+ css={{
117
+ objectFit,
118
+ filter: isVideoDegraded ? 'blur($space$2)' : undefined,
119
+ bg: 'transparent',
120
+ }}
121
+ />
122
+
125
123
  {isVideoMuted || (!isLocal && isAudioOnly) ? (
126
124
  <StyledVideoTile.AvatarContainer>
127
125
  <Avatar name={peerName || ''} data-testid="participant_avatar_icon" size={avatarSize} />
128
126
  </StyledVideoTile.AvatarContainer>
129
127
  ) : null}
130
128
 
131
- {showAudioMuted({
132
- hideAudioMute: hideAudioMuteOnTile,
133
- isAudioMuted,
134
- }) ? (
135
- <StyledVideoTile.AudioIndicator
136
- data-testid="participant_audio_mute_icon"
137
- size={width && height && (width < 180 || height < 180) ? 'small' : 'medium'}
138
- >
139
- <MicOffIcon />
140
- </StyledVideoTile.AudioIndicator>
141
- ) : (
142
- <AudioLevel trackId={audioTrack?.id} />
143
- )}
129
+ {!hideAudioMuteOnTile ? (
130
+ isAudioMuted ? (
131
+ <StyledVideoTile.AudioIndicator
132
+ data-testid="participant_audio_mute_icon"
133
+ size={width && height && (width < 180 || height < 180) ? 'small' : 'medium'}
134
+ >
135
+ <MicOffIcon />
136
+ </StyledVideoTile.AudioIndicator>
137
+ ) : (
138
+ <AudioLevel trackId={audioTrack?.id} />
139
+ )
140
+ ) : null}
144
141
  {isMouseHovered || isDragabble ? (
145
142
  <TileMenu
146
143
  peerID={peerId}
@@ -150,25 +147,24 @@ const Tile = ({
150
147
  enableSpotlightingPeer={enableSpotlightingPeer}
151
148
  />
152
149
  ) : null}
153
- <PeerMetadata peerId={peerId} />
154
- {isMobile ? null : (
155
- <TileConnection
156
- hideLabel={hideParticipantNameOnTile}
157
- name={label}
158
- isTile
159
- peerId={peerId}
160
- width={width}
161
- pinned={pinned}
162
- spotlighted={spotlighted}
163
- />
164
- )}
150
+ {!hideMetadataOnTile && <PeerMetadata peerId={peerId} />}
151
+
152
+ <TileConnection
153
+ hideLabel={hideParticipantNameOnTile}
154
+ name={label}
155
+ isTile
156
+ peerId={peerId}
157
+ width={width}
158
+ pinned={pinned}
159
+ spotlighted={spotlighted}
160
+ />
165
161
  </StyledVideoTile.Container>
166
162
  ) : null}
167
163
  </StyledVideoTile.Root>
168
164
  );
169
165
  };
170
166
 
171
- const metaStyles = { top: '$4', left: '$4' };
167
+ const metaStyles = { top: '$4', left: '$4', width: '$14', height: '$14' };
172
168
 
173
169
  const heightAnimation = value =>
174
170
  keyframes({
@@ -233,7 +229,7 @@ const PeerMetadata = ({ peerId }) => {
233
229
  ) : null}
234
230
  {isBRB ? (
235
231
  <StyledVideoTile.AttributeBox css={metaStyles} data-testid="brb_icon_onTile">
236
- <BrbTileIcon width={24} height={24} />
232
+ <BrbTileIcon width={22} height={22} />
237
233
  </StyledVideoTile.AttributeBox>
238
234
  ) : null}
239
235
  </Fragment>
@@ -242,8 +238,4 @@ const PeerMetadata = ({ peerId }) => {
242
238
 
243
239
  const VideoTile = React.memo(Tile);
244
240
 
245
- const showAudioMuted = ({ hideAudioMute, isAudioMuted }) => {
246
- return isAudioMuted && !hideAudioMute;
247
- };
248
-
249
241
  export default VideoTile;
@@ -23,14 +23,13 @@ import {
23
23
  useRoomLayoutConferencingScreen,
24
24
  useRoomLayoutPreviewScreen,
25
25
  } from '../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
26
- import { useAuthToken, useIsHeadless, useSetAppDataByKey } from './AppData/useUISettings';
27
- import { APP_DATA, EMOJI_REACTION_TYPE, isAndroid, isIOS, isIPadOS } from '../common/constants';
26
+ import { useAuthToken, useSetAppDataByKey } from './AppData/useUISettings';
27
+ import { APP_DATA, isAndroid, isIOS, isIPadOS } from '../common/constants';
28
28
 
29
29
  const Conference = () => {
30
30
  const navigate = useNavigate();
31
31
  const { roomId, role } = useParams();
32
- const isHeadless = useIsHeadless();
33
- const { userName } = useHMSPrebuiltContext();
32
+ const { userName, endpoints } = useHMSPrebuiltContext();
34
33
  const screenProps = useRoomLayoutConferencingScreen();
35
34
  const { isPreviewScreenEnabled } = useRoomLayoutPreviewScreen();
36
35
  const roomState = useHMSStore(selectRoomState);
@@ -42,11 +41,11 @@ const Conference = () => {
42
41
  const authTokenInAppData = useAuthToken();
43
42
  const headerRef = useRef();
44
43
  const footerRef = useRef();
44
+ const isMobileDevice = isAndroid || isIOS || isIPadOS;
45
45
  const dropdownListRef = useRef();
46
- const performAutoHide = hideControls && (isAndroid || isIOS || isIPadOS);
47
46
  const [isHLSStarted] = useSetAppDataByKey(APP_DATA.hlsStarted);
48
47
  const toggleControls = () => {
49
- if (dropdownListRef.current?.length === 0) {
48
+ if (dropdownListRef.current?.length === 0 && isMobileDevice) {
50
49
  setHideControls(value => !value);
51
50
  }
52
51
  };
@@ -58,14 +57,14 @@ const Conference = () => {
58
57
  clearTimeout(timeout);
59
58
  timeout = setTimeout(() => {
60
59
  if (dropdownListRef.current.length === 0) {
61
- setHideControls(true);
60
+ setHideControls(isMobileDevice);
62
61
  }
63
62
  }, 5000);
64
63
  }
65
64
  return () => {
66
65
  clearTimeout(timeout);
67
66
  };
68
- }, [dropdownList, hideControls]);
67
+ }, [dropdownList, hideControls, isMobileDevice]);
69
68
 
70
69
  useEffect(() => {
71
70
  if (!roomId) {
@@ -90,9 +89,7 @@ const Conference = () => {
90
89
  .join({
91
90
  userName,
92
91
  authToken: authTokenInAppData,
93
- initEndpoint: process.env.REACT_APP_ENV
94
- ? `https://${process.env.REACT_APP_ENV}-init.100ms.live/init`
95
- : undefined,
92
+ initEndpoint: endpoints?.init,
96
93
  initialSettings: {
97
94
  isAudioMuted: !isPreviewScreenEnabled,
98
95
  isVideoMuted: !isPreviewScreenEnabled,
@@ -101,14 +98,7 @@ const Conference = () => {
101
98
  })
102
99
  .catch(console.error);
103
100
  }
104
- }, [authTokenInAppData, hmsActions, isConnectedToRoom, isPreviewScreenEnabled, roomState, userName]);
105
-
106
- useEffect(() => {
107
- // beam doesn't need to store messages, saves on unnecessary store updates in large calls
108
- if (isHeadless) {
109
- hmsActions.ignoreMessageTypes(['chat', EMOJI_REACTION_TYPE]);
110
- }
111
- }, [isHeadless, hmsActions]);
101
+ }, [authTokenInAppData, endpoints?.init, hmsActions, isConnectedToRoom, isPreviewScreenEnabled, roomState, userName]);
112
102
 
113
103
  useEffect(() => {
114
104
  return () => {
@@ -117,71 +107,78 @@ const Conference = () => {
117
107
  }, []);
118
108
 
119
109
  if (!isConnectedToRoom) {
120
- return <FullPageProgress loadingText="Joining..." />;
121
- }
122
-
123
- if (isHLSStarted) {
124
- return <FullPageProgress loadingText="Starting live stream..." />;
110
+ return <FullPageProgress text="Joining..." />;
125
111
  }
126
112
 
127
113
  return (
128
- <Flex css={{ size: '100%', overflow: 'hidden' }} direction="column">
129
- {!screenProps.hideSections.includes('header') && (
130
- <Box
131
- ref={headerRef}
132
- css={{
133
- h: '$18',
134
- transition: 'margin 0.3s ease-in-out',
135
- marginTop: performAutoHide ? `-${headerRef.current?.clientHeight}px` : 'none',
136
- '@md': {
137
- h: '$17',
138
- },
139
- }}
140
- data-testid="header"
141
- >
142
- <Header elements={screenProps.elements} screenType={screenProps.screenType} />
114
+ <>
115
+ {isHLSStarted ? (
116
+ <Box css={{ position: 'fixed', zIndex: 100, w: '100%', h: '100%', left: 0, top: 0 }}>
117
+ <FullPageProgress text="Starting live stream..." css={{ opacity: 0.8, bg: '$background_dim' }} />
143
118
  </Box>
144
- )}
145
- <Box
146
- css={{
147
- w: '100%',
148
- flex: '1 1 0',
149
- minHeight: 0,
150
- px: '$10',
151
- paddingBottom: 'env(safe-area-inset-bottom)',
152
- '@lg': {
153
- px: '$4',
154
- },
155
- }}
156
- id="conferencing"
157
- data-testid="conferencing"
158
- onClick={toggleControls}
159
- >
160
- <VideoStreamingSection screenType={screenProps.screenType} elements={screenProps.elements} />
161
- </Box>
162
- {!screenProps.hideSections.includes('footer') && (
119
+ ) : null}
120
+ <Flex css={{ size: '100%', overflow: 'hidden' }} direction="column">
121
+ {!screenProps.hideSections.includes('header') && (
122
+ <Box
123
+ ref={headerRef}
124
+ css={{
125
+ h: '$18',
126
+ transition: 'margin 0.3s ease-in-out',
127
+ marginTop: hideControls ? `-${headerRef.current?.clientHeight}px` : 'none',
128
+ '@md': {
129
+ h: '$17',
130
+ },
131
+ }}
132
+ data-testid="header"
133
+ >
134
+ <Header elements={screenProps.elements} screenType={screenProps.screenType} />
135
+ </Box>
136
+ )}
163
137
  <Box
164
- ref={footerRef}
165
138
  css={{
166
- flexShrink: 0,
167
- maxHeight: '$24',
168
- transition: 'margin 0.3s ease-in-out',
169
- bg: '$background_dim',
170
- marginBottom: performAutoHide ? `-${footerRef.current?.clientHeight}px` : undefined,
171
- '@md': {
172
- maxHeight: 'unset',
173
- bg: screenProps.screenType === 'hls_live_streaming' ? 'transparent' : '$background_dim',
139
+ w: '100%',
140
+ flex: '1 1 0',
141
+ minHeight: 0,
142
+ px: screenProps?.elements?.video_tile_layout?.grid?.edge_to_edge ? 0 : '$10', // TODO: padding to be controlled by section/element
143
+ paddingBottom: 'env(safe-area-inset-bottom)',
144
+ '@lg': {
145
+ px: 0,
174
146
  },
175
147
  }}
176
- data-testid="footer"
148
+ id="conferencing"
149
+ data-testid="conferencing"
150
+ onClick={toggleControls}
177
151
  >
178
- <Footer elements={screenProps.elements} screenType={screenProps.screenType} />
152
+ <VideoStreamingSection
153
+ screenType={screenProps.screenType}
154
+ elements={screenProps.elements}
155
+ hideControls={hideControls}
156
+ />
179
157
  </Box>
180
- )}
181
- <RoleChangeRequestModal />
182
- <HLSFailureModal />
183
- <ActivatedPIP />
184
- </Flex>
158
+ {!screenProps.hideSections.includes('footer') && (
159
+ <Box
160
+ ref={footerRef}
161
+ css={{
162
+ flexShrink: 0,
163
+ maxHeight: '$24',
164
+ transition: 'margin 0.3s ease-in-out',
165
+ bg: '$background_dim',
166
+ marginBottom: hideControls ? `-${footerRef.current?.clientHeight}px` : undefined,
167
+ '@md': {
168
+ maxHeight: 'unset',
169
+ bg: screenProps.screenType === 'hls_live_streaming' ? 'transparent' : '$background_dim',
170
+ },
171
+ }}
172
+ data-testid="footer"
173
+ >
174
+ <Footer elements={screenProps.elements} screenType={screenProps.screenType} />
175
+ </Box>
176
+ )}
177
+ <RoleChangeRequestModal />
178
+ <HLSFailureModal />
179
+ <ActivatedPIP />
180
+ </Flex>
181
+ </>
185
182
  );
186
183
  };
187
184
 
@@ -0,0 +1,57 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ import {
3
+ HMSException,
4
+ selectIsConnectedToRoom,
5
+ selectPermissions,
6
+ useHMSActions,
7
+ useHMSStore,
8
+ useRecordingStreaming,
9
+ } from '@100mslive/react-sdk';
10
+ // @ts-ignore: No implicit Any
11
+ import { useSetAppDataByKey } from '../AppData/useUISettings';
12
+ // @ts-ignore: No implicit Any
13
+ import { useShowStreamingUI } from '../../common/hooks';
14
+ // @ts-ignore: No implicit Any
15
+ import { APP_DATA } from '../../common/constants';
16
+
17
+ export const useAutoStartStreaming = () => {
18
+ const [isHLSStarted, setHLSStarted] = useSetAppDataByKey(APP_DATA.hlsStarted);
19
+ const permissions = useHMSStore(selectPermissions);
20
+ const showStreamingUI = useShowStreamingUI();
21
+ const hmsActions = useHMSActions();
22
+ const isConnected = useHMSStore(selectIsConnectedToRoom);
23
+ const { isHLSRunning } = useRecordingStreaming();
24
+ const streamStartedRef = useRef(false);
25
+
26
+ const startHLS = useCallback(async () => {
27
+ try {
28
+ if (isHLSStarted || !showStreamingUI || isHLSRunning) {
29
+ return;
30
+ }
31
+ setHLSStarted(true);
32
+ streamStartedRef.current = true;
33
+ await hmsActions.startHLSStreaming();
34
+ } catch (error) {
35
+ if ((error as HMSException).message?.includes('beam already started')) {
36
+ return;
37
+ }
38
+ streamStartedRef.current = false;
39
+ setHLSStarted(false);
40
+ }
41
+ }, [hmsActions, isHLSRunning, isHLSStarted, setHLSStarted, showStreamingUI]);
42
+
43
+ useEffect(() => {
44
+ if (!isHLSStarted && !isHLSRunning) {
45
+ streamStartedRef.current = false;
46
+ }
47
+ }, [isHLSStarted, isHLSRunning]);
48
+
49
+ useEffect(() => {
50
+ if (!isConnected || streamStartedRef.current || !permissions?.hlsStreaming) {
51
+ return;
52
+ }
53
+ // Is a streaming kit and broadcaster joins
54
+ startHLS();
55
+ // eslint-disable-next-line react-hooks/exhaustive-deps
56
+ }, [isConnected]);
57
+ };
@@ -1,45 +1,36 @@
1
- import { useCallback, useState } from 'react';
2
- import { selectLocalPeerID, selectPeerMetadata, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
1
+ import { useCallback } from 'react';
2
+ import {
3
+ selectLocalPeerID,
4
+ selectPeerMetadata,
5
+ useHMSActions,
6
+ useHMSStore,
7
+ useHMSVanillaStore,
8
+ } from '@100mslive/react-sdk';
3
9
 
4
10
  export const useMyMetadata = () => {
5
11
  const hmsActions = useHMSActions();
6
12
  const localPeerId = useHMSStore(selectLocalPeerID);
13
+ const vanillaStore = useHMSVanillaStore();
7
14
  const metaData = useHMSStore(selectPeerMetadata(localPeerId));
8
- const [isHandRaised, setHandRaised] = useState(metaData?.isHandRaised || false);
9
- const [isBRBOn, setBRBOn] = useState(metaData?.isBRBOn || false); // BRB = be right back
10
15
 
11
16
  const update = async updatedFields => {
12
17
  try {
13
- await hmsActions.changeMetadata(Object.assign(metaData, updatedFields));
18
+ // get current state from store and merge updated fields
19
+ const currentMetadata = vanillaStore.getState(selectPeerMetadata(localPeerId));
20
+ await hmsActions.changeMetadata(Object.assign(currentMetadata, updatedFields));
14
21
  return true;
15
22
  } catch (error) {
16
- console.error('failed to update metadata ', metaData, updatedFields);
23
+ console.error('failed to update metadata ', updatedFields);
17
24
  }
18
25
  };
19
26
 
20
27
  const toggleHandRaise = useCallback(async () => {
21
- const brbUpdate = !isHandRaised ? false : isBRBOn;
22
- const success = await update({
23
- isHandRaised: !isHandRaised,
24
- isBRBOn: brbUpdate,
25
- });
26
- if (success) {
27
- setBRBOn(brbUpdate);
28
- setHandRaised(!isHandRaised);
29
- }
30
- }, [isHandRaised, isBRBOn]); //eslint-disable-line
28
+ await update({ isHandRaised: !metaData?.isHandRaised, isBRBOn: false });
29
+ }, [metaData?.isHandRaised]); //eslint-disable-line
31
30
 
32
31
  const toggleBRB = useCallback(async () => {
33
- const handRaiseUpdate = !isBRBOn ? false : isHandRaised;
34
- const success = await update({
35
- isHandRaised: handRaiseUpdate,
36
- isBRBOn: !isBRBOn,
37
- });
38
- if (success) {
39
- setBRBOn(!isBRBOn);
40
- setHandRaised(handRaiseUpdate);
41
- }
42
- }, [isHandRaised, isBRBOn]); //eslint-disable-line
32
+ await update({ isBRBOn: !metaData?.isBRBOn, isHandRaised: false });
33
+ }, [metaData?.isBRBOn]); //eslint-disable-line
43
34
 
44
35
  const setPrevRole = async role => {
45
36
  await update({
@@ -48,8 +39,8 @@ export const useMyMetadata = () => {
48
39
  };
49
40
 
50
41
  return {
51
- isHandRaised,
52
- isBRBOn,
42
+ isHandRaised: !!metaData?.isHandRaised,
43
+ isBRBOn: !!metaData?.isBRBOn,
53
44
  metaData,
54
45
  updateMetaData: update,
55
46
  toggleHandRaise,
@@ -0,0 +1,34 @@
1
+ import { useCallback } from 'react';
2
+ import { useNavigate, useParams } from 'react-router-dom';
3
+ import { useHMSPrebuiltContext } from '../../AppContext';
4
+ // @ts-ignore: No implicit Any
5
+ import { PictureInPicture } from '../PIP/PIPManager';
6
+ // @ts-ignore: No implicit Any
7
+ import { ToastManager } from '../Toast/ToastManager';
8
+ import { useRoomLayoutLeaveScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
9
+
10
+ export const useRedirectToLeave = () => {
11
+ const { isLeaveScreenEnabled } = useRoomLayoutLeaveScreen();
12
+ const { onLeave } = useHMSPrebuiltContext();
13
+ const params = useParams();
14
+ const navigate = useNavigate();
15
+
16
+ const redirect = useCallback(
17
+ (timeout = 0) => {
18
+ setTimeout(() => {
19
+ const prefix = isLeaveScreenEnabled ? '/leave/' : '/';
20
+ if (params.role) {
21
+ navigate(prefix + params.roomId + '/' + params.role);
22
+ } else {
23
+ navigate(prefix + params.roomId);
24
+ }
25
+ PictureInPicture.stop().catch(() => console.error('stopping pip'));
26
+ ToastManager.clearAllToast();
27
+ onLeave?.();
28
+ }, timeout);
29
+ },
30
+ [isLeaveScreenEnabled, navigate, onLeave, params.role, params.roomId],
31
+ );
32
+
33
+ return { redirectToLeave: redirect };
34
+ };
@@ -12,7 +12,7 @@ export const useRoleProminencePeers = (prominentRoles: string[], peers: HMSPeer[
12
12
  if (pinnedTrack) {
13
13
  if (pinnedTrack.peerId === peer.id) {
14
14
  acc[0].push(peer);
15
- } else {
15
+ } else if (!(isInsetEnabled && peer.isLocal)) {
16
16
  acc[1].push(peer);
17
17
  }
18
18
  return acc;