@100mslive/roomkit-react 0.1.8 → 0.1.9-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{HLSView-DDGPZHA2.js → HLSView-U53QN3AC.js} +3 -3
- package/dist/Modal/Dialog.d.ts +402 -1706
- package/dist/Prebuilt/App.d.ts +5 -0
- package/dist/Prebuilt/AppContext.d.ts +1 -0
- package/dist/Prebuilt/AppStateContext.d.ts +16 -0
- package/dist/Prebuilt/components/ConferenceScreen.d.ts +2 -0
- package/dist/Prebuilt/components/Footer/PollsToggle.d.ts +2 -0
- package/dist/Prebuilt/components/LeaveScreen.d.ts +2 -0
- package/dist/Prebuilt/components/MwebLandscapePrompt.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/AutoplayBlockedModal.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/HLSFailureModal.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/InitErrorModal.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/Notifications.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/PeerNotifications.d.ts +1 -0
- package/dist/Prebuilt/components/Notifications/PermissionErrorModal.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/ReconnectNotifications.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/TrackBulkUnmuteModal.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/TrackNotifications.d.ts +1 -0
- package/dist/Prebuilt/components/Notifications/TrackUnmuteModal.d.ts +2 -0
- package/dist/Prebuilt/components/Polls/Polls.d.ts +2 -0
- package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +1 -2
- package/dist/Prebuilt/components/Preview/PreviewScreen.d.ts +2 -0
- package/dist/Prebuilt/components/hooks/useRedirectToLeave.d.ts +1 -1
- package/dist/{VirtualBackground-UVZJVOA2.js → VirtualBackground-PMLQPJB6.js} +3 -5
- package/dist/{VirtualBackground-UVZJVOA2.js.map → VirtualBackground-PMLQPJB6.js.map} +1 -1
- package/dist/chunk-ANQRGVIX.js +14441 -0
- package/dist/chunk-ANQRGVIX.js.map +7 -0
- package/dist/{chunk-6SQTFOK6.js → chunk-XQ2NRKIW.js} +66 -3
- package/dist/{chunk-6SQTFOK6.js.map → chunk-XQ2NRKIW.js.map} +4 -4
- package/dist/context/DialogContext.d.ts +6 -0
- package/dist/hooks/useDialogContainerSelector.d.ts +1 -0
- package/dist/index.cjs.js +10944 -9974
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -2
- package/dist/meta.cjs.json +3871 -3188
- package/dist/meta.esbuild.json +4303 -3728
- package/dist/utils/animations.d.ts +11 -0
- package/package.json +6 -7
- package/src/Modal/Dialog.tsx +31 -3
- package/src/Prebuilt/App.tsx +46 -99
- package/src/Prebuilt/AppContext.tsx +4 -0
- package/src/Prebuilt/AppStateContext.tsx +71 -0
- package/src/Prebuilt/common/constants.js +35 -0
- package/src/Prebuilt/common/utils.js +47 -0
- package/src/Prebuilt/components/AppData/AppData.jsx +5 -0
- package/src/Prebuilt/components/AppData/useSidepane.js +23 -1
- package/src/Prebuilt/components/AppData/useUISettings.js +48 -4
- package/src/Prebuilt/components/{conference.jsx → ConferenceScreen.tsx} +30 -43
- package/src/Prebuilt/components/Footer/Footer.tsx +5 -0
- package/src/Prebuilt/components/Footer/PaginatedParticipants.tsx +63 -32
- package/src/Prebuilt/components/Footer/ParticipantList.jsx +2 -1
- package/src/Prebuilt/components/Footer/PollsToggle.tsx +22 -0
- package/src/Prebuilt/components/Footer/RoleAccordion.tsx +2 -2
- package/src/Prebuilt/components/Header/StreamActions.tsx +5 -3
- package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +4 -5
- package/src/Prebuilt/components/Leave/LeaveRoom.tsx +0 -4
- package/src/Prebuilt/components/{PostLeave.jsx → LeaveScreen.tsx} +6 -13
- package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +2 -3
- package/src/Prebuilt/components/MoreSettings/EmbedUrl.jsx +2 -3
- package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +18 -1
- package/src/Prebuilt/components/{MwebLandscapePrompt.jsx → MwebLandscapePrompt.tsx} +10 -11
- package/src/Prebuilt/components/Notifications/{AutoplayBlockedModal.jsx → AutoplayBlockedModal.tsx} +2 -1
- package/src/Prebuilt/components/Notifications/{HLSFailureModal.jsx → HLSFailureModal.tsx} +10 -8
- package/src/Prebuilt/components/Notifications/{InitErrorModal.jsx → InitErrorModal.tsx} +5 -2
- package/src/Prebuilt/components/Notifications/{Notifications.jsx → Notifications.tsx} +41 -27
- package/src/Prebuilt/components/Notifications/{PeerNotifications.jsx → PeerNotifications.tsx} +3 -0
- package/src/Prebuilt/components/Notifications/{PermissionErrorModal.jsx → PermissionErrorModal.tsx} +6 -4
- package/src/Prebuilt/components/Notifications/{ReconnectNotifications.jsx → ReconnectNotifications.tsx} +11 -6
- package/src/Prebuilt/components/Notifications/{TrackBulkUnmuteModal.jsx → TrackBulkUnmuteModal.tsx} +9 -3
- package/src/Prebuilt/components/Notifications/{TrackUnmuteModal.jsx → TrackUnmuteModal.tsx} +9 -3
- package/src/Prebuilt/components/Notifications/index.tsx +1 -0
- package/src/Prebuilt/components/Polls/CreatePollQuiz/PollsQuizMenu.jsx +229 -0
- package/src/Prebuilt/components/Polls/CreatePollQuiz/Timer.jsx +71 -0
- package/src/Prebuilt/components/Polls/CreateQuestions/CreateQuestions.jsx +132 -0
- package/src/Prebuilt/components/Polls/CreateQuestions/DeleteQuestionModal.jsx +66 -0
- package/src/Prebuilt/components/Polls/CreateQuestions/QuestionForm.jsx +251 -0
- package/src/Prebuilt/components/Polls/CreateQuestions/SavedQuestion.jsx +57 -0
- package/src/Prebuilt/components/Polls/Polls.tsx +28 -0
- package/src/Prebuilt/components/Polls/Voting/PollResultSummary.jsx +125 -0
- package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +249 -0
- package/src/Prebuilt/components/Polls/Voting/StandardVoting.jsx +40 -0
- package/src/Prebuilt/components/Polls/Voting/TimedVoting.jsx +36 -0
- package/src/Prebuilt/components/Polls/Voting/Voting.jsx +99 -0
- package/src/Prebuilt/components/Polls/common/MultipleChoiceOptions.jsx +101 -0
- package/src/Prebuilt/components/Polls/common/OptionInputWithDelete.jsx +25 -0
- package/src/Prebuilt/components/Polls/common/SingleChoiceOptions.jsx +125 -0
- package/src/Prebuilt/components/Polls/common/StatusIndicator.jsx +47 -0
- package/src/Prebuilt/components/Polls/common/VoteCount.jsx +28 -0
- package/src/Prebuilt/components/Polls/common/VoteProgress.jsx +17 -0
- package/src/Prebuilt/components/Polls/common/VoterList.jsx +22 -0
- package/src/Prebuilt/components/Polls/common/Votes.jsx +72 -0
- package/src/Prebuilt/components/Preview/PreviewForm.tsx +3 -2
- package/src/Prebuilt/components/Preview/PreviewJoin.tsx +32 -27
- package/src/Prebuilt/components/Preview/{PreviewContainer.tsx → PreviewScreen.tsx} +2 -19
- package/src/Prebuilt/components/RaiseHand.jsx +1 -1
- package/src/Prebuilt/components/RoleChangeModal.jsx +2 -3
- package/src/Prebuilt/components/RoleChangeRequest/RequestPrompt.tsx +2 -3
- package/src/Prebuilt/components/Settings/SettingsModal.jsx +2 -3
- package/src/Prebuilt/components/Settings/StartRecording.jsx +15 -4
- package/src/Prebuilt/components/SidePaneTabs.tsx +1 -1
- package/src/Prebuilt/components/StatsForNerds.jsx +2 -3
- package/src/Prebuilt/components/Streaming/Common.jsx +31 -21
- package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +8 -9
- package/src/Prebuilt/components/VideoTile.jsx +37 -33
- package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +3 -3
- package/src/Prebuilt/components/hooks/useRedirectToLeave.tsx +9 -17
- package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +2 -3
- package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +1 -1
- package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +2 -3
- package/src/Prebuilt/layouts/EmbedView.jsx +47 -60
- package/src/Prebuilt/layouts/PDFView.jsx +49 -99
- package/src/Prebuilt/layouts/SidePane.tsx +8 -4
- package/src/Prebuilt/layouts/VideoStreamingSection.tsx +2 -2
- package/src/Prebuilt/primitives/DialogContent.jsx +4 -5
- package/src/context/DialogContext.tsx +13 -0
- package/src/hooks/useDialogContainerSelector.tsx +7 -0
- package/src/index.ts +1 -0
- package/src/utils/animations.ts +6 -0
- package/dist/Prebuilt/components/Notifications/HeadlessEndRoomListener.d.ts +0 -2
- package/dist/Prebuilt/components/PrebuiltDialogPortal.d.ts +0 -4
- package/dist/Prebuilt/components/PrebuiltTileElements.d.ts +0 -2198
- package/dist/Prebuilt/components/Preview/PreviewContainer.d.ts +0 -3
- package/dist/chunk-HUMNPIYI.js +0 -70
- package/dist/chunk-HUMNPIYI.js.map +0 -7
- package/dist/chunk-PRM33R4R.js +0 -7160
- package/dist/chunk-PRM33R4R.js.map +0 -7
- package/dist/conference-N7S47TDK.js +0 -6602
- package/dist/conference-N7S47TDK.js.map +0 -7
- package/src/Prebuilt/components/GoLiveButton.jsx +0 -42
- package/src/Prebuilt/components/Notifications/HeadlessEndRoomListener.tsx +0 -23
- package/src/Prebuilt/components/PrebuiltDialogPortal.tsx +0 -6
- package/src/Prebuilt/components/PrebuiltTileElements.tsx +0 -5
- package/src/Prebuilt/components/Streaming/HLSStreaming.jsx +0 -220
- package/src/Prebuilt/components/Streaming/RTMPStreaming.jsx +0 -334
- package/src/Prebuilt/components/Streaming/StreamingLanding.jsx +0 -76
- /package/dist/{HLSView-DDGPZHA2.js.map → HLSView-U53QN3AC.js.map} +0 -0
- /package/{src/Prebuilt/components/Notifications/index.jsx → dist/Prebuilt/components/Notifications/index.d.ts} +0 -0
- /package/src/Prebuilt/components/Notifications/{TrackNotifications.jsx → TrackNotifications.tsx} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { Fragment, useCallback,
|
|
2
|
-
import { useMedia } from 'react-use';
|
|
1
|
+
import React, { Fragment, useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { useMeasure, useMedia } from 'react-use';
|
|
3
3
|
import {
|
|
4
4
|
selectAudioTrackByPeerID,
|
|
5
5
|
selectHasPeerHandRaised,
|
|
@@ -22,12 +22,10 @@ import { config as cssConfig } from '../../Theme';
|
|
|
22
22
|
import { Video } from '../../Video';
|
|
23
23
|
import { StyledVideoTile } from '../../VideoTile';
|
|
24
24
|
import { getVideoTileLabel } from './peerTileUtils';
|
|
25
|
-
import { PrebuiltAttributeBox, PrebuiltAudioIndicator } from './PrebuiltTileElements';
|
|
26
25
|
import { useSetAppDataByKey, useUISettings } from './AppData/useUISettings';
|
|
26
|
+
import { calculateAvatarAndAttribBoxSize } from '../common/utils';
|
|
27
27
|
import { APP_DATA, SESSION_STORE_KEY, UI_SETTINGS } from '../common/constants';
|
|
28
28
|
|
|
29
|
-
const iconDims = { height: '1rem', width: '1rem' };
|
|
30
|
-
|
|
31
29
|
const Tile = ({
|
|
32
30
|
peerId,
|
|
33
31
|
trackId,
|
|
@@ -74,11 +72,14 @@ const Tile = ({
|
|
|
74
72
|
setIsMouseHovered(event.type === 'mouseenter');
|
|
75
73
|
}, []);
|
|
76
74
|
|
|
77
|
-
const ref =
|
|
78
|
-
|
|
79
|
-
const calculatedWidth = ref.current?.clientWidth || '';
|
|
75
|
+
const [ref, { width: calculatedWidth, height: calculatedHeight }] = useMeasure();
|
|
76
|
+
|
|
80
77
|
const isTileBigEnoughToShowStats = calculatedHeight >= 180 && calculatedWidth >= 180;
|
|
81
|
-
|
|
78
|
+
|
|
79
|
+
const [avatarSize, attribBoxSize] = useMemo(
|
|
80
|
+
() => calculateAvatarAndAttribBoxSize(calculatedWidth, calculatedHeight),
|
|
81
|
+
[calculatedWidth, calculatedHeight],
|
|
82
|
+
);
|
|
82
83
|
|
|
83
84
|
return (
|
|
84
85
|
<StyledVideoTile.Root
|
|
@@ -118,23 +119,27 @@ const Tile = ({
|
|
|
118
119
|
bg: 'transparent',
|
|
119
120
|
}}
|
|
120
121
|
/>
|
|
122
|
+
{calculatedWidth > 0 && calculatedHeight > 0 ? (
|
|
123
|
+
<>
|
|
124
|
+
{isVideoMuted || (!isLocal && isAudioOnly) ? (
|
|
125
|
+
<StyledVideoTile.AvatarContainer>
|
|
126
|
+
<Avatar name={peerName || ''} data-testid="participant_avatar_icon" size={avatarSize} />
|
|
127
|
+
</StyledVideoTile.AvatarContainer>
|
|
128
|
+
) : null}
|
|
121
129
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<AudioLevel trackId={audioTrack?.id} />
|
|
136
|
-
</PrebuiltAudioIndicator>
|
|
137
|
-
)
|
|
130
|
+
{!hideAudioMuteOnTile ? (
|
|
131
|
+
isAudioMuted ? (
|
|
132
|
+
<StyledVideoTile.AudioIndicator data-testid="participant_audio_mute_icon" size={attribBoxSize}>
|
|
133
|
+
<MicOffIcon />
|
|
134
|
+
</StyledVideoTile.AudioIndicator>
|
|
135
|
+
) : (
|
|
136
|
+
<StyledVideoTile.AudioIndicator size={attribBoxSize}>
|
|
137
|
+
<AudioLevel trackId={audioTrack?.id} size={attribBoxSize} />
|
|
138
|
+
</StyledVideoTile.AudioIndicator>
|
|
139
|
+
)
|
|
140
|
+
) : null}
|
|
141
|
+
{!hideMetadataOnTile && <PeerMetadata peerId={peerId} size={attribBoxSize} />}
|
|
142
|
+
</>
|
|
138
143
|
) : null}
|
|
139
144
|
{isMouseHovered || (isDragabble && isMobile) ? (
|
|
140
145
|
<TileMenu
|
|
@@ -145,7 +150,6 @@ const Tile = ({
|
|
|
145
150
|
enableSpotlightingPeer={enableSpotlightingPeer}
|
|
146
151
|
/>
|
|
147
152
|
) : null}
|
|
148
|
-
{!hideMetadataOnTile && <PeerMetadata peerId={peerId} />}
|
|
149
153
|
|
|
150
154
|
<TileConnection
|
|
151
155
|
hideLabel={hideParticipantNameOnTile}
|
|
@@ -162,7 +166,7 @@ const Tile = ({
|
|
|
162
166
|
);
|
|
163
167
|
};
|
|
164
168
|
|
|
165
|
-
const PeerMetadata = ({ peerId }) => {
|
|
169
|
+
const PeerMetadata = ({ peerId, size }) => {
|
|
166
170
|
const metaData = useHMSStore(selectPeerMetadata(peerId));
|
|
167
171
|
const isBRB = metaData?.isBRBOn || false;
|
|
168
172
|
const isHandRaised = useHMSStore(selectHasPeerHandRaised(peerId));
|
|
@@ -170,14 +174,14 @@ const PeerMetadata = ({ peerId }) => {
|
|
|
170
174
|
return (
|
|
171
175
|
<Fragment>
|
|
172
176
|
{isHandRaised ? (
|
|
173
|
-
<
|
|
174
|
-
<HandIcon
|
|
175
|
-
</
|
|
177
|
+
<StyledVideoTile.AttributeBox size={size} data-testid="raiseHand_icon_onTile">
|
|
178
|
+
<HandIcon width={24} height={24} />
|
|
179
|
+
</StyledVideoTile.AttributeBox>
|
|
176
180
|
) : null}
|
|
177
181
|
{isBRB ? (
|
|
178
|
-
<
|
|
179
|
-
<BrbTileIcon
|
|
180
|
-
</
|
|
182
|
+
<StyledVideoTile.AttributeBox size={size} data-testid="brb_icon_onTile">
|
|
183
|
+
<BrbTileIcon width={22} height={22} />
|
|
184
|
+
</StyledVideoTile.AttributeBox>
|
|
181
185
|
) : null}
|
|
182
186
|
</Fragment>
|
|
183
187
|
);
|
|
@@ -20,12 +20,12 @@ export const useAutoStartStreaming = () => {
|
|
|
20
20
|
const showStreamingUI = useShowStreamingUI();
|
|
21
21
|
const hmsActions = useHMSActions();
|
|
22
22
|
const isConnected = useHMSStore(selectIsConnectedToRoom);
|
|
23
|
-
const { isHLSRunning } = useRecordingStreaming();
|
|
23
|
+
const { isHLSRunning, isRTMPRunning } = useRecordingStreaming();
|
|
24
24
|
const streamStartedRef = useRef(false);
|
|
25
25
|
|
|
26
26
|
const startHLS = useCallback(async () => {
|
|
27
27
|
try {
|
|
28
|
-
if (isHLSStarted || !showStreamingUI || isHLSRunning) {
|
|
28
|
+
if (isHLSStarted || !showStreamingUI || isHLSRunning || isRTMPRunning) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
setHLSStarted(true);
|
|
@@ -38,7 +38,7 @@ export const useAutoStartStreaming = () => {
|
|
|
38
38
|
streamStartedRef.current = false;
|
|
39
39
|
setHLSStarted(false);
|
|
40
40
|
}
|
|
41
|
-
}, [hmsActions, isHLSRunning, isHLSStarted, setHLSStarted, showStreamingUI]);
|
|
41
|
+
}, [hmsActions, isHLSRunning, isHLSStarted, setHLSStarted, showStreamingUI, isRTMPRunning]);
|
|
42
42
|
|
|
43
43
|
useEffect(() => {
|
|
44
44
|
if (!isHLSStarted && !isHLSRunning) {
|
|
@@ -1,33 +1,25 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import { useNavigate, useParams } from 'react-router-dom';
|
|
3
2
|
import { useHMSPrebuiltContext } from '../../AppContext';
|
|
4
3
|
// @ts-ignore: No implicit Any
|
|
5
4
|
import { PictureInPicture } from '../PIP/PIPManager';
|
|
6
5
|
// @ts-ignore: No implicit Any
|
|
7
6
|
import { ToastManager } from '../Toast/ToastManager';
|
|
8
|
-
import { useRoomLayoutLeaveScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
|
|
9
7
|
|
|
10
8
|
export const useRedirectToLeave = () => {
|
|
11
|
-
const { isLeaveScreenEnabled } = useRoomLayoutLeaveScreen();
|
|
12
9
|
const { onLeave } = useHMSPrebuiltContext();
|
|
13
|
-
const params = useParams();
|
|
14
|
-
const navigate = useNavigate();
|
|
15
10
|
|
|
16
11
|
const redirect = useCallback(
|
|
17
12
|
(timeout = 0) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
ToastManager.clearAllToast();
|
|
27
|
-
onLeave?.();
|
|
28
|
-
}, timeout);
|
|
13
|
+
return new Promise<void>(resolve => {
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
PictureInPicture.stop().catch(() => console.error('stopping pip'));
|
|
16
|
+
ToastManager.clearAllToast();
|
|
17
|
+
onLeave?.();
|
|
18
|
+
resolve();
|
|
19
|
+
}, timeout);
|
|
20
|
+
});
|
|
29
21
|
},
|
|
30
|
-
[
|
|
22
|
+
[onLeave],
|
|
31
23
|
);
|
|
32
24
|
|
|
33
25
|
return { redirectToLeave: redirect };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Dialog, Flex } from '../../../';
|
|
3
3
|
import { DialogInputFile } from '../../primitives/DialogContent';
|
|
4
|
-
import { PrebuiltDialogPortal } from '../PrebuiltDialogPortal';
|
|
5
4
|
import { PDFHeader } from './pdfHeader';
|
|
6
5
|
import { SubmitPDF } from './submitPdf';
|
|
7
6
|
import { UploadedFile } from './uploadedFile';
|
|
@@ -11,7 +10,7 @@ export function PDFFileOptions({ onOpenChange }) {
|
|
|
11
10
|
|
|
12
11
|
return !pdfFile ? (
|
|
13
12
|
<Dialog.Root defaultOpen onOpenChange={onOpenChange}>
|
|
14
|
-
<
|
|
13
|
+
<Dialog.Portal>
|
|
15
14
|
<Dialog.Overlay />
|
|
16
15
|
<Dialog.Content
|
|
17
16
|
css={{
|
|
@@ -35,7 +34,7 @@ export function PDFFileOptions({ onOpenChange }) {
|
|
|
35
34
|
<SubmitPDF pdfFile={pdfFile} onOpenChange={onOpenChange} />
|
|
36
35
|
</Flex>
|
|
37
36
|
</Dialog.Content>
|
|
38
|
-
</
|
|
37
|
+
</Dialog.Portal>
|
|
39
38
|
</Dialog.Root>
|
|
40
39
|
) : (
|
|
41
40
|
<UploadedFile pdfFile={pdfFile} setPDFFile={setPDFFile} onOpenChange={onOpenChange} />
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { TrashIcon } from '@100mslive/react-icons';
|
|
3
3
|
import { Dialog, Flex, Text } from '../../../';
|
|
4
4
|
import { DialogRow } from '../../primitives/DialogContent';
|
|
5
|
-
import { PrebuiltDialogPortal } from '../PrebuiltDialogPortal';
|
|
6
5
|
import { PDFHeader } from './pdfHeader';
|
|
7
6
|
import { PDFInfo } from './pdfInfo';
|
|
8
7
|
import { SubmitPDF } from './submitPdf';
|
|
@@ -11,7 +10,7 @@ export const UploadedFile = ({ pdfFile, setPDFFile, onOpenChange }) => {
|
|
|
11
10
|
const [fileName, ext] = pdfFile.name.split('.');
|
|
12
11
|
return (
|
|
13
12
|
<Dialog.Root defaultOpen onOpenChange={onOpenChange}>
|
|
14
|
-
<
|
|
13
|
+
<Dialog.Portal>
|
|
15
14
|
<Dialog.Overlay />
|
|
16
15
|
<Dialog.Content
|
|
17
16
|
css={{
|
|
@@ -66,7 +65,7 @@ export const UploadedFile = ({ pdfFile, setPDFFile, onOpenChange }) => {
|
|
|
66
65
|
<SubmitPDF pdfFile={pdfFile} onOpenChange={onOpenChange} />
|
|
67
66
|
</Flex>
|
|
68
67
|
</Dialog.Content>
|
|
69
|
-
</
|
|
68
|
+
</Dialog.Portal>
|
|
70
69
|
</Dialog.Root>
|
|
71
70
|
);
|
|
72
71
|
};
|
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
selectPeers,
|
|
4
|
-
selectPeerScreenSharing,
|
|
5
|
-
throwErrorHandler,
|
|
6
|
-
useHMSStore,
|
|
7
|
-
useScreenShare,
|
|
8
|
-
} from '@100mslive/react-sdk';
|
|
1
|
+
import React, { useEffect, useMemo } from 'react';
|
|
2
|
+
import { selectAppData, selectPeers, selectPeerScreenSharing, useEmbedShare, useHMSStore } from '@100mslive/react-sdk';
|
|
9
3
|
import { SecondaryTiles } from '../components/SecondaryTiles';
|
|
4
|
+
import { ToastManager } from '../components/Toast/ToastManager';
|
|
10
5
|
import { ProminenceLayout } from '../components/VideoLayouts/ProminenceLayout';
|
|
11
6
|
import { Box } from '../../Layout';
|
|
12
|
-
import { useSetAppDataByKey } from '../components/AppData/useUISettings';
|
|
7
|
+
import { useResetEmbedConfig, useSetAppDataByKey } from '../components/AppData/useUISettings';
|
|
13
8
|
import { APP_DATA } from '../common/constants';
|
|
14
9
|
|
|
15
10
|
export const EmbedView = () => {
|
|
16
11
|
return (
|
|
17
|
-
<
|
|
12
|
+
<EmbedScreenShareView>
|
|
18
13
|
<EmbedComponent />
|
|
19
|
-
</
|
|
14
|
+
</EmbedScreenShareView>
|
|
20
15
|
);
|
|
21
16
|
};
|
|
22
17
|
|
|
23
|
-
export const
|
|
18
|
+
export const EmbedScreenShareView = ({ children }) => {
|
|
24
19
|
const peers = useHMSStore(selectPeers);
|
|
25
20
|
|
|
26
21
|
const peerPresenting = useHMSStore(selectPeerScreenSharing);
|
|
@@ -44,62 +39,54 @@ export const EmbebScreenShareView = ({ children }) => {
|
|
|
44
39
|
</ProminenceLayout.Root>
|
|
45
40
|
);
|
|
46
41
|
};
|
|
47
|
-
|
|
42
|
+
/**
|
|
43
|
+
* EmbedView is responsible for rendering the iframe and managing the screen sharing functionality.
|
|
44
|
+
*/
|
|
48
45
|
const EmbedComponent = () => {
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const [wasScreenShared, setWasScreenShared] = useState(false);
|
|
52
|
-
// to handle - https://github.com/facebook/react/issues/24502
|
|
53
|
-
const screenShareAttemptInProgress = useRef(false);
|
|
54
|
-
const src = embedConfig.url;
|
|
55
|
-
const iframeRef = useRef();
|
|
56
|
-
|
|
57
|
-
const resetEmbedConfig = useCallback(() => {
|
|
58
|
-
if (src) {
|
|
59
|
-
setEmbedConfig({ url: '' });
|
|
60
|
-
}
|
|
61
|
-
}, [src, setEmbedConfig]);
|
|
46
|
+
const embedConfig = useHMSStore(selectAppData(APP_DATA.embedConfig));
|
|
47
|
+
const resetConfig = useResetEmbedConfig();
|
|
62
48
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
screenShareAttemptInProgress.current = true;
|
|
66
|
-
// start screenshare on load for others in the room to see
|
|
67
|
-
toggleScreenShare({
|
|
68
|
-
forceCurrentTab: true,
|
|
69
|
-
cropElement: iframeRef.current,
|
|
70
|
-
})
|
|
71
|
-
.then(() => {
|
|
72
|
-
setWasScreenShared(true);
|
|
73
|
-
})
|
|
74
|
-
.catch(resetEmbedConfig)
|
|
75
|
-
.finally(() => {
|
|
76
|
-
screenShareAttemptInProgress.current = false;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
80
|
-
}, []);
|
|
49
|
+
// need to send resetConfig to clear configuration, if stop screenshare occurs.
|
|
50
|
+
const { iframeRef, startEmbedShare, isEmbedShareInProgress } = useEmbedShare(resetConfig);
|
|
81
51
|
|
|
82
52
|
useEffect(() => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
53
|
+
(async () => {
|
|
54
|
+
if (embedConfig && !isEmbedShareInProgress) {
|
|
55
|
+
try {
|
|
56
|
+
await startEmbedShare(embedConfig);
|
|
57
|
+
} catch (err) {
|
|
58
|
+
resetConfig();
|
|
59
|
+
ToastManager.addToast({
|
|
60
|
+
title: `Error while sharing embed url ${err.message || ''}`,
|
|
61
|
+
variant: 'error',
|
|
62
|
+
});
|
|
63
|
+
}
|
|
92
64
|
}
|
|
93
|
-
};
|
|
94
|
-
}, [
|
|
65
|
+
})();
|
|
66
|
+
}, [isEmbedShareInProgress, embedConfig, startEmbedShare, resetConfig]);
|
|
95
67
|
|
|
96
68
|
return (
|
|
97
|
-
<Box
|
|
69
|
+
<Box
|
|
70
|
+
css={{
|
|
71
|
+
mx: '$8',
|
|
72
|
+
flex: '3 1 0',
|
|
73
|
+
'@lg': {
|
|
74
|
+
flex: '2 1 0',
|
|
75
|
+
display: 'flex',
|
|
76
|
+
alignItems: 'center',
|
|
77
|
+
},
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
98
80
|
<iframe
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
style={{
|
|
102
|
-
|
|
81
|
+
title="Embed View"
|
|
82
|
+
ref={iframeRef}
|
|
83
|
+
style={{
|
|
84
|
+
width: '100%',
|
|
85
|
+
height: '100%',
|
|
86
|
+
border: 0,
|
|
87
|
+
borderRadius: '0.75rem',
|
|
88
|
+
}}
|
|
89
|
+
allow="autoplay; clipboard-write;"
|
|
103
90
|
referrerPolicy="no-referrer"
|
|
104
91
|
/>
|
|
105
92
|
</Box>
|
|
@@ -1,111 +1,61 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { usePDFShare } from '@100mslive/react-sdk';
|
|
3
|
+
import { ToastManager } from '../components/Toast/ToastManager';
|
|
3
4
|
import { Box } from '../../Layout';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { useSetAppDataByKey } from '../components/AppData/useUISettings';
|
|
7
|
-
import { APP_DATA, isChrome } from '../common/constants';
|
|
5
|
+
import { EmbedScreenShareView } from './EmbedView';
|
|
6
|
+
import { usePDFConfig, useResetPDFConfig } from '../components/AppData/useUISettings';
|
|
8
7
|
|
|
8
|
+
/**
|
|
9
|
+
* PDFView is responsible for rendering the PDF iframe and managing the screen sharing functionality.
|
|
10
|
+
*/
|
|
9
11
|
export const PDFView = () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<PDFEmbedComponent />
|
|
13
|
-
</EmbebScreenShareView>
|
|
14
|
-
);
|
|
15
|
-
};
|
|
12
|
+
const pdfConfig = usePDFConfig();
|
|
13
|
+
const resetConfig = useResetPDFConfig();
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const themeType = useTheme().themeType;
|
|
20
|
-
const [isPDFLoaded, setIsPDFLoaded] = useState(false);
|
|
21
|
-
let pdfJSURL = process.env.REACT_APP_PDFJS_IFRAME_URL;
|
|
22
|
-
const { amIScreenSharing, toggleScreenShare } = useScreenShare(throwErrorHandler);
|
|
23
|
-
const [pdfConfig, setPDFConfig] = useSetAppDataByKey(APP_DATA.pdfConfig);
|
|
24
|
-
if (pdfConfig.url && !pdfConfig.file) {
|
|
25
|
-
pdfJSURL = pdfJSURL + '?file=' + encodeURIComponent(pdfConfig.url);
|
|
26
|
-
}
|
|
27
|
-
const [wasScreenShared, setWasScreenShared] = useState(false);
|
|
28
|
-
// to handle - https://github.com/facebook/react/issues/24502
|
|
29
|
-
const screenShareAttemptInProgress = useRef(false);
|
|
30
|
-
const iframeRef = useRef();
|
|
15
|
+
// need to send resetConfig to clear configuration, if stop screenshare occurs.
|
|
16
|
+
const { iframeRef, startPDFShare, isPDFShareInProgress } = usePDFShare(resetConfig);
|
|
31
17
|
|
|
32
|
-
const resetEmbedConfig = useCallback(() => {
|
|
33
|
-
setPDFConfig({ state: false });
|
|
34
|
-
}, [setPDFConfig]);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (isPDFLoaded && ref.current) {
|
|
37
|
-
ref.current.contentWindow.postMessage(
|
|
38
|
-
{
|
|
39
|
-
theme: themeType === ThemeTypes.dark ? 2 : 1,
|
|
40
|
-
},
|
|
41
|
-
'*',
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
}, [isPDFLoaded, themeType]);
|
|
45
18
|
useEffect(() => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
57
|
-
.catch(resetEmbedConfig)
|
|
58
|
-
.finally(() => {
|
|
59
|
-
screenShareAttemptInProgress.current = false;
|
|
19
|
+
(async () => {
|
|
20
|
+
try {
|
|
21
|
+
if (!isPDFShareInProgress && pdfConfig) {
|
|
22
|
+
await startPDFShare(pdfConfig);
|
|
23
|
+
}
|
|
24
|
+
} catch (err) {
|
|
25
|
+
resetConfig();
|
|
26
|
+
ToastManager.addToast({
|
|
27
|
+
title: `Error while sharing annotator ${err.message || ''}`,
|
|
28
|
+
variant: 'error',
|
|
60
29
|
});
|
|
61
|
-
}
|
|
62
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
|
-
}, []);
|
|
64
|
-
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
// reset embed when screenshare is closed from anywhere
|
|
67
|
-
if (wasScreenShared && !amIScreenSharing) {
|
|
68
|
-
resetEmbedConfig();
|
|
69
|
-
}
|
|
70
|
-
return () => {
|
|
71
|
-
// close screenshare when this component is being unmounted
|
|
72
|
-
if (wasScreenShared && amIScreenSharing) {
|
|
73
|
-
resetEmbedConfig();
|
|
74
|
-
toggleScreenShare(); // stop
|
|
75
30
|
}
|
|
76
|
-
};
|
|
77
|
-
}, [
|
|
78
|
-
|
|
31
|
+
})();
|
|
32
|
+
}, [isPDFShareInProgress, pdfConfig, resetConfig, startPDFShare]);
|
|
79
33
|
return (
|
|
80
|
-
<
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}}
|
|
91
|
-
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture fullscreen"
|
|
92
|
-
referrerPolicy="no-referrer"
|
|
93
|
-
onLoad={() => {
|
|
94
|
-
if (ref.current && pdfConfig.file) {
|
|
95
|
-
// setting theme dark -> 2 and light -> 1
|
|
96
|
-
requestAnimationFrame(() => {
|
|
97
|
-
ref.current.contentWindow.postMessage(
|
|
98
|
-
{
|
|
99
|
-
file: pdfConfig.file,
|
|
100
|
-
theme: themeType === ThemeTypes.dark ? 2 : 1,
|
|
101
|
-
},
|
|
102
|
-
'*',
|
|
103
|
-
);
|
|
104
|
-
setIsPDFLoaded(true);
|
|
105
|
-
}, 1000);
|
|
106
|
-
}
|
|
34
|
+
<EmbedScreenShareView>
|
|
35
|
+
<Box
|
|
36
|
+
css={{
|
|
37
|
+
mx: '$8',
|
|
38
|
+
flex: '3 1 0',
|
|
39
|
+
'@lg': {
|
|
40
|
+
flex: '2 1 0',
|
|
41
|
+
display: 'flex',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
},
|
|
107
44
|
}}
|
|
108
|
-
|
|
109
|
-
|
|
45
|
+
>
|
|
46
|
+
<iframe
|
|
47
|
+
title="Embed View"
|
|
48
|
+
ref={iframeRef}
|
|
49
|
+
style={{
|
|
50
|
+
width: '100%',
|
|
51
|
+
height: '100%',
|
|
52
|
+
border: 0,
|
|
53
|
+
borderRadius: '0.75rem',
|
|
54
|
+
}}
|
|
55
|
+
allow="autoplay; clipboard-write;"
|
|
56
|
+
referrerPolicy="no-referrer"
|
|
57
|
+
/>
|
|
58
|
+
</Box>
|
|
59
|
+
</EmbedScreenShareView>
|
|
110
60
|
);
|
|
111
61
|
};
|
|
@@ -2,15 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import { useMedia } from 'react-use';
|
|
3
3
|
import { ConferencingScreen } from '@100mslive/types-prebuilt';
|
|
4
4
|
import { selectAppData, selectVideoTrackByPeerID, useHMSStore } from '@100mslive/react-sdk';
|
|
5
|
+
import { Polls } from '../components/Polls/Polls';
|
|
5
6
|
import { SidePaneTabs } from '../components/SidePaneTabs';
|
|
6
|
-
// @ts-ignore: No implicit Any
|
|
7
|
-
import { StreamingLanding } from '../components/Streaming/StreamingLanding';
|
|
8
7
|
import { TileCustomisationProps } from '../components/VideoLayouts/GridLayout';
|
|
9
8
|
// @ts-ignore: No implicit Any
|
|
10
9
|
import VideoTile from '../components/VideoTile';
|
|
11
10
|
import { Box, Flex } from '../../Layout';
|
|
12
11
|
import { config as cssConfig } from '../../Theme';
|
|
13
12
|
import { useRoomLayoutConferencingScreen } from '../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
|
|
13
|
+
import { translateAcross } from '../../utils';
|
|
14
14
|
// @ts-ignore: No implicit Any
|
|
15
15
|
import { APP_DATA, SIDE_PANE_OPTIONS } from '../common/constants';
|
|
16
16
|
|
|
@@ -29,10 +29,11 @@ const SidePane = ({
|
|
|
29
29
|
const trackId = useHMSStore(selectVideoTrackByPeerID(activeScreensharePeerId))?.id;
|
|
30
30
|
const { elements } = useRoomLayoutConferencingScreen();
|
|
31
31
|
let ViewComponent;
|
|
32
|
+
if (sidepane === SIDE_PANE_OPTIONS.POLLS) {
|
|
33
|
+
ViewComponent = <Polls />;
|
|
34
|
+
}
|
|
32
35
|
if (sidepane === SIDE_PANE_OPTIONS.PARTICIPANTS || sidepane === SIDE_PANE_OPTIONS.CHAT) {
|
|
33
36
|
ViewComponent = <SidePaneTabs screenType={screenType} hideControls={hideControls} active={sidepane} />;
|
|
34
|
-
} else if (sidepane === SIDE_PANE_OPTIONS.STREAMING) {
|
|
35
|
-
ViewComponent = <StreamingLanding />;
|
|
36
37
|
}
|
|
37
38
|
if (!ViewComponent && !trackId) {
|
|
38
39
|
return null;
|
|
@@ -97,6 +98,9 @@ const SidePane = ({
|
|
|
97
98
|
'@md': {
|
|
98
99
|
p: '$6 $8',
|
|
99
100
|
pb: mwebStreamingChat ? '$20' : '$12',
|
|
101
|
+
borderTopLeftRadius: sidepane === SIDE_PANE_OPTIONS.POLLS ? '$2' : '0',
|
|
102
|
+
borderTopRightRadius: sidepane === SIDE_PANE_OPTIONS.POLLS ? '$2' : '0',
|
|
103
|
+
animation: `${translateAcross({ yFrom: '100%' })} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,
|
|
100
104
|
},
|
|
101
105
|
}}
|
|
102
106
|
>
|
|
@@ -18,7 +18,7 @@ import SidePane from './SidePane';
|
|
|
18
18
|
import { WaitingView } from './WaitingView';
|
|
19
19
|
// import { useWhiteboardMetadata } from '../plugins/whiteboard';
|
|
20
20
|
import {
|
|
21
|
-
|
|
21
|
+
usePDFConfig,
|
|
22
22
|
useUrlToEmbed,
|
|
23
23
|
useWaitingViewerRole,
|
|
24
24
|
// @ts-ignore: No implicit Any
|
|
@@ -45,7 +45,7 @@ export const VideoStreamingSection = ({
|
|
|
45
45
|
const hmsActions = useHMSActions();
|
|
46
46
|
const waitingViewerRole = useWaitingViewerRole();
|
|
47
47
|
const urlToIframe = useUrlToEmbed();
|
|
48
|
-
const pdfAnnotatorActive =
|
|
48
|
+
const pdfAnnotatorActive = usePDFConfig();
|
|
49
49
|
|
|
50
50
|
useEffect(() => {
|
|
51
51
|
if (!isConnected) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import { CheckIcon, CloudUploadIcon, CrossIcon } from '@100mslive/react-icons';
|
|
3
|
-
import { PrebuiltDialogPortal } from '../components/PrebuiltDialogPortal';
|
|
4
3
|
import { Button } from '../../Button';
|
|
5
4
|
import { Checkbox } from '../../Checkbox';
|
|
6
5
|
import { HorizontalDivider } from '../../Divider';
|
|
@@ -15,7 +14,7 @@ import { Text } from '../../Text';
|
|
|
15
14
|
|
|
16
15
|
export const DialogContent = ({ Icon, title, closeable = true, children, css, iconCSS = {}, ...props }) => {
|
|
17
16
|
return (
|
|
18
|
-
<
|
|
17
|
+
<Dialog.Portal>
|
|
19
18
|
<Dialog.Overlay />
|
|
20
19
|
<Dialog.Content css={{ width: 'min(600px, 100%)', ...css }} {...props}>
|
|
21
20
|
<Dialog.Title>
|
|
@@ -36,7 +35,7 @@ export const DialogContent = ({ Icon, title, closeable = true, children, css, ic
|
|
|
36
35
|
<HorizontalDivider css={{ mt: '0.8rem' }} />
|
|
37
36
|
<Box>{children}</Box>
|
|
38
37
|
</Dialog.Content>
|
|
39
|
-
</
|
|
38
|
+
</Dialog.Portal>
|
|
40
39
|
);
|
|
41
40
|
};
|
|
42
41
|
|
|
@@ -61,7 +60,7 @@ export const ErrorDialog = ({ open = true, onOpenChange, title, children, ...pro
|
|
|
61
60
|
|
|
62
61
|
export const RequestDialog = ({ open = true, onOpenChange, title, body, actionText = 'Accept', onAction, Icon }) => (
|
|
63
62
|
<Dialog.Root open={open} onOpenChange={onOpenChange}>
|
|
64
|
-
<
|
|
63
|
+
<Dialog.Portal>
|
|
65
64
|
<Dialog.Overlay />
|
|
66
65
|
<Dialog.Content css={{ width: 'min(400px,80%)', p: '$10' }}>
|
|
67
66
|
<Dialog.Title css={{ p: 0, display: 'flex', flexDirection: 'row', gap: '$md' }}>
|
|
@@ -98,7 +97,7 @@ export const RequestDialog = ({ open = true, onOpenChange, title, body, actionTe
|
|
|
98
97
|
</Box>
|
|
99
98
|
</Flex>
|
|
100
99
|
</Dialog.Content>
|
|
101
|
-
</
|
|
100
|
+
</Dialog.Portal>
|
|
102
101
|
</Dialog.Root>
|
|
103
102
|
);
|
|
104
103
|
|