@100mslive/roomkit-react 0.3.17-alpha.9 → 0.3.18-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-MC3I6AFB.css → HLSView-5HBDZGK5.css} +3 -3
- package/dist/{HLSView-MC3I6AFB.css.map → HLSView-5HBDZGK5.css.map} +1 -1
- package/dist/{HLSView-6B2VBGKL.js → HLSView-U75MMQRG.js} +2 -2
- package/dist/Prebuilt/components/MoreSettings/constants.d.ts +4 -0
- package/dist/Prebuilt/components/Notifications/ReconnectNotifications.d.ts +1 -2
- package/dist/Prebuilt/components/VirtualBackground/VBCollection.d.ts +1 -0
- package/dist/Prebuilt/components/VirtualBackground/util.d.ts +1 -0
- package/dist/{chunk-TCDCBDMC.js → chunk-QXCR7BIF.js} +724 -705
- package/dist/chunk-QXCR7BIF.js.map +7 -0
- package/dist/index.cjs.css +2 -2
- package/dist/index.cjs.css.map +1 -1
- package/dist/index.cjs.js +969 -946
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/dist/meta.cjs.json +101 -52
- package/dist/meta.esbuild.json +113 -64
- package/package.json +7 -7
- package/src/Prebuilt/components/AppData/AppData.tsx +9 -3
- package/src/Prebuilt/components/MoreSettings/constants.ts +2 -0
- package/src/Prebuilt/components/Notifications/ReconnectNotifications.tsx +10 -37
- package/src/Prebuilt/components/Preview/PreviewJoin.tsx +3 -1
- package/src/Prebuilt/components/Settings/LayoutSettings.tsx +0 -28
- package/src/Prebuilt/components/Toast/ToastConfig.jsx +2 -2
- package/src/Prebuilt/components/VirtualBackground/VBCollection.tsx +16 -11
- package/src/Prebuilt/components/VirtualBackground/VBHandler.tsx +1 -2
- package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +10 -2
- package/src/Prebuilt/components/VirtualBackground/VBToggle.tsx +9 -2
- package/src/Prebuilt/components/VirtualBackground/util.tsx +13 -0
- package/dist/chunk-TCDCBDMC.js.map +0 -7
- /package/dist/{HLSView-6B2VBGKL.js.map → HLSView-U75MMQRG.js.map} +0 -0
@@ -4,6 +4,7 @@ import {
|
|
4
4
|
HMSRoomState,
|
5
5
|
selectAppData,
|
6
6
|
selectIsLocalVideoEnabled,
|
7
|
+
selectIsVBEnabled,
|
7
8
|
selectLocalPeer,
|
8
9
|
selectRoomState,
|
9
10
|
selectVideoTrackByID,
|
@@ -253,6 +254,7 @@ export const PreviewTile = ({ name, error }: { name: string; error?: boolean })
|
|
253
254
|
|
254
255
|
export const PreviewControls = ({ hideSettings, vbEnabled }: { hideSettings: boolean; vbEnabled: boolean }) => {
|
255
256
|
const isMobile = useMedia(cssConfig.media.md);
|
257
|
+
const isVBEnabledForUser = useHMSStore(selectIsVBEnabled);
|
256
258
|
return (
|
257
259
|
<Flex
|
258
260
|
justify={hideSettings && isMobile ? 'center' : 'between'}
|
@@ -263,7 +265,7 @@ export const PreviewControls = ({ hideSettings, vbEnabled }: { hideSettings: boo
|
|
263
265
|
>
|
264
266
|
<Flex css={{ gap: '$4' }}>
|
265
267
|
<AudioVideoToggle />
|
266
|
-
{vbEnabled ? <VBToggle /> : null}
|
268
|
+
{vbEnabled && isVBEnabledForUser ? <VBToggle /> : null}
|
267
269
|
</Flex>
|
268
270
|
<Flex align="center" gap="1">
|
269
271
|
{isMobile && <NoiseCancellation iconOnly />}
|
@@ -41,34 +41,6 @@ export const LayoutSettings = () => {
|
|
41
41
|
|
42
42
|
return (
|
43
43
|
<Box className={settingOverflow()}>
|
44
|
-
<Box>
|
45
|
-
{/* <Text variant="md" css={{ fontWeight: '$semiBold' }}>
|
46
|
-
Layout Modes
|
47
|
-
</Text>
|
48
|
-
<RadioGroup.Root
|
49
|
-
css={{ flexDirection: 'column', alignItems: 'start', gap: '$10', my: '$2', py: '$8' }}
|
50
|
-
value={layoutMode}
|
51
|
-
onValueChange={value =>
|
52
|
-
setUISettings({
|
53
|
-
[UI_SETTINGS.layoutMode]: value,
|
54
|
-
})
|
55
|
-
}
|
56
|
-
>
|
57
|
-
{Object.keys(LayoutMode).map(key => {
|
58
|
-
return (
|
59
|
-
<Flex align="center" key={key} css={{ mr: '$8', gap: '$8' }}>
|
60
|
-
<RadioGroup.Item value={LayoutMode[key as LayoutModeKeys]} id={`layoutMode-${key}`} css={{ mr: '$4' }}>
|
61
|
-
<RadioGroup.Indicator />
|
62
|
-
</RadioGroup.Item>
|
63
|
-
<Label htmlFor={`layoutMode-${key}`} css={{ display: 'flex', gap: '$8', cursor: 'pointer' }}>
|
64
|
-
{LayoutModeIconMapping[LayoutMode[key as LayoutModeKeys]]}
|
65
|
-
{LayoutMode[key as LayoutModeKeys]}
|
66
|
-
</Label>
|
67
|
-
</Flex>
|
68
|
-
);
|
69
|
-
})}
|
70
|
-
</RadioGroup.Root> */}
|
71
|
-
</Box>
|
72
44
|
<Flex align="center" css={{ w: '100%', my: '$2', py: '$8', '@md': { display: 'none' } }}>
|
73
45
|
<Text variant="md" css={{ fontWeight: '$semiBold' }}>
|
74
46
|
Tiles In View({maxTileCount})
|
@@ -153,9 +153,9 @@ export const ToastConfig = {
|
|
153
153
|
},
|
154
154
|
},
|
155
155
|
RECONNECTED: {
|
156
|
-
single:
|
156
|
+
single: online => {
|
157
157
|
return {
|
158
|
-
title: `You are now connected`,
|
158
|
+
title: `You are now ${online ? 'online' : 'connected'}`,
|
159
159
|
icon: <ConnectivityIcon />,
|
160
160
|
variant: 'success',
|
161
161
|
duration: 3000,
|
@@ -15,6 +15,7 @@ export const VBCollection = ({
|
|
15
15
|
onClick?: () => Promise<void>;
|
16
16
|
mediaURL?: string;
|
17
17
|
value: string | HMSVirtualBackgroundTypes;
|
18
|
+
supported?: boolean;
|
18
19
|
}[];
|
19
20
|
title: string;
|
20
21
|
activeBackground: string;
|
@@ -28,17 +29,21 @@ export const VBCollection = ({
|
|
28
29
|
{title}
|
29
30
|
</Text>
|
30
31
|
<Box css={{ py: '$4', display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: '$8' }}>
|
31
|
-
{options.map((option, index) =>
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
32
|
+
{options.map((option, index) =>
|
33
|
+
option.supported ? (
|
34
|
+
<VBOption.Root
|
35
|
+
key={option.value}
|
36
|
+
testid={option.value === HMSVirtualBackgroundTypes.IMAGE ? `virtual_bg_option-${index}` : option.value}
|
37
|
+
{...option}
|
38
|
+
isActive={activeBackground === option.value}
|
39
|
+
>
|
40
|
+
<VBOption.Icon>{option?.icon}</VBOption.Icon>
|
41
|
+
<VBOption.Title>{option?.title}</VBOption.Title>
|
42
|
+
</VBOption.Root>
|
43
|
+
) : (
|
44
|
+
''
|
45
|
+
),
|
46
|
+
)}
|
42
47
|
</Box>
|
43
48
|
</Box>
|
44
49
|
);
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import { HMSEffectsPlugin, HMSVBPlugin, HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background';
|
2
|
-
|
3
2
|
export class VBPlugin {
|
4
3
|
private hmsPlugin?: HMSVBPlugin;
|
5
|
-
private effectsPlugin?: HMSEffectsPlugin
|
4
|
+
private effectsPlugin?: HMSEffectsPlugin;
|
6
5
|
|
7
6
|
initialisePlugin = (effectsSDKKey?: string, onInit?: () => void) => {
|
8
7
|
if (this.getVBObject()) {
|
@@ -22,6 +22,7 @@ import {
|
|
22
22
|
import { BlurPersonHighIcon, CrossCircleIcon, CrossIcon } from '@100mslive/react-icons';
|
23
23
|
import { Box, config as cssConfig, Flex, Loading, Slider, Video } from '../../../index';
|
24
24
|
import { Text } from '../../../Text';
|
25
|
+
import { doesBrowserSupportEffectsSDK } from './util';
|
25
26
|
import { VBCollection } from './VBCollection';
|
26
27
|
import { VBHandler } from './VBHandler';
|
27
28
|
// @ts-ignore
|
@@ -45,6 +46,7 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
|
|
45
46
|
const [blurAmount, setBlurAmount] = useState(VBHandler.getBlurAmount() || 0.5);
|
46
47
|
const roomState = useHMSStore(selectRoomState);
|
47
48
|
const isLargeRoom = useHMSStore(selectIsLargeRoom);
|
49
|
+
const [isBlurSupported, setIsBlurSupported] = useState(false);
|
48
50
|
const isEffectsEnabled = useHMSStore(selectIsEffectsEnabled);
|
49
51
|
const effectsKey = useHMSStore(selectEffectsKey);
|
50
52
|
const isMobile = useMedia(cssConfig.media.md);
|
@@ -61,13 +63,16 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
|
|
61
63
|
if (!track?.id) {
|
62
64
|
return;
|
63
65
|
}
|
64
|
-
|
66
|
+
const isEffectsSupported = doesBrowserSupportEffectsSDK();
|
67
|
+
setIsBlurSupported(isEffectsSupported);
|
68
|
+
const vbObject = VBHandler.getVBObject();
|
69
|
+
if (!isPluginAdded && !vbObject) {
|
65
70
|
setLoadingEffects(true);
|
66
71
|
let vbObject = VBHandler.getVBObject();
|
67
72
|
if (!vbObject) {
|
68
73
|
VBHandler.initialisePlugin(isEffectsEnabled && effectsKey ? effectsKey : '', () => setLoadingEffects(false));
|
69
74
|
vbObject = VBHandler.getVBObject();
|
70
|
-
if (isEffectsEnabled && effectsKey) {
|
75
|
+
if (isEffectsEnabled && isEffectsSupported && effectsKey) {
|
71
76
|
hmsActions.addPluginsToVideoStream([vbObject as HMSEffectsPlugin]);
|
72
77
|
} else {
|
73
78
|
setLoadingEffects(false);
|
@@ -155,6 +160,7 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
|
|
155
160
|
await VBHandler.removeEffects();
|
156
161
|
hmsActions.setAppData(APP_DATA.background, HMSVirtualBackgroundTypes.NONE);
|
157
162
|
},
|
163
|
+
supported: true,
|
158
164
|
},
|
159
165
|
{
|
160
166
|
title: 'Blur',
|
@@ -164,6 +170,7 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
|
|
164
170
|
await VBHandler?.setBlur(blurAmount);
|
165
171
|
hmsActions.setAppData(APP_DATA.background, HMSVirtualBackgroundTypes.BLUR);
|
166
172
|
},
|
173
|
+
supported: isBlurSupported,
|
167
174
|
},
|
168
175
|
]}
|
169
176
|
activeBackground={background}
|
@@ -208,6 +215,7 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
|
|
208
215
|
await VBHandler?.setBackground(mediaURL);
|
209
216
|
hmsActions.setAppData(APP_DATA.background, mediaURL);
|
210
217
|
},
|
218
|
+
supported: true,
|
211
219
|
}))}
|
212
220
|
activeBackground={background}
|
213
221
|
/>
|
@@ -1,5 +1,11 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
selectAppData,
|
4
|
+
selectIsEffectsEnabled,
|
5
|
+
selectIsLocalVideoEnabled,
|
6
|
+
selectIsVBEnabled,
|
7
|
+
useHMSStore,
|
8
|
+
} from '@100mslive/react-sdk';
|
3
9
|
import { VirtualBackgroundIcon } from '@100mslive/react-icons';
|
4
10
|
import { Loading } from '../../../Loading';
|
5
11
|
import { Tooltip } from '../../../Tooltip';
|
@@ -12,10 +18,11 @@ export const VBToggle = () => {
|
|
12
18
|
const toggleVB = useSidepaneToggle(SIDE_PANE_OPTIONS.VB);
|
13
19
|
const isVBOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.VB);
|
14
20
|
const isVideoOn = useHMSStore(selectIsLocalVideoEnabled);
|
21
|
+
const isVBEnabled = useHMSStore(selectIsVBEnabled);
|
15
22
|
const isEffectsEnabled = useHMSStore(selectIsEffectsEnabled);
|
16
23
|
const loadingEffects = useHMSStore(selectAppData(APP_DATA.loadingEffects));
|
17
24
|
|
18
|
-
if (!isVideoOn || (!isEffectsEnabled && isSafari)) {
|
25
|
+
if (!isVideoOn || (!isEffectsEnabled && isSafari) || !isVBEnabled) {
|
19
26
|
return null;
|
20
27
|
}
|
21
28
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { parsedUserAgent } from '@100mslive/react-sdk';
|
2
|
+
import { isSafari } from '../../common/constants';
|
3
|
+
|
4
|
+
export const doesBrowserSupportEffectsSDK = () => {
|
5
|
+
if (!isSafari) {
|
6
|
+
return true;
|
7
|
+
}
|
8
|
+
const browserVersion = parsedUserAgent?.getBrowser()?.version || '16';
|
9
|
+
if (browserVersion && parseInt(browserVersion.split('.')[0]) < 17) {
|
10
|
+
return false;
|
11
|
+
}
|
12
|
+
return true;
|
13
|
+
};
|