@100mslive/roomkit-react 0.3.24-alpha.0 → 0.3.24-alpha.2

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