@100mslive/roomkit-react 0.3.23 → 0.3.24-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/dist/Accordion/Accordion.d.ts +134 -322
  2. package/dist/Accordion/index.d.ts +134 -322
  3. package/dist/Avatar/Avatar.d.ts +47 -141
  4. package/dist/Button/Button.d.ts +47 -141
  5. package/dist/Checkbox/Checkbox.d.ts +134 -322
  6. package/dist/Collapsible/Collapsible.d.ts +201 -483
  7. package/dist/Divider/Divider.d.ts +134 -322
  8. package/dist/Dropdown/Dropdown.d.ts +804 -1932
  9. package/dist/Fieldset/Fieldset.d.ts +47 -141
  10. package/dist/Footer/Footer.d.ts +536 -1288
  11. package/dist/IconButton/IconButton.d.ts +47 -141
  12. package/dist/Input/Input.d.ts +362 -926
  13. package/dist/Label/Label.d.ts +47 -141
  14. package/dist/Layout/Box.d.ts +47 -141
  15. package/dist/Layout/Flex.d.ts +47 -141
  16. package/dist/Link/Link.d.ts +47 -141
  17. package/dist/Modal/Dialog.d.ts +329 -987
  18. package/dist/Modal/DialogContent.d.ts +469 -1127
  19. package/dist/Pagination/StyledPagination.d.ts +268 -644
  20. package/dist/Popover/index.d.ts +201 -483
  21. package/dist/Prebuilt/IconButton.d.ts +134 -322
  22. package/dist/Prebuilt/components/Chat/ChatBody.d.ts +134 -322
  23. package/dist/Prebuilt/components/Leave/LeaveAtoms.d.ts +335 -805
  24. package/dist/Prebuilt/components/Notifications/DeviceChangeNotifications.d.ts +1 -0
  25. package/dist/Prebuilt/components/Notifications/ErrorNotifications.d.ts +1 -0
  26. package/dist/Prebuilt/components/Notifications/MessageNotifications.d.ts +1 -0
  27. package/dist/Prebuilt/components/Notifications/PollNotificationModal.d.ts +1 -0
  28. package/dist/Prebuilt/components/Notifications/RoleChangeNotification.d.ts +1 -0
  29. package/dist/Prebuilt/components/Settings/common.d.ts +134 -322
  30. package/dist/Progress/index.d.ts +134 -322
  31. package/dist/RadioGroup/RadioGroup.d.ts +201 -483
  32. package/dist/ReactSelect/ReactSelect.d.ts +670 -1610
  33. package/dist/Select/Select.d.ts +201 -483
  34. package/dist/Sheet/Sheet.d.ts +329 -987
  35. package/dist/Slider/Slider.d.ts +47 -141
  36. package/dist/Stats/StyledStats.d.ts +402 -966
  37. package/dist/Switch/Switch.d.ts +47 -141
  38. package/dist/Tabs/Tabs.d.ts +268 -644
  39. package/dist/Text/Text.d.ts +47 -141
  40. package/dist/TextArea/TextArea.d.ts +47 -141
  41. package/dist/Theme/base.config.d.ts +26 -78
  42. package/dist/Theme/stitches.config.d.ts +1046 -1493
  43. package/dist/TileMenu/StyledMenuTile.d.ts +469 -1127
  44. package/dist/Toast/Toast.d.ts +382 -946
  45. package/dist/Video/Video.d.ts +47 -141
  46. package/dist/VideoList/StyledVideoList.d.ts +201 -483
  47. package/dist/VideoTile/StyledVideoTile.d.ts +670 -1610
  48. package/dist/android-perm-1.png +0 -0
  49. package/dist/audio-level.png +0 -0
  50. package/dist/empty-chat.svg +12 -0
  51. package/dist/index.cjs.css +2 -2
  52. package/dist/index.cjs.css.map +1 -1
  53. package/dist/index.cjs.js +34062 -37242
  54. package/dist/index.cjs.js.map +4 -4
  55. package/dist/index.css +2 -2
  56. package/dist/index.css.map +1 -1
  57. package/dist/index.js +36387 -67
  58. package/dist/index.js.map +4 -4
  59. package/dist/ios-perm-0.png +0 -0
  60. package/dist/meta.cjs.json +1531 -1218
  61. package/dist/meta.esbuild.json +942 -794
  62. package/dist/pdf-share.png +0 -0
  63. package/dist/screen-share.png +0 -0
  64. package/dist/transaction_error.svg +12 -0
  65. package/package.json +8 -8
  66. package/src/Avatar/Avatar.tsx +1 -1
  67. package/src/Popover/Popover.stories.tsx +1 -1
  68. package/src/Prebuilt/components/Chat/Chat.tsx +1 -1
  69. package/src/Prebuilt/components/Chat/ChatFooter.tsx +1 -1
  70. package/src/Prebuilt/components/Footer/WhiteboardToggle.tsx +11 -4
  71. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +3 -3
  72. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +3 -0
  73. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +14 -1
  74. package/src/Prebuilt/components/Notifications/DeviceChangeNotifications.tsx +18 -0
  75. package/src/Prebuilt/components/Notifications/ErrorNotifications.tsx +56 -0
  76. package/src/Prebuilt/components/Notifications/MessageNotifications.tsx +24 -0
  77. package/src/Prebuilt/components/Notifications/Notifications.tsx +13 -171
  78. package/src/Prebuilt/components/Notifications/PeerNotifications.tsx +9 -2
  79. package/src/Prebuilt/components/Notifications/PollNotificationModal.tsx +71 -0
  80. package/src/Prebuilt/components/Notifications/ReconnectNotifications.tsx +1 -5
  81. package/src/Prebuilt/components/Notifications/RoleChangeNotification.tsx +24 -0
  82. package/src/Prebuilt/components/Notifications/TrackBulkUnmuteModal.tsx +7 -5
  83. package/src/Prebuilt/components/Notifications/TrackNotifications.tsx +23 -1
  84. package/src/Prebuilt/components/Notifications/TrackUnmuteModal.tsx +13 -5
  85. package/src/Prebuilt/components/Preview/PreviewJoin.tsx +3 -2
  86. package/src/Prebuilt/components/StatsForNerds.jsx +122 -9
  87. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +0 -1
  88. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +2 -2
  89. package/src/Prebuilt/components/VirtualBackground/VBOption.tsx +3 -1
  90. package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +6 -0
  91. package/src/Prebuilt/layouts/HLSView.jsx +3 -3
  92. package/src/Prebuilt/layouts/PDFView.jsx +1 -0
  93. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +82 -86
  94. package/src/Prebuilt/layouts/WaitingView.tsx +2 -2
  95. package/dist/HLSView-HYI6LLL6.js +0 -1652
  96. package/dist/HLSView-HYI6LLL6.js.map +0 -7
  97. package/dist/HLSView-S4NJF7Q2.css +0 -2780
  98. package/dist/HLSView-S4NJF7Q2.css.map +0 -7
  99. package/dist/chunk-LRJSQMZ4.js +0 -34759
  100. package/dist/chunk-LRJSQMZ4.js.map +0 -7
@@ -1,1652 +0,0 @@
1
- import {
2
- APP_DATA,
3
- Box,
4
- Button,
5
- ChatToggle,
6
- Dialog,
7
- DialogContent,
8
- DialogRow,
9
- Dropdown,
10
- EMOJI_REACTION_TYPE,
11
- Flex,
12
- IconButton,
13
- IconButton_default,
14
- LeaveRoom,
15
- Loading,
16
- Logo,
17
- POLL_STATE,
18
- POLL_VIEWS,
19
- RoomDetailsRow,
20
- SIDE_PANE_OPTIONS,
21
- Sheet,
22
- Slider,
23
- Text,
24
- ToastManager,
25
- Tooltip,
26
- WaitingView,
27
- __async,
28
- __objRest,
29
- __spreadProps,
30
- __spreadValues,
31
- config,
32
- init_define_process_env,
33
- styled,
34
- theme,
35
- useIsLandscape,
36
- useIsSidepaneTypeOpen,
37
- useKeyboardHandler,
38
- useRoomLayoutConferencingScreen,
39
- useRoomLayoutHeader,
40
- useSidepaneToggle,
41
- useTheme
42
- } from "./chunk-LRJSQMZ4.js";
43
-
44
- // src/Prebuilt/layouts/HLSView.jsx
45
- init_define_process_env();
46
- import React15, { useCallback as useCallback3, useEffect as useEffect4, useRef, useState as useState5 } from "react";
47
- import { useFullscreen, useMedia as useMedia4, usePrevious, useToggle } from "react-use";
48
- import { HLSPlaybackState, HMSHLSPlayer, HMSHLSPlayerEvents as HMSHLSPlayerEvents2 } from "@100mslive/hls-player";
49
- import screenfull from "screenfull";
50
- import { match, P } from "ts-pattern";
51
- import {
52
- HLSPlaylistType,
53
- HMSNotificationTypes,
54
- selectAppData,
55
- selectHLSState,
56
- selectPeerNameByID,
57
- selectPollByID,
58
- useHMSActions,
59
- useHMSNotifications,
60
- useHMSStore,
61
- useHMSVanillaStore
62
- } from "@100mslive/react-sdk";
63
- import { ColoredHandIcon, GoLiveIcon } from "@100mslive/react-icons";
64
-
65
- // src/Prebuilt/components/HlsStatsOverlay.jsx
66
- init_define_process_env();
67
- import React, { memo } from "react";
68
- import { CrossIcon } from "@100mslive/react-icons";
69
- function HlsStatsOverlay({ hlsStatsState, onClose }) {
70
- var _a, _b, _c;
71
- return /* @__PURE__ */ React.createElement(
72
- Flex,
73
- {
74
- css: {
75
- position: "absolute",
76
- width: "$80",
77
- marginLeft: "$8",
78
- padding: "$8 $8 $10",
79
- zIndex: 10,
80
- backgroundColor: "$surface_brighter",
81
- borderRadius: "$1"
82
- },
83
- direction: "column"
84
- },
85
- /* @__PURE__ */ React.createElement(IconButton_default, { css: { position: "absolute", top: "$2", right: "$2" }, onClick: onClose }, /* @__PURE__ */ React.createElement(CrossIcon, null)),
86
- /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "URL" }, /* @__PURE__ */ React.createElement(Flex, { align: "center" }, /* @__PURE__ */ React.createElement(
87
- "a",
88
- {
89
- style: { cursor: "pointer", textDecoration: "underline" },
90
- href: hlsStatsState == null ? void 0 : hlsStatsState.url,
91
- target: "_blank",
92
- rel: "noreferrer"
93
- },
94
- "Stream url"
95
- ))),
96
- /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Video size" }, ` ${(_a = hlsStatsState == null ? void 0 : hlsStatsState.videoSize) == null ? void 0 : _a.width}x${(_b = hlsStatsState == null ? void 0 : hlsStatsState.videoSize) == null ? void 0 : _b.height}`),
97
- /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Buffer duration" }, (_c = hlsStatsState == null ? void 0 : hlsStatsState.bufferedDuration) == null ? void 0 : _c.toFixed(2), " "),
98
- /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Connection speed" }, `${((hlsStatsState == null ? void 0 : hlsStatsState.bandwidthEstimate) / (1e3 * 1e3)).toFixed(2)} Mbps`),
99
- /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Bitrate" }, `${((hlsStatsState == null ? void 0 : hlsStatsState.bitrate) / (1e3 * 1e3)).toFixed(2)} Mbps`),
100
- /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "distance from live" }, getDurationFromSeconds(hlsStatsState.distanceFromLive / 1e3)),
101
- /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Dropped frames" }, hlsStatsState == null ? void 0 : hlsStatsState.droppedFrames)
102
- );
103
- }
104
- function getDurationFromSeconds(timeInSeconds) {
105
- let time = Math.floor(timeInSeconds);
106
- const hours = Math.floor(time / 3600);
107
- time = time - hours * 3600;
108
- const minutes = Math.floor(time / 60);
109
- const seconds = Math.floor(time - minutes * 60);
110
- const prefixedMinutes = `${minutes < 10 ? "0" + minutes : minutes}`;
111
- const prefixedSeconds = `${seconds < 10 ? "0" + seconds : seconds}`;
112
- let videoTimeStr = `${prefixedMinutes}:${prefixedSeconds}`;
113
- if (hours) {
114
- const prefixedHours = `${hours < 10 ? "0" + hours : hours}`;
115
- videoTimeStr = `${prefixedHours}:${prefixedMinutes}:${prefixedSeconds}`;
116
- }
117
- return videoTimeStr;
118
- }
119
- var HlsStatsRow = memo(({ label, children }) => {
120
- return /* @__PURE__ */ React.createElement(Flex, { gap: 4, justify: "center", css: { width: "100%" } }, /* @__PURE__ */ React.createElement(
121
- Text,
122
- {
123
- css: {
124
- width: "50%",
125
- "@md": { fontSize: "$md" },
126
- "@sm": { fontSize: "$sm" }
127
- // textAlign: "right",
128
- }
129
- },
130
- label
131
- ), /* @__PURE__ */ React.createElement(
132
- Text,
133
- {
134
- css: {
135
- "@md": { fontSize: "$md" },
136
- "@sm": { fontSize: "$sm" },
137
- width: "50%",
138
- overflowWrap: "break-word"
139
- // textAlign: "left",
140
- }
141
- },
142
- children
143
- ));
144
- });
145
-
146
- // src/Prebuilt/components/HMSVideo/index.ts
147
- init_define_process_env();
148
-
149
- // src/Prebuilt/components/HMSVideo/Controls.jsx
150
- init_define_process_env();
151
- var VideoControls = styled(Flex, {
152
- justifyContent: "center",
153
- alignItems: "center",
154
- alignSelf: "stretch",
155
- width: "100%",
156
- gap: "$2"
157
- });
158
- var LeftControls = styled(Flex, {
159
- justifyContent: "flex-start",
160
- alignItems: "center",
161
- width: "100%",
162
- gap: "$4"
163
- });
164
- var RightControls = styled(Flex, {
165
- justifyContent: "flex-end",
166
- alignItems: "center",
167
- width: "100%",
168
- gap: "$4"
169
- });
170
-
171
- // src/Prebuilt/components/HMSVideo/HMSVideo.jsx
172
- init_define_process_env();
173
- import React2, { forwardRef, useEffect, useState } from "react";
174
- var HMSVideo = forwardRef((_a, videoRef) => {
175
- var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
176
- const [width, setWidth] = useState("auto");
177
- useEffect(() => {
178
- const updatingVideoWidth = () => {
179
- const videoEl2 = videoRef.current;
180
- if (!videoEl2) {
181
- return;
182
- }
183
- if (videoEl2.videoWidth > videoEl2.videoHeight && width !== "100%") {
184
- setWidth("100%");
185
- }
186
- };
187
- const videoEl = videoRef.current;
188
- if (!videoEl) {
189
- return;
190
- }
191
- videoEl.addEventListener("loadedmetadata", updatingVideoWidth);
192
- return () => {
193
- videoEl.removeEventListener("loadedmetadata", updatingVideoWidth);
194
- };
195
- }, []);
196
- return /* @__PURE__ */ React2.createElement(
197
- Flex,
198
- __spreadValues({
199
- "data-testid": "hms-video",
200
- css: {
201
- size: "100%",
202
- position: "relative",
203
- justifyContent: "center",
204
- transition: "all 0.3s ease-in-out",
205
- "@md": {
206
- "& video": {
207
- height: props.isFullScreen ? "" : "$60 !important"
208
- }
209
- },
210
- "& video::cue": {
211
- // default for on-surface-high
212
- color: "#EFF0FA",
213
- whiteSpace: "pre-line",
214
- fontSize: "$sm",
215
- fontStyle: "normal",
216
- fontWeight: "$regular",
217
- lineHeight: "$sm",
218
- letterSpacing: "0.25px"
219
- },
220
- "& video::-webkit-media-text-track-display": {
221
- padding: "0 $4",
222
- boxShadow: "0px 1px 3px 0px #000000A3"
223
- },
224
- "& video::-webkit-media-text-track-container": {
225
- fontSize: "$space$10 !important"
226
- }
227
- },
228
- direction: "column"
229
- }, props),
230
- /* @__PURE__ */ React2.createElement(
231
- "video",
232
- {
233
- style: {
234
- margin: "0 auto",
235
- objectFit: "contain",
236
- width,
237
- height: "100%",
238
- maxWidth: "100%"
239
- },
240
- ref: videoRef,
241
- playsInline: true,
242
- disablePictureInPicture: true
243
- }
244
- ),
245
- children
246
- );
247
- });
248
-
249
- // src/Prebuilt/components/HMSVideo/PlayPauseSeekControls.tsx
250
- init_define_process_env();
251
- import React6 from "react";
252
- import { useMedia } from "react-use";
253
- import { BackwardArrowIcon, ForwardArrowIcon } from "@100mslive/react-icons";
254
-
255
- // src/Prebuilt/components/HMSVideo/PlayPauseButton.tsx
256
- init_define_process_env();
257
- import React4 from "react";
258
- import { PauseIcon, PlayIcon } from "@100mslive/react-icons";
259
-
260
- // src/Prebuilt/components/HMSVideo/PlayerContext.tsx
261
- init_define_process_env();
262
- import React3, { useContext } from "react";
263
- var HMSPlayerContext = React3.createContext({
264
- hlsPlayer: void 0
265
- });
266
- var useHMSPlayerContext = () => {
267
- const context = useContext(HMSPlayerContext);
268
- return context;
269
- };
270
-
271
- // src/Prebuilt/components/HMSVideo/PlayPauseButton.tsx
272
- var PlayPauseButton = ({
273
- isPaused,
274
- width = 20,
275
- height = 20
276
- }) => {
277
- const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
278
- const onClick = (event) => __async(void 0, null, function* () {
279
- event == null ? void 0 : event.stopPropagation();
280
- isPaused ? yield hlsPlayer2 == null ? void 0 : hlsPlayer2.play() : hlsPlayer2 == null ? void 0 : hlsPlayer2.pause();
281
- });
282
- return /* @__PURE__ */ React4.createElement(Tooltip, { title: isPaused ? "Play" : "Pause", side: "top" }, /* @__PURE__ */ React4.createElement(IconButton, { onClick, "data-testid": "play_pause_btn" }, isPaused ? /* @__PURE__ */ React4.createElement(PlayIcon, { width, height }) : /* @__PURE__ */ React4.createElement(PauseIcon, { width, height })));
283
- };
284
-
285
- // src/Prebuilt/components/HMSVideo/SeekControl.tsx
286
- init_define_process_env();
287
- import React5 from "react";
288
- var SeekControl = ({
289
- title,
290
- onClick,
291
- children,
292
- css
293
- }) => {
294
- return /* @__PURE__ */ React5.createElement(Tooltip, { title, side: "top" }, /* @__PURE__ */ React5.createElement(IconButton, { onClick, "data-testid": "backward_forward_arrow_btn", css }, children));
295
- };
296
-
297
- // src/Prebuilt/components/HMSVideo/PlayPauseSeekControls.tsx
298
- var PlayPauseSeekControls = ({
299
- isPaused,
300
- onSeekTo
301
- }) => {
302
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
303
- SeekControl,
304
- {
305
- onClick: (e) => {
306
- e.stopPropagation();
307
- onSeekTo(-10);
308
- },
309
- title: "backward"
310
- },
311
- /* @__PURE__ */ React6.createElement(BackwardArrowIcon, { width: 20, height: 20 })
312
- ), /* @__PURE__ */ React6.createElement(PlayPauseButton, { isPaused }), /* @__PURE__ */ React6.createElement(
313
- SeekControl,
314
- {
315
- onClick: (e) => {
316
- e.stopPropagation();
317
- onSeekTo(10);
318
- },
319
- title: "forward"
320
- },
321
- /* @__PURE__ */ React6.createElement(ForwardArrowIcon, { width: 20, height: 20 })
322
- ));
323
- };
324
- var PlayPauseSeekOverlayControls = ({
325
- isPaused,
326
- showControls,
327
- hoverControlsVisible
328
- }) => {
329
- const isMobile = useMedia(config.media.md);
330
- const isLandscape = useIsLandscape();
331
- if (!isMobile && !isLandscape) {
332
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
333
- Flex,
334
- {
335
- css: {
336
- bg: "rgba(0, 0, 0, 0.6)",
337
- r: "$round",
338
- size: "$24",
339
- visibility: hoverControlsVisible.seekBackward ? `` : `hidden`,
340
- opacity: hoverControlsVisible.seekBackward ? `1` : "0"
341
- },
342
- direction: "column",
343
- align: "center"
344
- },
345
- /* @__PURE__ */ React6.createElement(SeekControl, { title: "backward" }, /* @__PURE__ */ React6.createElement(BackwardArrowIcon, { width: 52, height: 52 })),
346
- /* @__PURE__ */ React6.createElement(Text, { variant: "body2", css: { fontWeight: "$regular" } }, "10 secs")
347
- ), /* @__PURE__ */ React6.createElement(
348
- Box,
349
- {
350
- css: {
351
- bg: "rgba(0, 0, 0, 0.6)",
352
- r: "$round",
353
- visibility: hoverControlsVisible.pausePlay ? `` : `hidden`,
354
- opacity: hoverControlsVisible.pausePlay ? `1` : "0"
355
- }
356
- },
357
- /* @__PURE__ */ React6.createElement(PlayPauseButton, { isPaused, width: 48, height: 48 })
358
- ), /* @__PURE__ */ React6.createElement(
359
- Flex,
360
- {
361
- css: {
362
- bg: "rgba(0, 0, 0, 0.6)",
363
- r: "$round",
364
- size: "$24",
365
- visibility: hoverControlsVisible.seekForward ? `` : `hidden`,
366
- opacity: hoverControlsVisible.seekForward ? `1` : "0"
367
- },
368
- direction: "column",
369
- align: "center"
370
- },
371
- /* @__PURE__ */ React6.createElement(SeekControl, { title: "forward" }, /* @__PURE__ */ React6.createElement(ForwardArrowIcon, { width: 52, height: 52 })),
372
- /* @__PURE__ */ React6.createElement(Text, { variant: "body2", css: { fontWeight: "$regular" } }, "10 secs")
373
- ));
374
- }
375
- return /* @__PURE__ */ React6.createElement(
376
- Flex,
377
- {
378
- align: "center",
379
- justify: "center",
380
- css: {
381
- position: "absolute",
382
- bg: "#00000066",
383
- display: "inline-flex",
384
- gap: "$2",
385
- zIndex: 1,
386
- size: "100%",
387
- visibility: showControls ? `` : `hidden`,
388
- opacity: showControls ? `1` : "0"
389
- }
390
- },
391
- /* @__PURE__ */ React6.createElement(
392
- SeekControl,
393
- {
394
- title: "backward",
395
- css: {
396
- visibility: hoverControlsVisible.seekBackward ? `` : `hidden`,
397
- opacity: hoverControlsVisible.seekBackward ? `1` : "0"
398
- }
399
- },
400
- /* @__PURE__ */ React6.createElement(BackwardArrowIcon, { width: 32, height: 32 })
401
- ),
402
- /* @__PURE__ */ React6.createElement(
403
- Box,
404
- {
405
- css: {
406
- bg: "rgba(0, 0, 0, 0.6)",
407
- r: "$round"
408
- }
409
- },
410
- /* @__PURE__ */ React6.createElement(PlayPauseButton, { isPaused, width: 48, height: 48 })
411
- ),
412
- /* @__PURE__ */ React6.createElement(
413
- SeekControl,
414
- {
415
- title: "forward",
416
- css: {
417
- visibility: hoverControlsVisible.seekForward ? `` : `hidden`,
418
- opacity: hoverControlsVisible.seekForward ? `1` : "0"
419
- }
420
- },
421
- /* @__PURE__ */ React6.createElement(ForwardArrowIcon, { width: 32, height: 32 })
422
- )
423
- );
424
- };
425
-
426
- // src/Prebuilt/components/HMSVideo/VideoProgress.tsx
427
- init_define_process_env();
428
- import React7, { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
429
-
430
- // src/Prebuilt/components/HMSVideo/utils.ts
431
- init_define_process_env();
432
- function getPercentage(a, b) {
433
- return a / b * 100;
434
- }
435
- function getDurationFromSeconds2(timeInSeconds) {
436
- let time = Math.floor(timeInSeconds);
437
- const hours = Math.floor(time / 3600);
438
- time = time - hours * 3600;
439
- const minutes = Math.floor(time / 60);
440
- const seconds = Math.floor(time - minutes * 60);
441
- const prefixedMinutes = `${minutes < 10 ? `0${minutes}` : minutes}`;
442
- const prefixedSeconds = `${seconds < 10 ? `0${seconds}` : seconds}`;
443
- let videoTimeStr = `${prefixedMinutes}:${prefixedSeconds}`;
444
- if (hours) {
445
- const prefixedHours = `${hours < 10 ? `0${hours}` : hours}`;
446
- videoTimeStr = `${prefixedHours}:${prefixedMinutes}:${prefixedSeconds}`;
447
- }
448
- return videoTimeStr;
449
- }
450
- function getDuration(videoEl) {
451
- if (isFinite(videoEl.duration)) {
452
- return videoEl.duration;
453
- }
454
- if (videoEl.seekable.length > 0) {
455
- return videoEl.seekable.end(0);
456
- }
457
- return 0;
458
- }
459
-
460
- // src/Prebuilt/components/HMSVideo/VideoProgress.tsx
461
- var VideoProgress = ({
462
- seekProgress,
463
- setSeekProgress
464
- }) => {
465
- const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
466
- const [videoProgress, setVideoProgress] = useState2(0);
467
- const [bufferProgress, setBufferProgress] = useState2(0);
468
- const videoEl = hlsPlayer2 == null ? void 0 : hlsPlayer2.getVideoElement();
469
- const setProgress = useCallback(() => {
470
- var _a;
471
- if (!videoEl) {
472
- return;
473
- }
474
- const duration = getDuration(videoEl);
475
- const videoProgress2 = Math.floor(getPercentage(videoEl.currentTime, duration));
476
- let bufferProgress2 = 0;
477
- if (videoEl.buffered.length > 0) {
478
- bufferProgress2 = Math.floor(getPercentage((_a = videoEl.buffered) == null ? void 0 : _a.end(0), duration));
479
- }
480
- if (!isNaN(videoProgress2)) {
481
- setVideoProgress(videoProgress2);
482
- }
483
- if (!isNaN(bufferProgress2)) {
484
- setBufferProgress(bufferProgress2);
485
- }
486
- }, [videoEl]);
487
- const timeupdateHandler = useCallback(() => {
488
- if (!videoEl || seekProgress) {
489
- return;
490
- }
491
- setProgress();
492
- }, [seekProgress, setProgress, videoEl]);
493
- useEffect2(() => {
494
- if (!videoEl) {
495
- return;
496
- }
497
- setProgress();
498
- videoEl.addEventListener("timeupdate", timeupdateHandler);
499
- return function cleanup() {
500
- videoEl == null ? void 0 : videoEl.removeEventListener("timeupdate", timeupdateHandler);
501
- };
502
- }, [setProgress, timeupdateHandler, videoEl]);
503
- const onProgress = (progress) => {
504
- var _a;
505
- const progress1 = Math.floor(getPercentage(progress[0], 100));
506
- const videoEl2 = hlsPlayer2 == null ? void 0 : hlsPlayer2.getVideoElement();
507
- if (!videoEl2) {
508
- return;
509
- }
510
- const duration = isFinite(videoEl2.duration) ? videoEl2.duration : ((_a = videoEl2.seekable) == null ? void 0 : _a.end(0)) || 0;
511
- const currentTime = progress1 * duration / 100;
512
- hlsPlayer2 == null ? void 0 : hlsPlayer2.seekTo(currentTime);
513
- setProgress();
514
- };
515
- if (!videoEl) {
516
- return null;
517
- }
518
- return /* @__PURE__ */ React7.createElement(Flex, { align: "center", css: { cursor: "pointer", h: "$2", alignSelf: "stretch" } }, /* @__PURE__ */ React7.createElement(
519
- Slider,
520
- {
521
- id: "video-actual-rest",
522
- css: {
523
- cursor: "pointer",
524
- h: "$2",
525
- zIndex: 1,
526
- transition: `all .2s ease .5s`
527
- },
528
- min: 0,
529
- max: 100,
530
- step: 1,
531
- value: [videoProgress],
532
- showTooltip: false,
533
- onValueChange: onProgress,
534
- onPointerDown: () => setSeekProgress(true),
535
- onPointerUp: () => setSeekProgress(false),
536
- thumbStyles: { w: "$6", h: "$6" }
537
- }
538
- ), /* @__PURE__ */ React7.createElement(
539
- Box,
540
- {
541
- id: "video-buffer",
542
- css: {
543
- h: "$2",
544
- width: `${bufferProgress - videoProgress}%`,
545
- background: "$on_surface_high",
546
- position: "absolute",
547
- left: `${videoProgress}%`,
548
- opacity: "25%"
549
- }
550
- }
551
- ));
552
- };
553
-
554
- // src/Prebuilt/components/HMSVideo/VideoTime.tsx
555
- init_define_process_env();
556
- import React8, { useCallback as useCallback2, useEffect as useEffect3, useState as useState3 } from "react";
557
- import { HMSHLSPlayerEvents } from "@100mslive/hls-player";
558
- var VideoTime = () => {
559
- const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
560
- const [videoTime, setVideoTime] = useState3(getDurationFromSeconds2(0));
561
- const updateTime = useCallback2(
562
- (currentTime) => {
563
- const videoEl = hlsPlayer2 == null ? void 0 : hlsPlayer2.getVideoElement();
564
- if (videoEl) {
565
- const duration = getDuration(videoEl);
566
- setVideoTime(getDurationFromSeconds2(duration - currentTime));
567
- } else {
568
- setVideoTime(getDurationFromSeconds2(currentTime));
569
- }
570
- },
571
- [hlsPlayer2]
572
- );
573
- useEffect3(() => {
574
- const timeupdateHandler = (currentTime) => {
575
- updateTime(currentTime);
576
- };
577
- if (hlsPlayer2) {
578
- hlsPlayer2.on(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
579
- const videoEl = hlsPlayer2 == null ? void 0 : hlsPlayer2.getVideoElement();
580
- updateTime(videoEl.currentTime);
581
- }
582
- return function cleanup() {
583
- hlsPlayer2 == null ? void 0 : hlsPlayer2.off(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
584
- };
585
- }, [hlsPlayer2, updateTime]);
586
- return hlsPlayer2 ? /* @__PURE__ */ React8.createElement(
587
- Text,
588
- {
589
- variant: "body1",
590
- css: {
591
- minWidth: "$16",
592
- c: "$on_surface_medium",
593
- display: "flex",
594
- justifyContent: "center",
595
- fontWeight: "$regular"
596
- }
597
- },
598
- "-",
599
- videoTime
600
- ) : null;
601
- };
602
-
603
- // src/Prebuilt/components/HMSVideo/VolumeControl.tsx
604
- init_define_process_env();
605
- import React9, { useState as useState4 } from "react";
606
- import { VolumeOneIcon, VolumeTwoIcon, VolumeZeroIcon } from "@100mslive/react-icons";
607
- var VolumeControl = () => {
608
- var _a;
609
- const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
610
- const [volume, setVolume] = useState4((_a = hlsPlayer2 == null ? void 0 : hlsPlayer2.volume) != null ? _a : 100);
611
- const [showSlider, setShowSlider] = useState4(false);
612
- return /* @__PURE__ */ React9.createElement(
613
- Flex,
614
- {
615
- align: "center",
616
- css: { color: "$on_surface_high" },
617
- onMouseOver: (event) => {
618
- event.stopPropagation();
619
- setShowSlider(true);
620
- },
621
- onMouseLeave: (event) => {
622
- event.stopPropagation();
623
- setShowSlider(false);
624
- }
625
- },
626
- /* @__PURE__ */ React9.createElement(
627
- VolumeIcon,
628
- {
629
- volume,
630
- onClick: () => {
631
- if (volume > 0) {
632
- setVolume(0);
633
- hlsPlayer2 == null ? void 0 : hlsPlayer2.setVolume(0);
634
- } else {
635
- setVolume(100);
636
- hlsPlayer2 == null ? void 0 : hlsPlayer2.setVolume(100);
637
- }
638
- }
639
- }
640
- ),
641
- /* @__PURE__ */ React9.createElement(
642
- Slider,
643
- {
644
- css: {
645
- mx: "$4",
646
- w: "$20",
647
- cursor: "pointer",
648
- "@sm": { w: "$14" },
649
- "@xs": { w: "$14" },
650
- opacity: showSlider ? "1" : "0",
651
- display: showSlider ? "" : "none",
652
- transition: `all .2s ease .5s`
653
- },
654
- min: 0,
655
- max: 100,
656
- step: 1,
657
- value: [volume],
658
- onValueChange: (volume2) => {
659
- hlsPlayer2 == null ? void 0 : hlsPlayer2.setVolume(volume2[0]);
660
- setVolume(volume2[0]);
661
- },
662
- thumbStyles: { w: "$6", h: "$6" }
663
- }
664
- )
665
- );
666
- };
667
- var VolumeIcon = ({ volume, onClick }) => {
668
- if (volume === 0) {
669
- return /* @__PURE__ */ React9.createElement(VolumeZeroIcon, { style: { cursor: "pointer", transition: "color 0.3s" }, onClick });
670
- }
671
- return volume < 50 ? /* @__PURE__ */ React9.createElement(VolumeOneIcon, { style: { cursor: "pointer", transition: "color 0.3s" }, onClick }) : /* @__PURE__ */ React9.createElement(VolumeTwoIcon, { style: { cursor: "pointer", transition: "color 0.3s" }, onClick });
672
- };
673
-
674
- // src/Prebuilt/components/HMSVideo/index.ts
675
- var HMSVideoPlayer = {
676
- Root: HMSVideo,
677
- Progress: VideoProgress,
678
- Duration: VideoTime,
679
- Volume: VolumeControl,
680
- Controls: {
681
- Root: VideoControls,
682
- Left: LeftControls,
683
- Right: RightControls
684
- },
685
- PlayPauseSeekControls: {
686
- Overlay: PlayPauseSeekOverlayControls,
687
- Button: PlayPauseSeekControls
688
- }
689
- };
690
-
691
- // src/Prebuilt/components/HMSVideo/FullscreenButton.tsx
692
- init_define_process_env();
693
- import React10 from "react";
694
- import { ExpandIcon, ShrinkIcon } from "@100mslive/react-icons";
695
- var FullScreenButton = ({ isFullScreen, onToggle }) => {
696
- return /* @__PURE__ */ React10.createElement(Tooltip, { title: `${isFullScreen ? "Exit" : "Go"} fullscreen`, side: "top" }, /* @__PURE__ */ React10.createElement(IconButton, { css: { margin: "0px" }, onClick: onToggle, key: "fullscreen_btn", "data-testid": "fullscreen_btn" }, /* @__PURE__ */ React10.createElement(Flex, null, isFullScreen ? /* @__PURE__ */ React10.createElement(ShrinkIcon, null) : /* @__PURE__ */ React10.createElement(ExpandIcon, null))));
697
- };
698
-
699
- // src/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.tsx
700
- init_define_process_env();
701
- import React11 from "react";
702
- import { useMedia as useMedia2 } from "react-use";
703
- import { VolumeTwoIcon as VolumeTwoIcon2 } from "@100mslive/react-icons";
704
- function HLSAutoplayBlockedPrompt({
705
- open,
706
- unblockAutoPlay
707
- }) {
708
- const isLandscape = useIsLandscape();
709
- const isMobile = useMedia2(config.media.md);
710
- if ((isMobile || isLandscape) && open) {
711
- return /* @__PURE__ */ React11.createElement(
712
- IconButton,
713
- {
714
- css: {
715
- border: "1px solid white",
716
- bg: "white",
717
- color: "#000",
718
- r: "$2"
719
- },
720
- onClick: () => __async(this, null, function* () {
721
- return yield unblockAutoPlay();
722
- })
723
- },
724
- /* @__PURE__ */ React11.createElement(VolumeTwoIcon2, { width: "32", height: "32" }),
725
- /* @__PURE__ */ React11.createElement(
726
- Text,
727
- {
728
- variant: "body1",
729
- css: {
730
- fontWeight: "$semiBold",
731
- px: "$2",
732
- color: "#000"
733
- }
734
- },
735
- "Tap To Unmute"
736
- )
737
- );
738
- }
739
- return /* @__PURE__ */ React11.createElement(
740
- Dialog.Root,
741
- {
742
- open,
743
- onOpenChange: (value) => __async(this, null, function* () {
744
- if (!value) {
745
- yield unblockAutoPlay();
746
- }
747
- })
748
- },
749
- /* @__PURE__ */ React11.createElement(DialogContent, { title: "Attention", closeable: false }, /* @__PURE__ */ React11.createElement(DialogRow, null, /* @__PURE__ */ React11.createElement(Text, { variant: "md" }, 'The browser wants us to get a confirmation for playing the HLS Stream. Please click "play stream" to proceed.')), /* @__PURE__ */ React11.createElement(DialogRow, { justify: "end" }, /* @__PURE__ */ React11.createElement(
750
- Button,
751
- {
752
- variant: "primary",
753
- onClick: () => __async(this, null, function* () {
754
- yield unblockAutoPlay();
755
- })
756
- },
757
- "Play stream"
758
- )))
759
- );
760
- }
761
-
762
- // src/Prebuilt/components/HMSVideo/HLSCaptionSelector.tsx
763
- init_define_process_env();
764
- import React12 from "react";
765
- import { ClosedCaptionIcon, OpenCaptionIcon } from "@100mslive/react-icons";
766
- function HLSCaptionSelector({ isEnabled }) {
767
- const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
768
- return /* @__PURE__ */ React12.createElement(Tooltip, { title: "Subtitles/closed captions", side: "top" }, /* @__PURE__ */ React12.createElement(IconButton, { css: { p: "$2" }, onClick: () => hlsPlayer2 == null ? void 0 : hlsPlayer2.toggleCaption() }, isEnabled ? /* @__PURE__ */ React12.createElement(ClosedCaptionIcon, { width: "20", height: "20px" }) : /* @__PURE__ */ React12.createElement(OpenCaptionIcon, { width: "20", height: "20px" })));
769
- }
770
-
771
- // src/Prebuilt/components/HMSVideo/HLSQualitySelector.tsx
772
- init_define_process_env();
773
- import React13 from "react";
774
- import { useMedia as useMedia3 } from "react-use";
775
- import { CheckIcon, CrossIcon as CrossIcon2, SettingsIcon } from "@100mslive/react-icons";
776
- function HLSQualitySelector({
777
- open,
778
- onOpenChange,
779
- layers,
780
- onQualityChange,
781
- selection,
782
- isAuto,
783
- containerRef
784
- }) {
785
- const isMobile = useMedia3(config.media.md);
786
- const isLandscape = useIsLandscape();
787
- if (layers.length === 0) {
788
- return null;
789
- }
790
- if (isMobile || isLandscape) {
791
- return /* @__PURE__ */ React13.createElement(Sheet.Root, { open, onOpenChange }, /* @__PURE__ */ React13.createElement(Sheet.Trigger, { asChild: true, "data-testid": "quality_selector" }, /* @__PURE__ */ React13.createElement(
792
- Flex,
793
- {
794
- css: {
795
- color: "$on_primary_high",
796
- r: "$1",
797
- cursor: "pointer",
798
- p: "$2"
799
- }
800
- },
801
- /* @__PURE__ */ React13.createElement(SettingsIcon, null)
802
- )), /* @__PURE__ */ React13.createElement(
803
- Sheet.Content,
804
- {
805
- container: containerRef,
806
- css: { bg: "$surface_default", pb: "$1" },
807
- onClick: () => onOpenChange(false)
808
- },
809
- /* @__PURE__ */ React13.createElement(
810
- Sheet.Title,
811
- {
812
- css: {
813
- display: "flex",
814
- color: "$on_surface_high",
815
- w: "100%",
816
- justifyContent: "space-between",
817
- mt: "$8",
818
- fontSize: "$md",
819
- px: "$10",
820
- pb: "$8",
821
- borderBottom: "1px solid $border_bright",
822
- alignItems: "center"
823
- }
824
- },
825
- "Quality",
826
- /* @__PURE__ */ React13.createElement(Sheet.Close, { css: { color: "$on_surface_high" }, onClick: () => onOpenChange(false) }, /* @__PURE__ */ React13.createElement(CrossIcon2, null))
827
- ),
828
- layers.map((layer) => {
829
- return /* @__PURE__ */ React13.createElement(
830
- Flex,
831
- {
832
- align: "center",
833
- css: {
834
- w: "100%",
835
- bg: "$surface_default",
836
- "&:hover": {
837
- bg: "$surface_brighter"
838
- },
839
- cursor: "pointer",
840
- gap: "$4",
841
- py: "$8",
842
- px: "$10"
843
- },
844
- key: layer.width,
845
- onClick: () => onQualityChange(layer)
846
- },
847
- /* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold" } }, getQualityText(layer)),
848
- /* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { flex: "1 1 0", c: "$on_surface_low", pl: "$2" } }, getBitrateText(layer)),
849
- !isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) && /* @__PURE__ */ React13.createElement(CheckIcon, { width: "16px", height: "16px" })
850
- );
851
- }),
852
- /* @__PURE__ */ React13.createElement(
853
- Flex,
854
- {
855
- align: "center",
856
- css: {
857
- w: "100%",
858
- bg: "$surface_default",
859
- "&:hover": {
860
- bg: "$surface_brighter"
861
- },
862
- cursor: "pointer",
863
- gap: "$4",
864
- py: "$8",
865
- px: "$10"
866
- },
867
- key: "auto",
868
- onClick: () => onQualityChange({ height: "auto" })
869
- },
870
- /* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold", flex: "1 1 0" } }, "Auto"),
871
- isAuto && /* @__PURE__ */ React13.createElement(CheckIcon, { width: "16px", height: "16px" })
872
- )
873
- ));
874
- }
875
- return /* @__PURE__ */ React13.createElement(Dropdown.Root, { open, onOpenChange: (value) => onOpenChange(value), modal: false }, /* @__PURE__ */ React13.createElement(Dropdown.Trigger, { asChild: true, "data-testid": "quality_selector" }, /* @__PURE__ */ React13.createElement(
876
- Flex,
877
- {
878
- css: {
879
- color: "$on_primary_high",
880
- r: "$1",
881
- cursor: "pointer",
882
- p: "$2"
883
- }
884
- },
885
- /* @__PURE__ */ React13.createElement(Tooltip, { title: "Select Quality", side: "top" }, /* @__PURE__ */ React13.createElement(Flex, { align: "center" }, /* @__PURE__ */ React13.createElement(
886
- Box,
887
- {
888
- css: {
889
- w: "$9",
890
- h: "$9",
891
- display: "inline-flex",
892
- alignItems: "center",
893
- c: "$on_surface_high"
894
- }
895
- },
896
- /* @__PURE__ */ React13.createElement(SettingsIcon, null)
897
- ), /* @__PURE__ */ React13.createElement(
898
- Text,
899
- {
900
- variant: {
901
- "@md": "sm",
902
- "@sm": "xs",
903
- "@xs": "tiny"
904
- },
905
- css: { display: "flex", alignItems: "center", ml: "$2", c: "$on_surface_medium" }
906
- },
907
- isAuto && /* @__PURE__ */ React13.createElement(React13.Fragment, null, "Auto", /* @__PURE__ */ React13.createElement(
908
- Box,
909
- {
910
- css: {
911
- mx: "$2",
912
- w: "$2",
913
- h: "$2",
914
- background: "$on_surface_medium",
915
- r: "$1"
916
- }
917
- }
918
- )),
919
- selection && Math.min(selection.width || 0, selection.height || 0),
920
- "p"
921
- )))
922
- )), /* @__PURE__ */ React13.createElement(Dropdown.Portal, { container: containerRef }, /* @__PURE__ */ React13.createElement(
923
- Dropdown.Content,
924
- {
925
- sideOffset: 5,
926
- align: "end",
927
- css: {
928
- height: "auto",
929
- maxHeight: "$52",
930
- w: "$40",
931
- bg: "$surface_bright",
932
- py: "$4",
933
- gap: "$4",
934
- display: "grid"
935
- }
936
- },
937
- layers.map((layer) => {
938
- return /* @__PURE__ */ React13.createElement(
939
- Dropdown.Item,
940
- {
941
- onClick: () => onQualityChange(layer),
942
- key: layer.width,
943
- css: {
944
- bg: !isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) ? "$surface_default" : "$surface_bright",
945
- "&:hover": {
946
- bg: "$surface_brighter"
947
- },
948
- p: "$2 $4 $2 $8",
949
- h: "$12",
950
- gap: "$2"
951
- }
952
- },
953
- /* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold" } }, getQualityText(layer)),
954
- /* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { flex: "1 1 0", c: "$on_surface_low", pl: "$2" } }, getBitrateText(layer)),
955
- !isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) && /* @__PURE__ */ React13.createElement(CheckIcon, { width: "16px", height: "16px" })
956
- );
957
- }),
958
- /* @__PURE__ */ React13.createElement(
959
- Dropdown.Item,
960
- {
961
- onClick: () => onQualityChange({ height: "auto" }),
962
- key: "auto",
963
- css: {
964
- bg: !isAuto ? "$surface_bright" : "$surface_default",
965
- "&:hover": {
966
- bg: "$surface_brighter"
967
- },
968
- p: "$2 $4 $2 $8",
969
- h: "$12",
970
- gap: "$2"
971
- }
972
- },
973
- /* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold", flex: "1 1 0" } }, "Auto"),
974
- isAuto && /* @__PURE__ */ React13.createElement(CheckIcon, { width: "16px", height: "16px" })
975
- )
976
- )));
977
- }
978
- var getQualityText = (layer) => `${Math.min(layer.height || 0, layer.width || 0)}p `;
979
- var getBitrateText = (layer) => `(${(Number(layer.bitrate / 1e3) / 1e3).toFixed(2)} Mbps)`;
980
-
981
- // src/Prebuilt/components/HMSVideo/MwebHLSViewTitle.tsx
982
- init_define_process_env();
983
- import React14 from "react";
984
- import { ChevronDownIcon } from "@100mslive/react-icons";
985
- var HLSViewTitle = () => {
986
- const { title, details, description } = useRoomLayoutHeader();
987
- const toggleDetailsPane = useSidepaneToggle(SIDE_PANE_OPTIONS.ROOM_DETAILS);
988
- const isDetailSidepaneOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.ROOM_DETAILS);
989
- if (isDetailSidepaneOpen) {
990
- return /* @__PURE__ */ React14.createElement(
991
- Flex,
992
- {
993
- gap: "4",
994
- align: "center",
995
- justify: "between",
996
- css: {
997
- position: "relative",
998
- h: "fit-content",
999
- w: "100%",
1000
- borderBottom: "1px solid $border_bright",
1001
- p: "$8",
1002
- backgroundColor: "$surface_dim"
1003
- }
1004
- },
1005
- /* @__PURE__ */ React14.createElement(Text, { variant: "sub2", css: { fontWeight: "$semiBold" } }, "About Session"),
1006
- /* @__PURE__ */ React14.createElement(
1007
- Flex,
1008
- {
1009
- onClick: toggleDetailsPane,
1010
- css: {
1011
- color: "$on_surface_high",
1012
- cursor: "pointer",
1013
- "&:hover": { opacity: "0.8" }
1014
- }
1015
- },
1016
- /* @__PURE__ */ React14.createElement(ChevronDownIcon, null)
1017
- )
1018
- );
1019
- }
1020
- return /* @__PURE__ */ React14.createElement(
1021
- Flex,
1022
- {
1023
- gap: "4",
1024
- align: "center",
1025
- css: {
1026
- position: "relative",
1027
- h: "fit-content",
1028
- w: "100%",
1029
- borderBottom: "1px solid $border_bright",
1030
- p: "$8",
1031
- backgroundColor: "$surface_dim"
1032
- }
1033
- },
1034
- /* @__PURE__ */ React14.createElement(Logo, null),
1035
- /* @__PURE__ */ React14.createElement(Flex, { direction: "column" }, title ? /* @__PURE__ */ React14.createElement(Text, { variant: "sub2", css: { fontWeight: "$semiBold" } }, title) : null, /* @__PURE__ */ React14.createElement(Flex, null, /* @__PURE__ */ React14.createElement(RoomDetailsRow, { details }), description ? /* @__PURE__ */ React14.createElement(Text, { variant: "caption", css: { color: "$on_surface_medium" }, onClick: toggleDetailsPane }, "\xA0...more") : null))
1036
- );
1037
- };
1038
-
1039
- // src/Prebuilt/layouts/HLSView.jsx
1040
- var hlsPlayer;
1041
- var toastMap = {};
1042
- var ToggleChat = ({ isFullScreen = false }) => {
1043
- const { elements } = useRoomLayoutConferencingScreen();
1044
- const sidepane = useHMSStore(selectAppData(APP_DATA.sidePane));
1045
- const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
1046
- const showChat = !!(elements == null ? void 0 : elements.chat);
1047
- const isMobile = useMedia4(config.media.md);
1048
- const hmsActions = useHMSActions();
1049
- useEffect4(() => {
1050
- match({ sidepane, isMobile, showChat, isFullScreen }).with({ isFullScreen: true }, () => {
1051
- hmsActions.setAppData(APP_DATA.sidePane, "");
1052
- }).with({ isMobile: true, showChat: true, sidepane: P.when((value) => !value) }, () => {
1053
- toggleChat();
1054
- }).with({ showChat: false, isMobile: true, sidepane: SIDE_PANE_OPTIONS.CHAT }, () => {
1055
- hmsActions.setAppData(APP_DATA.sidePane, "");
1056
- }).otherwise(() => {
1057
- });
1058
- }, [sidepane, isMobile, toggleChat, showChat, hmsActions, isFullScreen]);
1059
- return null;
1060
- };
1061
- var HLSView = () => {
1062
- var _a, _b, _c, _d, _e, _f, _g;
1063
- const videoRef = useRef(null);
1064
- const hlsViewRef = useRef();
1065
- const { elements } = useRoomLayoutConferencingScreen();
1066
- const hlsState = useHMSStore(selectHLSState);
1067
- const enablHlsStats = useHMSStore(selectAppData(APP_DATA.hlsStats));
1068
- const notification = useHMSNotifications(HMSNotificationTypes.POLL_STOPPED);
1069
- const hmsActions = useHMSActions();
1070
- const { themeType } = useTheme();
1071
- const [streamEnded, setStreamEnded] = useState5(false);
1072
- let [hlsStatsState, setHlsStatsState] = useState5(null);
1073
- const hlsUrl = (_a = hlsState.variants[0]) == null ? void 0 : _a.url;
1074
- const [availableLayers, setAvailableLayers] = useState5([]);
1075
- const [isVideoLive, setIsVideoLive] = useState5(true);
1076
- const [isCaptionEnabled, setIsCaptionEnabled] = useState5(true);
1077
- const [hasCaptions, setHasCaptions] = useState5(false);
1078
- const [currentSelectedQuality, setCurrentSelectedQuality] = useState5(null);
1079
- const [isHlsAutoplayBlocked, setIsHlsAutoplayBlocked] = useState5(false);
1080
- const [hoverControlsVisible, setHoverControlsVisible] = useState5({
1081
- seekForward: false,
1082
- pausePlay: false,
1083
- seekBackward: false
1084
- });
1085
- const [isPaused, setIsPaused] = useState5(false);
1086
- const [show, toggle] = useToggle(false);
1087
- const lastHlsUrl = usePrevious(hlsUrl);
1088
- const vanillaStore = useHMSVanillaStore();
1089
- const [controlsVisible, setControlsVisible] = useState5(true);
1090
- const [isUserSelectedAuto, setIsUserSelectedAuto] = useState5(true);
1091
- const [qualityDropDownOpen, setQualityDropDownOpen] = useState5(false);
1092
- const controlsRef = useRef(null);
1093
- const controlsTimerRef = useRef();
1094
- const [seekProgress, setSeekProgress] = useState5(false);
1095
- const isFullScreenSupported = screenfull.isEnabled;
1096
- const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
1097
- const showChat = !!(elements == null ? void 0 : elements.chat);
1098
- const isMobile = useMedia4(config.media.md);
1099
- const isLandscape = useIsLandscape();
1100
- const isFullScreen = useFullscreen(hlsViewRef, show, {
1101
- onClose: () => toggle(false)
1102
- });
1103
- const [showLoader, setShowLoader] = useState5(false);
1104
- useEffect4(() => {
1105
- const videoEl = videoRef.current;
1106
- const showLoader2 = () => setShowLoader(true);
1107
- const hideLoader = () => setShowLoader(false);
1108
- videoEl == null ? void 0 : videoEl.addEventListener("playing", hideLoader);
1109
- videoEl == null ? void 0 : videoEl.addEventListener("waiting", showLoader2);
1110
- return () => {
1111
- videoEl == null ? void 0 : videoEl.removeEventListener("playing", hideLoader);
1112
- videoEl == null ? void 0 : videoEl.removeEventListener("waiting", showLoader2);
1113
- };
1114
- }, []);
1115
- useEffect4(() => {
1116
- if (streamEnded && lastHlsUrl !== hlsUrl) {
1117
- setStreamEnded(false);
1118
- }
1119
- }, [hlsUrl, streamEnded, lastHlsUrl]);
1120
- useEffect4(() => {
1121
- if (!notification)
1122
- return;
1123
- const toastID = toastMap == null ? void 0 : toastMap[notification.data.id];
1124
- if (toastID) {
1125
- ToastManager.removeToast(toastMap[notification.data.id]);
1126
- delete toastMap[notification.data.id];
1127
- }
1128
- }, [notification]);
1129
- useEffect4(() => {
1130
- const videoElem = videoRef.current;
1131
- const setStreamEndedCallback = () => {
1132
- setStreamEnded(true);
1133
- videoElem == null ? void 0 : videoElem.removeEventListener("ended", setStreamEndedCallback);
1134
- };
1135
- videoElem == null ? void 0 : videoElem.addEventListener("ended", setStreamEndedCallback);
1136
- return () => {
1137
- videoElem == null ? void 0 : videoElem.removeEventListener("ended", setStreamEndedCallback);
1138
- };
1139
- }, [hlsUrl]);
1140
- const handleQuality = useCallback3(
1141
- (quality) => {
1142
- var _a2;
1143
- if (hlsPlayer) {
1144
- setIsUserSelectedAuto(((_a2 = quality.height) == null ? void 0 : _a2.toString().toLowerCase()) === "auto");
1145
- hlsPlayer == null ? void 0 : hlsPlayer.setLayer(quality);
1146
- }
1147
- },
1148
- [availableLayers]
1149
- //eslint-disable-line
1150
- );
1151
- useEffect4(() => {
1152
- let videoEl = videoRef.current;
1153
- const manifestLoadedHandler = ({ layers }) => {
1154
- setAvailableLayers(layers);
1155
- setHasCaptions(hlsPlayer == null ? void 0 : hlsPlayer.hasCaptions());
1156
- };
1157
- const layerUpdatedHandler = ({ layer }) => {
1158
- setCurrentSelectedQuality(layer);
1159
- };
1160
- const metadataLoadedHandler = (_a2) => {
1161
- var _b2 = _a2, { payload } = _b2, rest = __objRest(_b2, ["payload"]);
1162
- var _a3;
1163
- const parsePayload = (str) => {
1164
- try {
1165
- return JSON.parse(str);
1166
- } catch (e) {
1167
- return str;
1168
- }
1169
- };
1170
- const duration = rest.duration;
1171
- const parsedPayload = parsePayload(payload);
1172
- if (parsedPayload.startsWith("poll:")) {
1173
- const pollId = parsedPayload.substr(parsedPayload.indexOf(":") + 1);
1174
- const poll = vanillaStore.getState(selectPollByID(pollId));
1175
- const pollStartedBy = vanillaStore.getState(selectPeerNameByID(poll.startedBy)) || "Participant";
1176
- if (!toastMap[pollId]) {
1177
- const toastID = ToastManager.addToast({
1178
- title: `${pollStartedBy} started a ${poll.type}: ${poll.title}`,
1179
- action: /* @__PURE__ */ React15.createElement(
1180
- Button,
1181
- {
1182
- onClick: () => {
1183
- hmsActions.setAppData(APP_DATA.pollState, {
1184
- [POLL_STATE.pollInView]: pollId,
1185
- [POLL_STATE.view]: POLL_VIEWS.VOTE
1186
- });
1187
- hmsActions.setAppData(APP_DATA.sidePane, SIDE_PANE_OPTIONS.POLLS);
1188
- },
1189
- variant: "standard",
1190
- css: {
1191
- backgroundColor: "$surface_bright",
1192
- fontWeight: "$semiBold",
1193
- color: "$on_surface_high",
1194
- p: "$xs $md"
1195
- }
1196
- },
1197
- poll.type === "quiz" ? "Answer" : "Vote"
1198
- ),
1199
- duration: Infinity
1200
- });
1201
- toastMap[pollId] = toastID;
1202
- }
1203
- return;
1204
- }
1205
- switch (parsedPayload.type) {
1206
- case EMOJI_REACTION_TYPE:
1207
- (_a3 = window.showFlyingEmoji) == null ? void 0 : _a3.call(window, { emojiId: parsedPayload == null ? void 0 : parsedPayload.emojiId, senderId: parsedPayload == null ? void 0 : parsedPayload.senderId });
1208
- break;
1209
- default: {
1210
- const toast = {
1211
- title: `Payload from timed Metadata ${parsedPayload}`,
1212
- duration: duration || 3e3
1213
- };
1214
- console.debug("Added toast ", JSON.stringify(toast));
1215
- ToastManager.addToast(toast);
1216
- break;
1217
- }
1218
- }
1219
- };
1220
- const handleError = (data) => {
1221
- console.error("[HLSView] error in hls", `${data}`);
1222
- };
1223
- const handleNoLongerLive = ({ isLive }) => {
1224
- setIsVideoLive(isLive);
1225
- };
1226
- const playbackEventHandler = (data) => {
1227
- setIsPaused(data.state === HLSPlaybackState.paused);
1228
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1229
- pausePlay: true
1230
- }));
1231
- setTimeout(() => {
1232
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1233
- pausePlay: false
1234
- }));
1235
- }, 2e3);
1236
- };
1237
- const captionEnabledEventHandler = (isCaptionEnabled2) => {
1238
- setIsCaptionEnabled(isCaptionEnabled2);
1239
- };
1240
- const handleAutoplayBlock = (data) => setIsHlsAutoplayBlocked(!!data);
1241
- if (videoEl && hlsUrl) {
1242
- hlsPlayer = new HMSHLSPlayer(hlsUrl, videoEl);
1243
- hlsPlayer.on(HMSHLSPlayerEvents2.SEEK_POS_BEHIND_LIVE_EDGE, handleNoLongerLive);
1244
- hlsPlayer.on(HMSHLSPlayerEvents2.TIMED_METADATA_LOADED, metadataLoadedHandler);
1245
- hlsPlayer.on(HMSHLSPlayerEvents2.ERROR, handleError);
1246
- hlsPlayer.on(HMSHLSPlayerEvents2.PLAYBACK_STATE, playbackEventHandler);
1247
- hlsPlayer.on(HMSHLSPlayerEvents2.CAPTION_ENABLED, captionEnabledEventHandler);
1248
- hlsPlayer.on(HMSHLSPlayerEvents2.AUTOPLAY_BLOCKED, handleAutoplayBlock);
1249
- hlsPlayer.on(HMSHLSPlayerEvents2.MANIFEST_LOADED, manifestLoadedHandler);
1250
- hlsPlayer.on(HMSHLSPlayerEvents2.LAYER_UPDATED, layerUpdatedHandler);
1251
- return () => {
1252
- hlsPlayer.off(HMSHLSPlayerEvents2.SEEK_POS_BEHIND_LIVE_EDGE, handleNoLongerLive);
1253
- hlsPlayer.off(HMSHLSPlayerEvents2.ERROR, handleError);
1254
- hlsPlayer.off(HMSHLSPlayerEvents2.TIMED_METADATA_LOADED, metadataLoadedHandler);
1255
- hlsPlayer.off(HMSHLSPlayerEvents2.PLAYBACK_STATE, playbackEventHandler);
1256
- hlsPlayer.off(HMSHLSPlayerEvents2.CAPTION_ENABLED, captionEnabledEventHandler);
1257
- hlsPlayer.off(HMSHLSPlayerEvents2.AUTOPLAY_BLOCKED, handleAutoplayBlock);
1258
- hlsPlayer.off(HMSHLSPlayerEvents2.MANIFEST_LOADED, manifestLoadedHandler);
1259
- hlsPlayer.off(HMSHLSPlayerEvents2.LAYER_UPDATED, layerUpdatedHandler);
1260
- hlsPlayer.reset();
1261
- };
1262
- }
1263
- }, [hlsUrl, vanillaStore, hmsActions]);
1264
- useEffect4(() => {
1265
- const onHLSStats = (state) => setHlsStatsState(state);
1266
- if (enablHlsStats) {
1267
- hlsPlayer == null ? void 0 : hlsPlayer.on(HMSHLSPlayerEvents2.STATS, onHLSStats);
1268
- } else {
1269
- hlsPlayer == null ? void 0 : hlsPlayer.off(HMSHLSPlayerEvents2.STATS, onHLSStats);
1270
- }
1271
- return () => {
1272
- hlsPlayer == null ? void 0 : hlsPlayer.off(HMSHLSPlayerEvents2.STATS, onHLSStats);
1273
- };
1274
- }, [enablHlsStats]);
1275
- const unblockAutoPlay = () => __async(void 0, null, function* () {
1276
- try {
1277
- yield hlsPlayer.play();
1278
- setIsHlsAutoplayBlocked(false);
1279
- } catch (error) {
1280
- console.error("Tried to unblock Autoplay failed with", error.message);
1281
- }
1282
- });
1283
- const sfnOverlayClose = () => {
1284
- hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats);
1285
- };
1286
- useEffect4(() => {
1287
- if (controlsVisible && isFullScreen && !qualityDropDownOpen) {
1288
- if (controlsTimerRef.current) {
1289
- clearTimeout(controlsTimerRef.current);
1290
- }
1291
- }
1292
- if (!isFullScreen && controlsTimerRef.current) {
1293
- clearTimeout(controlsTimerRef.current);
1294
- }
1295
- controlsTimerRef.current = setTimeout(() => {
1296
- if (!seekProgress) {
1297
- setControlsVisible(false);
1298
- }
1299
- }, 5e3);
1300
- return () => {
1301
- if (controlsTimerRef.current) {
1302
- clearTimeout(controlsTimerRef.current);
1303
- }
1304
- };
1305
- }, [controlsVisible, isFullScreen, seekProgress, qualityDropDownOpen]);
1306
- const onSeekTo = useCallback3(
1307
- (seek) => {
1308
- var _a2;
1309
- match({ isLandscape, isMobile, seek }).with({ seek: -10, isMobile: false, isLandscape: false }, () => {
1310
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), { seekBackward: true }));
1311
- setTimeout(() => {
1312
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1313
- seekBackward: false
1314
- }));
1315
- }, 1e3);
1316
- }).with({ seek: 10, isMobile: false, isLandscape: false }, () => {
1317
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), { seekForward: true }));
1318
- setTimeout(() => {
1319
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1320
- seekForward: false
1321
- }));
1322
- }, 1e3);
1323
- }).otherwise(() => null);
1324
- hlsPlayer == null ? void 0 : hlsPlayer.seekTo(((_a2 = videoRef.current) == null ? void 0 : _a2.currentTime) + seek);
1325
- },
1326
- [hoverControlsVisible, isLandscape, isMobile]
1327
- );
1328
- const onDoubleClickHandler = useCallback3(
1329
- (event) => {
1330
- var _a2;
1331
- if (!(isMobile || isLandscape) || ((_a2 = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _a2.playlist_type) !== HLSPlaylistType.DVR) {
1332
- return;
1333
- }
1334
- const sidePercentage = event.screenX * 100 / event.target.clientWidth;
1335
- if (sidePercentage < 45) {
1336
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1337
- seekBackward: true
1338
- }));
1339
- onSeekTo(-10);
1340
- } else {
1341
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1342
- seekForward: true
1343
- }));
1344
- onSeekTo(10);
1345
- }
1346
- setTimeout(() => {
1347
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1348
- seekForward: false,
1349
- seekBackward: false
1350
- }));
1351
- }, 1e3);
1352
- },
1353
- [hlsState == null ? void 0 : hlsState.variants, hoverControlsVisible, isLandscape, isMobile, onSeekTo]
1354
- );
1355
- const onClickHandler = useCallback3(() => __async(void 0, null, function* () {
1356
- var _a2;
1357
- match({ isMobile, isLandscape, playlist_type: (_a2 = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _a2.playlist_type }).with({ playlist_type: HLSPlaylistType.DVR, isMobile: false, isLandscape: false }, () => __async(void 0, null, function* () {
1358
- if (isPaused) {
1359
- yield hlsPlayer == null ? void 0 : hlsPlayer.play();
1360
- } else {
1361
- hlsPlayer == null ? void 0 : hlsPlayer.pause();
1362
- }
1363
- })).when(
1364
- ({ isMobile: isMobile2, isLandscape: isLandscape2 }) => isMobile2 || isLandscape2,
1365
- () => {
1366
- setControlsVisible((value) => !value);
1367
- if (controlsTimerRef.current) {
1368
- clearTimeout(controlsTimerRef.current);
1369
- }
1370
- }
1371
- ).otherwise(() => null);
1372
- }), [hlsState == null ? void 0 : hlsState.variants, isLandscape, isMobile, isPaused]);
1373
- const onHoverHandler = useCallback3(
1374
- (event) => {
1375
- event.preventDefault();
1376
- if (isMobile || isLandscape) {
1377
- return;
1378
- }
1379
- if (event.type === "mouseenter" || qualityDropDownOpen) {
1380
- setControlsVisible(true);
1381
- return;
1382
- }
1383
- if (event.type === "mouseleave" && !seekProgress) {
1384
- setControlsVisible(false);
1385
- } else if (!controlsVisible && event.type === "mousemove") {
1386
- setControlsVisible(true);
1387
- if (controlsTimerRef.current) {
1388
- clearTimeout(controlsTimerRef.current);
1389
- }
1390
- }
1391
- },
1392
- [controlsVisible, isLandscape, isMobile, qualityDropDownOpen, seekProgress]
1393
- );
1394
- const keyHandler = useKeyboardHandler(isPaused, hlsPlayer);
1395
- if (!hlsUrl || streamEnded) {
1396
- return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(ToggleChat, null), hlsViewRef.current && (isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(Box, { css: { position: "fixed", left: "$4", top: "$4", zIndex: 11 } }, /* @__PURE__ */ React15.createElement(LeaveRoom, { screenType: "hls_live_streaming", container: hlsViewRef.current })), /* @__PURE__ */ React15.createElement(
1397
- Flex,
1398
- {
1399
- key: "hls-viewer",
1400
- id: `hls-viewer-${themeType}`,
1401
- ref: hlsViewRef,
1402
- direction: isMobile || isLandscape ? "column" : "row",
1403
- justify: "center",
1404
- css: {
1405
- flex: isLandscape ? "2 1 0" : "1 1 0"
1406
- }
1407
- },
1408
- streamEnded ? /* @__PURE__ */ React15.createElement(
1409
- WaitingView,
1410
- {
1411
- icon: /* @__PURE__ */ React15.createElement(ColoredHandIcon, { height: 56, width: 56 }),
1412
- title: "Stream has ended",
1413
- subtitle: "Have a nice day!"
1414
- }
1415
- ) : /* @__PURE__ */ React15.createElement(
1416
- WaitingView,
1417
- {
1418
- icon: /* @__PURE__ */ React15.createElement(GoLiveIcon, { height: 56, width: 56, style: { color: "white" } }),
1419
- title: "Stream yet to start",
1420
- subtitle: "Sit back and relax"
1421
- }
1422
- )
1423
- ));
1424
- }
1425
- return /* @__PURE__ */ React15.createElement(
1426
- Flex,
1427
- {
1428
- key: "hls-viewer",
1429
- id: `hls-viewer-${themeType}`,
1430
- ref: hlsViewRef,
1431
- direction: isMobile || isLandscape ? "column" : "row",
1432
- justify: "center",
1433
- css: {
1434
- flex: isLandscape ? "2 1 0" : "1 1 0",
1435
- transition: "all 0.3s ease-in-out"
1436
- }
1437
- },
1438
- hlsViewRef.current && (isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(Box, { css: { position: "fixed", left: "$4", top: "$4", zIndex: 11 } }, /* @__PURE__ */ React15.createElement(LeaveRoom, { screenType: "hls_live_streaming", container: hlsViewRef.current })),
1439
- /* @__PURE__ */ React15.createElement(HMSPlayerContext.Provider, { value: { hlsPlayer } }, (hlsStatsState == null ? void 0 : hlsStatsState.url) && enablHlsStats && !(isMobile || isLandscape) ? /* @__PURE__ */ React15.createElement(HlsStatsOverlay, { hlsStatsState, onClose: sfnOverlayClose }) : null, /* @__PURE__ */ React15.createElement(
1440
- Flex,
1441
- {
1442
- id: "hls-player-container",
1443
- align: "center",
1444
- justify: "center",
1445
- css: {
1446
- size: "100%",
1447
- margin: "0 auto",
1448
- "@md": {
1449
- height: "auto"
1450
- },
1451
- outline: "none"
1452
- },
1453
- onKeyDown: (event) => __async(void 0, null, function* () {
1454
- var _a2;
1455
- if (((_a2 = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _a2.playlist_type) === HLSPlaylistType.DVR) {
1456
- yield keyHandler(event);
1457
- }
1458
- }),
1459
- tabIndex: "0"
1460
- },
1461
- !(isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(HLSAutoplayBlockedPrompt, { open: isHlsAutoplayBlocked, unblockAutoPlay }),
1462
- showLoader && /* @__PURE__ */ React15.createElement(
1463
- Flex,
1464
- {
1465
- align: "center",
1466
- justify: "center",
1467
- css: {
1468
- position: "absolute"
1469
- }
1470
- },
1471
- /* @__PURE__ */ React15.createElement(Loading, { width: 72, height: 72 })
1472
- ),
1473
- /* @__PURE__ */ React15.createElement(
1474
- HMSVideoPlayer.Root,
1475
- {
1476
- ref: videoRef,
1477
- onMouseEnter: onHoverHandler,
1478
- onMouseMove: onHoverHandler,
1479
- onMouseLeave: onHoverHandler,
1480
- onClick: onClickHandler,
1481
- isFullScreen,
1482
- onDoubleClick: (e) => {
1483
- onDoubleClickHandler(e);
1484
- }
1485
- },
1486
- /* @__PURE__ */ React15.createElement(React15.Fragment, null, !(isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(
1487
- Flex,
1488
- {
1489
- align: "center",
1490
- justify: "between",
1491
- css: {
1492
- position: "absolute",
1493
- bg: `${hoverControlsVisible.pausePlay || hoverControlsVisible.seekBackward || hoverControlsVisible.seekForward ? "#00000066" : ""}`,
1494
- display: "inline-flex",
1495
- gap: "$2",
1496
- zIndex: 1,
1497
- size: "100%"
1498
- }
1499
- },
1500
- !showLoader && ((_b = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _b.playlist_type) === HLSPlaylistType.DVR && /* @__PURE__ */ React15.createElement(
1501
- HMSVideoPlayer.PlayPauseSeekControls.Overlay,
1502
- {
1503
- isPaused,
1504
- showControls: controlsVisible,
1505
- hoverControlsVisible
1506
- }
1507
- )
1508
- ), isMobile || isLandscape ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, !showLoader && ((_c = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _c.playlist_type) === HLSPlaylistType.DVR && /* @__PURE__ */ React15.createElement(
1509
- HMSVideoPlayer.PlayPauseSeekControls.Overlay,
1510
- {
1511
- isPaused,
1512
- showControls: controlsVisible,
1513
- hoverControlsVisible
1514
- }
1515
- ), /* @__PURE__ */ React15.createElement(
1516
- Flex,
1517
- {
1518
- ref: controlsRef,
1519
- direction: "column",
1520
- justify: "start",
1521
- align: "start",
1522
- css: {
1523
- position: "absolute",
1524
- top: "0",
1525
- left: "0",
1526
- width: "100%",
1527
- flexShrink: 0,
1528
- zIndex: 1,
1529
- visibility: controlsVisible ? `` : `hidden`,
1530
- opacity: controlsVisible ? `1` : "0"
1531
- }
1532
- },
1533
- /* @__PURE__ */ React15.createElement(
1534
- HMSVideoPlayer.Controls.Root,
1535
- {
1536
- css: {
1537
- p: "$4 $8"
1538
- },
1539
- onClick: (e) => e.stopPropagation()
1540
- },
1541
- /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Controls.Right, null, (isLandscape || isMobile && isFullScreen) && showChat && /* @__PURE__ */ React15.createElement(
1542
- ChatToggle,
1543
- {
1544
- onClick: () => {
1545
- if (isFullScreen) {
1546
- toggle();
1547
- }
1548
- setTimeout(() => {
1549
- toggleChat();
1550
- }, 0);
1551
- }
1552
- }
1553
- ), hasCaptions && !isHlsAutoplayBlocked && /* @__PURE__ */ React15.createElement(HLSCaptionSelector, { isEnabled: isCaptionEnabled }), hlsViewRef.current && availableLayers.length > 0 && !isHlsAutoplayBlocked ? /* @__PURE__ */ React15.createElement(
1554
- HLSQualitySelector,
1555
- {
1556
- layers: availableLayers,
1557
- onOpenChange: setQualityDropDownOpen,
1558
- open: qualityDropDownOpen,
1559
- selection: currentSelectedQuality,
1560
- onQualityChange: handleQuality,
1561
- isAuto: isUserSelectedAuto,
1562
- containerRef: hlsViewRef.current
1563
- }
1564
- ) : null, /* @__PURE__ */ React15.createElement(HLSAutoplayBlockedPrompt, { open: isHlsAutoplayBlocked, unblockAutoPlay }))
1565
- )
1566
- )) : null, controlsVisible && /* @__PURE__ */ React15.createElement(
1567
- Flex,
1568
- {
1569
- ref: controlsRef,
1570
- direction: isMobile ? "columnReverse" : "column",
1571
- justify: "end",
1572
- align: "start",
1573
- css: {
1574
- position: "absolute",
1575
- bottom: isFullScreen && ((_d = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _d.playlist_type) === HLSPlaylistType.DVR ? "$8" : "0",
1576
- left: "0",
1577
- zIndex: 1,
1578
- background: isMobile || isLandscape ? "" : `linear-gradient(180deg, ${theme.colors.background_dim.value}00 29.46%, ${theme.colors.background_dim.value}A3 100%);`,
1579
- width: "100%",
1580
- pt: "$8",
1581
- flexShrink: 0,
1582
- transition: "visibility 0s 0.5s, opacity 0.5s linear"
1583
- }
1584
- },
1585
- ((_e = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _e.playlist_type) === HLSPlaylistType.DVR ? /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Progress, { seekProgress, setSeekProgress }) : null,
1586
- /* @__PURE__ */ React15.createElement(
1587
- HMSVideoPlayer.Controls.Root,
1588
- {
1589
- css: {
1590
- p: "$4 $8"
1591
- },
1592
- onClick: (e) => e.stopPropagation()
1593
- },
1594
- /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Controls.Left, null, !(isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(React15.Fragment, null, ((_f = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _f.playlist_type) === HLSPlaylistType.DVR ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(HMSVideoPlayer.PlayPauseSeekControls.Button, { isPaused, onSeekTo }), !isVideoLive ? /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Duration, null) : null) : null, /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Volume, null)), /* @__PURE__ */ React15.createElement(
1595
- IconButton,
1596
- {
1597
- css: { px: "$2" },
1598
- onClick: (e) => __async(void 0, null, function* () {
1599
- e.stopPropagation();
1600
- yield hlsPlayer == null ? void 0 : hlsPlayer.seekToLivePosition();
1601
- setIsVideoLive(true);
1602
- }),
1603
- key: "jump-to-live_btn",
1604
- "data-testid": "jump-to-live_btn"
1605
- },
1606
- /* @__PURE__ */ React15.createElement(Tooltip, { title: isVideoLive ? "Live" : "Go to Live", side: "top" }, /* @__PURE__ */ React15.createElement(Flex, { justify: "center", gap: 2, align: "center" }, /* @__PURE__ */ React15.createElement(
1607
- Box,
1608
- {
1609
- css: {
1610
- height: "$4",
1611
- width: "$4",
1612
- background: isVideoLive ? "$alert_error_default" : "$on_primary_medium",
1613
- r: "$1"
1614
- }
1615
- }
1616
- ), /* @__PURE__ */ React15.createElement(
1617
- Text,
1618
- {
1619
- variant: "$body1",
1620
- css: {
1621
- c: isVideoLive ? "$on_surface_high" : "$on_surface_medium",
1622
- fontWeight: "$semiBold"
1623
- }
1624
- },
1625
- isVideoLive ? "LIVE" : "GO LIVE"
1626
- )))
1627
- ), (isMobile || isLandscape) && !isVideoLive && ((_g = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _g.playlist_type) === HLSPlaylistType.DVR ? /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Duration, null) : null),
1628
- /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Controls.Right, null, hasCaptions && !(isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(HLSCaptionSelector, { isEnabled: isCaptionEnabled }), availableLayers.length > 0 && !(isMobile || isLandscape) ? /* @__PURE__ */ React15.createElement(
1629
- HLSQualitySelector,
1630
- {
1631
- layers: availableLayers,
1632
- onOpenChange: setQualityDropDownOpen,
1633
- open: qualityDropDownOpen,
1634
- selection: currentSelectedQuality,
1635
- onQualityChange: handleQuality,
1636
- isAuto: isUserSelectedAuto,
1637
- containerRef: hlsViewRef.current
1638
- }
1639
- ) : null, isFullScreenSupported ? /* @__PURE__ */ React15.createElement(FullScreenButton, { isFullScreen, onToggle: toggle }) : null)
1640
- )
1641
- ))
1642
- )
1643
- )),
1644
- /* @__PURE__ */ React15.createElement(ToggleChat, { isFullScreen }),
1645
- isMobile && !isFullScreen && /* @__PURE__ */ React15.createElement(HLSViewTitle, null)
1646
- );
1647
- };
1648
- var HLSView_default = HLSView;
1649
- export {
1650
- HLSView_default as default
1651
- };
1652
- //# sourceMappingURL=HLSView-HYI6LLL6.js.map