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

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",
13
+ "version": "0.2.6-alpha.1",
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",
86
- "@100mslive/hms-virtual-background": "1.12.5",
87
- "@100mslive/react-icons": "0.9.5",
88
- "@100mslive/react-sdk": "0.9.5",
85
+ "@100mslive/hls-player": "0.2.6-alpha.1",
86
+ "@100mslive/hms-virtual-background": "1.12.6-alpha.1",
87
+ "@100mslive/react-icons": "0.9.6-alpha.1",
88
+ "@100mslive/react-sdk": "0.9.6-alpha.1",
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": "f5d7f30ea4d999fdc3ebcfe3c277153b97ac8f7b"
123
+ "gitHead": "d85daadafe177c535fb1203a0e377042b5502a3e"
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
@@ -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>
File without changes