@100mslive/roomkit-react 0.3.20-alpha.3 → 0.3.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/dist/{HLSView-YFTHW2VY.js → HLSView-6QAHWMQF.js} +47 -63
  2. package/dist/HLSView-6QAHWMQF.js.map +7 -0
  3. package/dist/{HLSView-KKVZM355.css → HLSView-E242LM6X.css} +3 -3
  4. package/dist/{HLSView-KKVZM355.css.map → HLSView-E242LM6X.css.map} +1 -1
  5. package/dist/Prebuilt/AppContext.d.ts +1 -1
  6. package/dist/Prebuilt/components/AuthToken.d.ts +1 -1
  7. package/dist/Prebuilt/components/VirtualBackground/VBHandler.d.ts +0 -1
  8. package/dist/{chunk-Y3UYAB6J.js → chunk-ACEDLM3B.js} +532 -561
  9. package/dist/chunk-ACEDLM3B.js.map +7 -0
  10. package/dist/index.cjs.css +2 -2
  11. package/dist/index.cjs.css.map +1 -1
  12. package/dist/index.cjs.js +573 -619
  13. package/dist/index.cjs.js.map +4 -4
  14. package/dist/index.css +2 -2
  15. package/dist/index.css.map +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/meta.cjs.json +66 -86
  18. package/dist/meta.esbuild.json +78 -98
  19. package/package.json +7 -7
  20. package/src/Prebuilt/App.tsx +5 -5
  21. package/src/Prebuilt/AppContext.tsx +1 -1
  22. package/src/Prebuilt/components/AuthToken.tsx +1 -1
  23. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +4 -24
  24. package/src/Prebuilt/components/MoreSettings/ChangeNameContent.tsx +3 -13
  25. package/src/Prebuilt/components/MoreSettings/ChangeNameModal.tsx +1 -1
  26. package/src/Prebuilt/components/Notifications/TrackUnmuteModal.tsx +1 -1
  27. package/src/Prebuilt/components/ScreenshareTile.tsx +2 -2
  28. package/src/Prebuilt/components/Settings/SettingsModal.jsx +2 -1
  29. package/src/Prebuilt/components/TileMenu/TileMenu.tsx +6 -7
  30. package/src/Prebuilt/components/TileMenu/TileMenuContent.tsx +3 -3
  31. package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +2 -4
  32. package/src/Prebuilt/components/VideoTile.tsx +2 -2
  33. package/src/Prebuilt/components/VirtualBackground/VBHandler.tsx +1 -13
  34. package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +2 -3
  35. package/src/Prebuilt/components/{peerTileUtils.tsx → peerTileUtils.jsx} +6 -21
  36. package/src/Prebuilt/layouts/HLSView.jsx +5 -2
  37. package/dist/HLSView-YFTHW2VY.js.map +0 -7
  38. package/dist/Prebuilt/components/peerTileUtils.d.ts +0 -7
  39. package/dist/chunk-Y3UYAB6J.js.map +0 -7
@@ -1,28 +1,7 @@
1
- import React, { forwardRef, useEffect, useState } from 'react';
1
+ import React, { forwardRef } from 'react';
2
2
  import { Flex } from '../../../Layout';
3
3
 
4
4
  export const HMSVideo = forwardRef(({ children, ...props }, videoRef) => {
5
- const [width, setWidth] = useState('auto');
6
-
7
- useEffect(() => {
8
- const updatingVideoWidth = () => {
9
- const videoEl = videoRef.current;
10
- if (!videoEl) {
11
- return;
12
- }
13
- if (videoEl.videoWidth > videoEl.videoHeight && width !== '100%') {
14
- setWidth('100%');
15
- }
16
- };
17
- const videoEl = videoRef.current;
18
- if (!videoEl) {
19
- return;
20
- }
21
- videoEl.addEventListener('loadedmetadata', updatingVideoWidth);
22
- return () => {
23
- videoEl.removeEventListener('loadedmetadata', updatingVideoWidth);
24
- };
25
- }, []);
26
5
  return (
27
6
  <Flex
28
7
  data-testid="hms-video"
@@ -32,8 +11,9 @@ export const HMSVideo = forwardRef(({ children, ...props }, videoRef) => {
32
11
  justifyContent: 'center',
33
12
  transition: 'all 0.3s ease-in-out',
34
13
  '@md': {
14
+ height: 'auto',
35
15
  '& video': {
36
- height: props.isFullScreen ? '' : '$60 !important',
16
+ height: '$60 !important',
37
17
  },
38
18
  },
39
19
  '& video::cue': {
@@ -61,7 +41,7 @@ export const HMSVideo = forwardRef(({ children, ...props }, videoRef) => {
61
41
  style={{
62
42
  margin: '0 auto',
63
43
  objectFit: 'contain',
64
- width: width,
44
+ width: 'auto',
65
45
  height: '100%',
66
46
  maxWidth: '100%',
67
47
  }}
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useRef } from 'react';
1
+ import React from 'react';
2
2
  import { ChevronLeftIcon, CrossIcon } from '@100mslive/react-icons';
3
3
  import { Button } from '../../../Button';
4
4
  import { Input } from '../../../Input';
@@ -22,16 +22,6 @@ export const ChangeNameContent = ({
22
22
  onExit: () => void;
23
23
  onBackClick: () => void;
24
24
  }) => {
25
- const inputRef = useRef<HTMLInputElement>(null);
26
-
27
- useEffect(() => {
28
- if (isMobile) {
29
- setTimeout(() => {
30
- inputRef.current?.focus();
31
- }, 200);
32
- }
33
- }, [isMobile]);
34
-
35
25
  return (
36
26
  <form
37
27
  onSubmit={async e => {
@@ -63,10 +53,10 @@ export const ChangeNameContent = ({
63
53
  </Text>
64
54
  <Flex justify="center" align="center" css={{ my: '$8', w: '100%', '@md': { px: '$8' } }}>
65
55
  <Input
66
- ref={inputRef}
67
56
  css={{ width: '100%', bg: '$surface_default' }}
68
57
  value={currentName}
69
- type="text"
58
+ // Prevents popup from showing up on chrome mweb
59
+ type={isMobile ? 'search' : 'text'}
70
60
  onChange={e => {
71
61
  setCurrentName(e.target.value);
72
62
  }}
@@ -58,7 +58,7 @@ export const ChangeNameModal = ({
58
58
  if (isMobile) {
59
59
  return (
60
60
  <Sheet.Root defaultOpen onOpenChange={onOpenChange}>
61
- <Sheet.Content css={{ bg: '$surface_dim', p: '$8 0' }} onOpenAutoFocus={e => e.preventDefault()}>
61
+ <Sheet.Content css={{ bg: '$surface_dim', p: '$8 0' }}>
62
62
  <ChangeNameContent {...props} />
63
63
  </Sheet.Content>
64
64
  </Sheet.Root>
@@ -44,7 +44,7 @@ export const TrackUnmuteModal = () => {
44
44
  <RequestDialog
45
45
  title={`Unmute your ${track.type}?`}
46
46
  onOpenChange={(value: boolean) => !value && setMuteNotification(null)}
47
- body={`${peer?.name} is requesting you to unmute your ${track?.type}.`}
47
+ body={`${peer?.name}is requesting you to unmute your ${track?.type}.`}
48
48
  onAction={() => {
49
49
  hmsActions.setEnabledTrack(track.id, enabled);
50
50
  setMuteNotification(null);
@@ -16,6 +16,7 @@ import { config as cssConfig, useTheme } from '../../Theme';
16
16
  import { Video } from '../../Video';
17
17
  import { StyledVideoTile } from '../../VideoTile';
18
18
  import { LayoutModeSelector } from './LayoutModeSelector';
19
+ // @ts-ignore: No implicit Any
19
20
  import { getVideoTileLabel } from './peerTileUtils';
20
21
  import { ScreenshareDisplay } from './ScreenshareDisplay';
21
22
  // @ts-ignore: No implicit Any
@@ -61,8 +62,7 @@ const Tile = ({ peerId, width = '100%', height = '100%' }: { peerId: string; wid
61
62
  const label = getVideoTileLabel({
62
63
  peerName: peer?.name,
63
64
  isLocal: false,
64
- videoTrack: track,
65
- audioTrack,
65
+ track,
66
66
  });
67
67
 
68
68
  return (
@@ -140,6 +140,7 @@ const MobileSettingModal = ({
140
140
  <Flex
141
141
  direction="column"
142
142
  css={{
143
+ px: '$8',
143
144
  pb: '$8',
144
145
  overflowY: 'auto',
145
146
  }}
@@ -158,7 +159,7 @@ const MobileSettingModal = ({
158
159
  css={{
159
160
  all: 'unset',
160
161
  fontFamily: '$sans',
161
- p: '$10 $8',
162
+ py: '$10',
162
163
  display: 'flex',
163
164
  alignItems: 'center',
164
165
  fontSize: '$sm',
@@ -1,7 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { useMedia } from 'react-use';
3
3
  import {
4
- HMSAudioTrack,
5
4
  HMSVideoTrack,
6
5
  selectLocalPeerID,
7
6
  selectPeerByID,
@@ -18,7 +17,6 @@ import { Text } from '../../../Text';
18
17
  import { config as cssConfig, useTheme } from '../../../Theme';
19
18
  import { StyledMenuTile } from '../../../TileMenu';
20
19
  import { ChangeNameModal } from '../MoreSettings/ChangeNameModal';
21
- import { getVideoTileLabel } from '../peerTileUtils';
22
20
  import { RoleChangeModal } from '../RoleChangeModal';
23
21
  import { TileMenuContent } from './TileMenuContent';
24
22
  import { useDropdownList } from '../hooks/useDropdownList';
@@ -54,8 +52,7 @@ const TileMenu = ({
54
52
  const isPrimaryVideoTrack = useHMSStore(selectVideoTrackByPeerID(peerID))?.id === videoTrackID;
55
53
  const showPinAction = !!(audioTrackID || (videoTrackID && isPrimaryVideoTrack));
56
54
 
57
- const track = useHMSStore(selectTrackByID(videoTrackID)) as HMSVideoTrack | null;
58
- const audioTrack = useHMSStore(selectTrackByID(audioTrackID)) as HMSAudioTrack | null;
55
+ const track = useHMSStore(selectTrackByID(videoTrackID)) as HMSVideoTrack;
59
56
  const hideSimulcastLayers = !track?.layerDefinitions?.length || track.degraded || !track.enabled;
60
57
  const isMobile = useMedia(cssConfig.media.md);
61
58
  const peer = useHMSStore(selectPeerByID(peerID));
@@ -64,19 +61,20 @@ const TileMenu = ({
64
61
  useDropdownList({ open, name: 'TileMenu' });
65
62
  const dragClassName = getDragClassName();
66
63
 
67
- if (!peer || (!(removeOthers || toggleAudio || toggleVideo || setVolume || showPinAction) && hideSimulcastLayers)) {
64
+ if (!(removeOthers || toggleAudio || toggleVideo || setVolume || showPinAction) && hideSimulcastLayers) {
68
65
  return null;
69
66
  }
70
67
 
71
68
  const openNameChangeModal = () => setShowNameChangeModal(true);
72
69
  const openRoleChangeModal = () => setShowRoleChangeModal(true);
73
70
 
74
- const props: React.ComponentPropsWithoutRef<typeof TileMenuContent> = {
71
+ const props = {
75
72
  isLocal,
76
73
  isScreenshare,
77
74
  audioTrackID,
78
75
  videoTrackID,
79
76
  peerID,
77
+ isPrimaryVideoTrack,
80
78
  showSpotlight,
81
79
  showPinAction,
82
80
  canMinimise,
@@ -113,7 +111,8 @@ const TileMenu = ({
113
111
  >
114
112
  <Box>
115
113
  <Text css={{ color: '$on_surface_high', fontWeight: '$semiBold' }}>
116
- {getVideoTileLabel({ peerName: peer?.name, isLocal, audioTrack, videoTrack: track })}
114
+ {peer?.name}
115
+ {isLocal ? ` (You)` : null}
117
116
  </Text>
118
117
  {peer?.roleName ? (
119
118
  <Text variant="xs" css={{ color: '$on_surface_low', mt: '$2' }}>
@@ -41,7 +41,7 @@ import { useSetAppDataByKey } from '../AppData/useUISettings';
41
41
  // @ts-ignore
42
42
  import { useDropdownSelection } from '../hooks/useDropdownSelection';
43
43
  import { getDragClassName } from './utils';
44
- import { APP_DATA, isIOS, REMOTE_STOP_SCREENSHARE_TYPE, SESSION_STORE_KEY } from '../../common/constants';
44
+ import { APP_DATA, REMOTE_STOP_SCREENSHARE_TYPE, SESSION_STORE_KEY } from '../../common/constants';
45
45
 
46
46
  export const isSameTile = ({
47
47
  trackId,
@@ -317,7 +317,7 @@ export const TileMenuContent = ({
317
317
  </StyledMenuTile.ItemButton>
318
318
  ) : null}
319
319
 
320
- {!isScreenshare && canChangeRole && roles.length > 1 ? (
320
+ {canChangeRole && roles.length > 1 ? (
321
321
  <StyledMenuTile.ItemButton
322
322
  className={dragClassName}
323
323
  css={spacingCSS}
@@ -332,7 +332,7 @@ export const TileMenuContent = ({
332
332
  </StyledMenuTile.ItemButton>
333
333
  ) : null}
334
334
 
335
- {!isIOS && audioTrackID ? (
335
+ {audioTrackID ? (
336
336
  <StyledMenuTile.VolumeItem data-testid="participant_volume_slider" css={{ ...spacingCSS, mb: '$0' }}>
337
337
  <Flex align="center" gap={1}>
338
338
  <SpeakerIcon height={20} width={20} />
@@ -1,6 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { useMedia } from 'react-use';
3
- import { selectPeerCount, useHMSStore } from '@100mslive/react-sdk';
4
3
  import { PeopleAddIcon } from '@100mslive/react-icons';
5
4
  import { Flex } from '../../../Layout';
6
5
  import { config as cssConfig } from '../../../Theme';
@@ -18,7 +17,6 @@ export function EqualProminence({ isInsetEnabled = false, peers, onPageChange, o
18
17
  const isMobile = useMedia(cssConfig.media.md);
19
18
  let maxTileCount = useUISettings(UI_SETTINGS.maxTileCount);
20
19
  maxTileCount = isMobile ? Math.min(maxTileCount, 6) : maxTileCount;
21
- const peerCount = useHMSStore(selectPeerCount);
22
20
  const pageList = usePagesWithTiles({
23
21
  peers,
24
22
  maxTileCount,
@@ -53,8 +51,8 @@ export function EqualProminence({ isInsetEnabled = false, peers, onPageChange, o
53
51
  )}
54
52
  {pageList.length === 0 ? (
55
53
  <WaitingView
56
- title={peerCount <= 1 ? "You're the only one here" : 'Glad to have you here'}
57
- subtitle={peerCount <= 1 ? 'Sit back and relax till others join' : ''}
54
+ title="You're the first to join"
55
+ subtitle="Sit back and relax till others join"
58
56
  icon={<PeopleAddIcon width="56px" height="56px" style={{ color: 'white' }} />}
59
57
  />
60
58
  ) : null}
@@ -20,6 +20,7 @@ import { VideoTileStats } from '../../Stats';
20
20
  import { CSS } from '../../Theme';
21
21
  import { Video } from '../../Video';
22
22
  import { StyledVideoTile } from '../../VideoTile';
23
+ // @ts-ignore: No implicit Any
23
24
  import { getVideoTileLabel } from './peerTileUtils';
24
25
  // @ts-ignore: No implicit Any
25
26
  import { useSetAppDataByKey, useUISettings } from './AppData/useUISettings';
@@ -100,9 +101,8 @@ const Tile = ({
100
101
  });
101
102
  const label = getVideoTileLabel({
102
103
  peerName,
104
+ track,
103
105
  isLocal,
104
- videoTrack: track,
105
- audioTrack,
106
106
  });
107
107
  const onHoverHandler = useCallback((event: React.MouseEvent) => {
108
108
  setIsMouseHovered(event.type === 'mouseenter');
@@ -2,7 +2,7 @@
2
2
  // eslint-disable-next-line
3
3
  import { HMSVBPlugin, HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background/hmsvbplugin';
4
4
  import { parsedUserAgent } from '@100mslive/react-sdk';
5
- import { isIOS, isSafari } from '../../common/constants';
5
+ import { isSafari } from '../../common/constants';
6
6
  export class VBPlugin {
7
7
  private hmsPlugin?: HMSVBPlugin;
8
8
  private effectsPlugin?: any;
@@ -103,18 +103,6 @@ export class VBPlugin {
103
103
  this.hmsPlugin = undefined;
104
104
  };
105
105
 
106
- isBlurSupported = () => {
107
- if ((isSafari || isIOS) && this.hmsPlugin) {
108
- return false;
109
- }
110
-
111
- if (this.effectsPlugin) {
112
- return true;
113
- }
114
-
115
- return false;
116
- };
117
-
118
106
  isEffectsSupported = () => {
119
107
  if (!isSafari) {
120
108
  return true;
@@ -57,7 +57,6 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
57
57
  const background = useHMSStore(selectAppData(APP_DATA.background));
58
58
  const mediaList = backgroundMedia.map((media: VirtualBackgroundMedia) => media.url || '');
59
59
  const pluginLoadingRef = useRef(false);
60
- const isBlurSupported = VBHandler?.isBlurSupported();
61
60
 
62
61
  const inPreview = roomState === HMSRoomState.Preview;
63
62
  // Hidden in preview as the effect will be visible in the preview tile
@@ -191,7 +190,7 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
191
190
  await VBHandler?.setBlur(blurAmount);
192
191
  hmsActions.setAppData(APP_DATA.background, HMSVirtualBackgroundTypes.BLUR);
193
192
  },
194
- supported: isBlurSupported,
193
+ supported: isEffectsSupported && isEffectsEnabled,
195
194
  },
196
195
  ]}
197
196
  activeBackground={background}
@@ -199,7 +198,7 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
199
198
 
200
199
  {/* Slider */}
201
200
  <Flex direction="column" css={{ w: '100%', gap: '$8', mt: '$8' }}>
202
- {background === HMSVirtualBackgroundTypes.BLUR && isBlurSupported ? (
201
+ {background === HMSVirtualBackgroundTypes.BLUR && isEffectsEnabled && effectsKey ? (
203
202
  <Box>
204
203
  <Text variant="sm" css={{ color: '$on_surface_high', fontWeight: '$semiBold', mb: '$4' }}>
205
204
  Blur intensity
@@ -1,8 +1,4 @@
1
- import { HMSAudioTrack, HMSVideoTrack } from '@100mslive/react-sdk';
2
-
3
1
  const PEER_NAME_PLACEHOLDER = 'peerName';
4
-
5
- // Map [isLocal, videoSource] to the label to be displayed.
6
2
  const labelMap = new Map([
7
3
  [[true, 'screen'].toString(), 'Your Screen'],
8
4
  [[true, 'regular'].toString(), `You (${PEER_NAME_PLACEHOLDER})`],
@@ -12,30 +8,19 @@ const labelMap = new Map([
12
8
  [[false, undefined].toString(), `${PEER_NAME_PLACEHOLDER}`],
13
9
  ]);
14
10
 
15
- export const getVideoTileLabel = ({
16
- peerName,
17
- isLocal,
18
- videoTrack,
19
- audioTrack,
20
- }: {
21
- isLocal: boolean;
22
- peerName?: string;
23
- videoTrack?: HMSVideoTrack | null;
24
- audioTrack?: HMSAudioTrack | null;
25
- }) => {
11
+ export const getVideoTileLabel = ({ peerName, isLocal, track }) => {
26
12
  const isPeerPresent = peerName !== undefined;
27
- if (!isPeerPresent || !videoTrack) {
13
+ if (!isPeerPresent || !track) {
28
14
  // for peers with only audio track
29
- const label = labelMap.get([isLocal, undefined].toString());
30
- return isPeerPresent && label ? label.replace(PEER_NAME_PLACEHOLDER, peerName) : '';
15
+ return isPeerPresent ? labelMap.get([isLocal, undefined].toString()).replace(PEER_NAME_PLACEHOLDER, peerName) : '';
31
16
  }
32
- const isLocallyMuted = audioTrack?.volume === 0;
17
+ const isLocallyMuted = track.volume === 0;
33
18
  // Map [isLocal, videoSource] to the label to be displayed.
34
- let label = labelMap.get([isLocal, videoTrack.source].toString());
19
+ let label = labelMap.get([isLocal, track.source].toString());
35
20
  if (label) {
36
21
  label = label.replace(PEER_NAME_PLACEHOLDER, peerName);
37
22
  } else {
38
- label = `${peerName} ${videoTrack.source}`;
23
+ label = `${peerName} ${track.source}`;
39
24
  }
40
25
  // label = `${label}${track.degraded ? '(Degraded)' : ''}`;
41
26
  return `${label}${isLocallyMuted ? ' (Muted for you)' : ''}`;
@@ -485,6 +485,11 @@ const HLSView = () => {
485
485
  css={{
486
486
  flex: isLandscape ? '2 1 0' : '1 1 0',
487
487
  transition: 'all 0.3s ease-in-out',
488
+ '&:fullscreen': {
489
+ '& video': {
490
+ height: 'unset !important',
491
+ },
492
+ },
488
493
  }}
489
494
  >
490
495
  {hlsViewRef.current && (isMobile || isLandscape) && (
@@ -536,7 +541,6 @@ const HLSView = () => {
536
541
  onMouseMove={onHoverHandler}
537
542
  onMouseLeave={onHoverHandler}
538
543
  onClick={onClickHandler}
539
- isFullScreen={isFullScreen}
540
544
  onDoubleClick={e => {
541
545
  onDoubleClickHandler(e);
542
546
  }}
@@ -724,7 +728,6 @@ const HLSView = () => {
724
728
  selection={currentSelectedQuality}
725
729
  onQualityChange={handleQuality}
726
730
  isAuto={isUserSelectedAuto}
727
- containerRef={hlsViewRef.current}
728
731
  />
729
732
  ) : null}
730
733
  {isFullScreenSupported ? (