@100mslive/roomkit-react 0.2.8-alpha.2 → 0.2.8-alpha.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/dist/{HLSView-CEPQ23TO.js → HLSView-UIPDGADR.js} +509 -234
  2. package/dist/HLSView-UIPDGADR.js.map +7 -0
  3. package/dist/Prebuilt/common/hooks.d.ts +3 -0
  4. package/dist/Prebuilt/components/HMSVideo/FullscreenButton.d.ts +5 -0
  5. package/dist/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.d.ts +5 -0
  6. package/dist/Prebuilt/components/HMSVideo/HLSCaptionSelector.d.ts +1 -2
  7. package/dist/Prebuilt/components/HMSVideo/HLSQualitySelector.d.ts +12 -0
  8. package/dist/Prebuilt/components/HMSVideo/MwebHLSViewTitle.d.ts +2 -0
  9. package/dist/Prebuilt/components/HMSVideo/PlayButton.d.ts +6 -0
  10. package/dist/Prebuilt/components/HMSVideo/PlayerContext.d.ts +8 -0
  11. package/dist/Prebuilt/components/HMSVideo/VideoProgress.d.ts +2 -0
  12. package/dist/Prebuilt/components/HMSVideo/VideoTime.d.ts +2 -0
  13. package/dist/Prebuilt/components/HMSVideo/VolumeControl.d.ts +2 -0
  14. package/dist/Prebuilt/components/HMSVideo/index.d.ts +17 -0
  15. package/dist/Prebuilt/components/HMSVideo/utils.d.ts +9 -0
  16. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +1 -3
  17. package/dist/Prebuilt/components/MwebLandscapePrompt.d.ts +1 -1
  18. package/dist/Prebuilt/components/RaiseHand.d.ts +2 -0
  19. package/dist/Prebuilt/components/SidePaneTabs.d.ts +1 -0
  20. package/dist/{chunk-2Y4FJB25.js → chunk-J4NOQ2YL.js} +562 -450
  21. package/dist/chunk-J4NOQ2YL.js.map +7 -0
  22. package/dist/index.cjs.js +1556 -1145
  23. package/dist/index.cjs.js.map +4 -4
  24. package/dist/index.js +1 -1
  25. package/dist/meta.cjs.json +429 -156
  26. package/dist/meta.esbuild.json +445 -164
  27. package/package.json +6 -6
  28. package/src/Prebuilt/common/hooks.ts +21 -0
  29. package/src/Prebuilt/components/Chat/ChatFooter.tsx +26 -10
  30. package/src/Prebuilt/components/ConferenceScreen.tsx +34 -2
  31. package/src/Prebuilt/components/Footer/Footer.tsx +0 -1
  32. package/src/Prebuilt/components/HMSVideo/Controls.jsx +1 -1
  33. package/src/Prebuilt/components/HMSVideo/FullscreenButton.tsx +13 -0
  34. package/src/Prebuilt/components/HMSVideo/{HLSAutoplayBlockedPrompt.jsx → HLSAutoplayBlockedPrompt.tsx} +13 -6
  35. package/src/Prebuilt/components/HMSVideo/HLSCaptionSelector.tsx +4 -2
  36. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.tsx +241 -0
  37. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +3 -0
  38. package/src/Prebuilt/components/HMSVideo/MwebHLSViewTitle.tsx +91 -0
  39. package/src/Prebuilt/components/HMSVideo/PlayButton.tsx +27 -0
  40. package/src/Prebuilt/components/HMSVideo/PlayerContext.tsx +15 -0
  41. package/src/Prebuilt/components/HMSVideo/VideoProgress.tsx +81 -0
  42. package/src/Prebuilt/components/HMSVideo/VideoTime.tsx +42 -0
  43. package/src/Prebuilt/components/HMSVideo/{VolumeControl.jsx → VolumeControl.tsx} +7 -5
  44. package/src/Prebuilt/components/HMSVideo/{index.js → index.ts} +2 -0
  45. package/src/Prebuilt/components/HMSVideo/utils.ts +35 -0
  46. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +7 -1
  47. package/src/Prebuilt/components/Leave/MwebLeaveRoom.tsx +38 -25
  48. package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +3 -1
  49. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +1 -1
  50. package/src/Prebuilt/components/MwebLandscapePrompt.tsx +5 -0
  51. package/src/Prebuilt/components/{RaiseHand.jsx → RaiseHand.tsx} +3 -2
  52. package/src/Prebuilt/components/SidePaneTabs.tsx +29 -10
  53. package/src/Prebuilt/layouts/HLSView.jsx +272 -156
  54. package/src/Prebuilt/layouts/SidePane.tsx +21 -10
  55. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +11 -1
  56. package/dist/HLSView-CEPQ23TO.js.map +0 -7
  57. package/dist/chunk-2Y4FJB25.js.map +0 -7
  58. package/src/Prebuilt/components/HMSVideo/FullscreenButton.jsx +0 -18
  59. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +0 -127
  60. package/src/Prebuilt/components/HMSVideo/HMSVIdeoUtils.js +0 -27
  61. package/src/Prebuilt/components/HMSVideo/VideoProgress.jsx +0 -76
  62. package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +0 -33
@@ -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,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,27 +0,0 @@
1
- export function getPercentage(a, b) {
2
- return (a / b) * 100;
3
- }
4
-
5
- /**
6
- *
7
- * @param {number} timeInSeconds - if given as floating point value, it is floored.
8
- * @returns a string representing timeInSeconds in HH:MM:SS format.
9
- * (e.g) getDurationFromSeconds(3910) returns "1:05:10"
10
- */
11
- export function getDurationFromSeconds(timeInSeconds) {
12
- let time = Math.floor(timeInSeconds);
13
- const hours = Math.floor(time / 3600);
14
- time = time - hours * 3600;
15
- const minutes = Math.floor(time / 60);
16
- const seconds = Math.floor(time - minutes * 60);
17
-
18
- const prefixedMinutes = `${minutes < 10 ? `0${minutes}` : minutes}`;
19
- const prefixedSeconds = `${seconds < 10 ? `0${seconds}` : seconds}`;
20
-
21
- let videoTimeStr = `${prefixedMinutes}:${prefixedSeconds}`;
22
- if (hours) {
23
- const prefixedHours = `${hours < 10 ? `0${hours}` : hours}`;
24
- videoTimeStr = `${prefixedHours}:${prefixedMinutes}:${prefixedSeconds}`;
25
- }
26
- return videoTimeStr;
27
- }
@@ -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
- };