@100mslive/roomkit-react 0.1.5 → 0.1.6-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. package/dist/{HLSView-P57IRMAR.js → HLSView-HNVYG5VE.js} +309 -151
  2. package/dist/HLSView-HNVYG5VE.js.map +7 -0
  3. package/dist/Prebuilt/App.d.ts +3 -0
  4. package/dist/Prebuilt/AppContext.d.ts +13 -0
  5. package/dist/Prebuilt/common/PeersSorter.d.ts +21 -0
  6. package/dist/Prebuilt/components/Chat/ChatFooter.d.ts +7 -0
  7. package/dist/Prebuilt/components/Connection/ConnectionIndicator.d.ts +6 -0
  8. package/dist/Prebuilt/components/Connection/TileConnection.d.ts +10 -0
  9. package/dist/Prebuilt/components/Footer/ChatToggle.d.ts +4 -0
  10. package/dist/Prebuilt/components/Footer/Footer.d.ts +6 -0
  11. package/dist/Prebuilt/components/Footer/RoleAccordion.d.ts +14 -0
  12. package/dist/Prebuilt/components/Footer/RoleOptions.d.ts +6 -0
  13. package/dist/Prebuilt/components/Header/Header.d.ts +2 -0
  14. package/dist/Prebuilt/components/Header/StreamActions.d.ts +11 -0
  15. package/dist/Prebuilt/components/InsetTile.d.ts +2 -0
  16. package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +8 -0
  17. package/dist/Prebuilt/components/Leave/EndSessionContent.d.ts +9 -0
  18. package/dist/Prebuilt/components/Leave/LeaveAtoms.d.ts +2196 -0
  19. package/dist/Prebuilt/components/Leave/LeaveCard.d.ts +11 -0
  20. package/dist/Prebuilt/components/Leave/LeaveRoom.d.ts +5 -0
  21. package/dist/Prebuilt/components/Leave/LeaveSessionContent.d.ts +8 -0
  22. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +8 -0
  23. package/dist/Prebuilt/components/MoreSettings/MoreSettings.d.ts +6 -0
  24. package/dist/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.d.ts +6 -0
  25. package/dist/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.d.ts +6 -0
  26. package/dist/Prebuilt/components/Pagination.d.ts +6 -0
  27. package/dist/Prebuilt/components/Preview/PreviewContainer.d.ts +3 -0
  28. package/dist/Prebuilt/components/Preview/PreviewForm.d.ts +10 -0
  29. package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +16 -0
  30. package/dist/Prebuilt/components/RoleChangeRequestModal.d.ts +2 -0
  31. package/dist/Prebuilt/components/SecondaryTiles.d.ts +3 -0
  32. package/dist/Prebuilt/components/VideoLayouts/EqualProminence.d.ts +3 -0
  33. package/dist/Prebuilt/components/VideoLayouts/Grid.d.ts +6 -0
  34. package/dist/Prebuilt/components/VideoLayouts/GridLayout.d.ts +12 -0
  35. package/dist/Prebuilt/components/VideoLayouts/ProminenceLayout.d.ts +15 -0
  36. package/dist/Prebuilt/components/VideoLayouts/RoleProminence.d.ts +3 -0
  37. package/dist/Prebuilt/components/VideoLayouts/ScreenshareLayout.d.ts +3 -0
  38. package/dist/Prebuilt/components/VideoLayouts/interface.d.ts +9 -0
  39. package/dist/Prebuilt/components/hooks/useAutoStartStreaming.d.ts +1 -0
  40. package/dist/Prebuilt/components/hooks/useRedirectToLeave.d.ts +3 -0
  41. package/dist/Prebuilt/components/hooks/useRoleProminencePeers.d.ts +5 -0
  42. package/dist/Prebuilt/components/hooks/useTileLayout.d.ts +13 -0
  43. package/dist/Prebuilt/components/hooks/useVideoTileLayout.d.ts +13 -0
  44. package/dist/Prebuilt/layouts/SidePane.d.ts +9 -0
  45. package/dist/Prebuilt/layouts/VideoStreamingSection.d.ts +7 -0
  46. package/dist/Prebuilt/plugins/whiteboard/ToggleWhiteboard.d.ts +5 -0
  47. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.d.ts +1 -0
  48. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.d.ts +1 -0
  49. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +17 -0
  50. package/dist/Prebuilt/provider/roomLayoutProvider/index.d.ts +6 -1
  51. package/dist/{VirtualBackground-GGCQJ5JM.js → VirtualBackground-UM2FOUHQ.js} +5 -11
  52. package/dist/VirtualBackground-UM2FOUHQ.js.map +7 -0
  53. package/dist/{chunk-P5X32KOD.js → chunk-364HP22I.js} +8 -5
  54. package/dist/chunk-364HP22I.js.map +7 -0
  55. package/dist/{chunk-OSM4QEQG.js → chunk-LYSAET4G.js} +3742 -5462
  56. package/dist/chunk-LYSAET4G.js.map +7 -0
  57. package/dist/chunk-POE7H4IE.js +898 -0
  58. package/dist/chunk-POE7H4IE.js.map +7 -0
  59. package/dist/conference-UWLJHMB2.js +5727 -0
  60. package/dist/conference-UWLJHMB2.js.map +7 -0
  61. package/dist/index.cjs.js +9655 -15326
  62. package/dist/index.cjs.js.map +4 -4
  63. package/dist/index.js +2 -2
  64. package/dist/meta.cjs.json +2513 -3456
  65. package/dist/meta.esbuild.json +2807 -3838
  66. package/package.json +8 -7
  67. package/src/Button/Button.tsx +2 -2
  68. package/src/Prebuilt/App.tsx +58 -53
  69. package/src/Prebuilt/{AppContext.jsx → AppContext.tsx} +11 -3
  70. package/src/Prebuilt/IconButton.jsx +11 -0
  71. package/src/Prebuilt/Prebuilt.stories.tsx +1 -0
  72. package/src/Prebuilt/common/{PeersSorter.js → PeersSorter.ts} +16 -11
  73. package/src/Prebuilt/common/constants.js +4 -114
  74. package/src/Prebuilt/common/hooks.js +34 -1
  75. package/src/Prebuilt/common/utils.js +1 -9
  76. package/src/Prebuilt/components/AppData/AppData.jsx +11 -15
  77. package/src/Prebuilt/components/AppData/useUISettings.js +6 -10
  78. package/src/Prebuilt/components/AudioVideoToggle.jsx +10 -2
  79. package/src/Prebuilt/components/AuthToken.jsx +11 -42
  80. package/src/Prebuilt/components/Chat/Chat.jsx +75 -27
  81. package/src/Prebuilt/components/Chat/ChatBody.jsx +95 -36
  82. package/src/Prebuilt/components/Chat/ChatFooter.tsx +199 -0
  83. package/src/Prebuilt/components/Chat/ChatParticipantHeader.jsx +84 -0
  84. package/src/Prebuilt/components/Chat/ChatSelector.jsx +16 -17
  85. package/src/Prebuilt/components/Chat/ChatSelectorContainer.jsx +81 -0
  86. package/src/Prebuilt/components/Chat/useEmojiPickerStyles.js +5 -4
  87. package/src/Prebuilt/components/Connection/{ConnectionIndicator.jsx → ConnectionIndicator.tsx} +12 -4
  88. package/src/Prebuilt/components/Connection/TileConnection.tsx +71 -0
  89. package/src/Prebuilt/components/EmojiReaction.jsx +19 -22
  90. package/src/Prebuilt/components/Footer/{ChatToggle.jsx → ChatToggle.tsx} +13 -9
  91. package/src/Prebuilt/components/Footer/Footer.tsx +98 -0
  92. package/src/Prebuilt/components/Footer/ParticipantList.jsx +187 -179
  93. package/src/Prebuilt/components/Footer/RoleAccordion.tsx +94 -0
  94. package/src/Prebuilt/components/Footer/RoleOptions.tsx +155 -0
  95. package/src/Prebuilt/components/FullPageProgress.jsx +3 -3
  96. package/src/Prebuilt/components/HMSVideo/Controls.jsx +3 -2
  97. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +63 -18
  98. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +2 -2
  99. package/src/Prebuilt/components/HMSVideo/PlayButton.jsx +1 -1
  100. package/src/Prebuilt/components/HMSVideo/VideoProgress.jsx +5 -6
  101. package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +3 -3
  102. package/src/Prebuilt/components/HMSVideo/VolumeControl.jsx +38 -9
  103. package/src/Prebuilt/components/Header/{ConferencingHeader.jsx → Header.tsx} +9 -7
  104. package/src/Prebuilt/components/Header/HeaderComponents.jsx +13 -4
  105. package/src/Prebuilt/components/Header/{StreamActions.jsx → StreamActions.tsx} +54 -67
  106. package/src/Prebuilt/components/Header/common.jsx +5 -2
  107. package/src/Prebuilt/components/Header/index.tsx +1 -0
  108. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +23 -4
  109. package/src/Prebuilt/components/InsetTile.tsx +128 -0
  110. package/src/Prebuilt/components/{MoreSettings/SplitComponents/DesktopLeaveRoom.jsx → Leave/DesktopLeaveRoom.tsx} +67 -25
  111. package/src/Prebuilt/components/{EndSessionContent.jsx → Leave/EndSessionContent.tsx} +18 -11
  112. package/src/Prebuilt/components/Leave/LeaveAtoms.tsx +26 -0
  113. package/src/Prebuilt/components/Leave/LeaveCard.tsx +36 -0
  114. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +66 -0
  115. package/src/Prebuilt/components/{LeaveSessionContent.jsx → Leave/LeaveSessionContent.tsx} +20 -6
  116. package/src/Prebuilt/components/{MoreSettings/SplitComponents/MwebLeaveRoom.jsx → Leave/MwebLeaveRoom.tsx} +43 -18
  117. package/src/Prebuilt/components/MetaActions.jsx +15 -23
  118. package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +5 -0
  119. package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +16 -7
  120. package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +1 -1
  121. package/src/Prebuilt/components/MoreSettings/FullScreenItem.jsx +1 -4
  122. package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +27 -0
  123. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +216 -0
  124. package/src/Prebuilt/components/MoreSettings/SplitComponents/{MwebOptions.jsx → MwebOptions.tsx} +107 -45
  125. package/src/Prebuilt/components/Notifications/HLSFailureModal.jsx +3 -1
  126. package/src/Prebuilt/components/Notifications/Notifications.jsx +46 -30
  127. package/src/Prebuilt/components/Notifications/PeerNotifications.jsx +14 -2
  128. package/src/Prebuilt/components/Notifications/PermissionErrorModal.jsx +10 -4
  129. package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +5 -11
  130. package/src/Prebuilt/components/PIP/PIPComponent.jsx +7 -16
  131. package/src/Prebuilt/components/PIP/PIPManager.js +1 -0
  132. package/src/Prebuilt/components/Pagination.tsx +60 -0
  133. package/src/Prebuilt/components/Playlist/Playlist.jsx +1 -6
  134. package/src/Prebuilt/components/PostLeave.jsx +7 -7
  135. package/src/Prebuilt/components/Preview/{PreviewContainer.jsx → PreviewContainer.tsx} +16 -15
  136. package/src/Prebuilt/components/Preview/{PreviewForm.jsx → PreviewForm.tsx} +16 -8
  137. package/src/Prebuilt/components/Preview/{PreviewJoin.jsx → PreviewJoin.tsx} +48 -22
  138. package/src/Prebuilt/components/RaiseHand.jsx +0 -7
  139. package/src/Prebuilt/components/RoleChangeRequestModal.tsx +119 -0
  140. package/src/Prebuilt/components/ScreenshareDisplay.jsx +4 -10
  141. package/src/Prebuilt/components/ScreenshareTile.jsx +43 -36
  142. package/src/Prebuilt/components/SecondaryTiles.tsx +36 -0
  143. package/src/Prebuilt/components/Settings/LayoutSettings.jsx +2 -12
  144. package/src/Prebuilt/components/Settings/NotificationSettings.jsx +3 -9
  145. package/src/Prebuilt/components/Settings/SettingsModal.jsx +3 -9
  146. package/src/Prebuilt/components/StatsForNerds.jsx +3 -1
  147. package/src/Prebuilt/components/TileMenu/TileMenu.jsx +16 -17
  148. package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +33 -27
  149. package/src/Prebuilt/components/Toast/ToastConfig.jsx +58 -15
  150. package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +65 -0
  151. package/src/Prebuilt/components/VideoLayouts/Grid.tsx +43 -0
  152. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +110 -0
  153. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +74 -0
  154. package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +59 -0
  155. package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +52 -0
  156. package/src/Prebuilt/components/VideoLayouts/interface.ts +10 -0
  157. package/src/Prebuilt/components/VideoTile.jsx +116 -74
  158. package/src/Prebuilt/components/conference.jsx +86 -85
  159. package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +57 -0
  160. package/src/Prebuilt/components/hooks/useMetadata.jsx +19 -3
  161. package/src/Prebuilt/components/hooks/useRedirectToLeave.tsx +34 -0
  162. package/src/Prebuilt/components/hooks/useRoleProminencePeers.tsx +38 -0
  163. package/src/Prebuilt/components/hooks/useTileLayout.tsx +127 -0
  164. package/src/Prebuilt/components/hooks/useVideoTileLayout.ts +26 -0
  165. package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +5 -72
  166. package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +4 -45
  167. package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +2 -17
  168. package/src/Prebuilt/components/peerTileUtils.jsx +1 -1
  169. package/src/Prebuilt/images/empty-chat.svg +12 -0
  170. package/src/Prebuilt/layouts/EmbedView.jsx +17 -50
  171. package/src/Prebuilt/layouts/HLSView.jsx +138 -51
  172. package/src/Prebuilt/layouts/PDFView.jsx +1 -11
  173. package/src/Prebuilt/layouts/SidePane.tsx +108 -0
  174. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +96 -0
  175. package/src/Prebuilt/layouts/WhiteboardView.jsx +10 -34
  176. package/src/Prebuilt/plugins/FlyingEmoji.jsx +14 -2
  177. package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +1 -4
  178. package/src/Prebuilt/plugins/whiteboard/{ToggleWhiteboard.jsx → ToggleWhiteboard.tsx} +5 -9
  179. package/src/Prebuilt/primitives/DialogContent.jsx +15 -11
  180. package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +17 -2
  181. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.ts +36 -13
  182. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.ts +10 -0
  183. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +65 -0
  184. package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +17 -6
  185. package/src/Prebuilt/services/FeatureFlags.jsx +0 -1
  186. package/src/VideoTile/StyledVideoTile.tsx +1 -0
  187. package/dist/HLSView-P57IRMAR.js.map +0 -7
  188. package/dist/PinnedTrackView-4FYJEBTB.js +0 -102
  189. package/dist/PinnedTrackView-4FYJEBTB.js.map +0 -7
  190. package/dist/VirtualBackground-GGCQJ5JM.js.map +0 -7
  191. package/dist/chunk-IVTWKQI3.js +0 -827
  192. package/dist/chunk-IVTWKQI3.js.map +0 -7
  193. package/dist/chunk-OSM4QEQG.js.map +0 -7
  194. package/dist/chunk-P5X32KOD.js.map +0 -7
  195. package/dist/chunk-RVCZPPTL.js +0 -1100
  196. package/dist/chunk-RVCZPPTL.js.map +0 -7
  197. package/dist/conference-P6I6ESVF.js +0 -8995
  198. package/dist/conference-P6I6ESVF.js.map +0 -7
  199. package/src/Prebuilt/components/AudioLevel/BeamSpeakerLabelsLogging.jsx +0 -16
  200. package/src/Prebuilt/components/Chat/ChatFooter.jsx +0 -150
  201. package/src/Prebuilt/components/Chat/ChatHeader.jsx +0 -67
  202. package/src/Prebuilt/components/Connection/TileConnection.jsx +0 -39
  203. package/src/Prebuilt/components/EqualProminence.jsx +0 -180
  204. package/src/Prebuilt/components/FirstPersonDisplay.jsx +0 -50
  205. package/src/Prebuilt/components/Footer/Footer.jsx +0 -73
  206. package/src/Prebuilt/components/Header/Header.jsx +0 -8
  207. package/src/Prebuilt/components/Header/StreamingHeader.jsx +0 -54
  208. package/src/Prebuilt/components/LeaveCard.jsx +0 -19
  209. package/src/Prebuilt/components/LeaveRoom.jsx +0 -94
  210. package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +0 -10
  211. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.jsx +0 -219
  212. package/src/Prebuilt/components/Notifications/MessageNotifications.jsx +0 -25
  213. package/src/Prebuilt/components/Pagination.jsx +0 -29
  214. package/src/Prebuilt/components/RoleChangeRequestModal.jsx +0 -26
  215. package/src/Prebuilt/components/VideoList.jsx +0 -73
  216. package/src/Prebuilt/components/gridView.jsx +0 -85
  217. package/src/Prebuilt/components/hooks/useFeatures.js +0 -22
  218. package/src/Prebuilt/components/hooks/useNavigation.js +0 -19
  219. package/src/Prebuilt/components/hooks/useSkipPreview.jsx +0 -20
  220. package/src/Prebuilt/components/pdfAnnotator/pdfErrorView.jsx +0 -29
  221. package/src/Prebuilt/images/Logo.svg +0 -8
  222. package/src/Prebuilt/layouts/ActiveSpeakerView.jsx +0 -34
  223. package/src/Prebuilt/layouts/InsetView.jsx +0 -260
  224. package/src/Prebuilt/layouts/PinnedTrackView.jsx +0 -59
  225. package/src/Prebuilt/layouts/SidePane.jsx +0 -52
  226. package/src/Prebuilt/layouts/mainGridView.jsx +0 -98
  227. package/src/Prebuilt/layouts/mainView.jsx +0 -141
  228. package/src/Prebuilt/layouts/screenShareView.jsx +0 -183
  229. /package/{src/Prebuilt/components/Header/index.jsx → dist/Prebuilt/components/Header/index.d.ts} +0 -0
  230. /package/src/Prebuilt/components/{ScreenShare.jsx → ScreenShareToggle.jsx} +0 -0
  231. /package/src/{assets → Prebuilt/images}/android-perm-1.png +0 -0
  232. /package/src/{assets → Prebuilt/images}/ios-perm-0.png +0 -0
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
- import { useParams } from 'react-router-dom';
2
+ import { useNavigate, useParams } from 'react-router-dom';
3
3
  import { usePrevious } from 'react-use';
4
4
  import {
5
5
  HMSRoomState,
@@ -15,36 +15,37 @@ import { ActivatedPIP } from './PIP/PIPComponent';
15
15
  import { PictureInPicture } from './PIP/PIPManager';
16
16
  import { Box, Flex } from '../../Layout';
17
17
  import { useHMSPrebuiltContext } from '../AppContext';
18
- import { ConferenceMainView } from '../layouts/mainView';
18
+ import { VideoStreamingSection } from '../layouts/VideoStreamingSection';
19
19
  import FullPageProgress from './FullPageProgress';
20
20
  import { Header } from './Header';
21
21
  import { RoleChangeRequestModal } from './RoleChangeRequestModal';
22
- import { useAuthToken, useIsHeadless, useSetAppDataByKey } from './AppData/useUISettings';
23
- import { useNavigation } from './hooks/useNavigation';
24
- import { useSkipPreview } from './hooks/useSkipPreview';
25
- import { APP_DATA, EMOJI_REACTION_TYPE, isAndroid, isIOS, isIPadOS } from '../common/constants';
22
+ import {
23
+ useRoomLayoutConferencingScreen,
24
+ useRoomLayoutPreviewScreen,
25
+ } from '../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
26
+ import { useAuthToken, useSetAppDataByKey } from './AppData/useUISettings';
27
+ import { APP_DATA, isAndroid, isIOS, isIPadOS } from '../common/constants';
26
28
 
27
29
  const Conference = () => {
28
- const navigate = useNavigation();
30
+ const navigate = useNavigate();
29
31
  const { roomId, role } = useParams();
30
- const isHeadless = useIsHeadless();
32
+ const { userName, endpoints } = useHMSPrebuiltContext();
33
+ const screenProps = useRoomLayoutConferencingScreen();
34
+ const { isPreviewScreenEnabled } = useRoomLayoutPreviewScreen();
31
35
  const roomState = useHMSStore(selectRoomState);
32
36
  const prevState = usePrevious(roomState);
33
37
  const isConnectedToRoom = useHMSStore(selectIsConnectedToRoom);
34
38
  const hmsActions = useHMSActions();
35
39
  const [hideControls, setHideControls] = useState(false);
36
40
  const dropdownList = useHMSStore(selectAppData(APP_DATA.dropdownList));
37
- const skipPreview = useSkipPreview();
38
- const { showPreview } = useHMSPrebuiltContext();
39
41
  const authTokenInAppData = useAuthToken();
40
42
  const headerRef = useRef();
41
43
  const footerRef = useRef();
44
+ const isMobileDevice = isAndroid || isIOS || isIPadOS;
42
45
  const dropdownListRef = useRef();
43
- const performAutoHide = hideControls && (isAndroid || isIOS || isIPadOS);
44
46
  const [isHLSStarted] = useSetAppDataByKey(APP_DATA.hlsStarted);
45
-
46
47
  const toggleControls = () => {
47
- if (dropdownListRef.current?.length === 0) {
48
+ if (dropdownListRef.current?.length === 0 && isMobileDevice) {
48
49
  setHideControls(value => !value);
49
50
  }
50
51
  };
@@ -56,21 +57,21 @@ const Conference = () => {
56
57
  clearTimeout(timeout);
57
58
  timeout = setTimeout(() => {
58
59
  if (dropdownListRef.current.length === 0) {
59
- setHideControls(true);
60
+ setHideControls(isMobileDevice);
60
61
  }
61
62
  }, 5000);
62
63
  }
63
64
  return () => {
64
65
  clearTimeout(timeout);
65
66
  };
66
- }, [dropdownList, hideControls]);
67
+ }, [dropdownList, hideControls, isMobileDevice]);
67
68
 
68
69
  useEffect(() => {
69
70
  if (!roomId) {
70
71
  navigate(`/`);
71
72
  return;
72
73
  }
73
- if (!showPreview) {
74
+ if (!isPreviewScreenEnabled) {
74
75
  return;
75
76
  }
76
77
  if (
@@ -80,33 +81,24 @@ const Conference = () => {
80
81
  if (role) navigate(`/preview/${roomId || ''}/${role}`);
81
82
  else navigate(`/preview/${roomId || ''}`);
82
83
  }
83
- }, [isConnectedToRoom, prevState, roomState, navigate, role, roomId, showPreview]);
84
+ }, [isConnectedToRoom, prevState, roomState, navigate, role, roomId, isPreviewScreenEnabled]);
84
85
 
85
86
  useEffect(() => {
86
- if (authTokenInAppData && !isConnectedToRoom && !showPreview && roomState !== HMSRoomState.Connecting) {
87
+ if (authTokenInAppData && !isConnectedToRoom && !isPreviewScreenEnabled && roomState !== HMSRoomState.Connecting) {
87
88
  hmsActions
88
89
  .join({
89
- userName: 'Test',
90
+ userName,
90
91
  authToken: authTokenInAppData,
91
- initEndpoint: process.env.REACT_APP_ENV
92
- ? `https://${process.env.REACT_APP_ENV}-init.100ms.live/init`
93
- : undefined,
92
+ initEndpoint: endpoints?.init,
94
93
  initialSettings: {
95
- isAudioMuted: skipPreview,
96
- isVideoMuted: skipPreview,
94
+ isAudioMuted: !isPreviewScreenEnabled,
95
+ isVideoMuted: !isPreviewScreenEnabled,
97
96
  speakerAutoSelectionBlacklist: ['Yeti Stereo Microphone'],
98
97
  },
99
98
  })
100
99
  .catch(console.error);
101
100
  }
102
- }, [authTokenInAppData, skipPreview, hmsActions, isConnectedToRoom, showPreview, roomState]);
103
-
104
- useEffect(() => {
105
- // beam doesn't need to store messages, saves on unnecessary store updates in large calls
106
- if (isHeadless) {
107
- hmsActions.ignoreMessageTypes(['chat', EMOJI_REACTION_TYPE]);
108
- }
109
- }, [isHeadless, hmsActions]);
101
+ }, [authTokenInAppData, endpoints?.init, hmsActions, isConnectedToRoom, isPreviewScreenEnabled, roomState, userName]);
110
102
 
111
103
  useEffect(() => {
112
104
  return () => {
@@ -115,69 +107,78 @@ const Conference = () => {
115
107
  }, []);
116
108
 
117
109
  if (!isConnectedToRoom) {
118
- return <FullPageProgress loadingText="Joining..." />;
119
- }
120
-
121
- if (isHLSStarted) {
122
- return <FullPageProgress loadingText="Starting live stream..." />;
110
+ return <FullPageProgress text="Joining..." />;
123
111
  }
124
112
 
125
113
  return (
126
- <Flex css={{ size: '100%', overflow: 'hidden' }} direction="column">
127
- {!isHeadless && (
128
- <Box
129
- ref={headerRef}
130
- css={{
131
- h: '$18',
132
- transition: 'margin 0.3s ease-in-out',
133
- marginTop: performAutoHide ? `-${headerRef.current?.clientHeight}px` : 'none',
134
- '@md': {
135
- h: '$17',
136
- },
137
- }}
138
- data-testid="header"
139
- >
140
- <Header />
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' }} />
141
118
  </Box>
142
- )}
143
- <Box
144
- css={{
145
- w: '100%',
146
- flex: '1 1 0',
147
- minHeight: 0,
148
- px: '$10',
149
- paddingBottom: 'env(safe-area-inset-bottom)',
150
- '@lg': {
151
- px: '$4',
152
- },
153
- }}
154
- id="conferencing"
155
- data-testid="conferencing"
156
- onClick={toggleControls}
157
- >
158
- <ConferenceMainView />
159
- </Box>
160
- {!isHeadless && (
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
+ )}
161
137
  <Box
162
- ref={footerRef}
163
138
  css={{
164
- flexShrink: 0,
165
- maxHeight: '$24',
166
- transition: 'margin 0.3s ease-in-out',
167
- marginBottom: performAutoHide ? `-${footerRef.current?.clientHeight}px` : undefined,
168
- '@md': {
169
- maxHeight: 'unset',
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,
170
146
  },
171
147
  }}
172
- data-testid="footer"
148
+ id="conferencing"
149
+ data-testid="conferencing"
150
+ onClick={toggleControls}
173
151
  >
174
- <Footer />
152
+ <VideoStreamingSection
153
+ screenType={screenProps.screenType}
154
+ elements={screenProps.elements}
155
+ hideControls={hideControls}
156
+ />
175
157
  </Box>
176
- )}
177
- <RoleChangeRequestModal />
178
- <HLSFailureModal />
179
- <ActivatedPIP />
180
- </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
+ </>
181
182
  );
182
183
  };
183
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,19 +1,28 @@
1
1
  import { useCallback, useState } from 'react';
2
- import { selectLocalPeerID, selectPeerMetadata, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
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
15
  const [isHandRaised, setHandRaised] = useState(metaData?.isHandRaised || false);
9
16
  const [isBRBOn, setBRBOn] = useState(metaData?.isBRBOn || false); // BRB = be right back
10
17
 
11
18
  const update = async updatedFields => {
12
19
  try {
13
- await hmsActions.changeMetadata(Object.assign(metaData, updatedFields));
20
+ // get current state from store and merge updated fields
21
+ const currentMetadata = vanillaStore.getState(selectPeerMetadata(localPeerId));
22
+ await hmsActions.changeMetadata(Object.assign(currentMetadata, updatedFields));
14
23
  return true;
15
24
  } catch (error) {
16
- console.error('failed to update metadata ', metaData, updatedFields);
25
+ console.error('failed to update metadata ', updatedFields);
17
26
  }
18
27
  };
19
28
 
@@ -41,6 +50,12 @@ export const useMyMetadata = () => {
41
50
  }
42
51
  }, [isHandRaised, isBRBOn]); //eslint-disable-line
43
52
 
53
+ const setPrevRole = async role => {
54
+ await update({
55
+ prevRole: role,
56
+ });
57
+ };
58
+
44
59
  return {
45
60
  isHandRaised,
46
61
  isBRBOn,
@@ -48,5 +63,6 @@ export const useMyMetadata = () => {
48
63
  updateMetaData: update,
49
64
  toggleHandRaise,
50
65
  toggleBRB,
66
+ setPrevRole,
51
67
  };
52
68
  };
@@ -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
+ };
@@ -0,0 +1,38 @@
1
+ import { useMemo } from 'react';
2
+ import { HMSPeer } from '@100mslive/react-sdk';
3
+ // @ts-ignore: No implicit Any
4
+ import { usePinnedTrack } from '../AppData/useUISettings';
5
+
6
+ export const useRoleProminencePeers = (prominentRoles: string[], peers: HMSPeer[], isInsetEnabled: boolean) => {
7
+ const pinnedTrack = usePinnedTrack();
8
+
9
+ const [prominentPeers, secondaryPeers] = useMemo(() => {
10
+ return peers.reduce<[HMSPeer[], HMSPeer[]]>(
11
+ (acc, peer) => {
12
+ if (pinnedTrack) {
13
+ if (pinnedTrack.peerId === peer.id) {
14
+ acc[0].push(peer);
15
+ } else if (!(isInsetEnabled && peer.isLocal)) {
16
+ acc[1].push(peer);
17
+ }
18
+ return acc;
19
+ }
20
+ if (peer.isLocal && isInsetEnabled) {
21
+ return acc;
22
+ }
23
+ if (prominentRoles?.includes(peer.roleName || '')) {
24
+ acc[0].push(peer);
25
+ } else {
26
+ acc[1].push(peer);
27
+ }
28
+ return acc;
29
+ },
30
+ [[], []],
31
+ );
32
+ }, [peers, isInsetEnabled, prominentRoles, pinnedTrack]);
33
+
34
+ return {
35
+ prominentPeers,
36
+ secondaryPeers,
37
+ };
38
+ };
@@ -0,0 +1,127 @@
1
+ import { useEffect, useMemo, useState } from 'react';
2
+ import { useMeasure, useMedia } from 'react-use';
3
+ import {
4
+ getPeersWithTiles,
5
+ HMSPeer,
6
+ selectTracksMap,
7
+ TrackWithPeerAndDimensions,
8
+ useHMSVanillaStore,
9
+ } from '@100mslive/react-sdk';
10
+ import { config as cssConfig } from '../../../Theme';
11
+
12
+ const aspectRatioConfig = { default: [1 / 1, 4 / 3, 16 / 9], mobile: [1 / 1, 3 / 4, 9 / 16] };
13
+
14
+ export const usePagesWithTiles = ({ peers, maxTileCount }: { peers: HMSPeer[]; maxTileCount: number }) => {
15
+ const vanillaStore = useHMSVanillaStore();
16
+ const tracksMap = vanillaStore.getState(selectTracksMap);
17
+ const peersWithTiles = useMemo(
18
+ () => getPeersWithTiles(peers, tracksMap, () => false) as TrackWithPeerAndDimensions[],
19
+ [peers, tracksMap],
20
+ );
21
+ const noOfPages = Math.ceil(peersWithTiles.length / maxTileCount);
22
+ const pagesList = useMemo(() => {
23
+ let sliceStart = 0;
24
+ let remaining = peersWithTiles.length;
25
+ const list = [];
26
+ // split into pages
27
+ for (let i = 0; i < noOfPages; i++) {
28
+ const count = Math.min(remaining, maxTileCount);
29
+ list.push(peersWithTiles.slice(sliceStart, sliceStart + count));
30
+ remaining = remaining - count;
31
+ sliceStart += count;
32
+ }
33
+ return list;
34
+ }, [peersWithTiles, noOfPages, maxTileCount]);
35
+ return pagesList;
36
+ };
37
+
38
+ export const useTileLayout = ({
39
+ pageList,
40
+ maxTileCount,
41
+ edgeToEdge = false,
42
+ }: {
43
+ pageList: TrackWithPeerAndDimensions[][];
44
+ maxTileCount: number;
45
+ edgeToEdge?: boolean;
46
+ }) => {
47
+ const vanillaStore = useHMSVanillaStore();
48
+ const [ref, { width, height }] = useMeasure<HTMLDivElement>();
49
+ const isMobile = useMedia(cssConfig.media.lg);
50
+ const [pagesWithTiles, setPagesWithTiles] = useState<TrackWithPeerAndDimensions[][]>([]);
51
+
52
+ useEffect(() => {
53
+ if (width === 0 || height === 0) {
54
+ return;
55
+ }
56
+ // calculate dimesions for each page
57
+ for (const page of pageList) {
58
+ const noOfTilesInPage = page.length;
59
+ let maxCols =
60
+ noOfTilesInPage > 2 && noOfTilesInPage < 9
61
+ ? Math.ceil(noOfTilesInPage / 2)
62
+ : Math.ceil(Math.sqrt(noOfTilesInPage));
63
+ if (isMobile) {
64
+ maxCols = noOfTilesInPage < 4 ? 1 : Math.min(maxCols, 2);
65
+ }
66
+ const maxRows = Math.ceil(noOfTilesInPage / maxCols);
67
+ let index = 0;
68
+ // convert the current page to a matrix(grid)
69
+ const matrix = new Array(maxRows).fill(null).map((_, i) => {
70
+ const numCols = Math.min(maxCols, noOfTilesInPage - i * maxCols);
71
+ const rowElements = [];
72
+ for (let j = 0; j < numCols; j++) {
73
+ if (index < page.length) {
74
+ rowElements.push(page[index++]);
75
+ }
76
+ }
77
+ return rowElements;
78
+ });
79
+
80
+ const gap = edgeToEdge && isMobile ? 0 : 8; // gap between flex items
81
+ const maxHeight = height - (maxRows - 1) * gap;
82
+ const maxRowHeight = maxHeight / matrix.length;
83
+ const aspectRatios =
84
+ isMobile && (noOfTilesInPage === 1 || noOfTilesInPage > 3)
85
+ ? aspectRatioConfig.mobile
86
+ : aspectRatioConfig.default;
87
+ // calculate height and width of each tile in a row
88
+ for (const row of matrix) {
89
+ let tileWidth = (width - (row.length - 1) * gap) / row.length;
90
+ let tileHeight = 0;
91
+ if (edgeToEdge) {
92
+ tileHeight = maxRowHeight;
93
+ } else {
94
+ const calcHeights = aspectRatios.map(aR => tileWidth / aR);
95
+ for (const h of calcHeights) {
96
+ if (h < maxRowHeight) {
97
+ if (tileHeight < h) {
98
+ tileHeight = h;
99
+ }
100
+ }
101
+ }
102
+
103
+ // tileHeight is not calculated as it could be exceeding the max possible height
104
+ // find the max possible width instead
105
+ if (tileHeight === 0) {
106
+ tileHeight = maxRowHeight;
107
+ const calcWidths = aspectRatios.map(aR => tileHeight * aR);
108
+ tileWidth = 0;
109
+ for (const w of calcWidths) {
110
+ if (w < width) {
111
+ if (tileWidth < w) {
112
+ tileWidth = w;
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ for (let i = 0; i < row.length; i++) {
119
+ row[i].width = tileWidth;
120
+ row[i].height = tileHeight;
121
+ }
122
+ }
123
+ }
124
+ setPagesWithTiles([...pageList]);
125
+ }, [width, height, maxTileCount, pageList, vanillaStore, isMobile, edgeToEdge]);
126
+ return { pagesWithTiles, ref };
127
+ };
@@ -0,0 +1,26 @@
1
+ import React, { useContext } from 'react';
2
+
3
+ type TileContextType = {
4
+ enableSpotlightingPeer: boolean;
5
+ hideParticipantNameOnTile?: boolean;
6
+ roundedVideoTile?: boolean;
7
+ hideAudioMuteOnTile?: boolean;
8
+ hideAudioLevelOnTile?: boolean;
9
+ objectFit?: 'cover' | 'contain';
10
+ hideMetadataOnTile?: boolean;
11
+ };
12
+
13
+ export const VideoTileContext = React.createContext<TileContextType>({
14
+ enableSpotlightingPeer: true,
15
+ hideParticipantNameOnTile: false,
16
+ roundedVideoTile: true,
17
+ hideAudioMuteOnTile: false,
18
+ hideAudioLevelOnTile: false,
19
+ objectFit: 'contain',
20
+ hideMetadataOnTile: false,
21
+ });
22
+
23
+ export const useVideoTileContext = () => {
24
+ const context = useContext(VideoTileContext);
25
+ return context;
26
+ };