@100mslive/roomkit-react 0.1.4 → 0.1.6-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-CTAJQUU4.js → HLSView-PY2FKWX3.js} +191 -123
- package/dist/HLSView-PY2FKWX3.js.map +7 -0
- package/dist/Prebuilt/App.d.ts +3 -0
- package/dist/Prebuilt/AppContext.d.ts +13 -0
- package/dist/Prebuilt/common/PeersSorter.d.ts +21 -0
- package/dist/Prebuilt/components/Footer/Footer.d.ts +6 -0
- package/dist/Prebuilt/components/Header/Header.d.ts +2 -0
- package/dist/Prebuilt/components/InsetTile.d.ts +2 -0
- package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +7 -0
- package/dist/Prebuilt/components/Leave/EndSessionContent.d.ts +8 -0
- package/dist/Prebuilt/components/Leave/LeaveAtoms.d.ts +2196 -0
- package/dist/Prebuilt/components/Leave/LeaveCard.d.ts +12 -0
- package/dist/Prebuilt/components/Leave/LeaveRoom.d.ts +5 -0
- package/dist/Prebuilt/components/Leave/LeaveSessionContent.d.ts +6 -0
- package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +7 -0
- package/dist/Prebuilt/components/MoreSettings/MoreSettings.d.ts +6 -0
- package/dist/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.d.ts +6 -0
- package/dist/Prebuilt/components/Pagination.d.ts +6 -0
- package/dist/Prebuilt/components/Preview/PreviewForm.d.ts +10 -0
- package/dist/Prebuilt/components/SecondaryTiles.d.ts +3 -0
- package/dist/Prebuilt/components/VideoLayouts/EqualProminence.d.ts +3 -0
- package/dist/Prebuilt/components/VideoLayouts/Grid.d.ts +5 -0
- package/dist/Prebuilt/components/VideoLayouts/GridLayout.d.ts +10 -0
- package/dist/Prebuilt/components/VideoLayouts/ProminenceLayout.d.ts +12 -0
- package/dist/Prebuilt/components/VideoLayouts/RoleProminence.d.ts +3 -0
- package/dist/Prebuilt/components/VideoLayouts/ScreenshareLayout.d.ts +3 -0
- package/dist/Prebuilt/components/VideoLayouts/interface.d.ts +8 -0
- package/dist/Prebuilt/components/hooks/useRoleProminencePeers.d.ts +5 -0
- package/dist/Prebuilt/components/hooks/useTileLayout.d.ts +12 -0
- package/dist/Prebuilt/components/hooks/useVideoTileLayout.d.ts +11 -0
- package/dist/Prebuilt/layouts/SidePane.d.ts +6 -0
- package/dist/Prebuilt/layouts/VideoStreamingSection.d.ts +6 -0
- package/dist/Prebuilt/plugins/whiteboard/ToggleWhiteboard.d.ts +5 -0
- package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.d.ts +1 -0
- package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.d.ts +1 -0
- package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +17 -0
- package/dist/Prebuilt/provider/roomLayoutProvider/index.d.ts +6 -1
- package/dist/{VirtualBackground-GGGBJYVY.js → VirtualBackground-AYDHYLIZ.js} +5 -11
- package/dist/VirtualBackground-AYDHYLIZ.js.map +7 -0
- package/dist/{chunk-TJNDX446.js → chunk-E2M2ZSOL.js} +8 -5
- package/dist/chunk-E2M2ZSOL.js.map +7 -0
- package/dist/chunk-GQD2AGWW.js +888 -0
- package/dist/chunk-GQD2AGWW.js.map +7 -0
- package/dist/{chunk-L2SX7GBO.js → chunk-RXTHJUMZ.js} +2462 -4738
- package/dist/chunk-RXTHJUMZ.js.map +7 -0
- package/dist/conference-V2XZGTKU.js +5927 -0
- package/dist/conference-V2XZGTKU.js.map +7 -0
- package/dist/index.cjs.js +9414 -15534
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.js +2 -2
- package/dist/meta.cjs.json +2156 -3347
- package/dist/meta.esbuild.json +2601 -3885
- package/package.json +7 -7
- package/src/Button/Button.tsx +2 -2
- package/src/Prebuilt/App.tsx +49 -33
- package/src/Prebuilt/{AppContext.jsx → AppContext.tsx} +11 -3
- package/src/Prebuilt/IconButton.jsx +1 -0
- package/src/Prebuilt/Prebuilt.stories.tsx +1 -0
- package/src/Prebuilt/common/{PeersSorter.js → PeersSorter.ts} +15 -10
- package/src/Prebuilt/common/constants.js +3 -112
- package/src/Prebuilt/common/hooks.js +34 -1
- package/src/Prebuilt/common/utils.js +0 -8
- package/src/Prebuilt/components/AppData/AppData.jsx +3 -13
- package/src/Prebuilt/components/AppData/useUISettings.js +0 -4
- package/src/Prebuilt/components/AudioVideoToggle.jsx +6 -0
- package/src/Prebuilt/components/AuthToken.jsx +11 -42
- package/src/Prebuilt/components/Chat/Chat.jsx +57 -26
- package/src/Prebuilt/components/Chat/ChatBody.jsx +92 -32
- package/src/Prebuilt/components/Chat/ChatFooter.jsx +72 -48
- package/src/Prebuilt/components/Chat/ChatParticipantHeader.jsx +73 -0
- package/src/Prebuilt/components/Chat/ChatSelector.jsx +16 -17
- package/src/Prebuilt/components/Chat/ChatSelectorContainer.jsx +81 -0
- package/src/Prebuilt/components/Connection/TileConnection.jsx +30 -12
- package/src/Prebuilt/components/EmojiReaction.jsx +18 -17
- package/src/Prebuilt/components/Footer/ChatToggle.jsx +1 -7
- package/src/Prebuilt/components/Footer/Footer.tsx +89 -0
- package/src/Prebuilt/components/Footer/ParticipantList.jsx +213 -173
- package/src/Prebuilt/components/Footer/RoleAccordion.jsx +78 -0
- package/src/Prebuilt/components/HMSVideo/Controls.jsx +2 -2
- package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +33 -10
- package/src/Prebuilt/components/HMSVideo/PlayButton.jsx +1 -1
- package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +3 -3
- package/src/Prebuilt/components/HMSVideo/VolumeControl.jsx +38 -9
- package/src/Prebuilt/components/Header/{ConferencingHeader.jsx → Header.tsx} +9 -7
- package/src/Prebuilt/components/Header/HeaderComponents.jsx +13 -4
- package/src/Prebuilt/components/Header/StreamActions.jsx +33 -60
- package/src/Prebuilt/components/Header/index.tsx +1 -0
- package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +17 -3
- package/src/Prebuilt/components/InsetTile.tsx +122 -0
- package/src/Prebuilt/components/{MoreSettings/SplitComponents/DesktopLeaveRoom.jsx → Leave/DesktopLeaveRoom.tsx} +50 -18
- package/src/Prebuilt/components/{EndSessionContent.jsx → Leave/EndSessionContent.tsx} +19 -9
- package/src/Prebuilt/components/Leave/LeaveAtoms.tsx +26 -0
- package/src/Prebuilt/components/{LeaveCard.jsx → Leave/LeaveCard.tsx} +22 -3
- package/src/Prebuilt/components/Leave/LeaveRoom.tsx +63 -0
- package/src/Prebuilt/components/{LeaveSessionContent.jsx → Leave/LeaveSessionContent.tsx} +13 -5
- package/src/Prebuilt/components/{MoreSettings/SplitComponents/MwebLeaveRoom.jsx → Leave/MwebLeaveRoom.tsx} +38 -13
- package/src/Prebuilt/components/MetaActions.jsx +15 -23
- package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +5 -0
- package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +12 -7
- package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +1 -1
- package/src/Prebuilt/components/MoreSettings/FullScreenItem.jsx +1 -4
- package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +27 -0
- package/src/Prebuilt/components/MoreSettings/SplitComponents/{DesktopOptions.jsx → DesktopOptions.tsx} +86 -75
- package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.jsx +20 -19
- package/src/Prebuilt/components/Notifications/HLSFailureModal.jsx +3 -1
- package/src/Prebuilt/components/Notifications/Notifications.jsx +18 -11
- package/src/Prebuilt/components/Notifications/PeerNotifications.jsx +14 -2
- package/src/Prebuilt/components/Notifications/PermissionErrorModal.jsx +10 -4
- package/src/Prebuilt/components/PIP/PIPComponent.jsx +7 -16
- package/src/Prebuilt/components/PIP/PIPManager.js +1 -0
- package/src/Prebuilt/components/{Pagination.jsx → Pagination.tsx} +35 -6
- package/src/Prebuilt/components/Playlist/Playlist.jsx +1 -6
- package/src/Prebuilt/components/PostLeave.jsx +7 -7
- package/src/Prebuilt/components/Preview/PreviewContainer.jsx +5 -13
- package/src/Prebuilt/components/Preview/{PreviewForm.jsx → PreviewForm.tsx} +14 -4
- package/src/Prebuilt/components/Preview/PreviewJoin.jsx +9 -7
- package/src/Prebuilt/components/RaiseHand.jsx +0 -7
- package/src/Prebuilt/components/RoleChangeRequestModal.jsx +82 -6
- package/src/Prebuilt/components/ScreenshareDisplay.jsx +4 -10
- package/src/Prebuilt/components/ScreenshareTile.jsx +41 -33
- package/src/Prebuilt/components/SecondaryTiles.tsx +34 -0
- package/src/Prebuilt/components/Settings/LayoutSettings.jsx +2 -12
- package/src/Prebuilt/components/Settings/NotificationSettings.jsx +3 -9
- package/src/Prebuilt/components/Settings/SettingsModal.jsx +3 -9
- package/src/Prebuilt/components/StatsForNerds.jsx +3 -1
- package/src/Prebuilt/components/TileMenu/TileMenu.jsx +15 -16
- package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +21 -19
- package/src/Prebuilt/components/Toast/ToastConfig.jsx +53 -11
- package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +62 -0
- package/src/Prebuilt/components/VideoLayouts/Grid.tsx +41 -0
- package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +92 -0
- package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +60 -0
- package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +56 -0
- package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +36 -0
- package/src/Prebuilt/components/VideoLayouts/interface.ts +9 -0
- package/src/Prebuilt/components/VideoTile.jsx +93 -43
- package/src/Prebuilt/components/conference.jsx +24 -20
- package/src/Prebuilt/components/hooks/useMetadata.jsx +7 -0
- package/src/Prebuilt/components/hooks/useRoleProminencePeers.tsx +38 -0
- package/src/Prebuilt/components/hooks/useTileLayout.tsx +121 -0
- package/src/Prebuilt/components/hooks/useVideoTileLayout.ts +22 -0
- package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +5 -72
- package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +4 -45
- package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +2 -17
- package/src/Prebuilt/components/peerTileUtils.jsx +1 -1
- package/src/Prebuilt/images/empty-chat.svg +12 -0
- package/src/Prebuilt/layouts/EmbedView.jsx +17 -40
- package/src/Prebuilt/layouts/HLSView.jsx +83 -66
- package/src/Prebuilt/layouts/PDFView.jsx +1 -11
- package/src/Prebuilt/layouts/SidePane.tsx +96 -0
- package/src/Prebuilt/layouts/{mainView.jsx → VideoStreamingSection.tsx} +38 -47
- package/src/Prebuilt/layouts/WhiteboardView.jsx +10 -34
- package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +1 -4
- package/src/Prebuilt/plugins/whiteboard/{ToggleWhiteboard.jsx → ToggleWhiteboard.tsx} +5 -9
- package/src/Prebuilt/primitives/DialogContent.jsx +15 -11
- package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +17 -2
- package/src/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.ts +36 -13
- package/src/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.ts +10 -0
- package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +65 -0
- package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +17 -6
- package/dist/HLSView-CTAJQUU4.js.map +0 -7
- package/dist/PinnedTrackView-CQKONH4O.js +0 -102
- package/dist/PinnedTrackView-CQKONH4O.js.map +0 -7
- package/dist/VirtualBackground-GGGBJYVY.js.map +0 -7
- package/dist/chunk-I2FJWE74.js +0 -827
- package/dist/chunk-I2FJWE74.js.map +0 -7
- package/dist/chunk-L2SX7GBO.js.map +0 -7
- package/dist/chunk-NOKIGB6Y.js +0 -1100
- package/dist/chunk-NOKIGB6Y.js.map +0 -7
- package/dist/chunk-TJNDX446.js.map +0 -7
- package/dist/conference-OEO7VOJD.js +0 -8995
- package/dist/conference-OEO7VOJD.js.map +0 -7
- package/src/Prebuilt/components/Chat/ChatHeader.jsx +0 -67
- package/src/Prebuilt/components/EqualProminence.jsx +0 -180
- package/src/Prebuilt/components/FirstPersonDisplay.jsx +0 -50
- package/src/Prebuilt/components/Footer/Footer.jsx +0 -73
- package/src/Prebuilt/components/Header/Header.jsx +0 -8
- package/src/Prebuilt/components/Header/StreamingHeader.jsx +0 -54
- package/src/Prebuilt/components/LeaveRoom.jsx +0 -94
- package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +0 -10
- package/src/Prebuilt/components/Notifications/MessageNotifications.jsx +0 -25
- package/src/Prebuilt/components/gridView.jsx +0 -85
- package/src/Prebuilt/components/hooks/useFeatures.js +0 -22
- package/src/Prebuilt/components/hooks/useNavigation.js +0 -19
- package/src/Prebuilt/components/hooks/useSkipPreview.jsx +0 -20
- package/src/Prebuilt/components/pdfAnnotator/pdfErrorView.jsx +0 -29
- package/src/Prebuilt/images/Logo.svg +0 -8
- package/src/Prebuilt/layouts/ActiveSpeakerView.jsx +0 -34
- package/src/Prebuilt/layouts/InsetView.jsx +0 -260
- package/src/Prebuilt/layouts/PinnedTrackView.jsx +0 -59
- package/src/Prebuilt/layouts/SidePane.jsx +0 -52
- package/src/Prebuilt/layouts/mainGridView.jsx +0 -98
- package/src/Prebuilt/layouts/screenShareView.jsx +0 -183
- /package/{src/Prebuilt/components/Header/index.jsx → dist/Prebuilt/components/Header/index.d.ts} +0 -0
- /package/src/Prebuilt/components/{ScreenShare.jsx → ScreenShareToggle.jsx} +0 -0
- /package/src/{assets → Prebuilt/images}/android-perm-1.png +0 -0
- /package/src/{assets → Prebuilt/images}/ios-perm-0.png +0 -0
@@ -1,19 +0,0 @@
|
|
1
|
-
import { useCallback } from 'react';
|
2
|
-
import { useNavigate } from 'react-router-dom';
|
3
|
-
import { getRoutePrefix } from '../../common/utils';
|
4
|
-
|
5
|
-
export const useNavigation = () => {
|
6
|
-
const navigate = useNavigate();
|
7
|
-
const navigation = useCallback(
|
8
|
-
path => {
|
9
|
-
const prefix = getRoutePrefix();
|
10
|
-
let route = path;
|
11
|
-
if (prefix && !path.startsWith(prefix)) {
|
12
|
-
route = `${prefix}${path}`;
|
13
|
-
}
|
14
|
-
navigate(route);
|
15
|
-
},
|
16
|
-
[navigate],
|
17
|
-
);
|
18
|
-
return navigation;
|
19
|
-
};
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { useEffect } from 'react';
|
2
|
-
import { useSearchParam } from 'react-use';
|
3
|
-
import { useSetUiSettings } from '../AppData/useUISettings';
|
4
|
-
import { QUERY_PARAM_SKIP_PREVIEW, QUERY_PARAM_SKIP_PREVIEW_HEADFUL, UI_SETTINGS } from '../../common/constants';
|
5
|
-
|
6
|
-
export const useSkipPreview = () => {
|
7
|
-
// way to skip preview for automated tests, beam recording and streaming
|
8
|
-
const beamInToken = useSearchParam('token') === 'beam_recording'; // old format to remove
|
9
|
-
// use this field to join directly for quick testing while in local
|
10
|
-
const directJoinHeadfulFromEnv = process.env.REACT_APP_HEADLESS_JOIN === 'true';
|
11
|
-
const directJoinHeadful = useSearchParam(QUERY_PARAM_SKIP_PREVIEW_HEADFUL) === 'true' || directJoinHeadfulFromEnv;
|
12
|
-
let skipPreview = useSearchParam(QUERY_PARAM_SKIP_PREVIEW) === 'true';
|
13
|
-
skipPreview = skipPreview || beamInToken || directJoinHeadful;
|
14
|
-
const [, setIsHeadless] = useSetUiSettings(UI_SETTINGS.isHeadless);
|
15
|
-
useEffect(() => {
|
16
|
-
!directJoinHeadful && setIsHeadless(skipPreview);
|
17
|
-
}, [directJoinHeadful, skipPreview]); //eslint-disable-line
|
18
|
-
|
19
|
-
return skipPreview;
|
20
|
-
};
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { InfoIcon } from '@100mslive/react-icons';
|
3
|
-
import { Text } from '../../../';
|
4
|
-
import { DialogRow } from '../../primitives/DialogContent';
|
5
|
-
|
6
|
-
export const PdfErrorView = ({ isPDFUrlValid }) => {
|
7
|
-
return (
|
8
|
-
!isPDFUrlValid && (
|
9
|
-
<DialogRow
|
10
|
-
css={{
|
11
|
-
mt: '-$8',
|
12
|
-
color: '$alert_error_default',
|
13
|
-
justifyContent: 'start',
|
14
|
-
}}
|
15
|
-
>
|
16
|
-
<InfoIcon width="12px" height="12px" />
|
17
|
-
<Text
|
18
|
-
variant="caption"
|
19
|
-
css={{
|
20
|
-
pl: '$1',
|
21
|
-
color: '$alert_error_default',
|
22
|
-
}}
|
23
|
-
>
|
24
|
-
Please enter a valid PDF URL
|
25
|
-
</Text>
|
26
|
-
</DialogRow>
|
27
|
-
)
|
28
|
-
);
|
29
|
-
};
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<svg width="32" height="42" viewBox="0 0 32 42" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
-
<rect x="14.528" y="5.91187" width="2.944" height="30.176" fill="#538DFF"/>
|
3
|
-
<rect x="22.2692" y="7.19727" width="2.944" height="30.176" transform="rotate(30 22.2692 7.19727)" fill="#538DFF"/>
|
4
|
-
<rect x="31.088" y="19.5278" width="2.944" height="30.176" transform="rotate(90 31.088 19.5278)" fill="#538DFF"/>
|
5
|
-
<rect x="29.8026" y="27.269" width="2.944" height="30.176" transform="rotate(120 29.8026 27.269)" fill="#538DFF"/>
|
6
|
-
<rect x="24.8188" y="33.3304" width="2.944" height="30.176" transform="rotate(150 24.8188 33.3304)" fill="#538DFF"/>
|
7
|
-
<rect x="28.3306" y="12.181" width="2.944" height="30.176" transform="rotate(60 28.3306 12.181)" fill="#538DFF"/>
|
8
|
-
</svg>
|
@@ -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
|
-
};
|