@100mslive/roomkit-react 0.3.12-alpha.5 → 0.3.12-alpha.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,7 @@
26
26
  "format": "esm"
27
27
  },
28
28
  "src/Prebuilt/common/constants.ts": {
29
- "bytes": 4521,
29
+ "bytes": 4563,
30
30
  "imports": [
31
31
  {
32
32
  "path": "@100mslive/react-sdk",
@@ -1997,7 +1997,7 @@
1997
1997
  "format": "esm"
1998
1998
  },
1999
1999
  "src/Prebuilt/components/AppData/useUISettings.js": {
2000
- "bytes": 6214,
2000
+ "bytes": 6649,
2001
2001
  "imports": [
2002
2002
  {
2003
2003
  "path": "react",
@@ -2277,7 +2277,7 @@
2277
2277
  "format": "esm"
2278
2278
  },
2279
2279
  "src/Prebuilt/components/AppData/AppData.tsx": {
2280
- "bytes": 5935,
2280
+ "bytes": 6297,
2281
2281
  "imports": [
2282
2282
  {
2283
2283
  "path": "react",
@@ -2850,7 +2850,7 @@
2850
2850
  "format": "esm"
2851
2851
  },
2852
2852
  "src/Prebuilt/components/AudioVideoToggle.tsx": {
2853
- "bytes": 9981,
2853
+ "bytes": 10776,
2854
2854
  "imports": [
2855
2855
  {
2856
2856
  "path": "react",
@@ -2922,6 +2922,11 @@
2922
2922
  "kind": "import-statement",
2923
2923
  "original": "../provider/roomLayoutProvider/hooks/useRoomLayoutScreen"
2924
2924
  },
2925
+ {
2926
+ "path": "src/Prebuilt/components/AppData/useUISettings.js",
2927
+ "kind": "import-statement",
2928
+ "original": "./AppData/useUISettings"
2929
+ },
2925
2930
  {
2926
2931
  "path": "src/Prebuilt/components/hooks/useAudioOutputTest.tsx",
2927
2932
  "kind": "import-statement",
@@ -4890,7 +4895,7 @@
4890
4895
  "format": "cjs"
4891
4896
  },
4892
4897
  "../hms-video-store/dist/index.js": {
4893
- "bytes": 338124,
4898
+ "bytes": 339294,
4894
4899
  "imports": [
4895
4900
  {
4896
4901
  "path": "../../node_modules/reselect/es/index.js",
@@ -6769,7 +6774,7 @@
6769
6774
  "format": "esm"
6770
6775
  },
6771
6776
  "src/Prebuilt/components/Streaming/Common.jsx": {
6772
- "bytes": 3964,
6777
+ "bytes": 4034,
6773
6778
  "imports": [
6774
6779
  {
6775
6780
  "path": "react",
@@ -10944,7 +10949,7 @@
10944
10949
  ],
10945
10950
  "format": "esm"
10946
10951
  },
10947
- "../../../../../../../tmp/tmp-2820-qIAsQhpY2UjE/18fe8231ee82/tldraw.css": {
10952
+ "../../../../../../../tmp/tmp-2799-B2lKLlzDadvJ/1900669ab903/tldraw.css": {
10948
10953
  "bytes": 80111,
10949
10954
  "imports": [
10950
10955
  {
@@ -10994,7 +10999,7 @@
10994
10999
  }
10995
11000
  ]
10996
11001
  },
10997
- "../../../../../../../tmp/tmp-2820-qIAsQhpY2UjE/18fe8231e7a0/index.css": {
11002
+ "../../../../../../../tmp/tmp-2799-B2lKLlzDadvJ/1900669ab1e0/index.css": {
10998
11003
  "bytes": 597,
10999
11004
  "imports": [
11000
11005
  {
@@ -11003,7 +11008,7 @@
11003
11008
  "external": true
11004
11009
  },
11005
11010
  {
11006
- "path": "../../../../../../../tmp/tmp-2820-qIAsQhpY2UjE/18fe8231ee82/tldraw.css",
11011
+ "path": "../../../../../../../tmp/tmp-2799-B2lKLlzDadvJ/1900669ab903/tldraw.css",
11007
11012
  "kind": "import-rule",
11008
11013
  "original": "@tldraw/tldraw/tldraw.css"
11009
11014
  }
@@ -11078,7 +11083,7 @@
11078
11083
  "original": "../../common/constants"
11079
11084
  },
11080
11085
  {
11081
- "path": "../../../../../../../tmp/tmp-2820-qIAsQhpY2UjE/18fe8231e7a0/index.css",
11086
+ "path": "../../../../../../../tmp/tmp-2799-B2lKLlzDadvJ/1900669ab1e0/index.css",
11082
11087
  "kind": "import-statement",
11083
11088
  "original": "@100mslive/hms-whiteboard/index.css"
11084
11089
  },
@@ -11275,13 +11280,18 @@
11275
11280
  "format": "esm"
11276
11281
  },
11277
11282
  "src/Prebuilt/plugins/CaptionsViewer.tsx": {
11278
- "bytes": 7075,
11283
+ "bytes": 7363,
11279
11284
  "imports": [
11280
11285
  {
11281
11286
  "path": "react",
11282
11287
  "kind": "import-statement",
11283
11288
  "external": true
11284
11289
  },
11290
+ {
11291
+ "path": "react-draggable",
11292
+ "kind": "import-statement",
11293
+ "external": true
11294
+ },
11285
11295
  {
11286
11296
  "path": "react-use",
11287
11297
  "kind": "import-statement",
@@ -14302,7 +14312,7 @@
14302
14312
  "dist/index.js": {
14303
14313
  "imports": [
14304
14314
  {
14305
- "path": "dist/chunk-AKD6OMF6.js",
14315
+ "path": "dist/chunk-KBVFTNP3.js",
14306
14316
  "kind": "import-statement"
14307
14317
  }
14308
14318
  ],
@@ -14376,16 +14386,16 @@
14376
14386
  "inputs": {},
14377
14387
  "bytes": 1822
14378
14388
  },
14379
- "dist/HLSView-FFS2AZC5.js.map": {
14389
+ "dist/HLSView-Z6DOGESA.js.map": {
14380
14390
  "imports": [],
14381
14391
  "exports": [],
14382
14392
  "inputs": {},
14383
14393
  "bytes": 100275
14384
14394
  },
14385
- "dist/HLSView-FFS2AZC5.js": {
14395
+ "dist/HLSView-Z6DOGESA.js": {
14386
14396
  "imports": [
14387
14397
  {
14388
- "path": "dist/chunk-AKD6OMF6.js",
14398
+ "path": "dist/chunk-KBVFTNP3.js",
14389
14399
  "kind": "import-statement"
14390
14400
  },
14391
14401
  {
@@ -14563,7 +14573,7 @@
14563
14573
  "default"
14564
14574
  ],
14565
14575
  "entryPoint": "src/Prebuilt/layouts/HLSView.jsx",
14566
- "cssBundle": "dist/HLSView-KS57W3WL.css",
14576
+ "cssBundle": "dist/HLSView-5NGWLWHH.css",
14567
14577
  "inputs": {
14568
14578
  "src/Prebuilt/layouts/HLSView.jsx": {
14569
14579
  "bytesInOutput": 27671
@@ -14622,13 +14632,13 @@
14622
14632
  },
14623
14633
  "bytes": 61702
14624
14634
  },
14625
- "dist/chunk-AKD6OMF6.js.map": {
14635
+ "dist/chunk-KBVFTNP3.js.map": {
14626
14636
  "imports": [],
14627
14637
  "exports": [],
14628
14638
  "inputs": {},
14629
- "bytes": 3271970
14639
+ "bytes": 3277660
14630
14640
  },
14631
- "dist/chunk-AKD6OMF6.js": {
14641
+ "dist/chunk-KBVFTNP3.js": {
14632
14642
  "imports": [
14633
14643
  {
14634
14644
  "path": "react",
@@ -17080,6 +17090,11 @@
17080
17090
  "kind": "import-statement",
17081
17091
  "external": true
17082
17092
  },
17093
+ {
17094
+ "path": "react-draggable",
17095
+ "kind": "import-statement",
17096
+ "external": true
17097
+ },
17083
17098
  {
17084
17099
  "path": "react-use",
17085
17100
  "kind": "import-statement",
@@ -17101,7 +17116,7 @@
17101
17116
  "external": true
17102
17117
  },
17103
17118
  {
17104
- "path": "dist/HLSView-FFS2AZC5.js",
17119
+ "path": "dist/HLSView-Z6DOGESA.js",
17105
17120
  "kind": "dynamic-import"
17106
17121
  },
17107
17122
  {
@@ -17603,7 +17618,7 @@
17603
17618
  ],
17604
17619
  "inputs": {
17605
17620
  "<define:process.env>": {
17606
- "bytesInOutput": 17925
17621
+ "bytesInOutput": 17885
17607
17622
  },
17608
17623
  "../../node_modules/lodash/lodash.js": {
17609
17624
  "bytesInOutput": 224310
@@ -17651,7 +17666,7 @@
17651
17666
  "bytesInOutput": 5061
17652
17667
  },
17653
17668
  "src/Prebuilt/common/constants.ts": {
17654
- "bytesInOutput": 3571
17669
+ "bytesInOutput": 3613
17655
17670
  },
17656
17671
  "src/Theme/ThemeProvider.tsx": {
17657
17672
  "bytesInOutput": 1926
@@ -17861,7 +17876,7 @@
17861
17876
  "bytesInOutput": 7828
17862
17877
  },
17863
17878
  "src/Prebuilt/components/AppData/AppData.tsx": {
17864
- "bytesInOutput": 5542
17879
+ "bytesInOutput": 6004
17865
17880
  },
17866
17881
  "src/Prebuilt/components/Settings/LayoutSettings.tsx": {
17867
17882
  "bytesInOutput": 2705
@@ -17870,7 +17885,7 @@
17870
17885
  "bytesInOutput": 973
17871
17886
  },
17872
17887
  "src/Prebuilt/components/AppData/useUISettings.js": {
17873
- "bytesInOutput": 5454
17888
+ "bytesInOutput": 5870
17874
17889
  },
17875
17890
  "src/Prebuilt/components/hooks/useUserPreferences.jsx": {
17876
17891
  "bytesInOutput": 748
@@ -17912,7 +17927,7 @@
17912
17927
  "bytesInOutput": 3306
17913
17928
  },
17914
17929
  "src/Prebuilt/components/AudioVideoToggle.tsx": {
17915
- "bytesInOutput": 10280
17930
+ "bytesInOutput": 11007
17916
17931
  },
17917
17932
  "src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.tsx": {
17918
17933
  "bytesInOutput": 3173
@@ -18206,7 +18221,7 @@
18206
18221
  "bytesInOutput": 8166
18207
18222
  },
18208
18223
  "src/Prebuilt/components/Streaming/Common.jsx": {
18209
- "bytesInOutput": 2247
18224
+ "bytesInOutput": 2317
18210
18225
  },
18211
18226
  "src/Prebuilt/components/Polls/common/StatusIndicator.tsx": {
18212
18227
  "bytesInOutput": 795
@@ -18445,7 +18460,7 @@
18445
18460
  "src/Prebuilt/components/VideoLayouts/WhiteboardLayout.tsx": {
18446
18461
  "bytesInOutput": 2793
18447
18462
  },
18448
- "../../../../../../../tmp/tmp-2820-qIAsQhpY2UjE/18fe8231e7a0/index.css": {
18463
+ "../../../../../../../tmp/tmp-2799-B2lKLlzDadvJ/1900669ab1e0/index.css": {
18449
18464
  "bytesInOutput": 0
18450
18465
  },
18451
18466
  "src/Prebuilt/common/PeersSorter.ts": {
@@ -18458,7 +18473,7 @@
18458
18473
  "bytesInOutput": 1536
18459
18474
  },
18460
18475
  "src/Prebuilt/plugins/CaptionsViewer.tsx": {
18461
- "bytesInOutput": 6381
18476
+ "bytesInOutput": 6631
18462
18477
  },
18463
18478
  "src/Prebuilt/components/hooks/useCloseScreenshareWhiteboard.tsx": {
18464
18479
  "bytesInOutput": 619
@@ -18587,7 +18602,7 @@
18587
18602
  "bytesInOutput": 651
18588
18603
  }
18589
18604
  },
18590
- "bytes": 1342758
18605
+ "bytes": 1344685
18591
18606
  },
18592
18607
  "dist/index.css.map": {
18593
18608
  "imports": [],
@@ -18649,22 +18664,22 @@
18649
18664
  }
18650
18665
  ],
18651
18666
  "inputs": {
18652
- "../../../../../../../tmp/tmp-2820-qIAsQhpY2UjE/18fe8231ee82/tldraw.css": {
18667
+ "../../../../../../../tmp/tmp-2799-B2lKLlzDadvJ/1900669ab903/tldraw.css": {
18653
18668
  "bytesInOutput": 75223
18654
18669
  },
18655
- "../../../../../../../tmp/tmp-2820-qIAsQhpY2UjE/18fe8231e7a0/index.css": {
18670
+ "../../../../../../../tmp/tmp-2799-B2lKLlzDadvJ/1900669ab1e0/index.css": {
18656
18671
  "bytesInOutput": 401
18657
18672
  }
18658
18673
  },
18659
18674
  "bytes": 75901
18660
18675
  },
18661
- "dist/HLSView-KS57W3WL.css.map": {
18676
+ "dist/HLSView-5NGWLWHH.css.map": {
18662
18677
  "imports": [],
18663
18678
  "exports": [],
18664
18679
  "inputs": {},
18665
18680
  "bytes": 122402
18666
18681
  },
18667
- "dist/HLSView-KS57W3WL.css": {
18682
+ "dist/HLSView-5NGWLWHH.css": {
18668
18683
  "imports": [
18669
18684
  {
18670
18685
  "path": "https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap",
@@ -18718,10 +18733,10 @@
18718
18733
  }
18719
18734
  ],
18720
18735
  "inputs": {
18721
- "../../../../../../../tmp/tmp-2820-qIAsQhpY2UjE/18fe8231ee82/tldraw.css": {
18736
+ "../../../../../../../tmp/tmp-2799-B2lKLlzDadvJ/1900669ab903/tldraw.css": {
18722
18737
  "bytesInOutput": 75223
18723
18738
  },
18724
- "../../../../../../../tmp/tmp-2820-qIAsQhpY2UjE/18fe8231e7a0/index.css": {
18739
+ "../../../../../../../tmp/tmp-2799-B2lKLlzDadvJ/1900669ab1e0/index.css": {
18725
18740
  "bytesInOutput": 401
18726
18741
  }
18727
18742
  },
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prebuilt",
11
11
  "roomkit"
12
12
  ],
13
- "version": "0.3.12-alpha.5",
13
+ "version": "0.3.12-alpha.7",
14
14
  "author": "100ms",
15
15
  "license": "MIT",
16
16
  "repository": {
@@ -74,13 +74,13 @@
74
74
  "react": ">=17.0.2 <19.0.0"
75
75
  },
76
76
  "dependencies": {
77
- "@100mslive/hls-player": "0.3.12-alpha.5",
77
+ "@100mslive/hls-player": "0.3.12-alpha.7",
78
78
  "@100mslive/hms-noise-cancellation": "0.0.1",
79
- "@100mslive/hms-virtual-background": "1.13.12-alpha.5",
80
- "@100mslive/hms-whiteboard": "0.0.2-alpha.5",
81
- "@100mslive/react-icons": "0.10.12-alpha.5",
82
- "@100mslive/react-sdk": "0.10.12-alpha.5",
83
- "@100mslive/types-prebuilt": "0.12.8",
79
+ "@100mslive/hms-virtual-background": "1.13.12-alpha.7",
80
+ "@100mslive/hms-whiteboard": "0.0.2-alpha.7",
81
+ "@100mslive/react-icons": "0.10.12-alpha.7",
82
+ "@100mslive/react-sdk": "0.10.12-alpha.7",
83
+ "@100mslive/types-prebuilt": "0.12.9",
84
84
  "@emoji-mart/data": "^1.0.6",
85
85
  "@emoji-mart/react": "^1.0.1",
86
86
  "@radix-ui/react-accordion": "1.0.0",
@@ -115,5 +115,5 @@
115
115
  "uuid": "^8.3.2",
116
116
  "worker-timers": "^7.0.40"
117
117
  },
118
- "gitHead": "09711a75695943a34c79faf0c018f57b80ad0fa7"
118
+ "gitHead": "b88ca5d4312e552bb6379028339d8c27f6de09aa"
119
119
  }
@@ -47,6 +47,7 @@ export const APP_DATA = {
47
47
  sheet: 'sheet',
48
48
  caption: 'caption',
49
49
  loadingEffects: 'loadingEffects',
50
+ noiseCancellation: 'noiseCancellation',
50
51
  };
51
52
 
52
53
  export const UI_SETTINGS = {
@@ -17,7 +17,7 @@ import { UserPreferencesKeys, useUserPreferences } from '../hooks/useUserPrefere
17
17
  // @ts-ignore
18
18
  import { useIsSidepaneTypeOpen, useSidepaneToggle } from './useSidepane';
19
19
  // @ts-ignore
20
- import { useSetAppDataByKey } from './useUISettings';
20
+ import { useSetAppDataByKey, useSetNoiseCancellationEnabled } from './useUISettings';
21
21
  import {
22
22
  APP_DATA,
23
23
  CHAT_SELECTOR,
@@ -68,6 +68,7 @@ const initialAppData = {
68
68
  },
69
69
  // by default on because of on demand now, for beam disabled
70
70
  [APP_DATA.caption]: false,
71
+ [APP_DATA.noiseCancellation]: false,
71
72
  };
72
73
 
73
74
  export const AppData = React.memo(() => {
@@ -78,6 +79,13 @@ export const AppData = React.memo(() => {
78
79
  const toggleVB = useSidepaneToggle(SIDE_PANE_OPTIONS.VB);
79
80
  const { isLocalVideoEnabled } = useAVToggle();
80
81
  const sidepaneOpenedRef = useRef(false);
82
+ const [, setNoiseCancellationEnabled] = useSetNoiseCancellationEnabled();
83
+
84
+ useEffect(() => {
85
+ if (elements?.noise_cancellation?.enabled_by_default) {
86
+ setNoiseCancellationEnabled(true);
87
+ }
88
+ }, [elements?.noise_cancellation?.enabled_by_default, setNoiseCancellationEnabled]);
81
89
 
82
90
  const defaultMediaURL = useMemo(() => {
83
91
  const media = elements?.virtual_background?.background_media || [];
@@ -201,3 +201,13 @@ export const usePollViewState = () => {
201
201
  view: pollState?.view,
202
202
  };
203
203
  };
204
+
205
+ export const useIsNoiseCancellationEnabled = () => {
206
+ const IsNoiseCancellationEnabled = useHMSStore(selectAppDataByPath(APP_DATA.noiseCancellation));
207
+ return IsNoiseCancellationEnabled;
208
+ };
209
+
210
+ export const useSetNoiseCancellationEnabled = () => {
211
+ const [isNoiseCancellationEnabled, setNoiseCancellationEnabled] = useSetAppDataByKey(APP_DATA.noiseCancellation);
212
+ return [isNoiseCancellationEnabled, setNoiseCancellationEnabled];
213
+ };
@@ -37,6 +37,8 @@ import { Text } from '../../Text';
37
37
  import { Tooltip } from '../../Tooltip';
38
38
  import IconButton from '../IconButton';
39
39
  import { useRoomLayoutConferencingScreen } from '../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
40
+ // @ts-ignore: No implicit Any
41
+ import { useIsNoiseCancellationEnabled, useSetNoiseCancellationEnabled } from './AppData/useUISettings';
40
42
  import { useAudioOutputTest } from './hooks/useAudioOutputTest';
41
43
  import { isMacOS, TEST_AUDIO_URL } from '../common/constants';
42
44
 
@@ -97,8 +99,8 @@ const OptionLabel = ({ children, icon }: { children: React.ReactNode; icon: Reac
97
99
  const plugin = new HMSKrispPlugin();
98
100
  const NoiseCancellation = () => {
99
101
  const localPeerAudioTrackID = useHMSStore(selectLocalAudioTrackID);
102
+ const [enabled, setEnabled] = useSetNoiseCancellationEnabled();
100
103
  const isPluginAdded = useHMSStore(selectIsLocalAudioPluginPresent(plugin.getName()));
101
- const [active, setActive] = useState(isPluginAdded);
102
104
  const [inProgress, setInProgress] = useState(false);
103
105
  const actions = useHMSActions();
104
106
  const room = useHMSStore(selectRoom);
@@ -106,15 +108,15 @@ const NoiseCancellation = () => {
106
108
  useEffect(() => {
107
109
  (async () => {
108
110
  setInProgress(true);
109
- if (active && !isPluginAdded) {
111
+ if (enabled && !isPluginAdded) {
110
112
  await actions.addPluginToAudioTrack(plugin);
111
113
  }
112
- if (!active && isPluginAdded) {
114
+ if (!enabled && isPluginAdded) {
113
115
  await actions.removePluginFromAudioTrack(plugin);
114
116
  }
115
117
  setInProgress(false);
116
118
  })();
117
- }, [actions, active, isPluginAdded]);
119
+ }, [actions, enabled, isPluginAdded]);
118
120
 
119
121
  if (!plugin.isSupported() || !room.isNoiseCancellationEnabled || !localPeerAudioTrackID) {
120
122
  return null;
@@ -132,7 +134,7 @@ const NoiseCancellation = () => {
132
134
  }}
133
135
  onClick={e => {
134
136
  e.preventDefault();
135
- setActive(value => !value);
137
+ setEnabled(!enabled);
136
138
  }}
137
139
  >
138
140
  <Text css={{ display: 'flex', alignItems: 'center', gap: '$2', fontSize: '$xs', '& svg': { size: '$8' } }}>
@@ -141,11 +143,11 @@ const NoiseCancellation = () => {
141
143
  </Text>
142
144
  <Switch
143
145
  id="noise_cancellation"
144
- checked={active}
146
+ checked={enabled && isPluginAdded}
145
147
  disabled={inProgress}
146
148
  onClick={e => e.stopPropagation()}
147
149
  onCheckedChange={value => {
148
- setActive(value);
150
+ setEnabled(value);
149
151
  }}
150
152
  />
151
153
  </Dropdown.Item>
@@ -216,11 +218,28 @@ export const AudioVideoToggle = ({ hideOptions = false }) => {
216
218
  const shouldShowAudioOutput = 'setSinkId' in HTMLMediaElement.prototype && Number(audioOutput?.length) > 0;
217
219
  const { screenType } = useRoomLayoutConferencingScreen();
218
220
  const [showSettings, setShowSettings] = useState(false);
221
+ const isPluginAdded = useHMSStore(selectIsLocalAudioPluginPresent(plugin.getName()));
222
+ const isNoiseCancellationEnabled = useIsNoiseCancellationEnabled();
223
+
224
+ useEffect(() => {
225
+ (async () => {
226
+ if (isNoiseCancellationEnabled && !isPluginAdded) {
227
+ await actions.addPluginToAudioTrack(plugin);
228
+ }
229
+ if (isNoiseCancellationEnabled && isPluginAdded) {
230
+ ToastManager.addToast({
231
+ title: `Noise Reduction Enabled`,
232
+ variant: 'standard',
233
+ duration: 2000,
234
+ icon: <AudioLevelIcon />,
235
+ });
236
+ }
237
+ })();
238
+ }, [actions, isNoiseCancellationEnabled, isPluginAdded]);
219
239
 
220
240
  if (!toggleAudio && !toggleVideo) {
221
241
  return null;
222
242
  }
223
-
224
243
  return (
225
244
  <Fragment>
226
245
  {toggleAudio ? (
@@ -43,18 +43,19 @@ export const ContentHeader = ({ onBack, onClose, title = '', content }) => {
43
43
  css={{ w: '100%', py: '$8', px: '$10', cursor: 'pointer', borderBottom: '1px solid $border_bright', mb: '$8' }}
44
44
  >
45
45
  {onBack ? (
46
- <Text
46
+ <Flex
47
+ align="center"
47
48
  css={{
48
- alignSelf: 'center',
49
49
  mr: '$8',
50
+ color: '$on_surface_high',
50
51
  }}
51
52
  onClick={onBack}
52
53
  data-testid="go_back"
53
54
  >
54
55
  <ChevronLeftIcon />
55
- </Text>
56
+ </Flex>
56
57
  ) : null}
57
- <Box css={{ flex: '1 1 0' }}>
58
+ <Box css={{ flex: '1 1 0', display: 'flex', alignItems: 'center' }}>
58
59
  {title ? (
59
60
  <Text
60
61
  variant="tiny"
@@ -1,4 +1,5 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import Draggable from 'react-draggable';
2
3
  import { useMedia } from 'react-use';
3
4
  import {
4
5
  HMSTranscript,
@@ -178,6 +179,8 @@ export const CaptionsViewer = () => {
178
179
 
179
180
  const isTranscriptionEnabled = useHMSStore(selectIsTranscriptionEnabled);
180
181
 
182
+ const nodeRef = useRef<HTMLDivElement>(null);
183
+
181
184
  useEffect(() => {
182
185
  const timeInterval = setInterval(() => {
183
186
  if (!captionQueue) {
@@ -205,30 +208,33 @@ export const CaptionsViewer = () => {
205
208
  return null;
206
209
  }
207
210
  return (
208
- <Box
209
- css={{
210
- position: 'absolute',
211
- w: isMobile ? '100%' : '40%',
212
- bottom: showCaptionAtTop ? '' : '0',
213
- top: showCaptionAtTop ? '0' : '',
214
- left: isMobile ? 0 : '50%',
215
- transform: isMobile ? '' : 'translateX(-50%)',
216
- background: '#000000A3',
217
- overflow: 'clip',
218
- zIndex: 10,
219
- height: 'fit-content',
220
- r: '$1',
221
- p: '$6',
222
- transition: 'bottom 0.3s ease-in-out',
223
- '&:empty': { display: 'none' },
224
- }}
225
- >
226
- <Flex direction="column">
227
- {dataToShow.map((data: { [key: string]: string }, index: number) => {
228
- const key = Object.keys(data)[0];
229
- return <TranscriptView key={index} peer_id={key} data={data[key]} />;
230
- })}
231
- </Flex>
232
- </Box>
211
+ <Draggable bounds="parent" nodeRef={nodeRef} defaultPosition={{ x: isMobile ? 0 : -200, y: 0 }}>
212
+ <Box
213
+ ref={nodeRef}
214
+ css={{
215
+ position: 'absolute',
216
+ w: isMobile ? '100%' : '40%',
217
+ bottom: showCaptionAtTop ? '' : '0',
218
+ top: showCaptionAtTop ? '0' : '',
219
+ left: isMobile ? 0 : '50%',
220
+ transform: isMobile ? '' : 'translateX(-50%)',
221
+ background: '#000000A3',
222
+ overflow: 'clip',
223
+ zIndex: 10,
224
+ height: 'fit-content',
225
+ r: '$1',
226
+ p: '$6',
227
+ transition: 'bottom 0.3s ease-in-out',
228
+ '&:empty': { display: 'none' },
229
+ }}
230
+ >
231
+ <Flex direction="column">
232
+ {dataToShow.map((data: { [key: string]: string }, index: number) => {
233
+ const key = Object.keys(data)[0];
234
+ return <TranscriptView key={index} peer_id={key} data={data[key]} />;
235
+ })}
236
+ </Flex>
237
+ </Box>
238
+ </Draggable>
233
239
  );
234
240
  };