@100mslive/roomkit-react 0.5.4-alpha.0 → 0.5.4-alpha.1

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