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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. package/dist/{HLSView-P57IRMAR.js → HLSView-PY2FKWX3.js} +191 -123
  2. package/dist/HLSView-PY2FKWX3.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/Footer/Footer.d.ts +6 -0
  7. package/dist/Prebuilt/components/Header/Header.d.ts +2 -0
  8. package/dist/Prebuilt/components/InsetTile.d.ts +2 -0
  9. package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +7 -0
  10. package/dist/Prebuilt/components/Leave/EndSessionContent.d.ts +8 -0
  11. package/dist/Prebuilt/components/Leave/LeaveAtoms.d.ts +2196 -0
  12. package/dist/Prebuilt/components/Leave/LeaveCard.d.ts +12 -0
  13. package/dist/Prebuilt/components/Leave/LeaveRoom.d.ts +5 -0
  14. package/dist/Prebuilt/components/Leave/LeaveSessionContent.d.ts +6 -0
  15. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +7 -0
  16. package/dist/Prebuilt/components/MoreSettings/MoreSettings.d.ts +6 -0
  17. package/dist/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.d.ts +6 -0
  18. package/dist/Prebuilt/components/Pagination.d.ts +6 -0
  19. package/dist/Prebuilt/components/Preview/PreviewForm.d.ts +10 -0
  20. package/dist/Prebuilt/components/SecondaryTiles.d.ts +3 -0
  21. package/dist/Prebuilt/components/VideoLayouts/EqualProminence.d.ts +3 -0
  22. package/dist/Prebuilt/components/VideoLayouts/Grid.d.ts +5 -0
  23. package/dist/Prebuilt/components/VideoLayouts/GridLayout.d.ts +10 -0
  24. package/dist/Prebuilt/components/VideoLayouts/ProminenceLayout.d.ts +12 -0
  25. package/dist/Prebuilt/components/VideoLayouts/RoleProminence.d.ts +3 -0
  26. package/dist/Prebuilt/components/VideoLayouts/ScreenshareLayout.d.ts +3 -0
  27. package/dist/Prebuilt/components/VideoLayouts/interface.d.ts +8 -0
  28. package/dist/Prebuilt/components/hooks/useRoleProminencePeers.d.ts +5 -0
  29. package/dist/Prebuilt/components/hooks/useTileLayout.d.ts +12 -0
  30. package/dist/Prebuilt/components/hooks/useVideoTileLayout.d.ts +11 -0
  31. package/dist/Prebuilt/layouts/SidePane.d.ts +6 -0
  32. package/dist/Prebuilt/layouts/VideoStreamingSection.d.ts +6 -0
  33. package/dist/Prebuilt/plugins/whiteboard/ToggleWhiteboard.d.ts +5 -0
  34. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.d.ts +1 -0
  35. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.d.ts +1 -0
  36. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +17 -0
  37. package/dist/Prebuilt/provider/roomLayoutProvider/index.d.ts +6 -1
  38. package/dist/{VirtualBackground-GGCQJ5JM.js → VirtualBackground-AYDHYLIZ.js} +5 -11
  39. package/dist/VirtualBackground-AYDHYLIZ.js.map +7 -0
  40. package/dist/{chunk-P5X32KOD.js → chunk-E2M2ZSOL.js} +8 -5
  41. package/dist/chunk-E2M2ZSOL.js.map +7 -0
  42. package/dist/chunk-GQD2AGWW.js +888 -0
  43. package/dist/chunk-GQD2AGWW.js.map +7 -0
  44. package/dist/{chunk-OSM4QEQG.js → chunk-RXTHJUMZ.js} +2462 -4738
  45. package/dist/chunk-RXTHJUMZ.js.map +7 -0
  46. package/dist/conference-V2XZGTKU.js +5927 -0
  47. package/dist/conference-V2XZGTKU.js.map +7 -0
  48. package/dist/index.cjs.js +9414 -15534
  49. package/dist/index.cjs.js.map +4 -4
  50. package/dist/index.js +2 -2
  51. package/dist/meta.cjs.json +2156 -3347
  52. package/dist/meta.esbuild.json +2601 -3885
  53. package/package.json +7 -7
  54. package/src/Button/Button.tsx +2 -2
  55. package/src/Prebuilt/App.tsx +49 -33
  56. package/src/Prebuilt/{AppContext.jsx → AppContext.tsx} +11 -3
  57. package/src/Prebuilt/IconButton.jsx +1 -0
  58. package/src/Prebuilt/Prebuilt.stories.tsx +1 -0
  59. package/src/Prebuilt/common/{PeersSorter.js → PeersSorter.ts} +15 -10
  60. package/src/Prebuilt/common/constants.js +3 -112
  61. package/src/Prebuilt/common/hooks.js +34 -1
  62. package/src/Prebuilt/common/utils.js +0 -8
  63. package/src/Prebuilt/components/AppData/AppData.jsx +3 -13
  64. package/src/Prebuilt/components/AppData/useUISettings.js +0 -4
  65. package/src/Prebuilt/components/AudioVideoToggle.jsx +6 -0
  66. package/src/Prebuilt/components/AuthToken.jsx +11 -42
  67. package/src/Prebuilt/components/Chat/Chat.jsx +57 -26
  68. package/src/Prebuilt/components/Chat/ChatBody.jsx +92 -32
  69. package/src/Prebuilt/components/Chat/ChatFooter.jsx +72 -48
  70. package/src/Prebuilt/components/Chat/ChatParticipantHeader.jsx +73 -0
  71. package/src/Prebuilt/components/Chat/ChatSelector.jsx +16 -17
  72. package/src/Prebuilt/components/Chat/ChatSelectorContainer.jsx +81 -0
  73. package/src/Prebuilt/components/Connection/TileConnection.jsx +30 -12
  74. package/src/Prebuilt/components/EmojiReaction.jsx +18 -17
  75. package/src/Prebuilt/components/Footer/ChatToggle.jsx +1 -7
  76. package/src/Prebuilt/components/Footer/Footer.tsx +89 -0
  77. package/src/Prebuilt/components/Footer/ParticipantList.jsx +213 -173
  78. package/src/Prebuilt/components/Footer/RoleAccordion.jsx +78 -0
  79. package/src/Prebuilt/components/HMSVideo/Controls.jsx +2 -2
  80. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +33 -10
  81. package/src/Prebuilt/components/HMSVideo/PlayButton.jsx +1 -1
  82. package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +3 -3
  83. package/src/Prebuilt/components/HMSVideo/VolumeControl.jsx +38 -9
  84. package/src/Prebuilt/components/Header/{ConferencingHeader.jsx → Header.tsx} +9 -7
  85. package/src/Prebuilt/components/Header/HeaderComponents.jsx +13 -4
  86. package/src/Prebuilt/components/Header/StreamActions.jsx +33 -60
  87. package/src/Prebuilt/components/Header/index.tsx +1 -0
  88. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +17 -3
  89. package/src/Prebuilt/components/InsetTile.tsx +122 -0
  90. package/src/Prebuilt/components/{MoreSettings/SplitComponents/DesktopLeaveRoom.jsx → Leave/DesktopLeaveRoom.tsx} +50 -18
  91. package/src/Prebuilt/components/{EndSessionContent.jsx → Leave/EndSessionContent.tsx} +19 -9
  92. package/src/Prebuilt/components/Leave/LeaveAtoms.tsx +26 -0
  93. package/src/Prebuilt/components/{LeaveCard.jsx → Leave/LeaveCard.tsx} +22 -3
  94. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +63 -0
  95. package/src/Prebuilt/components/{LeaveSessionContent.jsx → Leave/LeaveSessionContent.tsx} +13 -5
  96. package/src/Prebuilt/components/{MoreSettings/SplitComponents/MwebLeaveRoom.jsx → Leave/MwebLeaveRoom.tsx} +38 -13
  97. package/src/Prebuilt/components/MetaActions.jsx +15 -23
  98. package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +5 -0
  99. package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +12 -7
  100. package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +1 -1
  101. package/src/Prebuilt/components/MoreSettings/FullScreenItem.jsx +1 -4
  102. package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +27 -0
  103. package/src/Prebuilt/components/MoreSettings/SplitComponents/{DesktopOptions.jsx → DesktopOptions.tsx} +86 -75
  104. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.jsx +20 -19
  105. package/src/Prebuilt/components/Notifications/HLSFailureModal.jsx +3 -1
  106. package/src/Prebuilt/components/Notifications/Notifications.jsx +18 -11
  107. package/src/Prebuilt/components/Notifications/PeerNotifications.jsx +14 -2
  108. package/src/Prebuilt/components/Notifications/PermissionErrorModal.jsx +10 -4
  109. package/src/Prebuilt/components/PIP/PIPComponent.jsx +7 -16
  110. package/src/Prebuilt/components/PIP/PIPManager.js +1 -0
  111. package/src/Prebuilt/components/{Pagination.jsx → Pagination.tsx} +35 -6
  112. package/src/Prebuilt/components/Playlist/Playlist.jsx +1 -6
  113. package/src/Prebuilt/components/PostLeave.jsx +7 -7
  114. package/src/Prebuilt/components/Preview/PreviewContainer.jsx +5 -13
  115. package/src/Prebuilt/components/Preview/{PreviewForm.jsx → PreviewForm.tsx} +14 -4
  116. package/src/Prebuilt/components/Preview/PreviewJoin.jsx +9 -7
  117. package/src/Prebuilt/components/RaiseHand.jsx +0 -7
  118. package/src/Prebuilt/components/RoleChangeRequestModal.jsx +82 -6
  119. package/src/Prebuilt/components/ScreenshareDisplay.jsx +4 -10
  120. package/src/Prebuilt/components/ScreenshareTile.jsx +41 -33
  121. package/src/Prebuilt/components/SecondaryTiles.tsx +34 -0
  122. package/src/Prebuilt/components/Settings/LayoutSettings.jsx +2 -12
  123. package/src/Prebuilt/components/Settings/NotificationSettings.jsx +3 -9
  124. package/src/Prebuilt/components/Settings/SettingsModal.jsx +3 -9
  125. package/src/Prebuilt/components/StatsForNerds.jsx +3 -1
  126. package/src/Prebuilt/components/TileMenu/TileMenu.jsx +15 -16
  127. package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +21 -19
  128. package/src/Prebuilt/components/Toast/ToastConfig.jsx +53 -11
  129. package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +62 -0
  130. package/src/Prebuilt/components/VideoLayouts/Grid.tsx +41 -0
  131. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +92 -0
  132. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +60 -0
  133. package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +56 -0
  134. package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +36 -0
  135. package/src/Prebuilt/components/VideoLayouts/interface.ts +9 -0
  136. package/src/Prebuilt/components/VideoTile.jsx +93 -43
  137. package/src/Prebuilt/components/conference.jsx +24 -20
  138. package/src/Prebuilt/components/hooks/useMetadata.jsx +7 -0
  139. package/src/Prebuilt/components/hooks/useRoleProminencePeers.tsx +38 -0
  140. package/src/Prebuilt/components/hooks/useTileLayout.tsx +121 -0
  141. package/src/Prebuilt/components/hooks/useVideoTileLayout.ts +22 -0
  142. package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +5 -72
  143. package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +4 -45
  144. package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +2 -17
  145. package/src/Prebuilt/components/peerTileUtils.jsx +1 -1
  146. package/src/Prebuilt/images/empty-chat.svg +12 -0
  147. package/src/Prebuilt/layouts/EmbedView.jsx +17 -40
  148. package/src/Prebuilt/layouts/HLSView.jsx +83 -66
  149. package/src/Prebuilt/layouts/PDFView.jsx +1 -11
  150. package/src/Prebuilt/layouts/SidePane.tsx +96 -0
  151. package/src/Prebuilt/layouts/{mainView.jsx → VideoStreamingSection.tsx} +38 -47
  152. package/src/Prebuilt/layouts/WhiteboardView.jsx +10 -34
  153. package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +1 -4
  154. package/src/Prebuilt/plugins/whiteboard/{ToggleWhiteboard.jsx → ToggleWhiteboard.tsx} +5 -9
  155. package/src/Prebuilt/primitives/DialogContent.jsx +15 -11
  156. package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +17 -2
  157. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.ts +36 -13
  158. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.ts +10 -0
  159. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +65 -0
  160. package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +17 -6
  161. package/dist/HLSView-P57IRMAR.js.map +0 -7
  162. package/dist/PinnedTrackView-4FYJEBTB.js +0 -102
  163. package/dist/PinnedTrackView-4FYJEBTB.js.map +0 -7
  164. package/dist/VirtualBackground-GGCQJ5JM.js.map +0 -7
  165. package/dist/chunk-IVTWKQI3.js +0 -827
  166. package/dist/chunk-IVTWKQI3.js.map +0 -7
  167. package/dist/chunk-OSM4QEQG.js.map +0 -7
  168. package/dist/chunk-P5X32KOD.js.map +0 -7
  169. package/dist/chunk-RVCZPPTL.js +0 -1100
  170. package/dist/chunk-RVCZPPTL.js.map +0 -7
  171. package/dist/conference-P6I6ESVF.js +0 -8995
  172. package/dist/conference-P6I6ESVF.js.map +0 -7
  173. package/src/Prebuilt/components/Chat/ChatHeader.jsx +0 -67
  174. package/src/Prebuilt/components/EqualProminence.jsx +0 -180
  175. package/src/Prebuilt/components/FirstPersonDisplay.jsx +0 -50
  176. package/src/Prebuilt/components/Footer/Footer.jsx +0 -73
  177. package/src/Prebuilt/components/Header/Header.jsx +0 -8
  178. package/src/Prebuilt/components/Header/StreamingHeader.jsx +0 -54
  179. package/src/Prebuilt/components/LeaveRoom.jsx +0 -94
  180. package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +0 -10
  181. package/src/Prebuilt/components/Notifications/MessageNotifications.jsx +0 -25
  182. package/src/Prebuilt/components/gridView.jsx +0 -85
  183. package/src/Prebuilt/components/hooks/useFeatures.js +0 -22
  184. package/src/Prebuilt/components/hooks/useNavigation.js +0 -19
  185. package/src/Prebuilt/components/hooks/useSkipPreview.jsx +0 -20
  186. package/src/Prebuilt/components/pdfAnnotator/pdfErrorView.jsx +0 -29
  187. package/src/Prebuilt/images/Logo.svg +0 -8
  188. package/src/Prebuilt/layouts/ActiveSpeakerView.jsx +0 -34
  189. package/src/Prebuilt/layouts/InsetView.jsx +0 -260
  190. package/src/Prebuilt/layouts/PinnedTrackView.jsx +0 -59
  191. package/src/Prebuilt/layouts/SidePane.jsx +0 -52
  192. package/src/Prebuilt/layouts/mainGridView.jsx +0 -98
  193. package/src/Prebuilt/layouts/screenShareView.jsx +0 -183
  194. /package/{src/Prebuilt/components/Header/index.jsx → dist/Prebuilt/components/Header/index.d.ts} +0 -0
  195. /package/src/Prebuilt/components/{ScreenShare.jsx → ScreenShareToggle.jsx} +0 -0
  196. /package/src/{assets → Prebuilt/images}/android-perm-1.png +0 -0
  197. /package/src/{assets → Prebuilt/images}/ios-perm-0.png +0 -0
@@ -1,67 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { ChevronDownIcon, ChevronUpIcon, CrossIcon } from '@100mslive/react-icons';
3
- import { Box, Dropdown, Flex, IconButton, Text, textEllipsis } from '../../../';
4
- import { ChatSelector } from './ChatSelector';
5
- import { useSidepaneToggle } from '../AppData/useSidepane';
6
- import { SIDE_PANE_OPTIONS } from '../../common/constants';
7
-
8
- export const ChatHeader = React.memo(({ selection, selectorOpen, onToggle, onSelect, role, peerId }) => {
9
- const [open, setOpen] = useState(false);
10
- const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
11
- return (
12
- <Flex
13
- onClick={onToggle}
14
- align="center"
15
- css={{
16
- color: '$on_primary_high',
17
- h: '$16',
18
- mb: '$2',
19
- }}
20
- >
21
- <Text variant="h6">Chat </Text>
22
- <Dropdown.Root open={open} onOpenChange={value => setOpen(value)}>
23
- <Dropdown.Trigger
24
- asChild
25
- data-testid="participant_list_filter"
26
- css={{
27
- border: '1px solid $on_surface_low',
28
- r: '$0',
29
- p: '$2 $4',
30
- ml: '$8',
31
- }}
32
- tabIndex={0}
33
- >
34
- <Flex align="center">
35
- <Text variant="sm" css={{ ...textEllipsis(80) }}>
36
- {selection}
37
- </Text>
38
- <Box css={{ ml: '$2', color: '$on_surface_low' }}>
39
- {open ? <ChevronUpIcon width={14} height={14} /> : <ChevronDownIcon width={14} height={14} />}
40
- </Box>
41
- </Flex>
42
- </Dropdown.Trigger>
43
- <Dropdown.Content
44
- css={{
45
- w: '$64',
46
- overflow: 'hidden',
47
- maxHeight: 'unset',
48
- }}
49
- align="start"
50
- sideOffset={8}
51
- >
52
- <ChatSelector onSelect={onSelect} role={role} peerId={peerId} />
53
- </Dropdown.Content>
54
- </Dropdown.Root>
55
- <IconButton
56
- css={{ ml: 'auto' }}
57
- onClick={e => {
58
- e.stopPropagation();
59
- selectorOpen ? onToggle() : toggleChat();
60
- }}
61
- data-testid="close_chat"
62
- >
63
- <CrossIcon />
64
- </IconButton>
65
- </Flex>
66
- );
67
- });
@@ -1,180 +0,0 @@
1
- import React, { useEffect, useMemo, useState } from 'react';
2
- import { useMeasure, useMedia } from 'react-use';
3
- import {
4
- getPeersWithTiles,
5
- selectLocalPeer,
6
- selectPeers,
7
- selectRemotePeers,
8
- selectTracksMap,
9
- useHMSStore,
10
- useHMSVanillaStore,
11
- } from '@100mslive/react-sdk';
12
- import { Box, Flex } from '../../Layout';
13
- import { config as cssConfig } from '../../Theme';
14
- import { InsetTile } from '../layouts/InsetView';
15
- import { useRoomLayout } from '../provider/roomLayoutProvider';
16
- import { Pagination } from './Pagination';
17
- import VideoTile from './VideoTile';
18
- import { useUISettings } from './AppData/useUISettings';
19
- import PeersSorter from '../common/PeersSorter';
20
- import { UI_SETTINGS } from '../common/constants';
21
-
22
- const aspectRatioConfig = { default: [1 / 1, 4 / 3, 16 / 9], mobile: [1 / 1, 3 / 4, 9 / 16] };
23
-
24
- export function EqualProminence() {
25
- const layout = useRoomLayout();
26
- const { enable_local_tile_inset: isInsetEnabled = true } =
27
- //@ts-ignore
28
- layout?.screens?.conferencing?.default?.elements?.video_tile_layout?.grid || {};
29
- const peers = useHMSStore(isInsetEnabled ? selectRemotePeers : selectPeers);
30
- const [sortedPeers, setSortedPeers] = useState(peers);
31
- const localPeer = useHMSStore(selectLocalPeer);
32
- const vanillaStore = useHMSVanillaStore();
33
- const isMobile = useMedia(cssConfig.media.md);
34
- let maxTileCount = useUISettings(UI_SETTINGS.maxTileCount);
35
- maxTileCount = isMobile ? Math.min(maxTileCount, 6) : maxTileCount;
36
- const [pagesWithTiles, setPagesWithTiles] = useState([]);
37
- const [page, setPage] = useState(0);
38
- const [ref, { width, height }] = useMeasure();
39
- const peersSorter = useMemo(() => new PeersSorter(vanillaStore), [vanillaStore]);
40
- const pageSize = pagesWithTiles[0]?.length;
41
-
42
- useEffect(() => {
43
- // currentPageIndex should not exceed pages length
44
- if (page >= pagesWithTiles.length) {
45
- setPage(0);
46
- }
47
- }, [pagesWithTiles.length, page]);
48
-
49
- useEffect(() => {
50
- if (width === 0 || height === 0) {
51
- return;
52
- }
53
- const tracksMap = vanillaStore.getState(selectTracksMap);
54
- const peersWithTiles = getPeersWithTiles(
55
- sortedPeers.length === 0 ? [localPeer] : sortedPeers,
56
- tracksMap,
57
- () => false,
58
- );
59
- const noOfPages = Math.ceil(peersWithTiles.length / maxTileCount);
60
- let remaining = peersWithTiles.length;
61
- let sliceStart = 0;
62
- let pagesList = [];
63
- // split into pages
64
- for (let i = 0; i < noOfPages; i++) {
65
- const count = Math.min(remaining, maxTileCount);
66
- pagesList.push(peersWithTiles.slice(sliceStart, sliceStart + count));
67
- remaining = remaining - count;
68
- sliceStart += count;
69
- }
70
- // calculate dimesions for each page
71
- for (const page of pagesList) {
72
- const noOfTilesInPage = page.length;
73
- let maxCols =
74
- noOfTilesInPage > 2 && noOfTilesInPage < 9
75
- ? Math.ceil(noOfTilesInPage / 2)
76
- : Math.ceil(Math.sqrt(noOfTilesInPage));
77
- if (isMobile) {
78
- maxCols = noOfTilesInPage < 4 ? 1 : Math.min(maxCols, 2);
79
- }
80
- let maxRows = Math.ceil(noOfTilesInPage / maxCols);
81
- let index = 0;
82
- // convert the current page to a matrix(grid)
83
- const matrix = new Array(maxRows).fill(null).map((_, i) => {
84
- const numCols = Math.min(maxCols, noOfTilesInPage - i * maxCols);
85
- let rowElements = [];
86
- for (let j = 0; j < numCols; j++) {
87
- if (index < page.length) {
88
- rowElements.push(page[index++]);
89
- }
90
- }
91
- return rowElements;
92
- });
93
-
94
- const maxHeight = height - (maxRows - 1) * 8;
95
- const maxRowHeight = maxHeight / matrix.length;
96
- const aspectRatios =
97
- isMobile && (noOfTilesInPage === 1 || noOfTilesInPage > 3)
98
- ? aspectRatioConfig.mobile
99
- : aspectRatioConfig.default;
100
- // calculate height and width of each tile in a row
101
- for (const row of matrix) {
102
- let tileWidth = (width - (row.length - 1) * 8) / row.length;
103
- let tileHeight = 0;
104
- const calcHeights = aspectRatios.map(aR => tileWidth / aR);
105
- for (const h of calcHeights) {
106
- if (h < maxRowHeight) {
107
- if (tileHeight < h) {
108
- tileHeight = h;
109
- }
110
- }
111
- }
112
-
113
- // tileHeight is not calculated as it could be exceeding the max possible height
114
- // find the max possible width instead
115
- if (tileHeight === 0) {
116
- tileHeight = maxRowHeight;
117
- const calcWidths = aspectRatios.map(aR => tileHeight * aR);
118
- tileWidth = 0;
119
- for (const w of calcWidths) {
120
- if (w < width) {
121
- if (tileWidth < w) {
122
- tileWidth = w;
123
- }
124
- }
125
- }
126
- }
127
- for (let i = 0; i < row.length; i++) {
128
- row[i].width = tileWidth;
129
- row[i].height = tileHeight;
130
- }
131
- }
132
- }
133
- setPagesWithTiles(pagesList);
134
- }, [width, height, maxTileCount, vanillaStore, sortedPeers, page, isMobile, localPeer]);
135
-
136
- useEffect(() => {
137
- if (page !== 0) {
138
- return;
139
- }
140
- peersSorter.setPeersAndTilesPerPage({
141
- peers,
142
- tilesPerPage: pageSize || maxTileCount,
143
- });
144
- peersSorter.onUpdate(setSortedPeers);
145
- }, [page, peersSorter, peers, pageSize, maxTileCount]);
146
-
147
- return (
148
- <Flex direction="column" css={{ flex: '1 1 0', h: '100%', position: 'relative', minWidth: 0 }}>
149
- <Box
150
- ref={ref}
151
- css={{
152
- flex: '1 1 0',
153
- gap: '$4',
154
- display: 'flex',
155
- placeContent: 'center',
156
- alignItems: 'center',
157
- justifyContent: 'center',
158
- flexFlow: 'row wrap',
159
- minHeight: 0,
160
- }}
161
- >
162
- {pagesWithTiles[page]?.map(tile => {
163
- return (
164
- <VideoTile
165
- key={tile.track?.id || tile.peer?.id}
166
- width={tile.width}
167
- height={tile.height}
168
- peerId={tile.peer?.id}
169
- trackId={tile.track?.id}
170
- rootCSS={{ padding: 0 }}
171
- objectFit="contain"
172
- />
173
- );
174
- })}
175
- </Box>
176
- {pagesWithTiles.length > 1 && <Pagination page={page} onPageChange={setPage} numPages={pagesWithTiles.length} />}
177
- {isInsetEnabled && sortedPeers.length > 0 && <InsetTile />}
178
- </Flex>
179
- );
180
- }
@@ -1,50 +0,0 @@
1
- import React from 'react';
2
- import { Box, Flex } from '../../Layout';
3
- import { Text } from '../../Text';
4
- import PlaceholderBg from '../images/first_person.png';
5
-
6
- export const FirstPersonDisplay = React.memo(() => {
7
- return (
8
- <Box
9
- css={{
10
- position: 'relative',
11
- overflow: 'hidden',
12
- w: '37.5rem',
13
- maxWidth: '80%',
14
- h: '100%',
15
- r: '$3',
16
- m: '0 auto',
17
- backgroundImage: `url(${PlaceholderBg})`,
18
- backgroundSize: 'cover',
19
- backgroundRepeat: 'no-repeat',
20
- '@md': {
21
- w: '100%',
22
- maxWidth: 'unset',
23
- },
24
- }}
25
- data-testid="first_person_img"
26
- >
27
- <Flex
28
- align="center"
29
- direction="column"
30
- css={{
31
- position: 'absolute',
32
- w: '100%',
33
- top: '33.33%',
34
- left: 0,
35
- textAlign: 'center',
36
- }}
37
- >
38
- <Text color="white" variant="h4" css={{ '@md': { fontSize: '$md' } }}>
39
- Welcome!
40
- </Text>
41
- <Text color="white" variant="h6" css={{ mt: '$4', '@md': { fontSize: '$sm' } }}>
42
- You’re the first one here.
43
- </Text>
44
- <Text color="white" variant="h6" css={{ mt: '$2', '@md': { fontSize: '$sm' } }}>
45
- Sit back and relax till the others join.
46
- </Text>
47
- </Flex>
48
- </Box>
49
- );
50
- });
@@ -1,73 +0,0 @@
1
- import React from 'react';
2
- import { useMedia } from 'react-use';
3
- import { selectLocalPeerRoleName, useHMSStore } from '@100mslive/react-sdk';
4
- import { config as cssConfig, Footer as AppFooter } from '../../..';
5
- import { AudioVideoToggle } from '../AudioVideoToggle';
6
- import { EmojiReaction } from '../EmojiReaction';
7
- import { LeaveRoom } from '../LeaveRoom';
8
- import { MoreSettings } from '../MoreSettings/MoreSettings';
9
- import { RaiseHand } from '../RaiseHand';
10
- import { ScreenshareToggle } from '../ScreenShare';
11
- import { ChatToggle } from './ChatToggle';
12
- import { ParticipantCount } from './ParticipantList';
13
- import { useHLSViewerRole } from '../AppData/useUISettings';
14
-
15
- export const Footer = () => {
16
- const isMobile = useMedia(cssConfig.media.md);
17
- const localPeerRole = useHMSStore(selectLocalPeerRoleName);
18
- const hlsViewerRole = useHLSViewerRole();
19
- const isHlsViewer = hlsViewerRole === localPeerRole;
20
-
21
- return (
22
- <AppFooter.Root
23
- css={{
24
- flexWrap: 'nowrap',
25
- '@md': {
26
- justifyContent: 'center',
27
- gap: '$10',
28
- },
29
- }}
30
- >
31
- <AppFooter.Left
32
- css={{
33
- '@md': {
34
- w: 'unset',
35
- p: '0',
36
- gap: '$10',
37
- },
38
- }}
39
- >
40
- {isMobile ? <LeaveRoom /> : null}
41
- <AudioVideoToggle />
42
- </AppFooter.Left>
43
- <AppFooter.Center
44
- css={{
45
- '@md': {
46
- w: 'unset',
47
- gap: '$10',
48
- },
49
- }}
50
- >
51
- {isMobile ? (
52
- <>
53
- {isHlsViewer ? <RaiseHand /> : null}
54
- <ChatToggle />
55
- <MoreSettings />
56
- </>
57
- ) : (
58
- <>
59
- <ScreenshareToggle />
60
- {isHlsViewer ? <RaiseHand /> : null}
61
- <EmojiReaction />
62
- <LeaveRoom />
63
- </>
64
- )}
65
- </AppFooter.Center>
66
- <AppFooter.Right>
67
- <ChatToggle />
68
- <ParticipantCount />
69
- <MoreSettings />
70
- </AppFooter.Right>
71
- </AppFooter.Root>
72
- );
73
- };
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { ConferencingHeader } from './ConferencingHeader';
3
- import { StreamingHeader } from './StreamingHeader';
4
- import { isStreamingKit } from '../../common/utils';
5
-
6
- export const Header = () => {
7
- return isStreamingKit() ? <StreamingHeader /> : <ConferencingHeader />;
8
- };
@@ -1,54 +0,0 @@
1
- import React from 'react';
2
- import { useMedia } from 'react-use';
3
- import { config as cssConfig, Flex } from '../../../';
4
- import { EmojiReaction } from '../EmojiReaction';
5
- import { ParticipantCount } from '../Footer/ParticipantList';
6
- import { LeaveRoom } from '../LeaveRoom';
7
- import MetaActions from '../MetaActions';
8
- import { SpeakerTag } from './HeaderComponents';
9
- import { LiveStatus, RecordingStatus, StreamActions } from './StreamActions';
10
-
11
- export const StreamingHeader = () => {
12
- const isMobile = useMedia(cssConfig.media.md);
13
- return (
14
- <Flex justify="between" align="center" css={{ position: 'relative', height: '100%' }}>
15
- <Flex
16
- align="center"
17
- css={{
18
- position: 'absolute',
19
- left: '$10',
20
- }}
21
- >
22
- {isMobile ? (
23
- <Flex align="center" gap={2}>
24
- <LeaveRoom />
25
- <LiveStatus />
26
- <RecordingStatus />
27
- </Flex>
28
- ) : null}
29
- <SpeakerTag />
30
- </Flex>
31
-
32
- <Flex
33
- align="center"
34
- css={{
35
- position: 'absolute',
36
- right: '$10',
37
- gap: '$4',
38
- }}
39
- >
40
- {isMobile ? (
41
- <>
42
- <EmojiReaction />
43
- <MetaActions compact />
44
- </>
45
- ) : (
46
- <Flex css={{ gap: '$4' }}>
47
- <StreamActions />
48
- </Flex>
49
- )}
50
- <ParticipantCount />
51
- </Flex>
52
- </Flex>
53
- );
54
- };
@@ -1,94 +0,0 @@
1
- import React from 'react';
2
- import { useParams } from 'react-router-dom';
3
- import { useMedia } from 'react-use';
4
- import { selectIsConnectedToRoom, selectPermissions, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
5
- import { DesktopLeaveRoom } from './MoreSettings/SplitComponents/DesktopLeaveRoom';
6
- import { MwebLeaveRoom } from './MoreSettings/SplitComponents/MwebLeaveRoom';
7
- import { PictureInPicture } from './PIP/PIPManager';
8
- import { ToastManager } from './Toast/ToastManager';
9
- import { IconButton } from '../../IconButton';
10
- import { config as cssConfig, styled } from '../../Theme';
11
- import { useHMSPrebuiltContext } from '../AppContext';
12
- import { useNavigation } from './hooks/useNavigation';
13
-
14
- export const LeaveRoom = () => {
15
- const navigate = useNavigation();
16
- const params = useParams();
17
- const isConnected = useHMSStore(selectIsConnectedToRoom);
18
- const permissions = useHMSStore(selectPermissions);
19
- const isMobile = useMedia(cssConfig.media.md);
20
- const hmsActions = useHMSActions();
21
- const { showLeave, onLeave } = useHMSPrebuiltContext();
22
-
23
- const stopStream = async () => {
24
- try {
25
- console.log('Stopping HLS stream');
26
- await hmsActions.stopHLSStreaming();
27
- ToastManager.addToast({ title: 'Stopping the stream' });
28
- } catch (e) {
29
- console.error('Error stopping stream', e);
30
- ToastManager.addToast({ title: 'Error in stopping the stream', type: 'error' });
31
- }
32
- };
33
-
34
- const redirectToLeavePage = () => {
35
- if (showLeave) {
36
- if (params.role) {
37
- navigate('/leave/' + params.roomId + '/' + params.role);
38
- } else {
39
- navigate('/leave/' + params.roomId);
40
- }
41
- }
42
- PictureInPicture.stop().catch(() => console.error('stopping pip'));
43
- ToastManager.clearAllToast();
44
- onLeave?.();
45
- };
46
-
47
- const leaveRoom = () => {
48
- hmsActions.leave();
49
- redirectToLeavePage();
50
- };
51
-
52
- // const endRoom = () => {
53
- // hmsActions.endRoom(false, 'End Room');
54
- // redirectToLeavePage();
55
- // };
56
-
57
- if (!permissions || !isConnected) {
58
- return null;
59
- }
60
- return isMobile ? (
61
- <MwebLeaveRoom leaveIconButton={LeaveIconButton} leaveRoom={leaveRoom} stopStream={stopStream} />
62
- ) : (
63
- <DesktopLeaveRoom
64
- leaveIconButton={LeaveIconButton}
65
- menuTriggerButton={MenuTriggerButton}
66
- leaveRoom={leaveRoom}
67
- stopStream={stopStream}
68
- />
69
- );
70
- };
71
-
72
- const LeaveIconButton = styled(IconButton, {
73
- color: '$on_primary_high',
74
- h: '$14',
75
- px: '$4',
76
- r: '$1',
77
- bg: '$alert_error_default',
78
- '&:not([disabled]):hover': {
79
- bg: '$alert_error_bright',
80
- },
81
- '&:not([disabled]):active': {
82
- bg: '$alert_error_default',
83
- },
84
- '@md': {
85
- mx: 0,
86
- },
87
- });
88
-
89
- const MenuTriggerButton = styled(LeaveIconButton, {
90
- borderLeft: '1px solid $alert_error_dim',
91
- borderTopLeftRadius: 0,
92
- borderBottomLeftRadius: 0,
93
- px: '$2',
94
- });
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { useMedia } from 'react-use';
3
- import { DesktopOptions } from './SplitComponents/DesktopOptions';
4
- import { MwebOptions } from './SplitComponents/MwebOptions';
5
- import { config as cssConfig } from '../../../';
6
-
7
- export const MoreSettings = () => {
8
- const isMobile = useMedia(cssConfig.media.md);
9
- return isMobile ? <MwebOptions /> : <DesktopOptions />;
10
- };
@@ -1,25 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
3
- import { ToastBatcher } from '../Toast/ToastBatcher';
4
- import { useIsHeadless, useSubscribedNotifications } from '../AppData/useUISettings';
5
- import { useIsFeatureEnabled } from '../hooks/useFeatures';
6
- import { FEATURE_LIST, SUBSCRIBED_NOTIFICATIONS } from '../../common/constants';
7
-
8
- export const MessageNotifications = () => {
9
- const notification = useHMSNotifications(HMSNotificationTypes.NEW_MESSAGE);
10
- const isChatEnabled = useIsFeatureEnabled(FEATURE_LIST.CHAT);
11
- const isNewMessageSubscribed = useSubscribedNotifications(SUBSCRIBED_NOTIFICATIONS.NEW_MESSAGE);
12
- const isHeadless = useIsHeadless();
13
- useEffect(() => {
14
- if (!notification) {
15
- return;
16
- }
17
- console.debug(`[${notification.type}]`, notification);
18
- if (!isNewMessageSubscribed || notification.data?.ignored || !isChatEnabled) {
19
- return;
20
- }
21
- ToastBatcher.showToast({ notification });
22
- }, [notification, isNewMessageSubscribed, isHeadless, isChatEnabled]);
23
-
24
- return null;
25
- };
@@ -1,85 +0,0 @@
1
- import React, { Fragment } from 'react';
2
- import { useMedia } from 'react-use';
3
- import { Box, Flex } from '../../Layout';
4
- import { config as cssConfig } from '../../Theme';
5
- import { FirstPersonDisplay } from './FirstPersonDisplay';
6
- import { Image } from './Image';
7
- import VideoList from './VideoList';
8
- import { useAppConfig } from './AppData/useAppConfig';
9
- import { useIsHeadless } from './AppData/useUISettings';
10
-
11
- const MAX_TILES_FOR_MOBILE = 4;
12
-
13
- /**
14
- * the below variables are for showing webinar etc. related image if required on certain meeting urls
15
- */
16
- const webinarProps = JSON.parse(process.env.REACT_APP_WEBINAR_PROPS || '{}');
17
- const eventRoomIDs = webinarProps?.ROOM_IDS || [];
18
- const eventsImg = webinarProps?.IMAGE_FILE || ''; // the image to show in center
19
- // the link to navigate to when user clicks on the image
20
- const webinarInfoLink = webinarProps?.LINK_HREF || 'https://100ms.live/';
21
-
22
- // The center of the screen shows bigger tiles
23
- export const GridCenterView = ({ peers, maxTileCount }) => {
24
- const mediaQueryLg = cssConfig.media.md;
25
- const limitMaxTiles = useMedia(mediaQueryLg);
26
-
27
- const headlessConfig = useAppConfig('headlessConfig');
28
- const isHeadless = useIsHeadless();
29
- return (
30
- <Fragment>
31
- <Box
32
- css={{
33
- flex: '1 1 0',
34
- height: '100%',
35
- mx: isHeadless && Number(headlessConfig?.tileOffset) === 0 ? '0' : '$8',
36
- '@md': { flex: '2 1 0' },
37
- }}
38
- >
39
- {peers && peers.length > 0 ? (
40
- <VideoList peers={peers} maxTileCount={limitMaxTiles ? MAX_TILES_FOR_MOBILE : maxTileCount} />
41
- ) : eventRoomIDs.some(id => window.location.href.includes(id)) ? (
42
- <Box
43
- css={{
44
- display: 'grid',
45
- placeItems: 'center',
46
- size: '100%',
47
- p: '$12',
48
- }}
49
- >
50
- <a href={webinarInfoLink} target="_blank" rel="noreferrer">
51
- <Image css={{ p: '$4', boxShadow: '$sm' }} alt="Event template" src={eventsImg} />
52
- </a>
53
- </Box>
54
- ) : (
55
- <FirstPersonDisplay />
56
- )}
57
- </Box>
58
- </Fragment>
59
- );
60
- };
61
-
62
- // Side pane shows smaller tiles
63
- export const GridSidePaneView = ({ peers }) => {
64
- const headlessConfig = useAppConfig('headlessConfig');
65
- const isHeadless = useIsHeadless();
66
- return (
67
- <Flex
68
- direction="column"
69
- css={{
70
- flex: '0 0 20%',
71
- mx: isHeadless && Number(headlessConfig?.tileOffset) === 0 ? '0' : '$8',
72
- '@lg': {
73
- flex: '0 0 25%',
74
- },
75
- '@md': {
76
- flex: '1 1 0',
77
- },
78
- }}
79
- >
80
- <Flex css={{ flex: '1 1 0' }} align="end">
81
- {peers && peers.length > 0 && <VideoList peers={peers} maxColCount={1} />}
82
- </Flex>
83
- </Flex>
84
- );
85
- };
@@ -1,22 +0,0 @@
1
- import { selectTemplateAppData, useHMSStore } from '@100mslive/react-sdk';
2
-
3
- export const useFeatures = () => {
4
- let features = useHMSStore(selectTemplateAppData)?.features;
5
- return features && typeof features === 'string' ? features.split(',') : undefined;
6
- };
7
-
8
- export const useIsFeatureEnabled = key => {
9
- let features = useFeatures();
10
- return features ? features.includes(key) : true;
11
- };
12
-
13
- export const useRolePreference = () => {
14
- let preference = useHMSStore(selectTemplateAppData)?.rolePreference;
15
- try {
16
- preference = JSON.parse(preference || '{}');
17
- return preference;
18
- } catch (e) {
19
- console.log('role preference parse error', e);
20
- return undefined;
21
- }
22
- };