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

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