@100mslive/roomkit-react 0.2.7-alpha.0 → 0.2.7-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +30 -33
- package/dist/{HLSView-E65JZSU4.js → HLSView-4B5MUDFR.js} +2 -2
- package/dist/Prebuilt/common/constants.d.ts +4 -8
- package/dist/Prebuilt/components/AudioVideoToggle.d.ts +9 -0
- package/dist/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.d.ts +11 -0
- package/dist/Prebuilt/components/Polls/common/utils.d.ts +1 -1
- package/dist/Prebuilt/components/hooks/useAudioOutputTest.d.ts +8 -0
- package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +0 -5
- package/dist/{chunk-DWLYDCFC.js → chunk-KST24BRA.js} +5297 -5064
- package/dist/chunk-KST24BRA.js.map +7 -0
- package/dist/index.cjs.js +6302 -6130
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.js +1 -1
- package/dist/meta.cjs.json +745 -1109
- package/dist/meta.esbuild.json +761 -1125
- package/package.json +8 -7
- package/src/Prebuilt/App.tsx +0 -2
- package/src/Prebuilt/common/constants.ts +7 -10
- package/src/Prebuilt/components/AppData/AppData.tsx +0 -1
- package/src/Prebuilt/components/AppData/useUISettings.js +1 -1
- package/src/Prebuilt/components/AudioVideoToggle.tsx +308 -0
- package/src/Prebuilt/components/Footer/RoleOptions.tsx +1 -0
- package/src/Prebuilt/components/Header/Header.tsx +0 -2
- package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.tsx +159 -0
- package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +0 -2
- package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +2 -18
- package/src/Prebuilt/components/Notifications/HandRaisedNotifications.tsx +13 -2
- package/src/Prebuilt/components/Notifications/Notifications.tsx +1 -18
- package/src/Prebuilt/components/Polls/common/utils.ts +9 -15
- package/src/Prebuilt/components/Settings/DeviceSettings.jsx +10 -17
- package/src/Prebuilt/components/hooks/useAudioOutputTest.tsx +20 -0
- package/src/Prebuilt/layouts/SidePane.tsx +0 -4
- package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +0 -40
- package/dist/Prebuilt/components/AppData/useSheet.d.ts +0 -4
- package/dist/Prebuilt/components/Header/RoomDetailsHeader.d.ts +0 -2
- package/dist/Prebuilt/components/RoomDetails/Duration.d.ts +0 -4
- package/dist/Prebuilt/components/RoomDetails/RoomDetailsPane.d.ts +0 -2
- package/dist/Prebuilt/components/RoomDetails/RoomDetailsRow.d.ts +0 -4
- package/dist/Prebuilt/components/RoomDetails/RoomDetailsSheet.d.ts +0 -2
- package/dist/Prebuilt/layouts/Sheet.d.ts +0 -2
- package/dist/chunk-DWLYDCFC.js.map +0 -7
- package/src/Prebuilt/components/AppData/useSheet.ts +0 -33
- package/src/Prebuilt/components/AudioVideoToggle.jsx +0 -171
- package/src/Prebuilt/components/Header/RoomDetailsHeader.tsx +0 -51
- package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +0 -121
- package/src/Prebuilt/components/RoomDetails/Duration.tsx +0 -26
- package/src/Prebuilt/components/RoomDetails/RoomDetailsPane.tsx +0 -36
- package/src/Prebuilt/components/RoomDetails/RoomDetailsRow.tsx +0 -23
- package/src/Prebuilt/components/RoomDetails/RoomDetailsSheet.tsx +0 -45
- package/src/Prebuilt/layouts/Sheet.tsx +0 -14
- /package/dist/{HLSView-E65JZSU4.js.map → HLSView-4B5MUDFR.js.map} +0 -0
@@ -11,25 +11,36 @@ import {
|
|
11
11
|
// @ts-ignore: No implicit Any
|
12
12
|
import { ToastBatcher } from '../Toast/ToastBatcher';
|
13
13
|
import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
|
14
|
+
// @ts-ignore: No implicit Any
|
15
|
+
import { useSubscribedNotifications } from '../AppData/useUISettings';
|
14
16
|
|
15
17
|
export const HandRaisedNotifications = () => {
|
16
18
|
const notification = useHMSNotifications(HMSNotificationTypes.HAND_RAISE_CHANGED);
|
17
19
|
const roomState = useHMSStore(selectRoomState);
|
18
20
|
const vanillaStore = useHMSVanillaStore();
|
19
21
|
const { on_stage_exp } = useRoomLayoutConferencingScreen().elements || {};
|
22
|
+
const subscribedNotifications = useSubscribedNotifications();
|
20
23
|
|
21
24
|
useEffect(() => {
|
22
25
|
if (!notification?.data) {
|
23
26
|
return;
|
24
27
|
}
|
25
|
-
|
28
|
+
|
29
|
+
// Don't show toast message in case of local peer.
|
30
|
+
if (
|
31
|
+
roomState !== HMSRoomState.Connected ||
|
32
|
+
notification.data.isLocal ||
|
33
|
+
!on_stage_exp ||
|
34
|
+
!subscribedNotifications.METADATA_UPDATED
|
35
|
+
) {
|
26
36
|
return;
|
27
37
|
}
|
28
38
|
const hasPeerHandRaised = vanillaStore.getState(selectHasPeerHandRaised(notification.data.id));
|
29
39
|
if (hasPeerHandRaised) {
|
30
40
|
ToastBatcher.showToast({ notification, type: 'RAISE_HAND' });
|
41
|
+
console.debug('Metadata updated', notification.data);
|
31
42
|
}
|
32
|
-
}, [notification, on_stage_exp, roomState, vanillaStore]);
|
43
|
+
}, [notification, on_stage_exp, roomState, subscribedNotifications.METADATA_UPDATED, vanillaStore]);
|
33
44
|
|
34
45
|
return null;
|
35
46
|
};
|
@@ -16,8 +16,6 @@ import { GroupIcon } from '@100mslive/react-icons';
|
|
16
16
|
import { Box, Button } from '../../..';
|
17
17
|
import { useUpdateRoomLayout } from '../../provider/roomLayoutProvider';
|
18
18
|
// @ts-ignore: No implicit Any
|
19
|
-
import { ToastBatcher } from '../Toast/ToastBatcher';
|
20
|
-
// @ts-ignore: No implicit Any
|
21
19
|
import { ToastManager } from '../Toast/ToastManager';
|
22
20
|
import { AutoplayBlockedModal } from './AutoplayBlockedModal';
|
23
21
|
import { ChatNotifications } from './ChatNotifications';
|
@@ -34,8 +32,6 @@ import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvid
|
|
34
32
|
import { usePollViewToggle } from '../AppData/useSidepane';
|
35
33
|
// @ts-ignore: No implicit Any
|
36
34
|
import { useIsNotificationDisabled, useSubscribedNotifications } from '../AppData/useUISettings';
|
37
|
-
// @ts-ignore: No implicit Any
|
38
|
-
import { getMetadata } from '../../common/utils';
|
39
35
|
import { ROLE_CHANGE_DECLINED } from '../../common/constants';
|
40
36
|
|
41
37
|
const pollToastKey: Record<string, string> = {};
|
@@ -43,7 +39,7 @@ const pollToastKey: Record<string, string> = {};
|
|
43
39
|
export function Notifications() {
|
44
40
|
const localPeerID = useHMSStore(selectLocalPeerID);
|
45
41
|
const notification = useHMSNotifications();
|
46
|
-
const subscribedNotifications = useSubscribedNotifications()
|
42
|
+
const subscribedNotifications = useSubscribedNotifications();
|
47
43
|
const roomState = useHMSStore(selectRoomState);
|
48
44
|
const updateRoomLayoutForRole = useUpdateRoomLayout();
|
49
45
|
const isNotificationDisabled = useIsNotificationDisabled();
|
@@ -65,19 +61,6 @@ export function Notifications() {
|
|
65
61
|
return;
|
66
62
|
}
|
67
63
|
switch (notification.type) {
|
68
|
-
case HMSNotificationTypes.METADATA_UPDATED:
|
69
|
-
if (roomState !== HMSRoomState.Connected) {
|
70
|
-
return;
|
71
|
-
}
|
72
|
-
// Don't show toast message when metadata is updated and raiseHand is false.
|
73
|
-
// Don't show toast message in case of local peer.
|
74
|
-
const metadata = getMetadata(notification.data?.metadata);
|
75
|
-
if (!metadata?.isHandRaised || notification.data.isLocal) return;
|
76
|
-
|
77
|
-
console.debug('Metadata updated', notification.data);
|
78
|
-
if (!subscribedNotifications.METADATA_UPDATED) return;
|
79
|
-
ToastBatcher.showToast({ notification, type: 'RAISE_HAND' });
|
80
|
-
break;
|
81
64
|
case HMSNotificationTypes.NAME_UPDATED:
|
82
65
|
console.log(notification.data.id + ' changed their name to ' + notification.data.name);
|
83
66
|
break;
|
@@ -1,22 +1,16 @@
|
|
1
|
-
export const getFormattedTime = (milliseconds: number | undefined
|
1
|
+
export const getFormattedTime = (milliseconds: number | undefined) => {
|
2
2
|
if (!milliseconds) return '-';
|
3
3
|
|
4
4
|
const totalSeconds = milliseconds / 1000;
|
5
|
-
const
|
6
|
-
const
|
7
|
-
const seconds = precise ? totalSeconds % 60 : Math.floor(totalSeconds % 60);
|
5
|
+
const minutes = Math.floor(totalSeconds / 60);
|
6
|
+
const seconds = totalSeconds % 60;
|
8
7
|
|
9
|
-
let
|
10
|
-
if (
|
11
|
-
|
8
|
+
let formattedSeconds = '';
|
9
|
+
if (Number.isInteger(seconds) || minutes) {
|
10
|
+
formattedSeconds = seconds.toFixed(0);
|
11
|
+
} else {
|
12
|
+
formattedSeconds = seconds.toFixed(1);
|
12
13
|
}
|
13
|
-
if (minutes || hours) {
|
14
|
-
formattedTime += `${minutes}m `;
|
15
|
-
}
|
16
|
-
if (!precise && (hours || minutes)) {
|
17
|
-
return formattedTime;
|
18
|
-
}
|
19
|
-
formattedTime += `${seconds}s`;
|
20
14
|
|
21
|
-
return
|
15
|
+
return `${minutes ? `${minutes}m ` : ''}${formattedSeconds}s`;
|
22
16
|
};
|
@@ -14,9 +14,10 @@ import { Box, Button, Dropdown, Flex, StyledVideoTile, Text, Video } from '../..
|
|
14
14
|
import { config as cssConfig } from '../../../Theme';
|
15
15
|
import { DialogDropdownTrigger } from '../../primitives/DropdownTrigger';
|
16
16
|
import { useUISettings } from '../AppData/useUISettings';
|
17
|
+
import { useAudioOutputTest } from '../hooks/useAudioOutputTest';
|
17
18
|
import { useDropdownSelection } from '../hooks/useDropdownSelection';
|
18
19
|
import { settingOverflow } from './common';
|
19
|
-
import { UI_SETTINGS } from '../../common/constants';
|
20
|
+
import { TEST_AUDIO_URL, UI_SETTINGS } from '../../common/constants';
|
20
21
|
|
21
22
|
/**
|
22
23
|
* wrap the button on click of whom settings should open, this component will take care of the rest,
|
@@ -182,22 +183,8 @@ const DeviceSelector = ({ title, devices, selection, onChange, icon, children =
|
|
182
183
|
);
|
183
184
|
};
|
184
185
|
|
185
|
-
const TEST_AUDIO_URL = 'https://100ms.live/test-audio.wav';
|
186
|
-
|
187
186
|
const TestAudio = ({ id }) => {
|
188
|
-
const audioRef =
|
189
|
-
const [playing, setPlaying] = useState(false);
|
190
|
-
useEffect(() => {
|
191
|
-
if (audioRef.current && id) {
|
192
|
-
try {
|
193
|
-
if (typeof audioRef.current.setSinkId !== 'undefined') {
|
194
|
-
audioRef.current.setSinkId(id);
|
195
|
-
}
|
196
|
-
} catch (error) {
|
197
|
-
console.log(error);
|
198
|
-
}
|
199
|
-
}
|
200
|
-
}, [id]);
|
187
|
+
const { playing, setPlaying, audioRef } = useAudioOutputTest({ deviceId: id });
|
201
188
|
return (
|
202
189
|
<>
|
203
190
|
<Button
|
@@ -218,7 +205,13 @@ const TestAudio = ({ id }) => {
|
|
218
205
|
speaker
|
219
206
|
</Text>
|
220
207
|
</Button>
|
221
|
-
<audio
|
208
|
+
<audio
|
209
|
+
ref={audioRef}
|
210
|
+
src={TEST_AUDIO_URL}
|
211
|
+
onEnded={() => setPlaying(false)}
|
212
|
+
onPlay={() => setPlaying(true)}
|
213
|
+
css={{ display: 'none' }}
|
214
|
+
/>
|
222
215
|
</>
|
223
216
|
);
|
224
217
|
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
2
|
+
|
3
|
+
export const useAudioOutputTest = ({ deviceId }: { deviceId: string }) => {
|
4
|
+
const audioRef = useRef<HTMLAudioElement | null>(null);
|
5
|
+
const [playing, setPlaying] = useState(false);
|
6
|
+
useEffect(() => {
|
7
|
+
if (audioRef.current && deviceId) {
|
8
|
+
try {
|
9
|
+
// @ts-ignore
|
10
|
+
if (typeof audioRef.current.setSinkId !== 'undefined') {
|
11
|
+
// @ts-ignore
|
12
|
+
audioRef.current.setSinkId(deviceId);
|
13
|
+
}
|
14
|
+
} catch (error) {
|
15
|
+
console.log(error);
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}, [deviceId]);
|
19
|
+
return { playing, setPlaying, audioRef };
|
20
|
+
};
|
@@ -2,7 +2,6 @@ import React, { useEffect } from 'react';
|
|
2
2
|
import { useMedia } from 'react-use';
|
3
3
|
import { selectAppData, selectVideoTrackByPeerID, useHMSStore } from '@100mslive/react-sdk';
|
4
4
|
import { Polls } from '../components/Polls/Polls';
|
5
|
-
import { RoomDetailsPane } from '../components/RoomDetails/RoomDetailsPane';
|
6
5
|
import { LayoutMode } from '../components/Settings/LayoutSettings';
|
7
6
|
import { SidePaneTabs } from '../components/SidePaneTabs';
|
8
7
|
import { TileCustomisationProps } from '../components/VideoLayouts/GridLayout';
|
@@ -53,9 +52,6 @@ const SidePane = ({
|
|
53
52
|
if (sidepane === SIDE_PANE_OPTIONS.VB) {
|
54
53
|
ViewComponent = <VBPicker backgroundMedia={backgroundMedia} />;
|
55
54
|
}
|
56
|
-
if (sidepane === SIDE_PANE_OPTIONS.ROOM_DETAILS) {
|
57
|
-
ViewComponent = <RoomDetailsPane />;
|
58
|
-
}
|
59
55
|
|
60
56
|
useEffect(() => {
|
61
57
|
return () => {
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { useMemo } from 'react';
|
2
1
|
import {
|
3
2
|
ConferencingScreen,
|
4
3
|
DefaultConferencingScreen_Elements,
|
@@ -8,16 +7,7 @@ import {
|
|
8
7
|
PreviewScreen,
|
9
8
|
Screens,
|
10
9
|
} from '@100mslive/types-prebuilt';
|
11
|
-
import {
|
12
|
-
selectHLSState,
|
13
|
-
selectPeerCount,
|
14
|
-
selectRoomStartTime,
|
15
|
-
useHMSStore,
|
16
|
-
useRecordingStreaming,
|
17
|
-
} from '@100mslive/react-sdk';
|
18
10
|
import { useRoomLayout } from '..';
|
19
|
-
// @ts-ignore
|
20
|
-
import { getFormattedCount } from '../../../common/utils';
|
21
11
|
|
22
12
|
export type useRoomLayoutScreenProps = {
|
23
13
|
screen: keyof Screens;
|
@@ -79,33 +69,3 @@ export function useRoomLayoutLeaveScreen() {
|
|
79
69
|
isLeaveScreenEnabled,
|
80
70
|
};
|
81
71
|
}
|
82
|
-
|
83
|
-
export function useRoomLayoutHeader() {
|
84
|
-
const { elements } = useRoomLayoutConferencingScreen();
|
85
|
-
// return elements.header;
|
86
|
-
const { isRecordingOn } = useRecordingStreaming();
|
87
|
-
const peerCount = useHMSStore(selectPeerCount);
|
88
|
-
const sessionStartedAt = useHMSStore(selectRoomStartTime);
|
89
|
-
const hlsState = useHMSStore(selectHLSState);
|
90
|
-
|
91
|
-
// People watching, start timestamp, recording status
|
92
|
-
const details = useMemo(() => {
|
93
|
-
const details = [];
|
94
|
-
if (hlsState?.variants[0]?.['startedAt']) {
|
95
|
-
details.push(`${getFormattedCount(peerCount)} watching`);
|
96
|
-
details.push(hlsState.variants[0]['startedAt']);
|
97
|
-
} else if (sessionStartedAt) {
|
98
|
-
details.push(sessionStartedAt);
|
99
|
-
}
|
100
|
-
if (isRecordingOn) {
|
101
|
-
details.push('Recording');
|
102
|
-
}
|
103
|
-
return details;
|
104
|
-
}, [hlsState?.variants, isRecordingOn, peerCount, sessionStartedAt]);
|
105
|
-
|
106
|
-
return {
|
107
|
-
title: elements.header?.title || '',
|
108
|
-
description: elements.header?.description || '',
|
109
|
-
details,
|
110
|
-
};
|
111
|
-
}
|