@100mslive/roomkit-react 0.2.8-alpha.1 → 0.2.8-alpha.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. package/dist/HLSView-FBEGJ3L7.js +1396 -0
  2. package/dist/HLSView-FBEGJ3L7.js.map +7 -0
  3. package/dist/Prebuilt/common/hooks.d.ts +3 -0
  4. package/dist/Prebuilt/components/Chat/MwebChatOption.d.ts +1 -1
  5. package/dist/Prebuilt/components/HMSVideo/FullscreenButton.d.ts +5 -0
  6. package/dist/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.d.ts +5 -0
  7. package/dist/Prebuilt/components/HMSVideo/HLSCaptionSelector.d.ts +1 -2
  8. package/dist/Prebuilt/components/HMSVideo/HLSQualitySelector.d.ts +13 -0
  9. package/dist/Prebuilt/components/HMSVideo/MwebHLSViewTitle.d.ts +2 -0
  10. package/dist/Prebuilt/components/HMSVideo/PlayButton.d.ts +6 -0
  11. package/dist/Prebuilt/components/HMSVideo/PlayPauseButton.d.ts +6 -0
  12. package/dist/Prebuilt/components/HMSVideo/PlayerContext.d.ts +8 -0
  13. package/dist/Prebuilt/components/HMSVideo/SeekControls.d.ts +7 -0
  14. package/dist/Prebuilt/components/HMSVideo/VideoProgress.d.ts +5 -0
  15. package/dist/Prebuilt/components/HMSVideo/VideoTime.d.ts +2 -0
  16. package/dist/Prebuilt/components/HMSVideo/VolumeControl.d.ts +2 -0
  17. package/dist/Prebuilt/components/HMSVideo/index.d.ts +26 -0
  18. package/dist/Prebuilt/components/HMSVideo/utils.d.ts +8 -0
  19. package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +2 -1
  20. package/dist/Prebuilt/components/Leave/LeaveRoom.d.ts +2 -1
  21. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +2 -3
  22. package/dist/Prebuilt/components/MwebLandscapePrompt.d.ts +1 -1
  23. package/dist/Prebuilt/components/RaiseHand.d.ts +5 -0
  24. package/dist/Prebuilt/components/SidePaneTabs.d.ts +1 -1
  25. package/dist/Sheet/Sheet.d.ts +1 -0
  26. package/dist/{chunk-ERIM35YN.js → chunk-R2JJJQR3.js} +1539 -1173
  27. package/dist/chunk-R2JJJQR3.js.map +7 -0
  28. package/dist/index.cjs.js +2709 -1898
  29. package/dist/index.cjs.js.map +4 -4
  30. package/dist/index.js +1 -1
  31. package/dist/meta.cjs.json +777 -290
  32. package/dist/meta.esbuild.json +796 -298
  33. package/package.json +7 -6
  34. package/src/Button/Button.tsx +4 -4
  35. package/src/Fieldset/Fieldset.tsx +1 -1
  36. package/src/Input/PasswordInput.stories.tsx +1 -1
  37. package/src/Pagination/StyledPagination.stories.tsx +2 -2
  38. package/src/Prebuilt/IconButton.tsx +1 -1
  39. package/src/Prebuilt/common/hooks.ts +21 -0
  40. package/src/Prebuilt/components/AppData/useSidepane.js +34 -7
  41. package/src/Prebuilt/components/AuthToken.jsx +1 -1
  42. package/src/Prebuilt/components/Chat/Chat.tsx +41 -1
  43. package/src/Prebuilt/components/Chat/ChatFooter.tsx +33 -13
  44. package/src/Prebuilt/components/Chat/MwebChatOption.tsx +1 -1
  45. package/src/Prebuilt/components/ConferenceScreen.tsx +48 -7
  46. package/src/Prebuilt/components/EmojiReaction.jsx +33 -23
  47. package/src/Prebuilt/components/Footer/Footer.tsx +0 -1
  48. package/src/Prebuilt/components/Footer/RoleOptions.tsx +138 -125
  49. package/src/Prebuilt/components/HMSVideo/Controls.jsx +1 -1
  50. package/src/Prebuilt/components/HMSVideo/FullscreenButton.tsx +13 -0
  51. package/src/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.tsx +72 -0
  52. package/src/Prebuilt/components/HMSVideo/HLSCaptionSelector.tsx +4 -2
  53. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.tsx +248 -0
  54. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +17 -7
  55. package/src/Prebuilt/components/HMSVideo/MwebHLSViewTitle.tsx +84 -0
  56. package/src/Prebuilt/components/HMSVideo/PlayButton.tsx +27 -0
  57. package/src/Prebuilt/components/HMSVideo/PlayPauseButton.tsx +27 -0
  58. package/src/Prebuilt/components/HMSVideo/PlayerContext.tsx +15 -0
  59. package/src/Prebuilt/components/HMSVideo/SeekControls.tsx +22 -0
  60. package/src/Prebuilt/components/HMSVideo/VideoProgress.tsx +95 -0
  61. package/src/Prebuilt/components/HMSVideo/VideoTime.tsx +43 -0
  62. package/src/Prebuilt/components/HMSVideo/{VolumeControl.jsx → VolumeControl.tsx} +6 -4
  63. package/src/Prebuilt/components/HMSVideo/{index.js → index.ts} +6 -2
  64. package/src/Prebuilt/components/HMSVideo/{HMSVIdeoUtils.js → utils.ts} +5 -5
  65. package/src/Prebuilt/components/Header/StreamActions.tsx +1 -1
  66. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.tsx +1 -1
  67. package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +50 -46
  68. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +15 -4
  69. package/src/Prebuilt/components/Leave/MwebLeaveRoom.tsx +46 -27
  70. package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +3 -1
  71. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +37 -31
  72. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +12 -8
  73. package/src/Prebuilt/components/MwebLandscapePrompt.tsx +14 -3
  74. package/src/Prebuilt/components/Notifications/HandRaisedNotifications.tsx +5 -2
  75. package/src/Prebuilt/components/Notifications/PeerNotifications.tsx +1 -1
  76. package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +19 -8
  77. package/src/Prebuilt/components/Polls/Voting/Voting.tsx +3 -2
  78. package/src/Prebuilt/components/Polls/common/OptionInputWithDelete.tsx +1 -1
  79. package/src/Prebuilt/components/Polls/common/utils.ts +2 -2
  80. package/src/Prebuilt/components/RaiseHand.tsx +24 -0
  81. package/src/Prebuilt/components/RoomDetails/RoomDetailsPane.tsx +41 -14
  82. package/src/Prebuilt/components/SidePaneTabs.tsx +56 -48
  83. package/src/Prebuilt/components/StatsForNerds.jsx +14 -6
  84. package/src/Prebuilt/components/Streaming/Common.jsx +1 -1
  85. package/src/Prebuilt/components/TileMenu/TileMenuContent.tsx +2 -2
  86. package/src/Prebuilt/components/Toast/ToastBatcher.js +8 -1
  87. package/src/Prebuilt/components/Toast/ToastConfig.jsx +17 -0
  88. package/src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx +2 -2
  89. package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +1 -1
  90. package/src/Prebuilt/layouts/HLSView.jsx +359 -178
  91. package/src/Prebuilt/layouts/SidePane.tsx +145 -59
  92. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +22 -2
  93. package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
  94. package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +1 -1
  95. package/src/Sheet/Sheet.tsx +7 -3
  96. package/dist/HLSView-SJCF34GE.js +0 -987
  97. package/dist/HLSView-SJCF34GE.js.map +0 -7
  98. package/dist/chunk-ERIM35YN.js.map +0 -7
  99. package/src/Prebuilt/components/HMSVideo/FullscreenButton.jsx +0 -18
  100. package/src/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.jsx +0 -35
  101. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +0 -127
  102. package/src/Prebuilt/components/HMSVideo/PlayButton.jsx +0 -13
  103. package/src/Prebuilt/components/HMSVideo/VideoProgress.jsx +0 -76
  104. package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +0 -33
  105. package/src/Prebuilt/components/RaiseHand.jsx +0 -17
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { Flex, IconButton, Tooltip } from '../../../';
3
-
4
- export const FullScreenButton = ({ isFullScreen, icon, onToggle }) => {
5
- return (
6
- <Tooltip title={`${isFullScreen ? 'Exit' : 'Go'} fullscreen`} side="top">
7
- <IconButton
8
- variant="standard"
9
- css={{ margin: '0px' }}
10
- onClick={onToggle}
11
- key="fullscreen_btn"
12
- data-testid="fullscreen_btn"
13
- >
14
- <Flex>{icon}</Flex>
15
- </IconButton>
16
- </Tooltip>
17
- );
18
- };
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import { Button, Dialog, Text } from '../../../';
3
- import { DialogContent, DialogRow } from '../../primitives/DialogContent';
4
-
5
- export function HLSAutoplayBlockedPrompt({ open, unblockAutoPlay }) {
6
- return (
7
- <Dialog.Root
8
- open={open}
9
- onOpenChange={value => {
10
- if (!value) {
11
- unblockAutoPlay();
12
- }
13
- }}
14
- >
15
- <DialogContent title="Attention" closeable={false}>
16
- <DialogRow>
17
- <Text variant="md">
18
- The browser wants us to get a confirmation for playing the HLS Stream. Please click "play stream" to
19
- proceed.
20
- </Text>
21
- </DialogRow>
22
- <DialogRow justify="end">
23
- <Button
24
- variant="primary"
25
- onClick={() => {
26
- unblockAutoPlay();
27
- }}
28
- >
29
- Play stream
30
- </Button>
31
- </DialogRow>
32
- </DialogContent>
33
- </Dialog.Root>
34
- );
35
- }
@@ -1,127 +0,0 @@
1
- import React from 'react';
2
- import { CheckIcon, SettingsIcon } from '@100mslive/react-icons';
3
- import { Box, Dropdown, Flex, Text, Tooltip } from '../../../';
4
-
5
- export function HLSQualitySelector({ open, onOpen, layers, onQualityChange, selection, isAuto }) {
6
- return (
7
- <Dropdown.Root open={open} onOpenChange={value => onOpen(value)}>
8
- <Dropdown.Trigger asChild data-testid="quality_selector">
9
- <Flex
10
- css={{
11
- color: '$on_primary_high',
12
- r: '$1',
13
- cursor: 'pointer',
14
- p: '$2',
15
- }}
16
- >
17
- <Tooltip title="Select Quality" side="top">
18
- <Flex align="center">
19
- <Box
20
- css={{
21
- w: '$9',
22
- h: '$9',
23
- display: 'inline-flex',
24
- alignItems: 'center',
25
- c: '$on_surface_high',
26
- }}
27
- >
28
- <SettingsIcon />
29
- </Box>
30
- <Text
31
- variant={{
32
- '@md': 'sm',
33
- '@sm': 'xs',
34
- '@xs': 'tiny',
35
- }}
36
- css={{ display: 'flex', alignItems: 'center', ml: '$2', c: '$on_surface_medium' }}
37
- >
38
- {isAuto && (
39
- <>
40
- Auto
41
- <Box
42
- css={{
43
- mx: '$2',
44
- w: '$2',
45
- h: '$2',
46
- background: '$on_surface_medium',
47
- r: '$1',
48
- }}
49
- />
50
- </>
51
- )}
52
- {selection && Math.min(selection.width, selection.height)}p
53
- </Text>
54
- </Flex>
55
- </Tooltip>
56
- </Flex>
57
- </Dropdown.Trigger>
58
- {layers.length > 0 && (
59
- <Dropdown.Content
60
- sideOffset={5}
61
- align="end"
62
- css={{
63
- height: 'auto',
64
- maxHeight: '$52',
65
- w: '$40',
66
- bg: '$surface_bright',
67
- py: '$4',
68
- gap: '$4',
69
- display: 'grid',
70
- }}
71
- >
72
- {layers.map(layer => {
73
- return (
74
- <Dropdown.Item
75
- onClick={() => onQualityChange(layer)}
76
- key={layer.width}
77
- css={{
78
- bg:
79
- !isAuto && layer.width === selection?.width && layer.height === selection?.height
80
- ? '$surface_default'
81
- : '$surface_bright',
82
- '&:hover': {
83
- bg: '$surface_brighter',
84
- },
85
- p: '$2 $4 $2 $8',
86
- h: '$12',
87
- gap: '$2',
88
- }}
89
- >
90
- <Text variant="caption" css={{ fontWeight: '$semiBold' }}>
91
- {getQualityText(layer)}
92
- </Text>
93
- <Text variant="caption" css={{ flex: '1 1 0', c: '$on_surface_low', pl: '$2' }}>
94
- {getBitrateText(layer)}
95
- </Text>
96
- {!isAuto && layer.width === selection?.width && layer.height === selection?.height && (
97
- <CheckIcon width="16px" height="16px" />
98
- )}
99
- </Dropdown.Item>
100
- );
101
- })}
102
- <Dropdown.Item
103
- onClick={() => onQualityChange({ height: 'auto' })}
104
- key="auto"
105
- css={{
106
- bg: !isAuto ? '$surface_bright' : '$surface_default',
107
- '&:hover': {
108
- bg: '$surface_brighter',
109
- },
110
- p: '$2 $4 $2 $8',
111
- h: '$12',
112
- gap: '$2',
113
- }}
114
- >
115
- <Text variant="caption" css={{ fontWeight: '$semiBold', flex: '1 1 0' }}>
116
- Auto
117
- </Text>
118
- {isAuto && <CheckIcon width="16px" height="16px" />}
119
- </Dropdown.Item>
120
- </Dropdown.Content>
121
- )}
122
- </Dropdown.Root>
123
- );
124
- }
125
-
126
- const getQualityText = layer => `${Math.min(layer.height, layer.width)}p `;
127
- const getBitrateText = layer => `(${(Number(layer.bitrate / 1000) / 1000).toFixed(2)} Mbps)`;
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import { PauseIcon, PlayIcon } from '@100mslive/react-icons';
3
- import { IconButton, Tooltip } from '../../../';
4
-
5
- export const PlayButton = ({ onClick, isPaused }) => {
6
- return (
7
- <Tooltip title={isPaused ? 'Play' : 'Pause'} side="top">
8
- <IconButton onClick={onClick} data-testid="play_pause_btn">
9
- {isPaused ? <PlayIcon width={20} height={20} /> : <PauseIcon width={20} height={20} />}
10
- </IconButton>
11
- </Tooltip>
12
- );
13
- };
@@ -1,76 +0,0 @@
1
- import React, { useEffect, useRef, useState } from 'react';
2
- import { Box, Flex } from '../../../';
3
- import { getPercentage } from './HMSVIdeoUtils';
4
-
5
- export const VideoProgress = ({ onValueChange, hlsPlayer }) => {
6
- const [videoProgress, setVideoProgress] = useState(0);
7
- const [bufferProgress, setBufferProgress] = useState(0);
8
- const progressRootRef = useRef();
9
-
10
- useEffect(() => {
11
- const videoEl = hlsPlayer.getVideoElement();
12
- const timeupdateHandler = () => {
13
- const videoProgress = Math.floor(getPercentage(videoEl.currentTime, videoEl.duration));
14
- let bufferProgress = 0;
15
- if (videoEl.buffered.length > 0) {
16
- bufferProgress = Math.floor(getPercentage(videoEl.buffered?.end(0), videoEl.duration));
17
- }
18
-
19
- setVideoProgress(isNaN(videoProgress) ? 0 : videoProgress);
20
- setBufferProgress(isNaN(bufferProgress) ? 0 : bufferProgress);
21
- };
22
- if (videoEl) {
23
- videoEl.addEventListener('timeupdate', timeupdateHandler);
24
- }
25
- return function cleanup() {
26
- if (videoEl) {
27
- videoEl.removeEventListener('timeupdate', timeupdateHandler);
28
- }
29
- };
30
- }, [hlsPlayer]);
31
-
32
- const onProgressChangeHandler = e => {
33
- const userClickedX = e.clientX - progressRootRef.current.offsetLeft;
34
- const progressBarWidth = progressRootRef.current.offsetWidth;
35
- const progress = Math.floor(getPercentage(userClickedX, progressBarWidth));
36
- const videoEl = hlsPlayer.getVideoElement();
37
- const currentTime = (progress * videoEl.duration) / 100;
38
-
39
- if (onValueChange) {
40
- onValueChange(currentTime);
41
- }
42
- };
43
-
44
- return hlsPlayer.getVideoElement() ? (
45
- <Flex
46
- ref={progressRootRef}
47
- css={{ cursor: 'pointer', h: '$2', alignSelf: 'stretch' }}
48
- onClick={onProgressChangeHandler}
49
- >
50
- <Box
51
- id="video-actual"
52
- css={{
53
- display: 'inline',
54
- width: `${videoProgress}%`,
55
- background: '$primary_default',
56
- }}
57
- />
58
- <Box
59
- id="video-buffer"
60
- css={{
61
- width: `${bufferProgress - videoProgress}%`,
62
- background: '$on_surface_high',
63
- opacity: '25%',
64
- }}
65
- />
66
- <Box
67
- id="video-rest"
68
- css={{
69
- width: `${100 - bufferProgress}%`,
70
- background: '$on_surface_high',
71
- opacity: '10%',
72
- }}
73
- />
74
- </Flex>
75
- ) : null;
76
- };
@@ -1,33 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { HMSHLSPlayerEvents } from '@100mslive/hls-player';
3
- import { Text } from '../../../';
4
- import { getDurationFromSeconds } from './HMSVIdeoUtils';
5
-
6
- export const VideoTime = ({ hlsPlayer }) => {
7
- const [videoTime, setVideoTime] = useState('');
8
-
9
- useEffect(() => {
10
- const timeupdateHandler = currentTime => setVideoTime(getDurationFromSeconds(currentTime));
11
- if (hlsPlayer) {
12
- hlsPlayer.on(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
13
- }
14
- return function cleanup() {
15
- if (hlsPlayer) {
16
- hlsPlayer.off(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
17
- }
18
- };
19
- }, [hlsPlayer]);
20
-
21
- return hlsPlayer ? (
22
- <Text
23
- css={{
24
- minWidth: '$16',
25
- c: '$on_surface_medium',
26
- display: 'flex',
27
- justifyContent: 'center',
28
- }}
29
- >
30
- {videoTime}
31
- </Text>
32
- ) : null;
33
- };
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { HandIcon } from '@100mslive/react-icons';
3
- import { Tooltip } from '../../Tooltip';
4
- import IconButton from '../IconButton';
5
- // @ts-ignore: No implicit Any
6
- import { useMyMetadata } from './hooks/useMetadata';
7
-
8
- export const RaiseHand = () => {
9
- const { isHandRaised, toggleHandRaise } = useMyMetadata();
10
- return (
11
- <Tooltip title={isHandRaised ? 'Lower hand' : 'Raise hand'}>
12
- <IconButton data-testid="hand_raise_btn" active={!isHandRaised} onClick={async () => await toggleHandRaise()}>
13
- <HandIcon />
14
- </IconButton>
15
- </Tooltip>
16
- );
17
- };