@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
@@ -0,0 +1,110 @@
1
+ import React, { useEffect, useMemo, useState } from 'react';
2
+ import { GridVideoTileLayout } from '@100mslive/types-prebuilt/elements/video_tile_layout';
3
+ import { selectPeers, selectPeerScreenSharing, useHMSStore, useHMSVanillaStore } from '@100mslive/react-sdk';
4
+ import { EqualProminence } from './EqualProminence';
5
+ import { RoleProminence } from './RoleProminence';
6
+ import { ScreenshareLayout } from './ScreenshareLayout';
7
+ // @ts-ignore: No implicit Any
8
+ import { usePinnedTrack } from '../AppData/useUISettings';
9
+ import { VideoTileContext } from '../hooks/useVideoTileLayout';
10
+ import PeersSorter from '../../common/PeersSorter';
11
+
12
+ export type TileCustomisationProps = {
13
+ hide_participant_name_on_tile: boolean;
14
+ rounded_video_tile: boolean;
15
+ hide_audio_mute_on_tile: boolean;
16
+ video_object_fit: 'contain' | 'cover';
17
+ edge_to_edge: boolean;
18
+ hide_metadata_on_tile: boolean;
19
+ };
20
+
21
+ export type GridLayoutProps = GridVideoTileLayout & TileCustomisationProps;
22
+
23
+ export const GridLayout = ({
24
+ enable_local_tile_inset: isInsetEnabled = false,
25
+ prominent_roles: prominentRoles = [],
26
+ enable_spotlighting_peer = false,
27
+ hide_participant_name_on_tile = false,
28
+ rounded_video_tile = true,
29
+ hide_audio_mute_on_tile = false,
30
+ video_object_fit = 'contain',
31
+ edge_to_edge = false,
32
+ hide_metadata_on_tile = false,
33
+ }: GridLayoutProps) => {
34
+ const peerSharing = useHMSStore(selectPeerScreenSharing);
35
+ const pinnedTrack = usePinnedTrack();
36
+ const peers = useHMSStore(selectPeers);
37
+ const isRoleProminence =
38
+ (prominentRoles.length &&
39
+ peers.some(
40
+ peer => peer.roleName && prominentRoles.includes(peer.roleName) && (peer.videoTrack || peer.audioTrack),
41
+ )) ||
42
+ pinnedTrack;
43
+ const updatedPeers = useMemo(() => {
44
+ if (isInsetEnabled && !isRoleProminence && !peerSharing) {
45
+ return peers.filter(peer => !peer.isLocal);
46
+ }
47
+ return peers;
48
+ }, [isInsetEnabled, isRoleProminence, peerSharing, peers]);
49
+ const vanillaStore = useHMSVanillaStore();
50
+ const [sortedPeers, setSortedPeers] = useState(updatedPeers);
51
+ const peersSorter = useMemo(() => new PeersSorter(vanillaStore), [vanillaStore]);
52
+ const [pageSize, setPageSize] = useState(0);
53
+ const [mainPage, setMainPage] = useState(0);
54
+ const tileLayout = {
55
+ enableSpotlightingPeer: enable_spotlighting_peer,
56
+ hideParticipantNameOnTile: hide_participant_name_on_tile,
57
+ roundedVideoTile: rounded_video_tile,
58
+ hideAudioMuteOnTile: hide_audio_mute_on_tile,
59
+ hideMetadataOnTile: hide_metadata_on_tile,
60
+ objectFit: video_object_fit,
61
+ };
62
+
63
+ useEffect(() => {
64
+ if (mainPage !== 0) {
65
+ return;
66
+ }
67
+ peersSorter.setPeersAndTilesPerPage({
68
+ peers: updatedPeers,
69
+ tilesPerPage: pageSize,
70
+ });
71
+ peersSorter.onUpdate(setSortedPeers);
72
+ }, [mainPage, peersSorter, updatedPeers, pageSize]);
73
+
74
+ if (peerSharing) {
75
+ return (
76
+ <VideoTileContext.Provider value={tileLayout}>
77
+ <ScreenshareLayout
78
+ peers={sortedPeers}
79
+ onPageSize={setPageSize}
80
+ onPageChange={setMainPage}
81
+ edgeToEdge={edge_to_edge}
82
+ />
83
+ </VideoTileContext.Provider>
84
+ );
85
+ } else if (isRoleProminence) {
86
+ return (
87
+ <VideoTileContext.Provider value={tileLayout}>
88
+ <RoleProminence
89
+ peers={sortedPeers}
90
+ onPageSize={setPageSize}
91
+ onPageChange={setMainPage}
92
+ prominentRoles={prominentRoles}
93
+ isInsetEnabled={isInsetEnabled}
94
+ edgeToEdge={edge_to_edge}
95
+ />
96
+ </VideoTileContext.Provider>
97
+ );
98
+ }
99
+ return (
100
+ <VideoTileContext.Provider value={tileLayout}>
101
+ <EqualProminence
102
+ peers={sortedPeers}
103
+ onPageSize={setPageSize}
104
+ onPageChange={setMainPage}
105
+ isInsetEnabled={isInsetEnabled}
106
+ edgeToEdge={edge_to_edge}
107
+ />
108
+ </VideoTileContext.Provider>
109
+ );
110
+ };
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import { TrackWithPeerAndDimensions } from '@100mslive/react-sdk';
3
+ import { Box, Flex } from '../../../Layout';
4
+ import { CSS } from '../../../Theme';
5
+ // @ts-ignore: No implicit Any
6
+ import VideoTile from '../VideoTile';
7
+ import { useVideoTileContext } from '../hooks/useVideoTileLayout';
8
+
9
+ const Root = ({ children, edgeToEdge }: React.PropsWithChildren<{ edgeToEdge?: boolean }>) => (
10
+ <Flex
11
+ direction="column"
12
+ css={{ h: '100%', flex: '1 1 0', minWidth: 0, gap: '$6', '@md': { gap: edgeToEdge ? 0 : '$6' } }}
13
+ >
14
+ {children}
15
+ </Flex>
16
+ );
17
+
18
+ const ProminentSection = ({ children, css = {} }: React.PropsWithChildren<{ css?: CSS }>) => {
19
+ return (
20
+ <Flex direction="column" css={{ flex: '1 1 0', gap: '$2', minHeight: 0, ...css }}>
21
+ {children}
22
+ </Flex>
23
+ );
24
+ };
25
+
26
+ const SecondarySection = ({
27
+ tiles,
28
+ children,
29
+ edgeToEdge,
30
+ }: React.PropsWithChildren<{ tiles: TrackWithPeerAndDimensions[]; edgeToEdge?: boolean }>) => {
31
+ const tileLayoutProps = useVideoTileContext();
32
+ if (!tiles?.length) {
33
+ return null;
34
+ }
35
+ return (
36
+ <Box
37
+ css={{
38
+ display: 'grid',
39
+ gridTemplateRows: React.Children.count(children) > 0 ? '136px auto' : '154px',
40
+ gridTemplateColumns: `repeat(${tiles.length}, minmax(0, 1fr))`,
41
+ margin: '0 auto',
42
+ gap: '$2 $4',
43
+ placeItems: 'center',
44
+ '@md': { gap: edgeToEdge ? 0 : '$4' },
45
+ }}
46
+ >
47
+ {tiles.map(tile => {
48
+ return (
49
+ <VideoTile
50
+ key={tile.track?.id || tile.peer?.id}
51
+ peerId={tile.peer?.id}
52
+ trackId={tile.track?.id}
53
+ rootCSS={{
54
+ padding: 0,
55
+ maxWidth: 240,
56
+ maxHeight: '100%',
57
+ aspectRatio: 16 / 9,
58
+ '@md': { aspectRatio: 1 },
59
+ }}
60
+ objectFit="contain"
61
+ {...tileLayoutProps}
62
+ />
63
+ );
64
+ })}
65
+ <Box css={{ gridColumn: `1/span ${tiles.length}` }}>{children}</Box>
66
+ </Box>
67
+ );
68
+ };
69
+
70
+ export const ProminenceLayout = {
71
+ Root,
72
+ ProminentSection,
73
+ SecondarySection,
74
+ };
@@ -0,0 +1,59 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { selectLocalPeer, useHMSStore } from '@100mslive/react-sdk';
3
+ import { InsetTile } from '../InsetTile';
4
+ import { Pagination } from '../Pagination';
5
+ import { SecondaryTiles } from '../SecondaryTiles';
6
+ import { Grid } from './Grid';
7
+ import { LayoutProps } from './interface';
8
+ import { ProminenceLayout } from './ProminenceLayout';
9
+ import { useRoleProminencePeers } from '../hooks/useRoleProminencePeers';
10
+ import { usePagesWithTiles, useTileLayout } from '../hooks/useTileLayout';
11
+
12
+ export function RoleProminence({
13
+ isInsetEnabled = false,
14
+ prominentRoles = [],
15
+ peers,
16
+ onPageChange,
17
+ onPageSize,
18
+ edgeToEdge,
19
+ }: LayoutProps) {
20
+ const { prominentPeers, secondaryPeers } = useRoleProminencePeers(prominentRoles, peers, isInsetEnabled);
21
+ const localPeer = useHMSStore(selectLocalPeer);
22
+ const maxTileCount = 4;
23
+ const pageList = usePagesWithTiles({
24
+ peers: prominentPeers,
25
+ maxTileCount,
26
+ });
27
+ const { ref, pagesWithTiles } = useTileLayout({
28
+ pageList,
29
+ maxTileCount,
30
+ });
31
+ const [page, setPage] = useState(0);
32
+ const pageSize = pagesWithTiles[0]?.length || 0;
33
+
34
+ useEffect(() => {
35
+ if (pageSize > 0) {
36
+ onPageSize?.(pageSize);
37
+ }
38
+ }, [pageSize, onPageSize]);
39
+
40
+ return (
41
+ <ProminenceLayout.Root>
42
+ <ProminenceLayout.ProminentSection>
43
+ <Grid ref={ref} tiles={pagesWithTiles[page]} />
44
+ </ProminenceLayout.ProminentSection>
45
+ {!edgeToEdge && (
46
+ <Pagination
47
+ page={page}
48
+ onPageChange={page => {
49
+ setPage(page);
50
+ onPageChange?.(page);
51
+ }}
52
+ numPages={pagesWithTiles.length}
53
+ />
54
+ )}
55
+ <SecondaryTiles peers={secondaryPeers} isInsetEnabled={isInsetEnabled} edgeToEdge={edgeToEdge} />
56
+ {isInsetEnabled && localPeer && !prominentPeers.includes(localPeer) && <InsetTile />}
57
+ </ProminenceLayout.Root>
58
+ );
59
+ }
@@ -0,0 +1,52 @@
1
+ import React, { useEffect, useMemo, useState } from 'react';
2
+ import { useMedia } from 'react-use';
3
+ import { selectPeersScreenSharing, useHMSStore } from '@100mslive/react-sdk';
4
+ import { config as cssConfig } from '../../../Theme';
5
+ import { Pagination } from '../Pagination';
6
+ // @ts-ignore: No implicit Any
7
+ import ScreenshareTile from '../ScreenshareTile';
8
+ import { SecondaryTiles } from '../SecondaryTiles';
9
+ import { LayoutProps } from './interface';
10
+ import { ProminenceLayout } from './ProminenceLayout';
11
+ // @ts-ignore: No implicit Any
12
+ import { useSetAppDataByKey } from '../AppData/useUISettings';
13
+ // @ts-ignore: No implicit Any
14
+ import { APP_DATA } from '../../common/constants';
15
+
16
+ export const ScreenshareLayout = ({ peers, onPageChange, onPageSize, edgeToEdge }: LayoutProps) => {
17
+ const peersSharing = useHMSStore(selectPeersScreenSharing);
18
+ const [, setActiveScreenSharePeer] = useSetAppDataByKey(APP_DATA.activeScreensharePeerId);
19
+ const [page, setPage] = useState(0);
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
+ );
31
+ useEffect(() => {
32
+ setActiveScreenSharePeer(isMobile ? '' : activeSharePeer?.id);
33
+ return () => {
34
+ setActiveScreenSharePeer('');
35
+ };
36
+ }, [activeSharePeer?.id, isMobile, setActiveScreenSharePeer]);
37
+
38
+ return (
39
+ <ProminenceLayout.Root edgeToEdge={edgeToEdge}>
40
+ <ProminenceLayout.ProminentSection>
41
+ <ScreenshareTile peerId={peersSharing[page]?.id} />
42
+ {!edgeToEdge && <Pagination page={page} onPageChange={setPage} numPages={peersSharing.length} />}
43
+ </ProminenceLayout.ProminentSection>
44
+ <SecondaryTiles
45
+ peers={secondaryPeers}
46
+ onPageChange={onPageChange}
47
+ onPageSize={onPageSize}
48
+ edgeToEdge={edgeToEdge}
49
+ />
50
+ </ProminenceLayout.Root>
51
+ );
52
+ };
@@ -0,0 +1,10 @@
1
+ import { HMSPeer } from '@100mslive/react-sdk';
2
+
3
+ export interface LayoutProps {
4
+ isInsetEnabled?: boolean;
5
+ edgeToEdge?: boolean;
6
+ prominentRoles?: string[];
7
+ peers: HMSPeer[];
8
+ onPageChange?: (page: number) => void;
9
+ onPageSize?: (size: number) => void;
10
+ }
@@ -1,29 +1,29 @@
1
- import React, { Fragment, useCallback, useMemo, useState } from 'react';
2
- import { useMedia } from 'react-use';
1
+ import React, { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
2
  import {
4
3
  selectAudioTrackByPeerID,
5
4
  selectIsPeerAudioEnabled,
6
5
  selectLocalPeerID,
7
6
  selectPeerMetadata,
8
7
  selectPeerNameByID,
8
+ selectSessionStore,
9
+ selectTrackAudioByID,
9
10
  selectVideoTrackByID,
10
11
  selectVideoTrackByPeerID,
11
12
  useHMSStore,
13
+ useHMSVanillaStore,
12
14
  } from '@100mslive/react-sdk';
13
15
  import { BrbTileIcon, HandIcon, MicOffIcon } from '@100mslive/react-icons';
14
16
  import TileConnection from './Connection/TileConnection';
15
- import TileMenu from './TileMenu/TileMenu';
16
- import { useBorderAudioLevel } from '../../AudioLevel';
17
+ import TileMenu, { isSameTile } from './TileMenu/TileMenu';
17
18
  import { Avatar } from '../../Avatar';
19
+ import { Box, Flex } from '../../Layout';
18
20
  import { VideoTileStats } from '../../Stats';
19
- import { config as cssConfig } from '../../Theme';
21
+ import { keyframes } from '../../Theme';
20
22
  import { Video } from '../../Video';
21
23
  import { StyledVideoTile } from '../../VideoTile';
22
24
  import { getVideoTileLabel } from './peerTileUtils';
23
- import { useAppConfig } from './AppData/useAppConfig';
24
- import { useIsHeadless, useUISettings } from './AppData/useUISettings';
25
- import { useShowStreamingUI } from '../common/hooks';
26
- import { UI_SETTINGS } from '../common/constants';
25
+ import { useSetAppDataByKey, useUISettings } from './AppData/useUISettings';
26
+ import { APP_DATA, SESSION_STORE_KEY, UI_SETTINGS } from '../common/constants';
27
27
 
28
28
  const Tile = ({
29
29
  peerId,
@@ -35,6 +35,11 @@ const Tile = ({
35
35
  isDragabble = false,
36
36
  rootCSS = {},
37
37
  containerCSS = {},
38
+ enableSpotlightingPeer = true,
39
+ hideParticipantNameOnTile = false,
40
+ roundedVideoTile = true,
41
+ hideAudioMuteOnTile = false,
42
+ hideMetadataOnTile = false,
38
43
  }) => {
39
44
  const trackSelector = trackId ? selectVideoTrackByID(trackId) : selectVideoTrackByPeerID(peerId);
40
45
  const track = useHMSStore(trackSelector);
@@ -44,15 +49,18 @@ const Tile = ({
44
49
  const isAudioOnly = useUISettings(UI_SETTINGS.isAudioOnly);
45
50
  const mirrorLocalVideo = useUISettings(UI_SETTINGS.mirrorLocalVideo);
46
51
  const showStatsOnTiles = useUISettings(UI_SETTINGS.showStatsOnTiles);
47
- const isHeadless = useIsHeadless();
48
52
  const isAudioMuted = !useHMSStore(selectIsPeerAudioEnabled(peerId));
49
53
  const isVideoMuted = !track?.enabled;
50
54
  const [isMouseHovered, setIsMouseHovered] = useState(false);
51
- const borderAudioRef = useBorderAudioLevel(audioTrack?.id);
52
55
  const isVideoDegraded = track?.degraded;
53
56
  const isLocal = localPeerID === peerId;
54
- const isMobile = useMedia(cssConfig.media.md);
55
- const showStreamingUI = useShowStreamingUI();
57
+ const [pinnedTrackId] = useSetAppDataByKey(APP_DATA.pinnedTrackId);
58
+ const pinned = isSameTile({
59
+ trackId: pinnedTrackId,
60
+ videoTrackID: track?.id,
61
+ audioTrackID: audioTrack?.id,
62
+ });
63
+ const spotlighted = useHMSStore(selectSessionStore(SESSION_STORE_KEY.SPOTLIGHT)) === peerId;
56
64
  const label = getVideoTileLabel({
57
65
  peerName,
58
66
  track,
@@ -61,8 +69,6 @@ const Tile = ({
61
69
  const onHoverHandler = useCallback(event => {
62
70
  setIsMouseHovered(event.type === 'mouseenter');
63
71
  }, []);
64
- const headlessConfig = useAppConfig('headlessConfig');
65
- const hideLabel = isHeadless && headlessConfig?.hideTileName;
66
72
  const isTileBigEnoughToShowStats = height >= 180 && width >= 180;
67
73
  const avatarSize = useMemo(() => {
68
74
  if (!width || !height) {
@@ -81,11 +87,6 @@ const Tile = ({
81
87
  css={{
82
88
  width,
83
89
  height,
84
- padding: getPadding({
85
- isHeadless,
86
- tileOffset: headlessConfig?.tileOffset,
87
- hideAudioLevel: headlessConfig?.hideAudioLevel,
88
- }),
89
90
  ...rootCSS,
90
91
  }}
91
92
  data-testid={`participant_tile_${peerName}`}
@@ -94,69 +95,125 @@ const Tile = ({
94
95
  <StyledVideoTile.Container
95
96
  onMouseEnter={onHoverHandler}
96
97
  onMouseLeave={onHoverHandler}
97
- ref={isHeadless && headlessConfig?.hideAudioLevel ? undefined : borderAudioRef}
98
- noRadius={isHeadless && Number(headlessConfig?.tileOffset) === 0}
98
+ noRadius={!roundedVideoTile}
99
99
  css={containerCSS}
100
100
  >
101
101
  {showStatsOnTiles && isTileBigEnoughToShowStats ? (
102
102
  <VideoTileStats audioTrackID={audioTrack?.id} videoTrackID={track?.id} peerID={peerId} isLocal={isLocal} />
103
103
  ) : null}
104
104
 
105
- {track ? (
106
- <Video
107
- trackId={track?.id}
108
- attach={isLocal ? undefined : !isAudioOnly}
109
- mirror={
110
- mirrorLocalVideo &&
111
- peerId === localPeerID &&
112
- track?.source === 'regular' &&
113
- track?.facingMode !== 'environment'
114
- }
115
- degraded={isVideoDegraded}
116
- noRadius={isHeadless && Number(headlessConfig?.tileOffset) === 0}
117
- data-testid="participant_video_tile"
118
- css={{
119
- objectFit,
120
- }}
121
- />
122
- ) : null}
123
- {isVideoMuted || isVideoDegraded || (!isLocal && isAudioOnly) ? (
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
+
123
+ {isVideoMuted || (!isLocal && isAudioOnly) ? (
124
124
  <StyledVideoTile.AvatarContainer>
125
125
  <Avatar name={peerName || ''} data-testid="participant_avatar_icon" size={avatarSize} />
126
126
  </StyledVideoTile.AvatarContainer>
127
127
  ) : null}
128
128
 
129
- {showAudioMuted({
130
- hideTileAudioMute: headlessConfig?.hideTileAudioMute,
131
- isHeadless,
132
- isAudioMuted,
133
- }) ? (
134
- <StyledVideoTile.AudioIndicator
135
- data-testid="participant_audio_mute_icon"
136
- size={width && height && (width < 180 || height < 180) ? 'small' : 'medium'}
137
- >
138
- <MicOffIcon />
139
- </StyledVideoTile.AudioIndicator>
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
140
  ) : null}
141
- {(isMouseHovered || isDragabble) && !isHeadless ? (
141
+ {isMouseHovered || isDragabble ? (
142
142
  <TileMenu
143
143
  peerID={peerId}
144
144
  audioTrackID={audioTrack?.id}
145
145
  videoTrackID={track?.id}
146
146
  canMinimise={canMinimise}
147
+ enableSpotlightingPeer={enableSpotlightingPeer}
147
148
  />
148
149
  ) : null}
149
- <PeerMetadata peerId={peerId} />
150
- {showStreamingUI && isMobile ? null : (
151
- <TileConnection hideLabel={hideLabel} name={label} isTile peerId={peerId} width={width} />
152
- )}
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
+ />
153
161
  </StyledVideoTile.Container>
154
162
  ) : null}
155
163
  </StyledVideoTile.Root>
156
164
  );
157
165
  };
158
166
 
159
- const metaStyles = { top: '$4', left: '$4' };
167
+ const metaStyles = { top: '$4', left: '$4', width: '$14', height: '$14' };
168
+
169
+ const heightAnimation = value =>
170
+ keyframes({
171
+ '50%': {
172
+ transform: `scale3d(1,${value},1)`,
173
+ },
174
+ '100%': {
175
+ transform: `scale3d(1,1,1)`,
176
+ },
177
+ });
178
+
179
+ const AudioLevelIndicator = ({ trackId, value, delay }) => {
180
+ const vanillaStore = useHMSVanillaStore();
181
+ const ref = useRef();
182
+
183
+ useEffect(() => {
184
+ const unsubscribe = vanillaStore.subscribe(audioLevel => {
185
+ if (ref.current) {
186
+ ref.current.style['animation'] = `${heightAnimation(
187
+ audioLevel ? value : 1,
188
+ )} 0.3s cubic-bezier(0.61, 1, 0.88, 1) infinite ${delay}s`;
189
+ }
190
+ }, selectTrackAudioByID(trackId));
191
+ return unsubscribe;
192
+ }, [vanillaStore, trackId, value, delay]);
193
+ return (
194
+ <Box
195
+ ref={ref}
196
+ css={{
197
+ w: 4,
198
+ height: 6,
199
+ r: 2,
200
+ bg: '$on_primary_high',
201
+ }}
202
+ />
203
+ );
204
+ };
205
+
206
+ export const AudioLevel = ({ trackId }) => {
207
+ return (
208
+ <StyledVideoTile.AudioIndicator>
209
+ <Flex align="center" justify="center" css={{ gap: '$2' }}>
210
+ {[3, 2, 3].map((v, i) => (
211
+ <AudioLevelIndicator trackId={trackId} value={v} delay={i * 0.15} key={i} />
212
+ ))}
213
+ </Flex>
214
+ </StyledVideoTile.AudioIndicator>
215
+ );
216
+ };
160
217
 
161
218
  const PeerMetadata = ({ peerId }) => {
162
219
  const metaData = useHMSStore(selectPeerMetadata(peerId));
@@ -172,7 +229,7 @@ const PeerMetadata = ({ peerId }) => {
172
229
  ) : null}
173
230
  {isBRB ? (
174
231
  <StyledVideoTile.AttributeBox css={metaStyles} data-testid="brb_icon_onTile">
175
- <BrbTileIcon width={24} height={24} />
232
+ <BrbTileIcon width={22} height={22} />
176
233
  </StyledVideoTile.AttributeBox>
177
234
  ) : null}
178
235
  </Fragment>
@@ -181,19 +238,4 @@ const PeerMetadata = ({ peerId }) => {
181
238
 
182
239
  const VideoTile = React.memo(Tile);
183
240
 
184
- const showAudioMuted = ({ hideTileAudioMute, isHeadless, isAudioMuted }) => {
185
- if (!isHeadless) {
186
- return isAudioMuted;
187
- }
188
- return isAudioMuted && !hideTileAudioMute;
189
- };
190
-
191
- const getPadding = ({ isHeadless, tileOffset, hideAudioLevel }) => {
192
- if (!isHeadless || isNaN(Number(tileOffset))) {
193
- return undefined;
194
- }
195
- // Adding extra padding of 3px to ensure that the audio border is visible properly between tiles when tileOffset is 0.
196
- return Number(tileOffset) === 0 ? (hideAudioLevel ? 0 : 3) : undefined;
197
- };
198
-
199
241
  export default VideoTile;