@100mslive/roomkit-react 0.3.4 → 0.3.5-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/dist/{HLSView-6NEUUQBX.js → HLSView-GF23J3TJ.js} +5 -3
  2. package/dist/{HLSView-6NEUUQBX.js.map → HLSView-GF23J3TJ.js.map} +2 -2
  3. package/dist/Prebuilt/components/RaiseHand.d.ts +1 -1
  4. package/dist/Prebuilt/components/hooks/useMetadata.d.ts +8 -0
  5. package/dist/{chunk-JF6QG5V5.js → chunk-7O27GQEH.js} +479 -453
  6. package/dist/chunk-7O27GQEH.js.map +7 -0
  7. package/dist/fixtures/peers.d.ts +1 -1
  8. package/dist/index.cjs.js +917 -894
  9. package/dist/index.cjs.js.map +4 -4
  10. package/dist/index.js +1 -1
  11. package/dist/meta.cjs.json +93 -68
  12. package/dist/meta.esbuild.json +101 -76
  13. package/package.json +7 -7
  14. package/src/Avatar/Avatar.tsx +3 -3
  15. package/src/Avatar/getAvatarBg.ts +11 -7
  16. package/src/Prebuilt/App.tsx +5 -6
  17. package/src/Prebuilt/AppStateContext.tsx +27 -14
  18. package/src/Prebuilt/components/AuthToken.jsx +27 -26
  19. package/src/Prebuilt/components/Chat/ChatFooter.tsx +2 -4
  20. package/src/Prebuilt/components/ConferenceScreen.tsx +1 -4
  21. package/src/Prebuilt/components/Connection/TileConnection.tsx +14 -2
  22. package/src/Prebuilt/components/Footer/Footer.tsx +1 -4
  23. package/src/Prebuilt/components/Footer/ParticipantList.tsx +15 -1
  24. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +1 -2
  25. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +1 -5
  26. package/src/Prebuilt/components/PreviousRoleInMetadata.tsx +0 -1
  27. package/src/Prebuilt/components/RaiseHand.tsx +7 -1
  28. package/src/Prebuilt/components/RoleChangeRequest/RoleChangeRequestModal.tsx +0 -1
  29. package/src/Prebuilt/components/hooks/{useMetadata.jsx → useMetadata.tsx} +2 -8
  30. package/src/Prebuilt/layouts/HLSView.jsx +4 -1
  31. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +22 -15
  32. package/src/Stats/Stats.tsx +12 -2
  33. package/src/fixtures/peers.ts +2 -1
  34. package/dist/chunk-JF6QG5V5.js.map +0 -7
@@ -1,6 +1,7 @@
1
1
  import React, { MutableRefObject, useEffect, useRef } from 'react';
2
2
  import { HMSStatsStoreWrapper, HMSStoreWrapper, IHMSNotifications } from '@100mslive/hms-video-store';
3
3
  import { Layout, Logo, Screens, Theme, Typography } from '@100mslive/types-prebuilt';
4
+ import { match } from 'ts-pattern';
4
5
  import {
5
6
  HMSActions,
6
7
  HMSReactiveStore,
@@ -251,12 +252,10 @@ const AppStates = ({ activeState }: { activeState: PrebuiltStates }) => {
251
252
  const { isLeaveScreenEnabled } = useRoomLayoutLeaveScreen();
252
253
  useAutoStartStreaming();
253
254
 
254
- if (activeState === PrebuiltStates.PREVIEW && isPreviewScreenEnabled) {
255
- return <PreviewScreen />;
256
- } else if (activeState === PrebuiltStates.LEAVE && isLeaveScreenEnabled) {
257
- return <LeaveScreen />;
258
- }
259
- return <ConferenceScreen />;
255
+ return match({ activeState, isPreviewScreenEnabled, isLeaveScreenEnabled })
256
+ .with({ activeState: PrebuiltStates.PREVIEW, isPreviewScreenEnabled: true }, () => <PreviewScreen />)
257
+ .with({ activeState: PrebuiltStates.LEAVE, isLeaveScreenEnabled: true }, () => <LeaveScreen />)
258
+ .otherwise(() => <ConferenceScreen />);
260
259
  };
261
260
 
262
261
  const BackSwipe = () => {
@@ -1,5 +1,6 @@
1
1
  import React, { useContext, useEffect } from 'react';
2
2
  import { usePreviousDistinct } from 'react-use';
3
+ import { match, P } from 'ts-pattern';
3
4
  import { HMSRoomState, selectRoomState, useHMSStore } from '@100mslive/react-sdk';
4
5
  import { VBHandler } from './components/VirtualBackground/VBHandler';
5
6
  import { useRoomLayout } from './provider/roomLayoutProvider';
@@ -52,20 +53,32 @@ export const useAppStateManager = () => {
52
53
  if (!roomLayout) {
53
54
  return;
54
55
  }
55
- if (roomState === HMSRoomState.Connected) {
56
- setActiveState(PrebuiltStates.MEETING);
57
- } else if (
58
- prevRoomState &&
59
- [HMSRoomState.Reconnecting, HMSRoomState.Connected, HMSRoomState.Connecting].includes(prevRoomState) &&
60
- [HMSRoomState.Disconnecting, HMSRoomState.Disconnected].includes(roomState)
61
- ) {
62
- const goTo = isPreviewScreenEnabled ? PrebuiltStates.PREVIEW : PrebuiltStates.MEETING;
63
- setActiveState(isLeaveScreenEnabled ? PrebuiltStates.LEAVE : goTo);
64
- VBHandler.reset();
65
- redirectToLeave(1000); // to clear toasts after 1 second
66
- } else if (!prevRoomState && roomState === HMSRoomState.Disconnected) {
67
- setActiveState(isPreviewScreenEnabled ? PrebuiltStates.PREVIEW : PrebuiltStates.MEETING);
68
- }
56
+ match([roomState, prevRoomState])
57
+ .with([HMSRoomState.Connected, P.any], () => setActiveState(PrebuiltStates.MEETING))
58
+ .with(
59
+ [HMSRoomState.Disconnecting, HMSRoomState.Connected],
60
+ [HMSRoomState.Disconnecting, HMSRoomState.Connecting],
61
+ [HMSRoomState.Disconnecting, HMSRoomState.Reconnecting],
62
+ [HMSRoomState.Disconnected, HMSRoomState.Connected],
63
+ [HMSRoomState.Disconnected, HMSRoomState.Connecting],
64
+ [HMSRoomState.Disconnected, HMSRoomState.Reconnecting],
65
+ () => {
66
+ setActiveState(
67
+ match({ isLeaveScreenEnabled, isPreviewScreenEnabled })
68
+ .with({ isLeaveScreenEnabled: true }, () => PrebuiltStates.LEAVE)
69
+ .with({ isPreviewScreenEnabled: true }, () => PrebuiltStates.PREVIEW)
70
+ .otherwise(() => PrebuiltStates.MEETING),
71
+ );
72
+ VBHandler.reset();
73
+ redirectToLeave(1000); // to clear toasts after 1 second
74
+ },
75
+ )
76
+ .with([HMSRoomState.Disconnected, P.nullish], () => {
77
+ setActiveState(isPreviewScreenEnabled ? PrebuiltStates.PREVIEW : PrebuiltStates.MEETING);
78
+ })
79
+ .otherwise(() => {
80
+ // do nothing
81
+ });
69
82
  }, [roomLayout, roomState, isLeaveScreenEnabled, isPreviewScreenEnabled, prevRoomState, redirectToLeave]);
70
83
 
71
84
  return { activeState, rejoin };
@@ -1,5 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { useSessionStorage } from 'react-use';
3
+ import { match } from 'ts-pattern';
3
4
  import { v4 as uuid } from 'uuid';
4
5
  import { useHMSActions } from '@100mslive/react-sdk';
5
6
  import { Dialog } from '../../Modal';
@@ -88,38 +89,38 @@ const convertError = error => {
88
89
  'If you think this is a mistake on our side, please reach out to us over Discord:',
89
90
  'https://discord.com/invite/kGdmszyzq2',
90
91
  );
91
- if (error.action === 'GET_TOKEN' && error.code === 403) {
92
- return {
92
+ return match([error.action, error.code])
93
+ .with(['GET_TOKEN', 403], () => ({
93
94
  title: 'Psst! This room is currently inactive.',
94
95
  body: 'Please feel free to join another open room for more conversations. Thanks for stopping by!',
95
- };
96
- } else if (error.action === 'GET_TOKEN' && error.code === 404) {
97
- return {
96
+ }))
97
+
98
+ .with(['GET_TOKEN', 404], () => ({
98
99
  title: 'Room code does not exist',
99
100
  body: 'We could not find a room code corresponding to this link.',
100
- };
101
- } else if (error.action === 'GET_TOKEN' && error.code === 2003) {
102
- return {
101
+ }))
102
+ .with(['GET_TOKEN', 2003], () => ({
103
103
  title: 'Endpoint is not reachable',
104
104
  body: `Endpoint is not reachable. ${error.description}.`,
105
- };
106
- } else if (error.response && error.response.status === 404) {
107
- return {
108
- title: 'Room does not exist',
109
- body: 'We could not find a room corresponding to this link.',
110
- };
111
- } else if (error.response && error.response.status === 403) {
112
- return {
113
- title: 'Accessing room using this link format is disabled',
114
- body: 'You can re-enable this from the developer section in Dashboard.',
115
- };
116
- } else {
117
- console.error('Token API Error', error);
118
- return {
119
- title: 'Error fetching token',
120
- body: 'An error occurred while fetching the app token. Please look into logs for more details.',
121
- };
122
- }
105
+ }))
106
+ .otherwise(() =>
107
+ match(error.response?.status)
108
+ .with(404, () => ({
109
+ title: 'Room does not exist',
110
+ body: 'We could not find a room corresponding to this link.',
111
+ }))
112
+ .with(403, () => ({
113
+ title: 'Accessing room using this link format is disabled',
114
+ body: 'You can re-enable this from the developer section in Dashboard.',
115
+ }))
116
+ .otherwise(() => {
117
+ console.error('Token API Error', error);
118
+ return {
119
+ title: 'Error fetching token',
120
+ body: 'An error occurred while fetching the app token. Please look into logs for more details.',
121
+ };
122
+ }),
123
+ );
123
124
  };
124
125
 
125
126
  export default AuthToken;
@@ -2,7 +2,7 @@ import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'reac
2
2
  import { useMedia } from 'react-use';
3
3
  import data from '@emoji-mart/data';
4
4
  import Picker from '@emoji-mart/react';
5
- import { HMSException, selectLocalPeer, useAVToggle, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
5
+ import { HMSException, selectLocalPeer, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
6
6
  import { EmojiIcon, PauseCircleIcon, SendIcon, VerticalMenuIcon } from '@100mslive/react-icons';
7
7
  import { Box, config as cssConfig, Flex, IconButton as BaseIconButton, Popover, styled, Text } from '../../..';
8
8
  import { IconButton } from '../../../IconButton';
@@ -89,8 +89,6 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
89
89
  const defaultSelection = useDefaultChatSelection();
90
90
  const selection = selectedPeer.name || selectedRole || defaultSelection;
91
91
  const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true });
92
- const { toggleAudio, toggleVideo } = useAVToggle();
93
- const noAVPermissions = !(toggleAudio || toggleVideo);
94
92
  const isMwebHLSStream = useMobileHLSStream();
95
93
  const isLandscapeHLSStream = useLandscapeHLSStream();
96
94
 
@@ -275,7 +273,7 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
275
273
  }}
276
274
  gap="2"
277
275
  >
278
- {noAVPermissions ? <RaiseHand css={{ bg: '$surface_default' }} /> : null}
276
+ <RaiseHand css={{ bg: '$surface_default' }} />
279
277
  <MoreSettings elements={elements} screenType={screenType} />
280
278
  </Flex>
281
279
  </>
@@ -6,7 +6,6 @@ import {
6
6
  selectAppData,
7
7
  selectIsConnectedToRoom,
8
8
  selectRoomState,
9
- useAVToggle,
10
9
  useHMSActions,
11
10
  useHMSStore,
12
11
  } from '@100mslive/react-sdk';
@@ -54,8 +53,6 @@ export const ConferenceScreen = () => {
54
53
  const dropdownListRef = useRef<string[]>();
55
54
  const [isHLSStarted] = useSetAppDataByKey(APP_DATA.hlsStarted);
56
55
 
57
- const { toggleAudio, toggleVideo } = useAVToggle();
58
- const noAVPermissions = !(toggleAudio || toggleVideo);
59
56
  // using it in hls stream to show action button when chat is disabled
60
57
  const showChat = !!screenProps.elements?.chat;
61
58
  const autoRoomJoined = useRef(isPreviewScreenEnabled);
@@ -202,7 +199,7 @@ export const ConferenceScreen = () => {
202
199
  justify="end"
203
200
  gap="2"
204
201
  >
205
- {noAVPermissions ? <RaiseHand /> : null}
202
+ <RaiseHand />
206
203
  <MoreSettings elements={screenProps.elements} screenType={screenProps.screenType} />
207
204
  <Box
208
205
  css={{
@@ -1,6 +1,12 @@
1
1
  import React from 'react';
2
- import { selectScreenShareByPeerID, selectSessionStore, useHMSStore } from '@100mslive/react-sdk';
3
- import { PinIcon, ShareScreenIcon, SpotlightIcon } from '@100mslive/react-icons';
2
+ import {
3
+ HMSPeerType,
4
+ selectPeerTypeByID,
5
+ selectScreenShareByPeerID,
6
+ selectSessionStore,
7
+ useHMSStore,
8
+ } from '@100mslive/react-sdk';
9
+ import { CallIcon, PinIcon, ShareScreenIcon, SpotlightIcon } from '@100mslive/react-icons';
4
10
  import { Flex, styled, Text, textEllipsis } from '../../..';
5
11
  import { ConnectionIndicator } from './ConnectionIndicator';
6
12
  import { SESSION_STORE_KEY } from '../../common/constants';
@@ -20,12 +26,18 @@ const TileConnection = ({
20
26
  }) => {
21
27
  const spotlighted = useHMSStore(selectSessionStore(SESSION_STORE_KEY.SPOTLIGHT)) === peerId;
22
28
  const isPeerScreenSharing = !!useHMSStore(selectScreenShareByPeerID(peerId));
29
+ const peerType = useHMSStore(selectPeerTypeByID(peerId));
23
30
  return (
24
31
  <Wrapper>
25
32
  {!hideLabel ? (
26
33
  <>
27
34
  {name ? (
28
35
  <Flex align="center">
36
+ {peerType === HMSPeerType.SIP && (
37
+ <IconWrapper>
38
+ <CallIcon width="15" height="15" />
39
+ </IconWrapper>
40
+ )}
29
41
  {isPeerScreenSharing && (
30
42
  <IconWrapper>
31
43
  <ShareScreenIcon width="15" height="15" />
@@ -2,7 +2,6 @@ import React, { useEffect } from 'react';
2
2
  import { useMedia } from 'react-use';
3
3
  import { ConferencingScreen } from '@100mslive/types-prebuilt';
4
4
  import { Chat_ChatState } from '@100mslive/types-prebuilt/elements/chat';
5
- import { useAVToggle } from '@100mslive/react-sdk';
6
5
  import { config as cssConfig, Footer as AppFooter } from '../../..';
7
6
  // @ts-ignore: No implicit Any
8
7
  import { AudioVideoToggle } from '../AudioVideoToggle';
@@ -41,8 +40,6 @@ export const Footer = ({
41
40
  const isOverlayChat = !!elements?.chat?.is_overlay;
42
41
  const openByDefault = elements?.chat?.initial_state === Chat_ChatState.CHAT_STATE_OPEN;
43
42
 
44
- const { toggleAudio, toggleVideo } = useAVToggle();
45
- const noAVPermissions = !(toggleAudio || toggleVideo);
46
43
  const isChatOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.CHAT);
47
44
  const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
48
45
  const { showPolls } = useShowPolls();
@@ -90,7 +87,7 @@ export const Footer = ({
90
87
  >
91
88
  {isMobile ? (
92
89
  <>
93
- {noAVPermissions ? <RaiseHand /> : null}
90
+ <RaiseHand />
94
91
  {elements?.chat && <ChatToggle />}
95
92
  <MoreSettings elements={elements} screenType={screenType} />
96
93
  </>
@@ -2,6 +2,7 @@ import React, { Fragment, useCallback, useState } from 'react';
2
2
  import { useDebounce, useMedia } from 'react-use';
3
3
  import {
4
4
  HMSPeer,
5
+ HMSPeerType,
5
6
  HMSRoleName,
6
7
  selectHandRaisedPeers,
7
8
  selectHasPeerHandRaised,
@@ -14,6 +15,7 @@ import {
14
15
  } from '@100mslive/react-sdk';
15
16
  import {
16
17
  AddIcon,
18
+ CallIcon,
17
19
  ChangeRoleIcon,
18
20
  CrossIcon,
19
21
  HandIcon,
@@ -184,6 +186,7 @@ export const Participant = ({
184
186
  {isConnected && peer.roleName ? (
185
187
  <ParticipantActions
186
188
  peerId={peer.id}
189
+ peerType={peer.type}
187
190
  isLocal={peer.id === localPeerId}
188
191
  role={peer.roleName}
189
192
  isHandRaisedAccordion={isHandRaisedAccordion}
@@ -261,6 +264,7 @@ const VirtualizedParticipants = ({
261
264
  const ParticipantActions = React.memo(
262
265
  ({
263
266
  peerId,
267
+ peerType,
264
268
  role,
265
269
  isLocal,
266
270
  isHandRaisedAccordion,
@@ -269,6 +273,7 @@ const ParticipantActions = React.memo(
269
273
  role: string;
270
274
  isLocal: boolean;
271
275
  isHandRaisedAccordion?: boolean;
276
+ peerType: HMSPeerType;
272
277
  }) => {
273
278
  const isHandRaised = useHMSStore(selectHasPeerHandRaised(peerId));
274
279
  const canChangeRole = useHMSStore(selectPermissions)?.changeRole;
@@ -290,7 +295,16 @@ const ParticipantActions = React.memo(
290
295
  <HandRaisedAccordionParticipantActions peerId={peerId} role={role} />
291
296
  ) : (
292
297
  <>
293
- <ConnectionIndicator peerId={peerId} />
298
+ {peerType === HMSPeerType.REGULAR && <ConnectionIndicator peerId={peerId} />}
299
+ {peerType === HMSPeerType.SIP && (
300
+ <Flex
301
+ align="center"
302
+ justify="center"
303
+ css={{ p: '$1', c: '$on_surface_high', bg: '$surface_bright', borderRadius: '$round' }}
304
+ >
305
+ <CallIcon width={19} height={19} />
306
+ </Flex>
307
+ )}
294
308
  {isHandRaised && (
295
309
  <Flex
296
310
  align="center"
@@ -29,7 +29,6 @@ import { FullScreenItem } from '../FullScreenItem';
29
29
  import { MuteAllModal } from '../MuteAllModal';
30
30
  // @ts-ignore: No implicit any
31
31
  import { useDropdownList } from '../../hooks/useDropdownList';
32
- // @ts-ignore: No implicit any
33
32
  import { useMyMetadata } from '../../hooks/useMetadata';
34
33
  // @ts-ignore: No implicit any
35
34
  import { APP_DATA, isMacOS } from '../../../common/constants';
@@ -117,7 +116,7 @@ export const DesktopOptions = ({
117
116
  ) : null}
118
117
 
119
118
  {screenType !== 'hls_live_streaming' ? (
120
- <Dropdown.Item>
119
+ <Dropdown.Item css={{ '&:empty': { display: 'none' } }}>
121
120
  <PIP
122
121
  content={
123
122
  <Flex css={{ w: '100%' }}>
@@ -6,7 +6,6 @@ import {
6
6
  selectIsConnectedToRoom,
7
7
  selectPeerCount,
8
8
  selectPermissions,
9
- useAVToggle,
10
9
  useHMSActions,
11
10
  useHMSStore,
12
11
  useRecordingStreaming,
@@ -51,7 +50,6 @@ import { usePollViewToggle, useSidepaneToggle } from '../../AppData/useSidepane'
51
50
  import { useShowPolls } from '../../AppData/useUISettings';
52
51
  // @ts-ignore: No implicit any
53
52
  import { useDropdownList } from '../../hooks/useDropdownList';
54
- // @ts-ignore: No implicit any
55
53
  import { useMyMetadata } from '../../hooks/useMetadata';
56
54
  import { useUnreadPollQuizPresent } from '../../hooks/useUnreadPollQuizPresent';
57
55
  import { useLandscapeHLSStream, useMobileHLSStream } from '../../../common/hooks';
@@ -95,8 +93,6 @@ export const MwebOptions = ({
95
93
  const peerCount = useHMSStore(selectPeerCount);
96
94
  const emojiCardRef = useRef(null);
97
95
  const { isBRBOn, toggleBRB, isHandRaised, toggleHandRaise } = useMyMetadata();
98
- const { toggleAudio, toggleVideo } = useAVToggle();
99
- const noAVPermissions = !(toggleAudio || toggleVideo);
100
96
  const { unreadPollQuiz, setUnreadPollQuiz } = useUnreadPollQuizPresent();
101
97
  const { title, description } = useRoomLayoutHeader();
102
98
  const toggleDetailsSheet = useSheetToggle(SHEET_OPTIONS.ROOM_DETAILS);
@@ -175,7 +171,7 @@ export const MwebOptions = ({
175
171
  </ActionTile.Root>
176
172
  )}
177
173
 
178
- {!noAVPermissions ? (
174
+ {elements.hand_raise ? (
179
175
  <ActionTile.Root
180
176
  active={isHandRaised}
181
177
  onClick={() => {
@@ -1,6 +1,5 @@
1
1
  import { useEffect } from 'react';
2
2
  import { selectLocalPeerRoleName, useHMSVanillaStore } from '@100mslive/react-sdk';
3
- // @ts-ignore: No implicit Any
4
3
  import { useMyMetadata } from './hooks/useMetadata';
5
4
 
6
5
  export const PreviousRoleInMetadata = () => {
@@ -4,11 +4,17 @@ import { CSS } from '../../Theme';
4
4
  import { Tooltip } from '../../Tooltip';
5
5
  // @ts-ignore: No implicit Any
6
6
  import IconButton from '../IconButton';
7
- // @ts-ignore: No implicit Any
7
+ import { useRoomLayoutConferencingScreen } from '../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
8
8
  import { useMyMetadata } from './hooks/useMetadata';
9
9
 
10
10
  export const RaiseHand = ({ css }: { css?: CSS }) => {
11
11
  const { isHandRaised, toggleHandRaise } = useMyMetadata();
12
+ const { elements } = useRoomLayoutConferencingScreen();
13
+
14
+ if (!elements.hand_raise) {
15
+ return null;
16
+ }
17
+
12
18
  return (
13
19
  <Tooltip title={isHandRaised ? 'Lower hand' : 'Raise hand'}>
14
20
  <IconButton
@@ -13,7 +13,6 @@ import { Flex, Text } from '../../..';
13
13
  import { PreviewControls, PreviewTile } from '../Preview/PreviewJoin';
14
14
  import { RequestPrompt } from './RequestPrompt';
15
15
  import { useRoomLayoutPreviewScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
16
- // @ts-ignore: No implicit Any
17
16
  import { useMyMetadata } from '../hooks/useMetadata';
18
17
  // @ts-ignore: No implicit Any
19
18
  import { ROLE_CHANGE_DECLINED } from '../../common/constants';
@@ -15,7 +15,7 @@ export const useMyMetadata = () => {
15
15
  const metaData = useHMSStore(selectPeerMetadata(localPeerId));
16
16
  const isHandRaised = useHMSStore(selectHasPeerHandRaised(localPeerId));
17
17
 
18
- const update = async updatedFields => {
18
+ const update = async (updatedFields: Record<string, any>) => {
19
19
  try {
20
20
  // get current state from store and merge updated fields
21
21
  const currentMetadata = vanillaStore.getState(selectPeerMetadata(localPeerId));
@@ -24,6 +24,7 @@ export const useMyMetadata = () => {
24
24
  } catch (error) {
25
25
  console.error('failed to update metadata ', updatedFields);
26
26
  }
27
+ return false;
27
28
  };
28
29
 
29
30
  const toggleHandRaise = useCallback(async () => {
@@ -43,12 +44,6 @@ export const useMyMetadata = () => {
43
44
  }
44
45
  }, [metaData?.isBRBOn]); //eslint-disable-line
45
46
 
46
- const setPrevRole = async role => {
47
- await update({
48
- prevRole: role,
49
- });
50
- };
51
-
52
47
  return {
53
48
  isHandRaised,
54
49
  isBRBOn: !!metaData?.isBRBOn,
@@ -56,6 +51,5 @@ export const useMyMetadata = () => {
56
51
  updateMetaData: update,
57
52
  toggleHandRaise,
58
53
  toggleBRB,
59
- setPrevRole,
60
54
  };
61
55
  };
@@ -602,7 +602,10 @@ const HLSView = () => {
602
602
  if (isFullScreen) {
603
603
  toggle();
604
604
  }
605
- toggleChat();
605
+ // toggle and closing fullscreen takes few ms, to make it synced we are calling settimeout
606
+ setTimeout(() => {
607
+ toggleChat();
608
+ }, 0);
606
609
  }}
607
610
  />
608
611
  )}
@@ -70,20 +70,6 @@ export const VideoStreamingSection = ({
70
70
  return null;
71
71
  }
72
72
 
73
- let ViewComponent;
74
- if (screenType === 'hls_live_streaming') {
75
- ViewComponent = <HLSView />;
76
- } else if (localPeerRole === waitingViewerRole) {
77
- ViewComponent = <WaitingView />;
78
- } else if (pdfAnnotatorActive) {
79
- ViewComponent = <PDFView />;
80
- } else if (urlToIframe) {
81
- ViewComponent = <EmbedView />;
82
- } else {
83
- //@ts-ignore
84
- ViewComponent = <GridLayout {...(elements as DefaultConferencingScreen_Elements)?.video_tile_layout?.grid} />;
85
- }
86
-
87
73
  return (
88
74
  <Suspense fallback={<FullPageProgress />}>
89
75
  <Flex
@@ -97,7 +83,28 @@ export const VideoStreamingSection = ({
97
83
  .with({ isMobileHLSStream: true }, () => 'column')
98
84
  .otherwise(() => 'row')}
99
85
  >
100
- {ViewComponent}
86
+ {match({ screenType, localPeerRole, pdfAnnotatorActive, urlToIframe })
87
+ .with(
88
+ {
89
+ screenType: 'hls_live_streaming',
90
+ },
91
+ () => <HLSView />,
92
+ )
93
+ .when(
94
+ ({ localPeerRole }) => localPeerRole === waitingViewerRole,
95
+ () => <WaitingView />,
96
+ )
97
+ .with({ pdfAnnotatorActive: true }, () => <PDFView />)
98
+ .when(
99
+ ({ urlToIframe }) => !!urlToIframe,
100
+ () => <EmbedView />,
101
+ )
102
+
103
+ .otherwise(() => {
104
+ // @ts-ignore
105
+ return <GridLayout {...(elements as DefaultConferencingScreen_Elements)?.video_tile_layout?.grid} />;
106
+ })}
107
+
101
108
  <Box
102
109
  css={{
103
110
  flex: match({ isLandscapeHLSStream, isMobileHLSStream })
@@ -56,7 +56,7 @@ export function VideoTileStats({ videoTrackID, audioTrackID, peerID, isLocal = f
56
56
  }
57
57
  const layer = stat.rid ? simulcastMapping[stat.rid as RID] : '';
58
58
  return (
59
- <Fragment>
59
+ <Fragment key={`${stat.id}${stat.rid}`}>
60
60
  {layer && <StatsRow label={layer.toUpperCase()} value="" />}
61
61
  <StatsRow
62
62
  show={isNotNullishAndNot0(stat.frameWidth)}
@@ -106,6 +106,16 @@ export function VideoTileStats({ videoTrackID, audioTrackID, peerID, isLocal = f
106
106
  : ''
107
107
  }`}
108
108
  />
109
+ <StatsRow
110
+ show={isNotNullish(videoTrackStats?.totalPausesDuration)}
111
+ label="Pauses Duration"
112
+ value={videoTrackStats?.totalPausesDuration}
113
+ />
114
+ <StatsRow
115
+ show={isNotNullish(videoTrackStats?.totalFreezesDuration)}
116
+ label="Freezes Duration"
117
+ value={videoTrackStats?.totalFreezesDuration}
118
+ />
109
119
  <StatsRow
110
120
  show={isNotNullish(videoTrackStats?.bitrate)}
111
121
  label="Bitrate(V)"
@@ -185,7 +195,7 @@ const RawStatsRow = ({
185
195
  show?: boolean;
186
196
  tooltip?: string;
187
197
  }) => {
188
- const statsLabel = <Stats.Label css={{ fontWeight: !value ? '$semiBold' : '$regular' }}>{label}</Stats.Label>;
198
+ const statsLabel = <Stats.Label>{label}</Stats.Label>;
189
199
 
190
200
  return (
191
201
  <>
@@ -1,4 +1,4 @@
1
- import { HMSPeerWithMuteStatus } from '@100mslive/hms-video-store';
1
+ import { HMSPeerType, HMSPeerWithMuteStatus } from '@100mslive/react-sdk';
2
2
 
3
3
  let counter = 1;
4
4
  export const makeFakeParticipant = (name: string, role = 'Student'): HMSPeerWithMuteStatus => {
@@ -11,6 +11,7 @@ export const makeFakeParticipant = (name: string, role = 'Student'): HMSPeerWith
11
11
  isLocal: counter === 1,
12
12
  groups: [],
13
13
  isHandRaised: false,
14
+ type: HMSPeerType.REGULAR,
14
15
  },
15
16
  isAudioEnabled: false,
16
17
  };