@100mslive/roomkit-react 0.3.8-alpha.0 → 0.3.8-alpha.1

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.
Files changed (32) hide show
  1. package/dist/{HLSView-CTZXD762.js → HLSView-HUMJOIWO.js} +2 -2
  2. package/dist/Prebuilt/common/constants.d.ts +1 -0
  3. package/dist/Prebuilt/common/hooks.d.ts +10 -0
  4. package/dist/Prebuilt/components/FullPageProgress.d.ts +8 -0
  5. package/dist/Prebuilt/components/VirtualBackground/VBHandler.d.ts +3 -3
  6. package/dist/{chunk-NDLMRKFR.js → chunk-IDAPJGWC.js} +263 -279
  7. package/dist/chunk-IDAPJGWC.js.map +7 -0
  8. package/dist/index.cjs.js +190 -207
  9. package/dist/index.cjs.js.map +4 -4
  10. package/dist/index.js +1 -1
  11. package/dist/meta.cjs.json +74 -49
  12. package/dist/meta.esbuild.json +84 -59
  13. package/package.json +6 -6
  14. package/src/Prebuilt/common/constants.ts +1 -0
  15. package/src/Prebuilt/common/hooks.ts +72 -1
  16. package/src/Prebuilt/components/AppData/AppData.tsx +1 -0
  17. package/src/Prebuilt/components/ConferenceScreen.tsx +0 -2
  18. package/src/Prebuilt/components/{FullPageProgress.jsx → FullPageProgress.tsx} +10 -1
  19. package/src/Prebuilt/components/Header/StreamActions.tsx +3 -25
  20. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +4 -26
  21. package/src/Prebuilt/components/Notifications/PeerNotifications.tsx +1 -11
  22. package/src/Prebuilt/components/Preview/PreviewJoin.tsx +4 -9
  23. package/src/Prebuilt/components/Preview/PreviewScreen.tsx +0 -3
  24. package/src/Prebuilt/components/Settings/StartRecording.jsx +4 -37
  25. package/src/Prebuilt/components/Toast/ToastConfig.jsx +0 -22
  26. package/src/Prebuilt/components/VirtualBackground/VBHandler.tsx +3 -3
  27. package/src/Prebuilt/components/VirtualBackground/VBOption.tsx +3 -1
  28. package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +23 -7
  29. package/src/Prebuilt/components/VirtualBackground/VBToggle.tsx +5 -3
  30. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +0 -2
  31. package/dist/chunk-NDLMRKFR.js.map +0 -7
  32. /package/dist/{HLSView-CTZXD762.js.map → HLSView-HUMJOIWO.js.map} +0 -0
@@ -20,12 +20,9 @@ import { ToastManager } from '../Toast/ToastManager';
20
20
  // @ts-ignore
21
21
  import { AdditionalRoomState, getRecordingText } from './AdditionalRoomState';
22
22
  import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
23
- // @ts-ignore
24
- import { useSetAppDataByKey } from '../AppData/useUISettings';
23
+ import { useRecordingHandler } from '../../common/hooks';
25
24
  // @ts-ignore
26
25
  import { formatTime } from '../../common/utils';
27
- // @ts-ignore
28
- import { APP_DATA } from '../../common/constants';
29
26
 
30
27
  export const LiveStatus = () => {
31
28
  const { isHLSRunning, isRTMPRunning } = useRecordingStreaming();
@@ -147,7 +144,7 @@ export const RecordingPauseStatus = () => {
147
144
  const StartRecording = () => {
148
145
  const permissions = useHMSStore(selectPermissions);
149
146
  const [open, setOpen] = useState(false);
150
- const [recordingStarted, setRecordingState] = useSetAppDataByKey(APP_DATA.recordingStarted);
147
+ const { startRecording, recordingStarted } = useRecordingHandler();
151
148
  const { isBrowserRecordingOn, isStreamingOn, isHLSRunning } = useRecordingStreaming();
152
149
  const hmsActions = useHMSActions();
153
150
  if (!permissions?.browserRecording || isHLSRunning) {
@@ -201,26 +198,7 @@ const StartRecording = () => {
201
198
  icon
202
199
  disabled={recordingStarted || isStreamingOn}
203
200
  onClick={async () => {
204
- try {
205
- setRecordingState(true);
206
- await hmsActions.startRTMPOrRecording({
207
- record: true,
208
- });
209
- } catch (error) {
210
- const err = error as Error;
211
- if (err.message.includes('stream already running')) {
212
- ToastManager.addToast({
213
- title: 'Recording already running',
214
- variant: 'error',
215
- });
216
- } else {
217
- ToastManager.addToast({
218
- title: err.message,
219
- variant: 'error',
220
- });
221
- }
222
- setRecordingState(false);
223
- }
201
+ await startRecording();
224
202
  }}
225
203
  >
226
204
  {recordingStarted ? <Loading size={24} color="currentColor" /> : <RecordIcon />}
@@ -54,7 +54,7 @@ import { useShowPolls } from '../../AppData/useUISettings';
54
54
  import { useDropdownList } from '../../hooks/useDropdownList';
55
55
  import { useMyMetadata } from '../../hooks/useMetadata';
56
56
  import { useUnreadPollQuizPresent } from '../../hooks/useUnreadPollQuizPresent';
57
- import { useLandscapeHLSStream, useMobileHLSStream } from '../../../common/hooks';
57
+ import { useLandscapeHLSStream, useMobileHLSStream, useRecordingHandler } from '../../../common/hooks';
58
58
  // @ts-ignore: No implicit any
59
59
  import { getFormattedCount } from '../../../common/utils';
60
60
  // @ts-ignore: No implicit any
@@ -88,7 +88,6 @@ export const MwebOptions = ({
88
88
  const [openSettingsSheet, setOpenSettingsSheet] = useState(false);
89
89
  const [showEmojiCard, setShowEmojiCard] = useState(false);
90
90
  const [showRecordingOn, setShowRecordingOn] = useState(false);
91
- const [isRecordingLoading, setIsRecordingLoading] = useState(false);
92
91
  const toggleParticipants = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
93
92
  const { showPolls } = useShowPolls();
94
93
  const togglePollView = usePollViewToggle();
@@ -102,7 +101,7 @@ export const MwebOptions = ({
102
101
  const isLandscapeHLSStream = useLandscapeHLSStream();
103
102
  const toggleVB = useSidepaneToggle(SIDE_PANE_OPTIONS.VB);
104
103
  const isLocalVideoEnabled = useHMSStore(selectIsLocalVideoEnabled);
105
-
104
+ const { startRecording, isRecordingLoading } = useRecordingHandler();
106
105
  useDropdownList({ open: openModals.size > 0 || openOptionsSheet || openSettingsSheet, name: 'MoreSettings' });
107
106
 
108
107
  const updateState = (modalName: string, value: boolean) => {
@@ -260,29 +259,8 @@ export const MwebOptions = ({
260
259
  setShowRecordingOn(true);
261
260
  } else {
262
261
  // start recording
263
- setIsRecordingLoading(true);
264
- try {
265
- await hmsActions.startRTMPOrRecording({
266
- record: true,
267
- });
268
- setOpenOptionsSheet(false);
269
- setIsRecordingLoading(false);
270
- } catch (error) {
271
- // @ts-ignore
272
- if (error.message.includes('stream already running')) {
273
- ToastManager.addToast({
274
- title: 'Recording already running',
275
- variant: 'error',
276
- });
277
- } else {
278
- ToastManager.addToast({
279
- // @ts-ignore
280
- title: error.message,
281
- variant: 'error',
282
- });
283
- }
284
- setIsRecordingLoading(false);
285
- }
262
+ await startRecording();
263
+ setOpenOptionsSheet(false);
286
264
  }
287
265
  if (isHLSRunning) {
288
266
  setOpenOptionsSheet(false);
@@ -7,11 +7,7 @@ import { useSetSubscribedChatSelector, useSubscribedNotifications } from '../App
7
7
  // @ts-ignore: No implicit Any
8
8
  import { CHAT_SELECTOR, SUBSCRIBED_NOTIFICATIONS } from '../../common/constants';
9
9
 
10
- const notificationTypes = [
11
- HMSNotificationTypes.PEER_LIST,
12
- HMSNotificationTypes.PEER_JOINED,
13
- HMSNotificationTypes.PEER_LEFT,
14
- ];
10
+ const notificationTypes = [HMSNotificationTypes.PEER_JOINED, HMSNotificationTypes.PEER_LEFT];
15
11
 
16
12
  export const PeerNotifications = () => {
17
13
  const notification = useHMSNotifications(notificationTypes);
@@ -26,11 +22,6 @@ export const PeerNotifications = () => {
26
22
 
27
23
  console.debug(`[${notification.type}]`, notification);
28
24
  switch (notification.type) {
29
- case HMSNotificationTypes.PEER_LIST:
30
- if (!isPeerJoinSubscribed || notification.data.length === 0) {
31
- return;
32
- }
33
- break;
34
25
  case HMSNotificationTypes.PEER_JOINED:
35
26
  if (!isPeerJoinSubscribed) {
36
27
  return;
@@ -47,7 +38,6 @@ export const PeerNotifications = () => {
47
38
  default:
48
39
  return;
49
40
  }
50
-
51
41
  ToastBatcher.showToast({ notification });
52
42
  }, [notification, isPeerJoinSubscribed, isPeerLeftSubscribed, selectedPeer.id, setPeerSelector]);
53
43
 
@@ -2,6 +2,7 @@ import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'reac
2
2
  import { useMeasure, useMedia } from 'react-use';
3
3
  import {
4
4
  HMSRoomState,
5
+ selectAppData,
5
6
  selectIsLocalVideoEnabled,
6
7
  selectLocalPeer,
7
8
  selectRoomState,
@@ -16,24 +17,17 @@ import { MicOffIcon, SettingsIcon } from '@100mslive/react-icons';
16
17
  import { Avatar, Box, config as cssConfig, Flex, flexCenter, styled, StyledVideoTile, Text, Video } from '../../..';
17
18
  import { AudioLevel } from '../../../AudioLevel';
18
19
  import { useHMSPrebuiltContext } from '../../AppContext';
19
- // @ts-ignore: No implicit Any
20
20
  import IconButton from '../../IconButton';
21
21
  import SidePane from '../../layouts/SidePane';
22
- // @ts-ignore: No implicit Any
23
22
  import { AudioVideoToggle } from '../AudioVideoToggle';
24
- // @ts-ignore: No implicit Any
25
23
  import Chip from '../Chip';
26
- // @ts-ignore: No implicit Any
27
24
  import TileConnection from '../Connection/TileConnection';
28
- // @ts-ignore: No implicit Any
29
25
  import FullPageProgress from '../FullPageProgress';
30
26
  // @ts-ignore: No implicit Any
31
27
  import { Logo } from '../Header/HeaderComponents';
32
28
  // @ts-ignore: No implicit Any
33
29
  import SettingsModal from '../Settings/SettingsModal';
34
- // @ts-ignore: No implicit Any
35
30
  import { VBToggle } from '../VirtualBackground/VBToggle';
36
- // @ts-ignore: No implicit Any
37
31
  import PreviewForm from './PreviewForm';
38
32
  import { useRoomLayoutPreviewScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
39
33
  // @ts-ignore: No implicit Any
@@ -42,7 +36,7 @@ import { useAuthToken, useUISettings } from '../AppData/useUISettings';
42
36
  import { defaultPreviewPreference, UserPreferencesKeys, useUserPreferences } from '../hooks/useUserPreferences';
43
37
  // @ts-ignore: No implicit Any
44
38
  import { calculateAvatarAndAttribBoxSize, getFormattedCount } from '../../common/utils';
45
- import { UI_SETTINGS } from '../../common/constants';
39
+ import { APP_DATA, UI_SETTINGS } from '../../common/constants';
46
40
 
47
41
  const getParticipantChipContent = (peerCount = 0) => {
48
42
  if (peerCount === 0) {
@@ -85,6 +79,7 @@ const PreviewJoin = ({
85
79
  const [previewError, setPreviewError] = useState(false);
86
80
  const { endpoints } = useHMSPrebuiltContext();
87
81
  const { peerCount } = useParticipants();
82
+ const loadingEffects = useHMSStore(selectAppData(APP_DATA.loadingEffects));
88
83
  const { enableJoin, preview, join } = usePreviewJoin({
89
84
  name,
90
85
  token: authToken,
@@ -166,7 +161,7 @@ const PreviewJoin = ({
166
161
  name={name}
167
162
  disabled={!!initialName}
168
163
  onChange={setName}
169
- enableJoin={enableJoin}
164
+ enableJoin={enableJoin && !loadingEffects}
170
165
  onJoin={savePreferenceAndJoin}
171
166
  cannotPublishVideo={!toggleVideo}
172
167
  cannotPublishAudio={!toggleAudio}
@@ -3,14 +3,11 @@ import { useSearchParam } from 'react-use';
3
3
  import { Flex } from '../../..';
4
4
  import { useHMSPrebuiltContext } from '../../AppContext';
5
5
  import { useRoomLayout } from '../../provider/roomLayoutProvider';
6
- // @ts-ignore: No implicit Any
7
6
  import FullPageProgress from '../FullPageProgress';
8
- // @ts-ignore: No implicit Any
9
7
  import PreviewJoin from './PreviewJoin';
10
8
  import { useRoomLayoutPreviewScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
11
9
  // @ts-ignore: No implicit Any
12
10
  import { useAuthToken } from '../AppData/useUISettings';
13
- // @ts-ignore: No implicit Any
14
11
  import { QUERY_PARAM_PREVIEW_AS_ROLE } from '../../common/constants';
15
12
 
16
13
  export const PreviewScreen = () => {
@@ -4,27 +4,13 @@ import { AlertTriangleIcon } from '@100mslive/react-icons';
4
4
  import { Button, Dialog, Flex, Text } from '../../../';
5
5
  import { ResolutionInput } from '../Streaming/ResolutionInput';
6
6
  import { ToastManager } from '../Toast/ToastManager';
7
- import { useSetAppDataByKey } from '../AppData/useUISettings';
8
- import { APP_DATA, RTMP_RECORD_DEFAULT_RESOLUTION } from '../../common/constants';
9
-
10
- export function getResolution(recordingResolution) {
11
- const resolution = {};
12
- if (recordingResolution.width) {
13
- resolution.width = recordingResolution.width;
14
- }
15
- if (recordingResolution.height) {
16
- resolution.height = recordingResolution.height;
17
- }
18
- if (Object.keys(resolution).length > 0) {
19
- return resolution;
20
- }
21
- }
7
+ import { useRecordingHandler } from '../../common/hooks';
8
+ import { RTMP_RECORD_DEFAULT_RESOLUTION } from '../../common/constants';
22
9
 
23
10
  const StartRecording = ({ open, onOpenChange }) => {
24
11
  const permissions = useHMSStore(selectPermissions);
25
12
  const [resolution, setResolution] = useState(RTMP_RECORD_DEFAULT_RESOLUTION);
26
-
27
- const [recordingStarted, setRecordingState] = useSetAppDataByKey(APP_DATA.recordingStarted);
13
+ const { startRecording, recordingStarted } = useRecordingHandler();
28
14
  const { isBrowserRecordingOn, isStreamingOn, isHLSRunning } = useRecordingStreaming();
29
15
  const hmsActions = useHMSActions();
30
16
  if (!permissions?.browserRecording || isHLSRunning) {
@@ -101,26 +87,7 @@ const StartRecording = ({ open, onOpenChange }) => {
101
87
  type="submit"
102
88
  disabled={recordingStarted || isStreamingOn}
103
89
  onClick={async () => {
104
- try {
105
- setRecordingState(true);
106
- await hmsActions.startRTMPOrRecording({
107
- resolution: getResolution(resolution),
108
- record: true,
109
- });
110
- } catch (error) {
111
- if (error.message.includes('stream already running')) {
112
- ToastManager.addToast({
113
- title: 'Recording already running',
114
- variant: 'error',
115
- });
116
- } else {
117
- ToastManager.addToast({
118
- title: error.message,
119
- variant: 'error',
120
- });
121
- }
122
- setRecordingState(false);
123
- }
90
+ await startRecording(resolution);
124
91
  onOpenChange(false);
125
92
  }}
126
93
  >
@@ -72,28 +72,6 @@ const HandRaiseAction = React.forwardRef(({ id = '', isSingleHandRaise = true },
72
72
  });
73
73
 
74
74
  export const ToastConfig = {
75
- PEER_LIST: {
76
- single: function (notification) {
77
- if (notification.data.length === 1) {
78
- return {
79
- title: `${notification.data[0]?.name} joined`,
80
- icon: <PeopleAddIcon />,
81
- };
82
- }
83
- return {
84
- title: `${notification.data[notification.data.length - 1]?.name} and ${
85
- notification.data.length - 1
86
- } others joined`,
87
- icon: <PeopleAddIcon />,
88
- };
89
- },
90
- multiple: notifications => {
91
- return {
92
- title: `${notifications[0].data.name} and ${notifications.length - 1} others joined`,
93
- icon: <PeopleAddIcon />,
94
- };
95
- },
96
- },
97
75
  PEER_JOINED: {
98
76
  single: function (notification) {
99
77
  return {
@@ -4,12 +4,12 @@ export class VBPlugin {
4
4
  private hmsPlugin?: HMSVBPlugin;
5
5
  private effectsPlugin?: HMSEffectsPlugin | undefined;
6
6
 
7
- initialisePlugin = (effectsSDKKey?: string) => {
7
+ initialisePlugin = (effectsSDKKey?: string, onInit?: () => void) => {
8
8
  if (this.getVBObject()) {
9
9
  return;
10
10
  }
11
11
  if (effectsSDKKey) {
12
- this.effectsPlugin = new HMSEffectsPlugin(effectsSDKKey);
12
+ this.effectsPlugin = new HMSEffectsPlugin(effectsSDKKey, onInit);
13
13
  } else {
14
14
  this.hmsPlugin = new HMSVBPlugin(HMSVirtualBackgroundTypes.NONE, HMSVirtualBackgroundTypes.NONE);
15
15
  }
@@ -70,7 +70,7 @@ export class VBPlugin {
70
70
  }
71
71
  };
72
72
 
73
- setPreset = async (preset: string) => {
73
+ setPreset = async (preset: 'quality' | 'balanced') => {
74
74
  if (this.effectsPlugin) {
75
75
  await this.effectsPlugin.setPreset(preset);
76
76
  }
@@ -28,7 +28,9 @@ const Root = ({
28
28
  '&:hover': { border: '4px solid $primary_dim' },
29
29
  ...(mediaURL ? { height: '$20', backgroundImage: `url(${mediaURL})`, backgroundSize: 'cover' } : {}),
30
30
  }}
31
- onClick={async () => await onClick?.()}
31
+ onClick={async () => {
32
+ await onClick?.();
33
+ }}
32
34
  >
33
35
  {children}
34
36
  </Flex>
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
+ import { useMedia } from 'react-use';
2
3
  import {
3
4
  selectAppData,
4
5
  selectEffectsKey,
@@ -19,14 +20,14 @@ import {
19
20
  useHMSStore,
20
21
  } from '@100mslive/react-sdk';
21
22
  import { BlurPersonHighIcon, CrossCircleIcon, CrossIcon } from '@100mslive/react-icons';
22
- import { Box, Flex, Slider, Video } from '../../../index';
23
+ import { Box, config as cssConfig, Flex, Loading, Slider, Video } from '../../../index';
23
24
  import { Text } from '../../../Text';
24
25
  import { VBCollection } from './VBCollection';
25
26
  import { VBHandler } from './VBHandler';
26
27
  // @ts-ignore
27
28
  import { useSidepaneToggle } from '../AppData/useSidepane';
28
29
  // @ts-ignore
29
- import { useUISettings } from '../AppData/useUISettings';
30
+ import { useSetAppDataByKey, useUISettings } from '../AppData/useUISettings';
30
31
  import { APP_DATA, SIDE_PANE_OPTIONS, UI_SETTINGS } from '../../common/constants';
31
32
  import { defaultMedia } from './constants';
32
33
 
@@ -46,6 +47,8 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
46
47
  const isLargeRoom = useHMSStore(selectIsLargeRoom);
47
48
  const isEffectsEnabled = useHMSStore(selectIsEffectsEnabled);
48
49
  const effectsKey = useHMSStore(selectEffectsKey);
50
+ const isMobile = useMedia(cssConfig.media.md);
51
+ const [loadingEffects, setLoadingEffects] = useSetAppDataByKey(APP_DATA.loadingEffects);
49
52
  const isPluginAdded = useHMSStore(selectIsLocalVideoPluginPresent(VBHandler?.getName() || ''));
50
53
  const background = useHMSStore(selectAppData(APP_DATA.background));
51
54
  const mediaList = backgroundMedia.length
@@ -61,13 +64,15 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
61
64
  return;
62
65
  }
63
66
  if (!isPluginAdded) {
67
+ setLoadingEffects(true);
64
68
  let vbObject = VBHandler.getVBObject();
65
69
  if (!vbObject) {
66
- VBHandler.initialisePlugin(isEffectsEnabled && effectsKey ? effectsKey : '');
70
+ VBHandler.initialisePlugin(isEffectsEnabled && effectsKey ? effectsKey : '', () => setLoadingEffects(false));
67
71
  vbObject = VBHandler.getVBObject();
68
72
  if (isEffectsEnabled && effectsKey) {
69
73
  hmsActions.addPluginsToVideoStream([vbObject as HMSEffectsPlugin]);
70
74
  } else {
75
+ setLoadingEffects(false);
71
76
  if (!role) {
72
77
  return;
73
78
  }
@@ -89,19 +94,30 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
89
94
  };
90
95
  handleDefaultBackground();
91
96
  }
92
- }, [hmsActions, role, isPluginAdded, isEffectsEnabled, effectsKey, track?.id, background, blurAmount]);
97
+ }, [
98
+ hmsActions,
99
+ role,
100
+ isPluginAdded,
101
+ isEffectsEnabled,
102
+ effectsKey,
103
+ track?.id,
104
+ background,
105
+ blurAmount,
106
+ setLoadingEffects,
107
+ ]);
93
108
 
94
109
  useEffect(() => {
95
110
  if (!isVideoOn) {
96
111
  toggleVB();
97
112
  }
98
- }, [isVideoOn, toggleVB]);
113
+ return () => setLoadingEffects(false);
114
+ }, [isVideoOn, setLoadingEffects, toggleVB]);
99
115
 
100
116
  return (
101
117
  <Flex css={{ pr: '$6', size: '100%' }} direction="column">
102
118
  <Flex align="center" justify="between" css={{ w: '100%', background: '$surface_dim', pb: '$4' }}>
103
- <Text variant="h6" css={{ color: '$on_surface_high' }}>
104
- Virtual Background
119
+ <Text variant="h6" css={{ color: '$on_surface_high', display: 'flex', alignItems: 'center' }}>
120
+ Virtual Background {isMobile && loadingEffects ? <Loading size={18} style={{ marginLeft: '0.5rem' }} /> : ''}
105
121
  </Text>
106
122
  <Box
107
123
  css={{ color: '$on_surface_high', '&:hover': { color: '$on_surface_medium' }, cursor: 'pointer' }}
@@ -1,17 +1,19 @@
1
1
  import React from 'react';
2
- import { selectIsEffectsEnabled, selectIsLocalVideoEnabled, useHMSStore } from '@100mslive/react-sdk';
2
+ import { selectAppData, selectIsEffectsEnabled, selectIsLocalVideoEnabled, useHMSStore } from '@100mslive/react-sdk';
3
3
  import { VirtualBackgroundIcon } from '@100mslive/react-icons';
4
+ import { Loading } from '../../../Loading';
4
5
  import { Tooltip } from '../../../Tooltip';
5
6
  import IconButton from '../../IconButton';
6
7
  // @ts-ignore
7
8
  import { useIsSidepaneTypeOpen, useSidepaneToggle } from '../AppData/useSidepane';
8
- import { isSafari, SIDE_PANE_OPTIONS } from '../../common/constants';
9
+ import { APP_DATA, isSafari, SIDE_PANE_OPTIONS } from '../../common/constants';
9
10
 
10
11
  export const VBToggle = () => {
11
12
  const toggleVB = useSidepaneToggle(SIDE_PANE_OPTIONS.VB);
12
13
  const isVBOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.VB);
13
14
  const isVideoOn = useHMSStore(selectIsLocalVideoEnabled);
14
15
  const isEffectsEnabled = useHMSStore(selectIsEffectsEnabled);
16
+ const loadingEffects = useHMSStore(selectAppData(APP_DATA.loadingEffects));
15
17
 
16
18
  if (!isVideoOn || (!isEffectsEnabled && isSafari)) {
17
19
  return null;
@@ -20,7 +22,7 @@ export const VBToggle = () => {
20
22
  return (
21
23
  <Tooltip side="top" disabled={isVBOpen} title="Configure Virtual Background">
22
24
  <IconButton active={!isVBOpen} onClick={toggleVB} data-testid="virtual_bg_btn">
23
- <VirtualBackgroundIcon />
25
+ {loadingEffects ? <Loading size={18} /> : <VirtualBackgroundIcon />}
24
26
  </IconButton>
25
27
  </Tooltip>
26
28
  );
@@ -6,7 +6,6 @@ import {
6
6
  } from '@100mslive/types-prebuilt';
7
7
  import { match } from 'ts-pattern';
8
8
  import { selectIsConnectedToRoom, selectLocalPeerRoleName, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
9
- // @ts-ignore: No implicit Any
10
9
  import FullPageProgress from '../components/FullPageProgress';
11
10
  import { GridLayout } from '../components/VideoLayouts/GridLayout';
12
11
  import { Box, Flex } from '../../Layout';
@@ -25,7 +24,6 @@ import {
25
24
  } from '../components/AppData/useUISettings';
26
25
  import { useCloseScreenshareWhiteboard } from '../components/hooks/useCloseScreenshareWhiteboard';
27
26
  import { useLandscapeHLSStream, useMobileHLSStream } from '../common/hooks';
28
- // @ts-ignore: No implicit Any
29
27
  import { SESSION_STORE_KEY } from '../common/constants';
30
28
 
31
29
  // @ts-ignore: No implicit Any