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

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