@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,34 +0,0 @@
1
- import React, { useRef } from 'react';
2
- import { selectDominantSpeaker, selectPeers, useHMSStore } from '@100mslive/react-sdk';
3
- import { GridSidePaneView } from '../components/gridView';
4
- import VideoTile from '../components/VideoTile';
5
- import { Box, Flex } from '../../Layout';
6
-
7
- const ActiveSpeakerView = () => {
8
- const dominantSpeaker = useHMSStore(selectDominantSpeaker);
9
- const latestDominantSpeakerRef = useRef(dominantSpeaker);
10
- const peers = (useHMSStore(selectPeers) || []).filter(
11
- peer => peer.videoTrack || peer.audioTrack || peer.auxiliaryTracks.length > 0,
12
- );
13
- // if there is no current dominant speaker latest keeps pointing to last
14
- if (dominantSpeaker) {
15
- latestDominantSpeakerRef.current = dominantSpeaker;
16
- }
17
- if (peers.length === 0) {
18
- return null;
19
- }
20
- // show local peer if there hasn't been any dominant speaker
21
- const activeSpeaker = latestDominantSpeakerRef.current || peers[0];
22
- const showSidePane = activeSpeaker && peers.length > 1;
23
-
24
- return (
25
- <Flex css={{ size: '100%', '@lg': { flexDirection: 'column' } }}>
26
- <Box css={{ flex: '1 1 0 ' }}>
27
- <VideoTile peerId={activeSpeaker.id} width="100%" height="100%" />
28
- </Box>
29
- {showSidePane && <GridSidePaneView peers={peers.filter(peer => peer.id !== activeSpeaker.id)} />}
30
- </Flex>
31
- );
32
- };
33
-
34
- export default ActiveSpeakerView;
@@ -1,260 +0,0 @@
1
- import React, { Fragment, useEffect, useRef } from 'react';
2
- import Draggable from 'react-draggable';
3
- import { useMedia } from 'react-use';
4
- import {
5
- selectIsAllowedToPublish,
6
- selectLocalPeer,
7
- selectRemotePeers,
8
- selectRolesMap,
9
- useHMSStore,
10
- } from '@100mslive/react-sdk';
11
- import { ExpandIcon } from '@100mslive/react-icons';
12
- import { AudioVideoToggle } from '../components/AudioVideoToggle';
13
- import { FirstPersonDisplay } from '../components/FirstPersonDisplay';
14
- import VideoTile from '../components/VideoTile';
15
- import { Box, Flex } from '../../Layout';
16
- import { Text } from '../../Text';
17
- import { config as cssConfig } from '../../Theme';
18
- import IconButton from '../IconButton';
19
- import { useSetAppDataByKey } from '../components/AppData/useUISettings';
20
- import { useRolePreference } from '../components/hooks/useFeatures';
21
- import { APP_DATA } from '../common/constants';
22
-
23
- const getAspectRatio = ({ roleMap, roleName, isMobile }) => {
24
- const role = roleMap[roleName];
25
- const { width, height } = role.publishParams.video;
26
- return isMobile ? height / width : width / height;
27
- };
28
-
29
- export function InsetView() {
30
- const remotePeers = useHMSStore(selectRemotePeers);
31
- const localPeer = useHMSStore(selectLocalPeer);
32
- const isMobile = useMedia(cssConfig.media.md);
33
- const isLandscape = useMedia(cssConfig.media.ls);
34
- const roleMap = useHMSStore(selectRolesMap);
35
- const rolePreference = useRolePreference();
36
- let centerPeers = [];
37
- let sidepanePeers = [];
38
- if (rolePreference) {
39
- const center = rolePreference[localPeer.roleName]?.split(',') || [];
40
- for (const peer of remotePeers) {
41
- if (center.includes(peer.roleName)) {
42
- centerPeers.push(peer);
43
- } else {
44
- sidepanePeers.push(peer);
45
- }
46
- }
47
- if (centerPeers.length === 0 && sidepanePeers.length > 0) {
48
- centerPeers = sidepanePeers;
49
- sidepanePeers = [];
50
- }
51
- } else {
52
- centerPeers = remotePeers;
53
- }
54
- const hideInset = sidepanePeers.length > 0 && (isMobile || isLandscape);
55
-
56
- return (
57
- <Fragment>
58
- <Box
59
- css={{
60
- display: 'grid',
61
- gridTemplateColumns: sidepanePeers.length > 0 ? '3fr 1fr' : '100%',
62
- gridTemplateRows: '1fr',
63
- gap: '$8',
64
- px: '$10',
65
- size: '100%',
66
- '@md': {
67
- gridTemplateColumns: '1fr',
68
- gridTemplateRows: sidepanePeers.length > 0 ? `3fr 1fr` : '100%',
69
- },
70
- }}
71
- >
72
- <Flex
73
- align="center"
74
- justify="center"
75
- css={{
76
- size: '100%',
77
- gap: '$8',
78
- flexWrap: 'wrap',
79
- placeContent: 'center',
80
- minHeight: 0,
81
- minWidth: 0,
82
- '@lg': { flexFlow: 'column' },
83
- '@ls': { flexFlow: 'row' },
84
- }}
85
- >
86
- {centerPeers.length > 0 ? (
87
- centerPeers.map(peer => (
88
- <VideoTile
89
- key={peer.videoTrack || peer.id}
90
- peerId={peer.id}
91
- trackId={peer.videoTrack}
92
- rootCSS={{
93
- aspectRatio: getAspectRatio({
94
- roleMap,
95
- roleName: peer.roleName,
96
- isMobile,
97
- }),
98
- padding: 0,
99
- height: '100%',
100
- maxWidth: '100%',
101
- minWidth: 0,
102
- minHeight: 0,
103
- flex: remotePeers.length === 1 ? undefined : '1 1 0',
104
- display: 'flex',
105
- alignItems: 'center',
106
- '@lg': {
107
- display: 'block',
108
- padding: '0 !important',
109
- width: '100%',
110
- },
111
- }}
112
- objectFit="contain"
113
- />
114
- ))
115
- ) : (
116
- <FirstPersonDisplay />
117
- )}
118
- </Flex>
119
- {sidepanePeers.length > 0 && (
120
- <Flex
121
- align="center"
122
- justify="center"
123
- css={{
124
- size: '100%',
125
- gap: '$4',
126
- flexFlow: 'row wrap',
127
- placeContent: 'center',
128
- }}
129
- >
130
- {(hideInset ? [...sidepanePeers, localPeer] : sidepanePeers).map((peer, _, arr) => (
131
- <VideoTile
132
- key={peer.videoTrack || peer.id}
133
- peerId={peer.id}
134
- trackId={peer.videoTrack}
135
- rootCSS={{
136
- aspectRatio: getAspectRatio({
137
- roleMap,
138
- roleName: peer.roleName,
139
- isMobile: false,
140
- }),
141
- flexBasis: '100%',
142
- '@ls': {
143
- aspectRatio: 1,
144
- flexBasis: 'calc(50% - $4)',
145
- },
146
- '@md': {
147
- aspectRatio: 1,
148
- flexBasis: arr.length < 4 ? 'calc(50% - $4)' : 'calc(33% - $4)',
149
- },
150
- '@sm': {
151
- flexBasis: arr.length <= 4 ? 'calc(50% - $4)' : 'calc(33% - $4)',
152
- },
153
- padding: 0,
154
- }}
155
- objectFit="contain"
156
- />
157
- ))}
158
- </Flex>
159
- )}
160
- </Box>
161
- {!hideInset && <InsetTile roleMap={roleMap} isMobile={isMobile} isLandscape={isLandscape} />}
162
- </Fragment>
163
- );
164
- }
165
-
166
- const MinimisedTile = ({ setMinimised }) => {
167
- return (
168
- <Flex align="center" css={{ gap: '$6', r: '$1', bg: '$surface_default', p: '$4', color: '$on_surface_high' }}>
169
- <AudioVideoToggle hideOptions={true} />
170
- <Text>You</Text>
171
- <IconButton
172
- onClick={() => setMinimised(false)}
173
- css={{ bg: 'transparent', border: 'transparent' }}
174
- className="__cancel-drag-event"
175
- >
176
- <ExpandIcon />
177
- </IconButton>
178
- </Flex>
179
- );
180
- };
181
-
182
- export const InsetTile = () => {
183
- const isMobile = useMedia(cssConfig.media.md);
184
- const isLandscape = useMedia(cssConfig.media.ls);
185
- const localPeer = useHMSStore(selectLocalPeer);
186
- const isAllowedToPublish = useHMSStore(selectIsAllowedToPublish);
187
- const [minimised, setMinimised] = useSetAppDataByKey(APP_DATA.minimiseInset);
188
- const aspectRatio = isMobile ? 9 / 16 : 16 / 9;
189
- let height = 180;
190
- let width = height * aspectRatio;
191
- if (isLandscape && width > 240) {
192
- width = 240;
193
- height = width / aspectRatio;
194
- }
195
-
196
- const nodeRef = useRef(null);
197
-
198
- useEffect(() => {
199
- if (!nodeRef.current || !window.ResizeObserver) {
200
- return;
201
- }
202
- const node = nodeRef.current;
203
- const resizeObserver = new ResizeObserver(entries => {
204
- entries.forEach(entry => {
205
- if (entry.target === node.parentElement) {
206
- // reset to original position on resize
207
- node.style.transform = `translate(0,0)`;
208
- }
209
- });
210
- });
211
- resizeObserver.observe(node.parentElement);
212
- return () => {
213
- node?.parentElement && resizeObserver?.unobserve(node.parentElement);
214
- resizeObserver?.disconnect();
215
- };
216
- }, []);
217
-
218
- if (!isAllowedToPublish.audio && !isAllowedToPublish.video) {
219
- return null;
220
- }
221
-
222
- return (
223
- <Draggable bounds="parent" nodeRef={nodeRef} cancel=".__cancel-drag-event">
224
- <Box
225
- ref={nodeRef}
226
- css={{
227
- position: 'absolute',
228
- bottom: 0,
229
- right: 0,
230
- zIndex: 10,
231
- boxShadow: '0 0 8px 0 rgba(0,0,0,0.3)',
232
- r: '$2',
233
- ...(!minimised
234
- ? {
235
- aspectRatio: aspectRatio,
236
- h: height,
237
- }
238
- : {}),
239
- }}
240
- >
241
- {minimised ? (
242
- <MinimisedTile setMinimised={setMinimised} />
243
- ) : (
244
- <VideoTile
245
- peerId={localPeer.id}
246
- trackid={localPeer.videoTrack}
247
- rootCSS={{
248
- size: '100%',
249
- padding: 0,
250
- }}
251
- width={width}
252
- height={height}
253
- isDragabble={isMobile}
254
- canMinimise
255
- />
256
- )}
257
- </Box>
258
- </Draggable>
259
- );
260
- };
@@ -1,59 +0,0 @@
1
- import React from 'react';
2
- import { useMeasure } from 'react-use';
3
- import { selectPeers, selectVideoTrackByPeerID, useHMSStore } from '@100mslive/react-sdk';
4
- import { GridSidePaneView } from '../components/gridView';
5
- import VideoTile from '../components/VideoTile';
6
- import { Flex } from '../../Layout';
7
- import { useTheme } from '../../Theme';
8
- import { usePinnedTrack } from '../components/AppData/useUISettings';
9
-
10
- const PinnedPeerView = () => {
11
- const { aspectRatio } = useTheme();
12
- // can be audio or video track, if tile with only audio track is pinned
13
- const pinnedTrack = usePinnedTrack();
14
- const peerVideoTrack = useHMSStore(selectVideoTrackByPeerID(pinnedTrack.peerId));
15
- const pinnedVideoTrack = pinnedTrack && pinnedTrack.type === 'audio' ? peerVideoTrack : pinnedTrack;
16
- const [ref, { height, width }] = useMeasure();
17
- const peers = (useHMSStore(selectPeers) || []).filter(
18
- peer => peer.videoTrack || peer.audioTrack || peer.auxiliaryTracks.length > 0,
19
- );
20
- if (peers.length === 0) {
21
- return null;
22
- }
23
- const showSidePane = pinnedTrack && peers.length > 1;
24
-
25
- let finalWidth = (aspectRatio.width / aspectRatio.height) * height;
26
- let finalHeight = height;
27
-
28
- if (finalWidth > width) {
29
- finalWidth = width;
30
- finalHeight = (aspectRatio.height / aspectRatio.width) * width;
31
- }
32
-
33
- return (
34
- <Flex css={{ size: '100%', '@lg': { flexDirection: 'column' } }}>
35
- <Flex
36
- css={{
37
- flex: '1 1 0',
38
- p: '$8',
39
- minHeight: 0,
40
- minWidth: 0,
41
- justifyContent: 'center',
42
- alignItems: 'center',
43
- }}
44
- ref={ref}
45
- >
46
- <VideoTile
47
- key={pinnedTrack.id}
48
- trackId={pinnedVideoTrack?.id}
49
- peerId={pinnedTrack.peerId}
50
- height={finalHeight}
51
- width={finalWidth}
52
- />
53
- </Flex>
54
- {showSidePane && <GridSidePaneView peers={peers.filter(peer => peer.id !== pinnedTrack.peerId)} />}
55
- </Flex>
56
- );
57
- };
58
-
59
- export default PinnedPeerView;
@@ -1,52 +0,0 @@
1
- import React from 'react';
2
- import { selectAppData, useHMSStore } from '@100mslive/react-sdk';
3
- import { Chat } from '../components/Chat/Chat';
4
- import { ParticipantList } from '../components/Footer/ParticipantList';
5
- import { StreamingLanding } from '../components/Streaming/StreamingLanding';
6
- import { Box } from '../../Layout';
7
- import { APP_DATA, SIDE_PANE_OPTIONS } from '../common/constants';
8
-
9
- const SidePane = ({ css = {} }) => {
10
- const sidepane = useHMSStore(selectAppData(APP_DATA.sidePane));
11
- let ViewComponent;
12
- if (sidepane === SIDE_PANE_OPTIONS.PARTICIPANTS) {
13
- ViewComponent = ParticipantList;
14
- } else if (sidepane === SIDE_PANE_OPTIONS.CHAT) {
15
- ViewComponent = Chat;
16
- } else if (sidepane === SIDE_PANE_OPTIONS.STREAMING) {
17
- ViewComponent = StreamingLanding;
18
- }
19
- if (!ViewComponent) {
20
- return null;
21
- }
22
- return (
23
- <Box
24
- css={{
25
- w: '$100',
26
- h: '100%',
27
- p: '$10',
28
- bg: '$surface_default',
29
- r: '$1',
30
- ml: '$8',
31
- flexShrink: 0,
32
- position: 'relative',
33
- ...css,
34
- '@lg': {
35
- w: '100%',
36
- h: '100%',
37
- ml: 0,
38
- right: 0,
39
- position: 'fixed',
40
- bottom: 0,
41
- r: 0,
42
- zIndex: 10,
43
- ...(css['@lg'] || {}),
44
- },
45
- }}
46
- >
47
- <ViewComponent />
48
- </Box>
49
- );
50
- };
51
-
52
- export default SidePane;
@@ -1,98 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import {
3
- selectLocalPeerID,
4
- selectLocalPeerRole,
5
- selectPeers,
6
- selectPeersByRoles,
7
- selectRolesMap,
8
- useHMSStore,
9
- } from '@100mslive/react-sdk';
10
- import { GridCenterView, GridSidePaneView } from '../components/gridView';
11
- import { Flex } from '../../Layout';
12
- import { NonPublisherView } from './NonPublisherView';
13
- import { useAppLayout } from '../components/AppData/useAppLayout';
14
- import { useUISettings } from '../components/AppData/useUISettings';
15
- import { UI_SETTINGS } from '../common/constants';
16
-
17
- export const MainGridView = () => {
18
- const centerRoles = useAppLayout('center') || [];
19
- const sidepaneRoles = useAppLayout('sidepane') || [];
20
- const maxTileCount = useUISettings(UI_SETTINGS.maxTileCount);
21
- const peers = useHMSStore(selectPeers);
22
- const roles = useHMSStore(selectRolesMap);
23
- const localPeerId = useHMSStore(selectLocalPeerID);
24
- const centerPeers = peers.filter(peer => centerRoles.includes(peer.roleName));
25
- const sidebarPeers = peers.filter(peer => sidepaneRoles.includes(peer.roleName));
26
- const localRole = useHMSStore(selectLocalPeerRole);
27
- const peersByRoles = useHMSStore(selectPeersByRoles(localRole.subscribeParams.subscribeToRoles || []));
28
- const [placeholder, setPlaceholder] = useState('');
29
-
30
- useEffect(() => {
31
- const hasPublishingPeers = peers.some(peer => {
32
- // peer able to publish
33
- if (peer.roleName && roles[peer.roleName]) {
34
- return !!roles[peer.roleName].publishParams?.allowed.length;
35
- }
36
- return true;
37
- });
38
- const hasSubscribedRolePublishing = peersByRoles.some(peer => {
39
- if (peer.roleName && roles[peer.roleName]) {
40
- return !!roles[peer.roleName].publishParams?.allowed.length;
41
- }
42
- return true;
43
- });
44
- if (!hasPublishingPeers) {
45
- setPlaceholder('None of the roles can publish video, audio or screen');
46
- } else if (!localRole.subscribeParams.subscribeToRoles?.length) {
47
- setPlaceholder("This role isn't subscribed to any role");
48
- } else if (!hasSubscribedRolePublishing) {
49
- setPlaceholder('This role subscribed to roles is not publishing');
50
- } else {
51
- setPlaceholder('');
52
- }
53
- }, [localRole.subscribeParams.subscribeToRoles?.length, peers, peersByRoles, roles]);
54
- /**
55
- * If there are peers from many publishing roles, then it's possible to divide
56
- * them into two parts, those who show in center and those who show in sidepane.
57
- * In case there is only one person in the room, then too sidepane will be shown
58
- * and center would be taken up by a banner image.
59
- * There is an issue currently, where the banner is still shown if there are
60
- * multiple viewers in the room but no publisher. Depending on the use case
61
- * this can be useful(for webinar) or look odd(for showing you're the only one).
62
- * Note that both center peers and sidebar peers have only publishing peers in them.
63
- */
64
- let showSidePane = centerPeers.length > 0 && sidebarPeers.length > 0;
65
- if (centerPeers.length === 0) {
66
- // we'll show the sidepane for banner in this case too if 1). it's only me
67
- // in the room. or 2). noone is publishing in the room
68
- const itsOnlyMeInTheRoom = peers.length === 1 && peers[0].id === localPeerId;
69
- const nooneIsPublishing = sidebarPeers.length === 0;
70
- showSidePane = itsOnlyMeInTheRoom || nooneIsPublishing;
71
- }
72
- return (
73
- <Flex
74
- css={{
75
- size: '100%',
76
- }}
77
- direction={{
78
- '@initial': 'row',
79
- '@md': 'column',
80
- }}
81
- >
82
- {placeholder ? (
83
- <NonPublisherView message={placeholder} />
84
- ) : (
85
- <>
86
- <GridCenterView
87
- peers={showSidePane ? centerPeers : peers}
88
- maxTileCount={maxTileCount}
89
- allowRemoteMute={false}
90
- hideSidePane={!showSidePane}
91
- totalPeers={peers.length}
92
- />
93
- {showSidePane && <GridSidePaneView peers={sidebarPeers} totalPeers={peers.length} />}
94
- </>
95
- )}
96
- </Flex>
97
- );
98
- };
@@ -1,141 +0,0 @@
1
- import React, { Suspense, useCallback, useEffect } from 'react';
2
- import {
3
- selectIsConnectedToRoom,
4
- selectLocalPeerRoleName,
5
- selectPeerScreenSharing,
6
- selectPeerSharingAudio,
7
- selectPeerSharingVideoPlaylist,
8
- selectPermissions,
9
- useHMSActions,
10
- useHMSStore,
11
- useRecordingStreaming,
12
- } from '@100mslive/react-sdk';
13
- import { EqualProminence } from '../components/EqualProminence';
14
- import FullPageProgress from '../components/FullPageProgress';
15
- import { Flex } from '../../Layout';
16
- import { EmbedView } from './EmbedView';
17
- import { PDFView } from './PDFView';
18
- import ScreenShareView from './screenShareView';
19
- import SidePane from './SidePane';
20
- import { WaitingView } from './WaitingView';
21
- import { useWhiteboardMetadata } from '../plugins/whiteboard';
22
- import {
23
- useHLSViewerRole,
24
- usePDFAnnotator,
25
- usePinnedTrack,
26
- useSetAppDataByKey,
27
- useUISettings,
28
- useUrlToEmbed,
29
- useWaitingViewerRole,
30
- } from '../components/AppData/useUISettings';
31
- import { useShowStreamingUI } from '../common/hooks';
32
- import { APP_DATA, SESSION_STORE_KEY } from '../common/constants';
33
-
34
- // const WhiteboardView = React.lazy(() => import("./WhiteboardView"));
35
- const HLSView = React.lazy(() => import('./HLSView'));
36
- const PinnedTrackView = React.lazy(() => import('./PinnedTrackView'));
37
-
38
- export const ConferenceMainView = () => {
39
- const localPeerRole = useHMSStore(selectLocalPeerRoleName);
40
- const pinnedTrack = usePinnedTrack();
41
- const peerSharing = useHMSStore(selectPeerScreenSharing);
42
- const peerSharingAudio = useHMSStore(selectPeerSharingAudio);
43
- const peerSharingPlaylist = useHMSStore(selectPeerSharingVideoPlaylist);
44
- const { whiteboardOwner: whiteboardShared } = useWhiteboardMetadata();
45
- const isConnected = useHMSStore(selectIsConnectedToRoom);
46
- const hmsActions = useHMSActions();
47
- const { isAudioOnly } = useUISettings();
48
- const hlsViewerRole = useHLSViewerRole();
49
- const waitingViewerRole = useWaitingViewerRole();
50
- const urlToIframe = useUrlToEmbed();
51
- const pdfAnnotatorActive = usePDFAnnotator();
52
- const { isHLSRunning } = useRecordingStreaming();
53
- const [isHLSStarted, setHLSStarted] = useSetAppDataByKey(APP_DATA.hlsStarted);
54
- const permissions = useHMSStore(selectPermissions);
55
- const showStreamingUI = useShowStreamingUI();
56
-
57
- const startHLS = useCallback(async () => {
58
- try {
59
- if (isHLSStarted) {
60
- return;
61
- }
62
- setHLSStarted(true);
63
- await hmsActions.startHLSStreaming({});
64
- } catch (error) {
65
- if (error.message === 'beam already started') {
66
- return;
67
- }
68
- if (error.message.includes('invalid input')) {
69
- await startHLS();
70
- return;
71
- }
72
- setHLSStarted(false);
73
- }
74
- }, [hmsActions, isHLSStarted, setHLSStarted]);
75
-
76
- useEffect(() => {
77
- if (!isConnected) {
78
- return;
79
- }
80
- // Is a streaming kit and broadcaster joins
81
- if (permissions?.hlsStreaming && !isHLSRunning && showStreamingUI) {
82
- startHLS();
83
- }
84
- // eslint-disable-next-line react-hooks/exhaustive-deps
85
- }, [isConnected]);
86
-
87
- useEffect(() => {
88
- if (!isConnected) {
89
- return;
90
- }
91
- const audioPlaylist = JSON.parse(process.env.REACT_APP_AUDIO_PLAYLIST || '[]');
92
- const videoPlaylist = JSON.parse(process.env.REACT_APP_VIDEO_PLAYLIST || '[]');
93
- if (videoPlaylist.length > 0) {
94
- hmsActions.videoPlaylist.setList(videoPlaylist);
95
- }
96
- if (audioPlaylist.length > 0) {
97
- hmsActions.audioPlaylist.setList(audioPlaylist);
98
- }
99
-
100
- hmsActions.sessionStore.observe([SESSION_STORE_KEY.PINNED_MESSAGE, SESSION_STORE_KEY.SPOTLIGHT]);
101
- // eslint-disable-next-line react-hooks/exhaustive-deps
102
- }, [isConnected, hmsActions]);
103
-
104
- if (!localPeerRole) {
105
- // we don't know the role yet to decide how to render UI
106
- return null;
107
- }
108
-
109
- let ViewComponent;
110
- if (localPeerRole === hlsViewerRole) {
111
- ViewComponent = HLSView;
112
- } else if (localPeerRole === waitingViewerRole) {
113
- ViewComponent = WaitingView;
114
- } else if (pdfAnnotatorActive) {
115
- ViewComponent = PDFView;
116
- } else if (urlToIframe) {
117
- ViewComponent = EmbedView;
118
- } else if (whiteboardShared) {
119
- // ViewComponent = WhiteboardView;
120
- } else if (((peerSharing && peerSharing.id !== peerSharingAudio?.id) || peerSharingPlaylist) && !isAudioOnly) {
121
- ViewComponent = ScreenShareView;
122
- } else if (pinnedTrack) {
123
- ViewComponent = PinnedTrackView;
124
- } else {
125
- ViewComponent = EqualProminence;
126
- }
127
-
128
- return (
129
- <Suspense fallback={<FullPageProgress />}>
130
- <Flex
131
- css={{
132
- size: '100%',
133
- position: 'relative',
134
- }}
135
- >
136
- <ViewComponent />
137
- <SidePane />
138
- </Flex>
139
- </Suspense>
140
- );
141
- };