@100mslive/roomkit-react 0.2.5-alpha.0 → 0.2.6-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prebuilt",
11
11
  "roomkit"
12
12
  ],
13
- "version": "0.2.5-alpha.0",
13
+ "version": "0.2.6-alpha.0",
14
14
  "author": "100ms",
15
15
  "license": "MIT",
16
16
  "repository": {
@@ -82,10 +82,10 @@
82
82
  "react": ">=17.0.2 <19.0.0"
83
83
  },
84
84
  "dependencies": {
85
- "@100mslive/hls-player": "0.2.5-alpha.0",
86
- "@100mslive/hms-virtual-background": "1.12.5-alpha.0",
87
- "@100mslive/react-icons": "0.9.5-alpha.0",
88
- "@100mslive/react-sdk": "0.9.5-alpha.0",
85
+ "@100mslive/hls-player": "0.2.6-alpha.0",
86
+ "@100mslive/hms-virtual-background": "1.12.6-alpha.0",
87
+ "@100mslive/react-icons": "0.9.6-alpha.0",
88
+ "@100mslive/react-sdk": "0.9.6-alpha.0",
89
89
  "@100mslive/types-prebuilt": "0.12.6",
90
90
  "@emoji-mart/data": "^1.0.6",
91
91
  "@emoji-mart/react": "^1.0.1",
@@ -120,5 +120,5 @@
120
120
  "uuid": "^8.3.2",
121
121
  "worker-timers": "^7.0.40"
122
122
  },
123
- "gitHead": "f1a88c4b49cdf442d6eb3d3adcf50b227a56249a"
123
+ "gitHead": "ad5e1f4190299572b1b91c1951bb5d14788efac8"
124
124
  }
@@ -22,6 +22,7 @@ import {
22
22
  QuizIcon,
23
23
  RecordIcon,
24
24
  SettingsIcon,
25
+ VirtualBackgroundIcon,
25
26
  } from '@100mslive/react-icons';
26
27
  import { Box, Loading, Tooltip } from '../../../..';
27
28
  import { Sheet } from '../../../../Sheet';
@@ -55,8 +56,6 @@ import { getFormattedCount } from '../../../common/utils';
55
56
  // @ts-ignore: No implicit any
56
57
  import { SIDE_PANE_OPTIONS } from '../../../common/constants';
57
58
 
58
- // const VirtualBackground = React.lazy(() => import('../../../plugins/VirtualBackground/VirtualBackground'));
59
-
60
59
  const MODALS = {
61
60
  CHANGE_NAME: 'changeName',
62
61
  SELF_ROLE_CHANGE: 'selfRoleChange',
@@ -92,10 +91,10 @@ export const MwebOptions = ({
92
91
  const peerCount = useHMSStore(selectPeerCount);
93
92
  const emojiCardRef = useRef(null);
94
93
  const { isBRBOn, toggleBRB, isHandRaised, toggleHandRaise } = useMyMetadata();
95
- const { toggleAudio, toggleVideo } = useAVToggle();
94
+ const { toggleAudio, toggleVideo, isLocalVideoEnabled } = useAVToggle();
96
95
  const noAVPermissions = !(toggleAudio || toggleVideo);
97
96
  const { unreadPollQuiz, setUnreadPollQuiz } = useUnreadPollQuizPresent();
98
- // const isVideoOn = useHMSStore(selectIsLocalVideoEnabled);
97
+ const toggleVB = useSidepaneToggle(SIDE_PANE_OPTIONS.VB);
99
98
 
100
99
  useDropdownList({ open: openModals.size > 0 || openOptionsSheet || openSettingsSheet, name: 'MoreSettings' });
101
100
 
@@ -182,11 +181,17 @@ export const MwebOptions = ({
182
181
  </ActionTile.Root>
183
182
  ) : null}
184
183
 
185
- {/* {isVideoOn ? (
186
- <Suspense fallback="">
187
- <VirtualBackground asActionTile onVBClick={() => setOpenOptionsSheet(false)} />
188
- </Suspense>
189
- ) : null} */}
184
+ {isLocalVideoEnabled && !!elements?.virtual_background ? (
185
+ <ActionTile.Root
186
+ onClick={() => {
187
+ toggleVB();
188
+ setOpenOptionsSheet(false);
189
+ }}
190
+ >
191
+ <VirtualBackgroundIcon />
192
+ <ActionTile.Title>Virtual Background</ActionTile.Title>
193
+ </ActionTile.Root>
194
+ ) : null}
190
195
 
191
196
  {elements?.emoji_reactions && (
192
197
  <ActionTile.Root
@@ -1,9 +1,9 @@
1
1
  import React, { useEffect, useMemo, useRef, useState } from 'react';
2
2
  import {
3
- HMSPoll,
4
3
  HMSPollState,
5
4
  selectLocalPeerRoleName,
6
5
  selectPermissions,
6
+ selectPolls,
7
7
  useHMSActions,
8
8
  useHMSStore,
9
9
  } from '@100mslive/react-sdk';
@@ -133,7 +133,7 @@ const AddMenu = () => {
133
133
  active={interactionType === INTERACTION_TYPE.QUIZ}
134
134
  />
135
135
  </Flex>
136
- <Flex direction="column">
136
+ <Flex direction="column" css={{ mb: '$10' }}>
137
137
  <Text variant="body2" css={{ mb: '$4' }}>{`Name this ${interactionType.toLowerCase()}`}</Text>
138
138
  <Input
139
139
  ref={inputRef}
@@ -194,20 +194,12 @@ const AddMenu = () => {
194
194
 
195
195
  const PrevMenu = () => {
196
196
  const hmsActions = useHMSActions();
197
- const [polls, setPolls] = useState<HMSPoll[]>([]);
197
+ const polls = useHMSStore(selectPolls);
198
+ const permissions = useHMSStore(selectPermissions);
198
199
 
199
200
  useEffect(() => {
200
- const listPolls = async () => {
201
- const polls = await hmsActions.interactivityCenter.getPolls();
202
- const sortedPolls = await polls
203
- ?.sort((a, b) => (b.createdAt?.getTime() || 0) - (a.createdAt?.getTime() || 0))
204
- ?.sort((a, b) => (b.state === 'started' ? 1 : 0) - (a.state === 'started' ? 1 : 0));
205
- return sortedPolls;
206
- };
207
-
208
201
  const updatePolls = async () => {
209
- const sortedPolls = await listPolls();
210
- setPolls(sortedPolls);
202
+ await hmsActions.interactivityCenter.getPolls();
211
203
  };
212
204
 
213
205
  updatePolls();
@@ -215,21 +207,19 @@ const PrevMenu = () => {
215
207
 
216
208
  return polls?.length ? (
217
209
  <Flex
210
+ direction="column"
218
211
  css={{
219
- borderTop: '$space$px solid $border_bright',
220
- mt: '$10',
221
- pt: '$10',
212
+ width: '100%',
213
+ ...(permissions?.pollWrite ? { borderTop: '$space$px solid $border_bright', paddingTop: '$10' } : {}),
222
214
  }}
223
215
  >
224
- <Flex direction="column" css={{ w: '100%' }}>
225
- <Text variant="h6" css={{ c: '$on_surface_high' }}>
226
- Previous Polls and Quizzes
227
- </Text>
228
- <Flex direction="column" css={{ gap: '$10', mt: '$8' }}>
229
- {polls?.map(poll => (
230
- <InteractionCard key={poll.id} id={poll.id} title={poll.title} status={poll.state} />
231
- ))}
232
- </Flex>
216
+ <Text variant="h6" css={{ c: '$on_surface_high' }}>
217
+ Previous Polls and Quizzes
218
+ </Text>
219
+ <Flex direction="column" css={{ gap: '$10', mt: '$8' }}>
220
+ {polls?.map(poll => (
221
+ <InteractionCard key={poll.id} id={poll.id} title={poll.title} status={poll.state} />
222
+ ))}
233
223
  </Flex>
234
224
  </Flex>
235
225
  ) : null;
@@ -268,7 +268,7 @@ export const PreviewControls = ({ hideSettings, vbEnabled }: { hideSettings: boo
268
268
  >
269
269
  <Flex css={{ gap: '$4' }}>
270
270
  <AudioVideoToggle />
271
- {!isMobile && vbEnabled ? <VBToggle /> : null}
271
+ {vbEnabled ? <VBToggle /> : null}
272
272
  </Flex>
273
273
  {!hideSettings ? <PreviewSettings /> : null}
274
274
  </Flex>
@@ -3,6 +3,7 @@ import { selectIsEffectsEnabled, selectIsLocalVideoEnabled, useHMSStore } from '
3
3
  import { VirtualBackgroundIcon } from '@100mslive/react-icons';
4
4
  import { Tooltip } from '../../../Tooltip';
5
5
  import IconButton from '../../IconButton';
6
+ // @ts-ignore
6
7
  import { useIsSidepaneTypeOpen, useSidepaneToggle } from '../AppData/useSidepane';
7
8
  import { isSafari, SIDE_PANE_OPTIONS } from '../../common/constants';
8
9
 
@@ -308,7 +308,8 @@ const HLSView = () => {
308
308
  align="center"
309
309
  justify="center"
310
310
  css={{
311
- width: '100%',
311
+ width:
312
+ videoRef.current && videoRef.current.clientWidth <= 720 ? `${videoRef.current.clientWidth}px` : '100%',
312
313
  margin: '0 auto',
313
314
  height: '100%',
314
315
  }}
@@ -351,6 +352,7 @@ const HLSView = () => {
351
352
  </IconButton>
352
353
  </Box>
353
354
  )}
355
+
354
356
  <Flex
355
357
  ref={controlsRef}
356
358
  direction="column"
@@ -370,78 +372,90 @@ const HLSView = () => {
370
372
  }}
371
373
  >
372
374
  {!isMobile && (
373
- <HMSVideoPlayer.Controls.Root
374
- css={{
375
- p: '$4 $8',
376
- }}
377
- >
378
- <HMSVideoPlayer.Controls.Left>
379
- <HMSVideoPlayer.PlayButton
380
- onClick={async () => {
381
- isPaused ? await hlsPlayer?.play() : hlsPlayer?.pause();
382
- }}
383
- isPaused={isPaused}
384
- />
385
- <HMSVideoPlayer.Duration hlsPlayer={hlsPlayer} />
386
- <HMSVideoPlayer.Volume hlsPlayer={hlsPlayer} />
387
- <IconButton
388
- variant="standard"
389
- css={{ px: '$2' }}
390
- onClick={async () => {
391
- await hlsPlayer.seekToLivePosition();
392
- setIsVideoLive(true);
393
- }}
394
- key="jump-to-live_btn"
395
- data-testid="jump-to-live_btn"
396
- >
397
- <Tooltip title="Go to Live" side="top">
398
- <Flex justify="center" gap={2} align="center">
399
- <Box
400
- css={{
401
- height: '$4',
402
- width: '$4',
403
- background: isVideoLive ? '$alert_error_default' : '$on_primary_medium',
404
- r: '$1',
405
- }}
406
- />
407
- <Text
408
- variant={{
409
- '@sm': 'xs',
410
- }}
411
- css={{
412
- c: isVideoLive ? '$on_surface_high' : '$on_surface_medium',
413
- }}
414
- >
415
- {isVideoLive ? 'LIVE' : 'GO LIVE'}
416
- </Text>
417
- </Flex>
418
- </Tooltip>
419
- </IconButton>
420
- </HMSVideoPlayer.Controls.Left>
421
-
422
- <HMSVideoPlayer.Controls.Right>
423
- {hasCaptions && (
424
- <HLSCaptionSelector onClick={() => hlsPlayer?.toggleCaption()} isEnabled={isCaptionEnabled} />
425
- )}
426
- {availableLayers.length > 0 ? (
427
- <HLSQualitySelector
428
- layers={availableLayers}
429
- onOpen={setQualityDropDownOpen}
430
- open={qualityDropDownOpen}
431
- selection={currentSelectedQuality}
432
- onQualityChange={handleQuality}
433
- isAuto={isUserSelectedAuto}
375
+ <Flex direction="column">
376
+ <Box>
377
+ {hlsPlayer && (
378
+ <HMSVideoPlayer.Progress
379
+ hlsPlayer={hlsPlayer}
380
+ onValueChange={time => {
381
+ hlsPlayer.seekTo(time);
382
+ }}
434
383
  />
435
- ) : null}
436
- {isFullScreenSupported ? (
437
- <FullScreenButton
438
- isFullScreen={isFullScreen}
439
- onToggle={toggle}
440
- icon={isFullScreen ? <ShrinkIcon /> : <ExpandIcon />}
384
+ )}
385
+ </Box>
386
+ <HMSVideoPlayer.Controls.Root
387
+ css={{
388
+ p: '$4 $8',
389
+ }}
390
+ >
391
+ <HMSVideoPlayer.Controls.Left>
392
+ <HMSVideoPlayer.PlayButton
393
+ onClick={async () => {
394
+ isPaused ? await hlsPlayer?.play() : hlsPlayer?.pause();
395
+ }}
396
+ isPaused={isPaused}
441
397
  />
442
- ) : null}
443
- </HMSVideoPlayer.Controls.Right>
444
- </HMSVideoPlayer.Controls.Root>
398
+ <HMSVideoPlayer.Duration hlsPlayer={hlsPlayer} />
399
+ <HMSVideoPlayer.Volume hlsPlayer={hlsPlayer} />
400
+ <IconButton
401
+ variant="standard"
402
+ css={{ px: '$2' }}
403
+ onClick={async () => {
404
+ await hlsPlayer.seekToLivePosition();
405
+ setIsVideoLive(true);
406
+ }}
407
+ key="jump-to-live_btn"
408
+ data-testid="jump-to-live_btn"
409
+ >
410
+ <Tooltip title="Go to Live" side="top">
411
+ <Flex justify="center" gap={2} align="center">
412
+ <Box
413
+ css={{
414
+ height: '$4',
415
+ width: '$4',
416
+ background: isVideoLive ? '$alert_error_default' : '$on_primary_medium',
417
+ r: '$1',
418
+ }}
419
+ />
420
+ <Text
421
+ variant={{
422
+ '@sm': 'xs',
423
+ }}
424
+ css={{
425
+ c: isVideoLive ? '$on_surface_high' : '$on_surface_medium',
426
+ }}
427
+ >
428
+ {isVideoLive ? 'LIVE' : 'GO LIVE'}
429
+ </Text>
430
+ </Flex>
431
+ </Tooltip>
432
+ </IconButton>
433
+ </HMSVideoPlayer.Controls.Left>
434
+
435
+ <HMSVideoPlayer.Controls.Right>
436
+ {hasCaptions && (
437
+ <HLSCaptionSelector onClick={() => hlsPlayer?.toggleCaption()} isEnabled={isCaptionEnabled} />
438
+ )}
439
+ {availableLayers.length > 0 ? (
440
+ <HLSQualitySelector
441
+ layers={availableLayers}
442
+ onOpen={setQualityDropDownOpen}
443
+ open={qualityDropDownOpen}
444
+ selection={currentSelectedQuality}
445
+ onQualityChange={handleQuality}
446
+ isAuto={isUserSelectedAuto}
447
+ />
448
+ ) : null}
449
+ {isFullScreenSupported ? (
450
+ <FullScreenButton
451
+ isFullScreen={isFullScreen}
452
+ onToggle={toggle}
453
+ icon={isFullScreen ? <ShrinkIcon /> : <ExpandIcon />}
454
+ />
455
+ ) : null}
456
+ </HMSVideoPlayer.Controls.Right>
457
+ </HMSVideoPlayer.Controls.Root>
458
+ </Flex>
445
459
  )}
446
460
  </Flex>
447
461
  </HMSVideoPlayer.Root>