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