@100mslive/roomkit-react 0.1.9 → 0.1.11-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/dist/{HLSView-VGJ2XUDT.js → HLSView-TEG6Y6WL.js} +14 -10
  2. package/dist/HLSView-TEG6Y6WL.js.map +7 -0
  3. package/dist/Modal/Dialog.d.ts +878 -9
  4. package/dist/Modal/DialogContent.d.ts +2 -2
  5. package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +4 -4
  6. package/dist/Prebuilt/components/Leave/EndSessionContent.d.ts +3 -3
  7. package/dist/Prebuilt/components/Leave/LeaveSessionContent.d.ts +3 -3
  8. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +4 -4
  9. package/dist/Prebuilt/components/VirtualBackground/VBCollection.d.ts +13 -0
  10. package/dist/Prebuilt/components/VirtualBackground/VBOption.d.ts +15 -0
  11. package/dist/Prebuilt/components/VirtualBackground/constants.d.ts +9 -0
  12. package/dist/Prebuilt/layouts/SidePane.d.ts +2 -2
  13. package/dist/{chunk-EDGWHFCM.js → chunk-VSALCLHF.js} +6091 -4897
  14. package/dist/chunk-VSALCLHF.js.map +7 -0
  15. package/dist/index.cjs.js +5217 -5060
  16. package/dist/index.cjs.js.map +4 -4
  17. package/dist/index.js +11 -13
  18. package/dist/meta.cjs.json +1567 -1385
  19. package/dist/meta.esbuild.json +1657 -1551
  20. package/package.json +6 -6
  21. package/src/Modal/Dialog.tsx +3 -11
  22. package/src/Modal/DialogContent.tsx +4 -4
  23. package/src/Prebuilt/common/constants.js +3 -0
  24. package/src/Prebuilt/components/AppData/AppData.jsx +4 -11
  25. package/src/Prebuilt/components/AppData/useSidepane.js +1 -1
  26. package/src/Prebuilt/components/Connection/ConnectionIndicator.tsx +2 -2
  27. package/src/Prebuilt/components/Footer/Footer.tsx +4 -8
  28. package/src/Prebuilt/components/Footer/ParticipantList.jsx +1 -6
  29. package/src/Prebuilt/components/Header/Header.tsx +2 -2
  30. package/src/Prebuilt/components/Header/common.jsx +46 -23
  31. package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +5 -5
  32. package/src/Prebuilt/components/Leave/EndSessionContent.tsx +2 -2
  33. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +6 -5
  34. package/src/Prebuilt/components/Leave/LeaveSessionContent.tsx +2 -2
  35. package/src/Prebuilt/components/Leave/MwebLeaveRoom.tsx +3 -3
  36. package/src/Prebuilt/components/Notifications/HLSFailureModal.tsx +1 -4
  37. package/src/Prebuilt/components/Preview/PreviewForm.tsx +8 -2
  38. package/src/Prebuilt/components/Preview/PreviewJoin.tsx +62 -57
  39. package/src/Prebuilt/components/RoleChangeRequest/RequestPrompt.tsx +2 -3
  40. package/src/Prebuilt/components/Settings/DeviceSettings.jsx +11 -0
  41. package/src/Prebuilt/components/VirtualBackground/VBCollection.tsx +50 -0
  42. package/src/Prebuilt/components/VirtualBackground/VBOption.tsx +50 -0
  43. package/src/Prebuilt/components/VirtualBackground/VBPicker.jsx +165 -0
  44. package/src/Prebuilt/components/VirtualBackground/VBToggle.jsx +25 -0
  45. package/src/Prebuilt/components/VirtualBackground/constants.ts +26 -0
  46. package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +11 -7
  47. package/src/Prebuilt/layouts/HLSView.jsx +7 -1
  48. package/src/Prebuilt/layouts/SidePane.tsx +21 -5
  49. package/dist/HLSView-VGJ2XUDT.js.map +0 -7
  50. package/dist/VirtualBackground-2VZVBRIC.js +0 -175
  51. package/dist/VirtualBackground-2VZVBRIC.js.map +0 -7
  52. package/dist/chunk-EDGWHFCM.js.map +0 -7
  53. package/dist/chunk-SONHO3VM.js +0 -962
  54. package/dist/chunk-SONHO3VM.js.map +0 -7
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prebuilt",
11
11
  "roomkit"
12
12
  ],
13
- "version": "0.1.9",
13
+ "version": "0.1.11-alpha.0",
14
14
  "author": "100ms",
15
15
  "license": "MIT",
16
16
  "files": [
@@ -76,10 +76,10 @@
76
76
  "react": ">=17.0.2 <19.0.0"
77
77
  },
78
78
  "dependencies": {
79
- "@100mslive/hls-player": "0.1.18",
80
- "@100mslive/hms-virtual-background": "1.11.18",
81
- "@100mslive/react-icons": "0.8.18",
82
- "@100mslive/react-sdk": "0.8.18",
79
+ "@100mslive/hls-player": "0.1.20-alpha.0",
80
+ "@100mslive/hms-virtual-background": "1.11.20-alpha.0",
81
+ "@100mslive/react-icons": "0.8.20-alpha.0",
82
+ "@100mslive/react-sdk": "0.8.20-alpha.0",
83
83
  "@100mslive/types-prebuilt": "0.12.0",
84
84
  "@emoji-mart/data": "^1.0.6",
85
85
  "@emoji-mart/react": "^1.0.1",
@@ -114,5 +114,5 @@
114
114
  "uuid": "^8.3.2",
115
115
  "worker-timers": "^7.0.40"
116
116
  },
117
- "gitHead": "b78d4abbfb1bb119dcdd29613484f22fbae5b149"
117
+ "gitHead": "a9b4d6c1bca655825e8fd4a8b07753912e213626"
118
118
  }
@@ -1,28 +1,20 @@
1
1
  import React, { ReactNode, useRef } from 'react';
2
2
  import { Root } from '@radix-ui/react-dialog';
3
3
  import { styled } from '@stitches/react';
4
- import { CSS } from '../Theme';
5
4
  import {
5
+ CustomDialogContent,
6
+ CustomDialogOverlay,
6
7
  DialogClose,
7
8
  DialogDefaultCloseIcon,
8
9
  DialogDescription,
9
10
  DialogTitle,
10
- StyledDialogContent,
11
- StyledDialogOverlay,
12
11
  StyledDialogPortal,
13
12
  StyledDialogTrigger,
14
13
  } from './DialogContent';
15
14
  import { useDialogContainerSelector } from '../hooks/useDialogContainerSelector';
16
15
 
17
16
  const StyledDialog = styled(Root, {});
18
- const CustomDialogContent = ({ children, props = {}, css = {} }: { children: ReactNode; props?: any; css?: CSS }) => (
19
- <StyledDialogContent css={{ ...css, position: 'absolute' }} {...props}>
20
- {children}
21
- </StyledDialogContent>
22
- );
23
- const CustomDialogOverlay = ({ css = {} }: { css?: CSS }) => (
24
- <StyledDialogOverlay css={{ ...css, position: 'absolute' }} />
25
- );
17
+
26
18
  const CustomDialogPortal = ({ children, container }: { children: ReactNode; container?: HTMLElement | null }) => {
27
19
  const dialogContainerSelector = useDialogContainerSelector();
28
20
  const containerRef = useRef<HTMLElement | null>(null);
@@ -17,19 +17,19 @@ export const StyledDialogTrigger = styled(DialogPrimitive.Trigger, {
17
17
  appearance: 'none !important', // Needed for safari it shows white overlay
18
18
  });
19
19
 
20
- export const StyledDialogOverlay = styled(DialogPrimitive.Overlay, {
20
+ export const CustomDialogOverlay = styled(DialogPrimitive.Overlay, {
21
21
  backgroundColor: 'rgba(0, 0, 0, 0.5);',
22
- position: 'fixed',
22
+ position: 'absolute',
23
23
  inset: 0,
24
24
  });
25
25
 
26
26
  export const StyledDialogPortal = styled(DialogPrimitive.Portal, {});
27
27
 
28
- export const StyledDialogContent = styled(DialogPrimitive.Content, {
28
+ export const CustomDialogContent = styled(DialogPrimitive.Content, {
29
29
  color: '$on_surface_medium',
30
30
  backgroundColor: '$surface_default',
31
31
  borderRadius: '8px',
32
- position: 'fixed',
32
+ position: 'absolute',
33
33
  top: '50%',
34
34
  left: '50%',
35
35
  border: '$space$px solid $border_bright',
@@ -46,6 +46,8 @@ export const APP_DATA = {
46
46
  activeScreensharePeerId: 'activeScreensharePeerId',
47
47
  disableNotifications: 'disableNotifications',
48
48
  pollState: 'pollState',
49
+ background: 'background',
50
+ backgroundType: 'backgroundType',
49
51
  };
50
52
  export const UI_SETTINGS = {
51
53
  isAudioOnly: 'isAudioOnly',
@@ -61,6 +63,7 @@ export const SIDE_PANE_OPTIONS = {
61
63
  CHAT: 'Chat',
62
64
  STREAMING: 'STREAMING',
63
65
  POLLS: 'POLLS',
66
+ VB: 'VB',
64
67
  };
65
68
 
66
69
  export const POLL_STATE = {
@@ -4,7 +4,6 @@ import {
4
4
  selectAvailableRoleNames,
5
5
  selectFullAppData,
6
6
  selectHLSState,
7
- selectIsConnectedToRoom,
8
7
  selectLocalPeerRoleName,
9
8
  selectRolesMap,
10
9
  selectRoomState,
@@ -15,7 +14,7 @@ import {
15
14
  } from '@100mslive/react-sdk';
16
15
  import { normalizeAppPolicyConfig } from '../init/initUtils';
17
16
  import { UserPreferencesKeys, useUserPreferences } from '../hooks/useUserPreferences';
18
- import { useIsSidepaneTypeOpen, useSidepaneReset, useSidepaneState, useSidepaneToggle } from './useSidepane';
17
+ import { useIsSidepaneTypeOpen, useSidepaneToggle } from './useSidepane';
19
18
  import { useSetAppDataByKey } from './useUISettings';
20
19
  import {
21
20
  APP_DATA,
@@ -26,6 +25,7 @@ import {
26
25
  UI_MODE_GRID,
27
26
  UI_SETTINGS,
28
27
  } from '../../common/constants';
28
+ import { VB_EFFECT } from '../VirtualBackground/constants';
29
29
 
30
30
  export const getAppDetails = appDetails => {
31
31
  try {
@@ -67,6 +67,8 @@ const initialAppData = {
67
67
  [APP_DATA.minimiseInset]: false,
68
68
  [APP_DATA.activeScreensharePeerId]: '',
69
69
  [APP_DATA.disableNotifications]: false,
70
+ [APP_DATA.background]: VB_EFFECT.NONE,
71
+ [APP_DATA.backgroundType]: VB_EFFECT.NONE,
70
72
  [APP_DATA.pollState]: {
71
73
  [POLL_STATE.pollInView]: '',
72
74
  [POLL_STATE.view]: '',
@@ -75,21 +77,12 @@ const initialAppData = {
75
77
 
76
78
  export const AppData = React.memo(({ appDetails, tokenEndpoint }) => {
77
79
  const hmsActions = useHMSActions();
78
- const isConnected = useHMSStore(selectIsConnectedToRoom);
79
- const sidePane = useSidepaneState();
80
- const resetSidePane = useSidepaneReset();
81
80
  const [preferences = {}] = useUserPreferences(UserPreferencesKeys.UI_SETTINGS);
82
81
  const roleNames = useHMSStore(selectAvailableRoleNames);
83
82
  const rolesMap = useHMSStore(selectRolesMap);
84
83
  const localPeerRole = useHMSStore(selectLocalPeerRoleName);
85
84
  const appData = useHMSStore(selectFullAppData);
86
85
 
87
- useEffect(() => {
88
- if (!isConnected && sidePane && sidePane !== SIDE_PANE_OPTIONS.PARTICIPANTS) {
89
- resetSidePane();
90
- }
91
- }, [isConnected, sidePane, resetSidePane]);
92
-
93
86
  useEffect(() => {
94
87
  hmsActions.initAppData({
95
88
  ...initialAppData,
@@ -60,7 +60,7 @@ export const usePollViewToggle = () => {
60
60
  };
61
61
 
62
62
  /**
63
- * reset's the sidepane value
63
+ * resets the sidepane value
64
64
  */
65
65
  export const useSidepaneReset = () => {
66
66
  const hmsActions = useHMSActions();
@@ -39,7 +39,7 @@ export const ConnectionIndicator = ({
39
39
  }
40
40
  if (downlinkQuality === 0) {
41
41
  return (
42
- <Tooltip title={getTooltipText(downlinkQuality)}>
42
+ <Tooltip side="left" title={getTooltipText(downlinkQuality)}>
43
43
  <Wrapper isTile={isTile} css={{ color: '#ED4C5A' }} data-testid="tile_network">
44
44
  <PoorConnectivityIcon />
45
45
  </Wrapper>
@@ -48,7 +48,7 @@ export const ConnectionIndicator = ({
48
48
  }
49
49
  const size = isTile ? 12 : 16;
50
50
  return (
51
- <Tooltip title={getTooltipText(downlinkQuality)}>
51
+ <Tooltip side="left" title={getTooltipText(downlinkQuality)}>
52
52
  <Wrapper isTile={isTile} data-testid="tile_network" css={{ backgroundColor: hideBg ? '' : '$surface_bright' }}>
53
53
  <svg
54
54
  width={size}
@@ -1,4 +1,4 @@
1
- import React, { Suspense, useEffect } from 'react';
1
+ import React, { useEffect } from 'react';
2
2
  import { useMedia } from 'react-use';
3
3
  import {
4
4
  ConferencingScreen,
@@ -21,6 +21,8 @@ import { RaiseHand } from '../RaiseHand';
21
21
  // @ts-ignore: No implicit Any
22
22
  import { ScreenshareToggle } from '../ScreenShareToggle';
23
23
  // @ts-ignore: No implicit Any
24
+ import { VBToggle } from '../VirtualBackground/VBToggle';
25
+ // @ts-ignore: No implicit Any
24
26
  import { ChatToggle } from './ChatToggle';
25
27
  // @ts-ignore: No implicit Any
26
28
  import { ParticipantCount } from './ParticipantList';
@@ -31,8 +33,6 @@ import { useIsSidepaneTypeOpen, useSidepaneToggle } from '../AppData/useSidepane
31
33
  import { useShowPolls } from '../AppData/useUISettings';
32
34
  // @ts-ignore: No implicit Any
33
35
  import { SIDE_PANE_OPTIONS } from '../../common/constants';
34
- // @ts-ignore: No implicit Any
35
- const VirtualBackground = React.lazy(() => import('../../plugins/VirtualBackground/VirtualBackground'));
36
36
 
37
37
  export const Footer = ({
38
38
  screenType,
@@ -82,11 +82,7 @@ export const Footer = ({
82
82
  >
83
83
  {isMobile ? <LeaveRoom screenType={screenType} /> : null}
84
84
  <AudioVideoToggle />
85
- {isMobile ? null : (
86
- <Suspense fallback={<></>}>
87
- <VirtualBackground />
88
- </Suspense>
89
- )}
85
+ {isMobile ? null : <VBToggle />}
90
86
  </AppFooter.Left>
91
87
  <AppFooter.Center
92
88
  css={{
@@ -1,4 +1,4 @@
1
- import React, { Fragment, useCallback, useEffect, useState } from 'react';
1
+ import React, { Fragment, useCallback, useState } from 'react';
2
2
  import { useDebounce, useMedia } from 'react-use';
3
3
  import {
4
4
  selectHandRaisedPeers,
@@ -96,11 +96,6 @@ export const ParticipantCount = () => {
96
96
  const peerCount = useHMSStore(selectPeerCount);
97
97
  const toggleSidepane = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
98
98
  const isParticipantsOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.PARTICIPANTS);
99
- useEffect(() => {
100
- if (isParticipantsOpen && peerCount === 0) {
101
- toggleSidepane();
102
- }
103
- }, [isParticipantsOpen, peerCount, toggleSidepane]);
104
99
 
105
100
  if (peerCount === 0) {
106
101
  return null;
@@ -7,7 +7,7 @@ import { Logo, SpeakerTag } from './HeaderComponents';
7
7
  // @ts-ignore: No implicit any
8
8
  import { LiveStatus, RecordingStatus, StreamActions } from './StreamActions';
9
9
  // @ts-ignore: No implicit any
10
- import { AudioOutputActions, CamaraFlipActions } from './common';
10
+ import { AudioActions, CamaraFlipActions } from './common';
11
11
 
12
12
  export const Header = () => {
13
13
  const roomState = useHMSStore(selectRoomState);
@@ -40,7 +40,7 @@ export const Header = () => {
40
40
  {isMobile ? (
41
41
  <>
42
42
  <CamaraFlipActions />
43
- <AudioOutputActions />
43
+ <AudioActions />
44
44
  </>
45
45
  ) : null}
46
46
  </Flex>
@@ -8,7 +8,14 @@ import {
8
8
  useHMSActions,
9
9
  useHMSStore,
10
10
  } from '@100mslive/react-sdk';
11
- import { CameraFlipIcon, CheckIcon, CrossIcon, SpeakerIcon } from '@100mslive/react-icons';
11
+ import {
12
+ BluetoothIcon,
13
+ CameraFlipIcon,
14
+ CheckIcon,
15
+ CrossIcon,
16
+ HeadphonesIcon,
17
+ SpeakerIcon,
18
+ } from '@100mslive/react-icons';
12
19
  import { HorizontalDivider } from '../../../Divider';
13
20
  import { Label } from '../../../Label';
14
21
  import { Box, Flex } from '../../../Layout';
@@ -49,48 +56,64 @@ export const CamaraFlipActions = () => {
49
56
  );
50
57
  };
51
58
 
52
- export const AudioOutputActions = () => {
59
+ // It will handle and show audio input devices in Mweb while audio output devices in desktop
60
+ export const AudioActions = () => {
53
61
  const { allDevices, selectedDeviceIDs, updateDevice } = useDevices();
54
- const { audioOutput } = allDevices;
62
+
55
63
  // don't show speaker selector where the API is not supported, and use
56
64
  // a generic word("Audio") for Mic. In some cases(Chrome Android for e.g.) this changes both mic and speaker keeping them in sync.
57
65
  const shouldShowAudioOutput = 'setSinkId' in HTMLMediaElement.prototype;
66
+ const { audioInput, audioOutput } = allDevices;
67
+ let availableAudioDevices = audioInput;
68
+ let selectedAudio = selectedDeviceIDs.audioInput;
69
+ if (shouldShowAudioOutput) {
70
+ availableAudioDevices = audioOutput;
71
+ selectedAudio = selectedDeviceIDs.audioOutput;
72
+ }
73
+ const hmsActions = useHMSActions();
74
+ const audioFiltered = availableAudioDevices?.find(item => !!item.label);
75
+ const currentSelection = availableAudioDevices?.find(item => item.deviceId === selectedAudio);
58
76
 
59
- /**
60
- * Chromium browsers return an audioOutput with empty label when no permissions are given
61
- */
62
- const audioOutputFiltered = audioOutput?.filter(item => !!item.label) ?? [];
63
- if (!shouldShowAudioOutput || !audioOutputFiltered?.length > 0) {
77
+ if (!audioFiltered) {
64
78
  return null;
65
79
  }
80
+ let AudioIcon = <SpeakerIcon />;
81
+ if (currentSelection && currentSelection.label.toLowerCase().includes('bluetooth')) {
82
+ AudioIcon = <BluetoothIcon />;
83
+ } else if (currentSelection && currentSelection.label.toLowerCase().includes('wired')) {
84
+ AudioIcon = <HeadphonesIcon />;
85
+ }
66
86
  return (
67
- <AudioOutputSelectionSheet
68
- outputDevices={audioOutput}
69
- outputSelected={selectedDeviceIDs.outputDevices}
87
+ <AudioSelectionSheet
88
+ audioDevices={availableAudioDevices}
89
+ audioSelected={selectedAudio}
70
90
  onChange={async deviceId => {
71
91
  try {
72
92
  await updateDevice({
73
93
  deviceId,
74
- deviceType: DeviceType.audioOutput,
94
+ deviceType: shouldShowAudioOutput ? DeviceType.audioOutput : DeviceType.audioInput,
75
95
  });
76
96
  } catch (e) {
77
97
  ToastManager.addToast({
78
- title: `Error while changing audio output ${e.message || ''}`,
98
+ title: `Error while changing audio device ${e.message || ''}`,
79
99
  variant: 'error',
80
100
  });
81
101
  }
82
102
  }}
83
103
  >
84
- <Box>
85
- <IconButton>
86
- <SpeakerIcon />
87
- </IconButton>
104
+ <Box
105
+ onClick={async () => {
106
+ // refresh device as `devicechange` listener won't work in mobile device
107
+ await hmsActions.refreshDevices();
108
+ }}
109
+ >
110
+ <IconButton>{AudioIcon} </IconButton>
88
111
  </Box>
89
- </AudioOutputSelectionSheet>
112
+ </AudioSelectionSheet>
90
113
  );
91
114
  };
92
115
 
93
- const AudioOutputSelectionSheet = ({ outputDevices, outputSelected, onChange, children }) => {
116
+ const AudioSelectionSheet = ({ audioDevices, audioSelected, onChange, children }) => {
94
117
  return (
95
118
  <Sheet.Root>
96
119
  <Sheet.Trigger asChild>{children}</Sheet.Trigger>
@@ -98,7 +121,7 @@ const AudioOutputSelectionSheet = ({ outputDevices, outputSelected, onChange, ch
98
121
  <Sheet.Title css={{ py: '$10', px: '$8', alignItems: 'center' }}>
99
122
  <Flex direction="row" justify="between" css={{ w: '100%' }}>
100
123
  <Text variant="h6" css={{ display: 'flex' }}>
101
- Audio Output
124
+ Audio
102
125
  </Text>
103
126
  <Sheet.Close>
104
127
  <IconButton as="div" data-testid="dialog_cross_icon">
@@ -113,16 +136,16 @@ const AudioOutputSelectionSheet = ({ outputDevices, outputSelected, onChange, ch
113
136
  css={{
114
137
  px: '$8',
115
138
  maxHeight: '80vh',
116
- overflowY: 'scroll',
139
+ overflowY: 'auto',
117
140
  }}
118
141
  >
119
- {outputDevices.map(audioDevice => {
142
+ {audioDevices.map(audioDevice => {
120
143
  return (
121
144
  <SelectWithLabel
122
145
  key={audioDevice.deviceId}
123
146
  label={audioDevice.label}
124
147
  id={audioDevice.deviceId}
125
- checked={audioDevice.deviceId === outputSelected}
148
+ checked={audioDevice.deviceId === audioSelected}
126
149
  onChange={() => onChange(audioDevice.deviceId)}
127
150
  />
128
151
  );
@@ -20,9 +20,9 @@ export const DesktopLeaveRoom = ({
20
20
  screenType,
21
21
  endRoom,
22
22
  }: {
23
- leaveRoom: (args: { endstream: boolean }) => void;
23
+ leaveRoom: (options?: { endStream?: boolean }) => Promise<void>;
24
24
  screenType: keyof ConferencingScreen;
25
- endRoom: () => void;
25
+ endRoom: () => Promise<void>;
26
26
  }) => {
27
27
  const [open, setOpen] = useState(false);
28
28
  const [showLeaveRoomAlert, setShowLeaveRoomAlert] = useState(false);
@@ -78,7 +78,7 @@ export const DesktopLeaveRoom = ({
78
78
  color: '$on_surface_medium',
79
79
  '&:hover': { bg: '$surface_default', color: '$on_surface_high' },
80
80
  }}
81
- onClick={() => leaveRoom({ endstream: false })}
81
+ onClick={async () => await leaveRoom()}
82
82
  data-testid="just_leave_btn"
83
83
  >
84
84
  <LeaveCard
@@ -89,7 +89,7 @@ export const DesktopLeaveRoom = ({
89
89
  bg=""
90
90
  titleColor="$on_surface_high"
91
91
  icon={<ExitIcon height={24} width={24} style={{ transform: 'rotate(180deg)' }} />}
92
- onClick={() => leaveRoom({ endstream: false })}
92
+ onClick={async () => await leaveRoom()}
93
93
  css={{ p: 0 }}
94
94
  />
95
95
  </Dropdown.Item>
@@ -142,7 +142,7 @@ export const DesktopLeaveRoom = ({
142
142
  <Dialog.Content css={{ w: 'min(420px, 90%)', p: '$8', bg: '$surface_dim' }}>
143
143
  <EndSessionContent
144
144
  setShowEndStreamAlert={setShowEndStreamAlert}
145
- leaveRoom={isStreamingOn ? leaveRoom : endRoom}
145
+ leaveRoom={isStreamingOn ? () => leaveRoom({ endStream: true }) : endRoom}
146
146
  isStreamingOn={isStreamingOn}
147
147
  isModal
148
148
  />
@@ -11,7 +11,7 @@ export const EndSessionContent = ({
11
11
  isStreamingOn = false,
12
12
  }: {
13
13
  setShowEndStreamAlert: (value: boolean) => void;
14
- leaveRoom: (args: { endstream: boolean }) => void;
14
+ leaveRoom: (options?: { endStream?: boolean }) => Promise<void>;
15
15
  isModal?: boolean;
16
16
  isStreamingOn: boolean;
17
17
  }) => {
@@ -50,7 +50,7 @@ export const EndSessionContent = ({
50
50
  variant="danger"
51
51
  css={{ w: '100%' }}
52
52
  onClick={async () => {
53
- await leaveRoom({ endstream: true });
53
+ await leaveRoom({ endStream: true });
54
54
  setShowEndStreamAlert(false);
55
55
  }}
56
56
  id="stopStream"
@@ -46,15 +46,16 @@ export const LeaveRoom = ({ screenType }: { screenType: keyof ConferencingScreen
46
46
  ToastManager.addToast({ title: 'Error in stopping the stream', type: 'error' });
47
47
  }
48
48
  };
49
- const endRoom = () => {
50
- hmsActions.endRoom(false, 'End Room');
49
+
50
+ const endRoom = async () => {
51
+ await hmsActions.endRoom(false, 'End Room');
51
52
  };
52
53
 
53
- const leaveRoom = async ({ endstream = false }) => {
54
- if (endstream || (hlsState.running && peersWithStreamingRights.length === 1)) {
54
+ const leaveRoom = async (options: { endStream?: boolean } = { endStream: false }) => {
55
+ if (options.endStream || (hlsState.running && peersWithStreamingRights.length === 1)) {
55
56
  await stopStream();
56
57
  }
57
- hmsActions.leave();
58
+ await hmsActions.leave();
58
59
  };
59
60
 
60
61
  if (!permissions || !isConnected) {
@@ -10,7 +10,7 @@ export const LeaveSessionContent = ({
10
10
  isModal = false,
11
11
  }: {
12
12
  setShowLeaveRoomAlert: (value: boolean) => void;
13
- leaveRoom: (args: { endstream: boolean }) => void;
13
+ leaveRoom: (options?: { endStream?: boolean }) => Promise<void>;
14
14
  isModal?: boolean;
15
15
  }) => {
16
16
  return (
@@ -47,7 +47,7 @@ export const LeaveSessionContent = ({
47
47
  <Button
48
48
  variant="danger"
49
49
  css={{ w: '100%' }}
50
- onClick={() => leaveRoom({ endstream: false })}
50
+ onClick={async () => await leaveRoom()}
51
51
  id="leaveRoom"
52
52
  data-testid="leave_room"
53
53
  >
@@ -19,9 +19,9 @@ export const MwebLeaveRoom = ({
19
19
  screenType,
20
20
  endRoom,
21
21
  }: {
22
- leaveRoom: (args: { endstream: boolean }) => void;
22
+ leaveRoom: (options?: { endStream?: boolean }) => Promise<void>;
23
23
  screenType: keyof ConferencingScreen;
24
- endRoom: () => void;
24
+ endRoom: () => Promise<void>;
25
25
  }) => {
26
26
  const [open, setOpen] = useState(false);
27
27
  const [showLeaveRoomAlert, setShowLeaveRoomAlert] = useState(false);
@@ -67,7 +67,7 @@ export const MwebLeaveRoom = ({
67
67
  bg="$surface_default"
68
68
  titleColor="$on_surface_high"
69
69
  icon={<ExitIcon height={24} width={24} style={{ transform: 'rotate(180deg)' }} />}
70
- onClick={() => leaveRoom({ endstream: false })}
70
+ onClick={async () => await leaveRoom()}
71
71
  css={{ pt: 0, mt: '$10', color: '$on_surface_low', '&:hover': { color: '$on_surface_high' } }}
72
72
  />
73
73
 
@@ -23,10 +23,7 @@ export function HLSFailureModal() {
23
23
  setHLSStarted(true);
24
24
  await hmsActions.startHLSStreaming({});
25
25
  } catch (error) {
26
- if ((error as Error).message.includes('invalid input')) {
27
- await startHLS();
28
- return;
29
- }
26
+ console.error(error);
30
27
  setHLSStarted(false);
31
28
  }
32
29
  }, [hmsActions, isHLSStarted, setHLSStarted, isRTMPRunning]);
@@ -27,11 +27,17 @@ const PreviewForm = ({
27
27
  e.preventDefault();
28
28
  };
29
29
  const isMobile = useMedia(cssConfig.media.md);
30
- const { isHLSRunning, isRTMPRunning } = useRecordingStreaming();
30
+ const { isHLSRunning, isRTMPRunning, isHLSRecordingOn, isBrowserRecordingOn } = useRecordingStreaming();
31
+
31
32
  const layout = useRoomLayout();
32
33
  const { join_form: joinForm = {} } = layout?.screens?.preview?.default?.elements || {};
34
+
33
35
  const showGoLive =
34
- joinForm?.join_btn_type === JoinForm_JoinBtnType.JOIN_BTN_TYPE_JOIN_AND_GO_LIVE && !isHLSRunning && !isRTMPRunning;
36
+ joinForm?.join_btn_type === JoinForm_JoinBtnType.JOIN_BTN_TYPE_JOIN_AND_GO_LIVE &&
37
+ !isHLSRunning &&
38
+ !isRTMPRunning &&
39
+ !isHLSRecordingOn &&
40
+ !isBrowserRecordingOn;
35
41
 
36
42
  return (
37
43
  <Form