@100mslive/roomkit-react 0.2.8-alpha.3 → 0.2.8-alpha.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-PACDZWJN.js → HLSView-CVNJNDUQ.js} +509 -234
- package/dist/HLSView-CVNJNDUQ.js.map +7 -0
- package/dist/Prebuilt/common/hooks.d.ts +3 -0
- package/dist/Prebuilt/components/HMSVideo/FullscreenButton.d.ts +5 -0
- package/dist/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.d.ts +5 -0
- package/dist/Prebuilt/components/HMSVideo/HLSCaptionSelector.d.ts +1 -2
- package/dist/Prebuilt/components/HMSVideo/HLSQualitySelector.d.ts +12 -0
- package/dist/Prebuilt/components/HMSVideo/MwebHLSViewTitle.d.ts +2 -0
- package/dist/Prebuilt/components/HMSVideo/PlayButton.d.ts +6 -0
- package/dist/Prebuilt/components/HMSVideo/PlayerContext.d.ts +8 -0
- package/dist/Prebuilt/components/HMSVideo/VideoProgress.d.ts +2 -0
- package/dist/Prebuilt/components/HMSVideo/VideoTime.d.ts +2 -0
- package/dist/Prebuilt/components/HMSVideo/VolumeControl.d.ts +2 -0
- package/dist/Prebuilt/components/HMSVideo/index.d.ts +17 -0
- package/dist/Prebuilt/components/HMSVideo/utils.d.ts +9 -0
- package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +1 -3
- package/dist/Prebuilt/components/MwebLandscapePrompt.d.ts +1 -1
- package/dist/Prebuilt/components/RaiseHand.d.ts +2 -0
- package/dist/Prebuilt/components/SidePaneTabs.d.ts +1 -0
- package/dist/{chunk-2QHBD2VO.js → chunk-25HZFDG5.js} +562 -450
- package/dist/chunk-25HZFDG5.js.map +7 -0
- package/dist/index.cjs.js +1556 -1145
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.js +1 -1
- package/dist/meta.cjs.json +429 -156
- package/dist/meta.esbuild.json +445 -164
- package/package.json +6 -6
- package/src/Prebuilt/common/hooks.ts +21 -0
- package/src/Prebuilt/components/Chat/ChatFooter.tsx +26 -10
- package/src/Prebuilt/components/ConferenceScreen.tsx +34 -2
- package/src/Prebuilt/components/Footer/Footer.tsx +0 -1
- package/src/Prebuilt/components/HMSVideo/Controls.jsx +1 -1
- package/src/Prebuilt/components/HMSVideo/FullscreenButton.tsx +13 -0
- package/src/Prebuilt/components/HMSVideo/{HLSAutoplayBlockedPrompt.jsx → HLSAutoplayBlockedPrompt.tsx} +13 -6
- package/src/Prebuilt/components/HMSVideo/HLSCaptionSelector.tsx +4 -2
- package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.tsx +241 -0
- package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +3 -0
- package/src/Prebuilt/components/HMSVideo/MwebHLSViewTitle.tsx +91 -0
- package/src/Prebuilt/components/HMSVideo/PlayButton.tsx +27 -0
- package/src/Prebuilt/components/HMSVideo/PlayerContext.tsx +15 -0
- package/src/Prebuilt/components/HMSVideo/VideoProgress.tsx +81 -0
- package/src/Prebuilt/components/HMSVideo/VideoTime.tsx +42 -0
- package/src/Prebuilt/components/HMSVideo/{VolumeControl.jsx → VolumeControl.tsx} +7 -5
- package/src/Prebuilt/components/HMSVideo/{index.js → index.ts} +2 -0
- package/src/Prebuilt/components/HMSVideo/utils.ts +35 -0
- package/src/Prebuilt/components/Leave/LeaveRoom.tsx +7 -1
- package/src/Prebuilt/components/Leave/MwebLeaveRoom.tsx +38 -25
- package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +3 -1
- package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +1 -1
- package/src/Prebuilt/components/MwebLandscapePrompt.tsx +5 -0
- package/src/Prebuilt/components/{RaiseHand.jsx → RaiseHand.tsx} +3 -2
- package/src/Prebuilt/components/SidePaneTabs.tsx +29 -10
- package/src/Prebuilt/layouts/HLSView.jsx +272 -156
- package/src/Prebuilt/layouts/SidePane.tsx +21 -10
- package/src/Prebuilt/layouts/VideoStreamingSection.tsx +11 -1
- package/dist/HLSView-PACDZWJN.js.map +0 -7
- package/dist/chunk-2QHBD2VO.js.map +0 -7
- package/src/Prebuilt/components/HMSVideo/FullscreenButton.jsx +0 -18
- package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +0 -127
- package/src/Prebuilt/components/HMSVideo/HMSVIdeoUtils.js +0 -27
- package/src/Prebuilt/components/HMSVideo/VideoProgress.jsx +0 -76
- package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +0 -33
@@ -2,6 +2,7 @@ import {
|
|
2
2
|
APP_DATA,
|
3
3
|
Box,
|
4
4
|
Button,
|
5
|
+
ChatToggle,
|
5
6
|
Dialog,
|
6
7
|
DialogContent,
|
7
8
|
DialogRow,
|
@@ -11,6 +12,9 @@ import {
|
|
11
12
|
IconButton,
|
12
13
|
IconButton_default,
|
13
14
|
Loading,
|
15
|
+
Logo,
|
16
|
+
SIDE_PANE_OPTIONS,
|
17
|
+
Sheet,
|
14
18
|
Slider,
|
15
19
|
Text,
|
16
20
|
ToastManager,
|
@@ -19,30 +23,36 @@ import {
|
|
19
23
|
__objRest,
|
20
24
|
__spreadValues,
|
21
25
|
config,
|
26
|
+
getFormattedCount,
|
22
27
|
init_define_process_env,
|
23
28
|
styled,
|
29
|
+
theme,
|
30
|
+
useIsLandscape,
|
24
31
|
usePollViewToggle,
|
32
|
+
useRoomLayoutConferencingScreen,
|
33
|
+
useSidepaneToggle,
|
25
34
|
useTheme
|
26
|
-
} from "./chunk-
|
35
|
+
} from "./chunk-25HZFDG5.js";
|
27
36
|
|
28
37
|
// src/Prebuilt/layouts/HLSView.jsx
|
29
38
|
init_define_process_env();
|
30
|
-
import
|
31
|
-
import { useFullscreen, useMedia, usePrevious, useToggle } from "react-use";
|
39
|
+
import React13, { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef2, useState as useState5 } from "react";
|
40
|
+
import { useFullscreen, useMedia as useMedia2, usePrevious, useToggle } from "react-use";
|
32
41
|
import { HLSPlaybackState, HMSHLSPlayer, HMSHLSPlayerEvents as HMSHLSPlayerEvents2 } from "@100mslive/hls-player";
|
33
42
|
import screenfull from "screenfull";
|
34
43
|
import {
|
44
|
+
HLSPlaylistType,
|
35
45
|
HMSNotificationTypes,
|
36
46
|
selectAppData,
|
37
|
-
selectHLSState,
|
47
|
+
selectHLSState as selectHLSState2,
|
38
48
|
selectPeerNameByID,
|
39
49
|
selectPollByID,
|
40
50
|
useHMSActions,
|
41
51
|
useHMSNotifications,
|
42
|
-
useHMSStore,
|
52
|
+
useHMSStore as useHMSStore2,
|
43
53
|
useHMSVanillaStore
|
44
54
|
} from "@100mslive/react-sdk";
|
45
|
-
import { ColoredHandIcon,
|
55
|
+
import { ColoredHandIcon, GoLiveIcon, PauseIcon as PauseIcon2, PlayIcon as PlayIcon2 } from "@100mslive/react-icons";
|
46
56
|
|
47
57
|
// src/Prebuilt/components/HlsStatsOverlay.jsx
|
48
58
|
init_define_process_env();
|
@@ -125,7 +135,7 @@ var HlsStatsRow = memo(({ label, children }) => {
|
|
125
135
|
));
|
126
136
|
});
|
127
137
|
|
128
|
-
// src/Prebuilt/components/HMSVideo/index.
|
138
|
+
// src/Prebuilt/components/HMSVideo/index.ts
|
129
139
|
init_define_process_env();
|
130
140
|
|
131
141
|
// src/Prebuilt/components/HMSVideo/Controls.jsx
|
@@ -173,7 +183,8 @@ var HMSVideo = forwardRef((_a, videoRef) => {
|
|
173
183
|
letterSpacing: "0.5px"
|
174
184
|
},
|
175
185
|
"& video::-webkit-media-text-track-display": {
|
176
|
-
padding: "0 $4"
|
186
|
+
padding: "0 $4",
|
187
|
+
boxShadow: "0px 1px 3px 0px #000000A3"
|
177
188
|
},
|
178
189
|
"& video::-webkit-media-text-track-container": {
|
179
190
|
fontSize: "$space$10 !important"
|
@@ -187,7 +198,9 @@ var HMSVideo = forwardRef((_a, videoRef) => {
|
|
187
198
|
style: {
|
188
199
|
flex: "1 1 0",
|
189
200
|
margin: "0 auto",
|
190
|
-
minHeight: "0"
|
201
|
+
minHeight: "0",
|
202
|
+
objectFit: "contain",
|
203
|
+
width: "inherit"
|
191
204
|
},
|
192
205
|
ref: videoRef,
|
193
206
|
playsInline: true
|
@@ -197,19 +210,41 @@ var HMSVideo = forwardRef((_a, videoRef) => {
|
|
197
210
|
);
|
198
211
|
});
|
199
212
|
|
200
|
-
// src/Prebuilt/components/HMSVideo/PlayButton.
|
213
|
+
// src/Prebuilt/components/HMSVideo/PlayButton.tsx
|
201
214
|
init_define_process_env();
|
202
|
-
import
|
215
|
+
import React4 from "react";
|
203
216
|
import { PauseIcon, PlayIcon } from "@100mslive/react-icons";
|
204
|
-
|
205
|
-
|
217
|
+
|
218
|
+
// src/Prebuilt/components/HMSVideo/PlayerContext.tsx
|
219
|
+
init_define_process_env();
|
220
|
+
import React3, { useContext } from "react";
|
221
|
+
var HMSPlayerContext = React3.createContext({
|
222
|
+
hlsPlayer: void 0
|
223
|
+
});
|
224
|
+
var useHMSPlayerContext = () => {
|
225
|
+
const context = useContext(HMSPlayerContext);
|
226
|
+
return context;
|
206
227
|
};
|
207
228
|
|
208
|
-
// src/Prebuilt/components/HMSVideo/
|
229
|
+
// src/Prebuilt/components/HMSVideo/PlayButton.tsx
|
230
|
+
var PlayButton = ({
|
231
|
+
isPaused,
|
232
|
+
width = 20,
|
233
|
+
height = 20
|
234
|
+
}) => {
|
235
|
+
const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
|
236
|
+
const onClick = (event) => __async(void 0, null, function* () {
|
237
|
+
event == null ? void 0 : event.stopPropagation();
|
238
|
+
isPaused ? yield hlsPlayer2 == null ? void 0 : hlsPlayer2.play() : hlsPlayer2 == null ? void 0 : hlsPlayer2.pause();
|
239
|
+
});
|
240
|
+
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 })));
|
241
|
+
};
|
242
|
+
|
243
|
+
// src/Prebuilt/components/HMSVideo/VideoProgress.tsx
|
209
244
|
init_define_process_env();
|
210
|
-
import
|
245
|
+
import React5, { useEffect, useState } from "react";
|
211
246
|
|
212
|
-
// src/Prebuilt/components/HMSVideo/
|
247
|
+
// src/Prebuilt/components/HMSVideo/utils.ts
|
213
248
|
init_define_process_env();
|
214
249
|
function getPercentage(a, b) {
|
215
250
|
return a / b * 100;
|
@@ -229,16 +264,32 @@ function getDurationFromSeconds2(timeInSeconds) {
|
|
229
264
|
}
|
230
265
|
return videoTimeStr;
|
231
266
|
}
|
267
|
+
function getTime(timeInMilles) {
|
268
|
+
const timeInSeconds = Math.floor(timeInMilles / 1e3);
|
269
|
+
const hours = Math.floor(timeInSeconds / 3600);
|
270
|
+
const minutes = Math.floor(timeInSeconds % 3600 / 60);
|
271
|
+
const hour = hours !== 0 ? `${hours < 10 ? "0" : ""}${hours}` : "";
|
272
|
+
return hour + `${hour ? "h:" : ""}` + minutes + "m";
|
273
|
+
}
|
232
274
|
|
233
|
-
// src/Prebuilt/components/HMSVideo/VideoProgress.
|
234
|
-
var VideoProgress = (
|
275
|
+
// src/Prebuilt/components/HMSVideo/VideoProgress.tsx
|
276
|
+
var VideoProgress = () => {
|
277
|
+
const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
|
235
278
|
const [videoProgress, setVideoProgress] = useState(0);
|
236
279
|
const [bufferProgress, setBufferProgress] = useState(0);
|
237
|
-
const
|
280
|
+
const videoEl = hlsPlayer2 == null ? void 0 : hlsPlayer2.getVideoElement();
|
281
|
+
const onValueChange = (time) => {
|
282
|
+
hlsPlayer2 == null ? void 0 : hlsPlayer2.seekTo(time);
|
283
|
+
};
|
238
284
|
useEffect(() => {
|
239
|
-
|
285
|
+
if (!videoEl) {
|
286
|
+
return;
|
287
|
+
}
|
240
288
|
const timeupdateHandler = () => {
|
241
289
|
var _a;
|
290
|
+
if (!videoEl) {
|
291
|
+
return;
|
292
|
+
}
|
242
293
|
const videoProgress2 = Math.floor(getPercentage(videoEl.currentTime, videoEl.duration));
|
243
294
|
let bufferProgress2 = 0;
|
244
295
|
if (videoEl.buffered.length > 0) {
|
@@ -247,108 +298,105 @@ var VideoProgress = ({ onValueChange, hlsPlayer: hlsPlayer2 }) => {
|
|
247
298
|
setVideoProgress(isNaN(videoProgress2) ? 0 : videoProgress2);
|
248
299
|
setBufferProgress(isNaN(bufferProgress2) ? 0 : bufferProgress2);
|
249
300
|
};
|
250
|
-
|
251
|
-
videoEl.addEventListener("timeupdate", timeupdateHandler);
|
252
|
-
}
|
301
|
+
videoEl.addEventListener("timeupdate", timeupdateHandler);
|
253
302
|
return function cleanup() {
|
254
|
-
|
255
|
-
videoEl.removeEventListener("timeupdate", timeupdateHandler);
|
256
|
-
}
|
303
|
+
videoEl == null ? void 0 : videoEl.removeEventListener("timeupdate", timeupdateHandler);
|
257
304
|
};
|
258
|
-
}, [
|
259
|
-
const
|
260
|
-
const
|
261
|
-
const
|
262
|
-
const
|
263
|
-
const videoEl = hlsPlayer2.getVideoElement();
|
264
|
-
const currentTime = progress * videoEl.duration / 100;
|
305
|
+
}, [videoEl]);
|
306
|
+
const onProgress = (progress) => {
|
307
|
+
const progress1 = Math.floor(getPercentage(progress[0], 100));
|
308
|
+
const videoEl2 = hlsPlayer2 == null ? void 0 : hlsPlayer2.getVideoElement();
|
309
|
+
const currentTime = progress1 * ((videoEl2 == null ? void 0 : videoEl2.duration) || 0) / 100;
|
265
310
|
if (onValueChange) {
|
266
311
|
onValueChange(currentTime);
|
267
312
|
}
|
268
313
|
};
|
269
|
-
|
270
|
-
|
314
|
+
if (!videoEl) {
|
315
|
+
return null;
|
316
|
+
}
|
317
|
+
return /* @__PURE__ */ React5.createElement(Flex, { align: "center", css: { cursor: "pointer", h: "$2", alignSelf: "stretch" } }, /* @__PURE__ */ React5.createElement(
|
318
|
+
Slider,
|
271
319
|
{
|
272
|
-
|
273
|
-
css: {
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
}
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
/* @__PURE__ */ React4.createElement(
|
299
|
-
Box,
|
300
|
-
{
|
301
|
-
id: "video-rest",
|
302
|
-
css: {
|
303
|
-
width: `${100 - bufferProgress}%`,
|
304
|
-
background: "$on_surface_high",
|
305
|
-
opacity: "10%"
|
306
|
-
}
|
320
|
+
id: "video-actual-rest",
|
321
|
+
css: {
|
322
|
+
cursor: "pointer",
|
323
|
+
h: "$2",
|
324
|
+
zIndex: 1,
|
325
|
+
transition: `all .2s ease .5s`
|
326
|
+
},
|
327
|
+
min: 0,
|
328
|
+
max: 100,
|
329
|
+
step: 1,
|
330
|
+
value: [videoProgress],
|
331
|
+
showTooltip: false,
|
332
|
+
onValueChange: onProgress,
|
333
|
+
thumbStyles: { w: "$6", h: "$6" }
|
334
|
+
}
|
335
|
+
), /* @__PURE__ */ React5.createElement(
|
336
|
+
Box,
|
337
|
+
{
|
338
|
+
id: "video-buffer",
|
339
|
+
css: {
|
340
|
+
h: "$2",
|
341
|
+
width: `${bufferProgress - videoProgress}%`,
|
342
|
+
background: "$on_surface_high",
|
343
|
+
position: "absolute",
|
344
|
+
left: `${videoProgress}%`,
|
345
|
+
opacity: "25%"
|
307
346
|
}
|
308
|
-
|
309
|
-
)
|
347
|
+
}
|
348
|
+
));
|
310
349
|
};
|
311
350
|
|
312
|
-
// src/Prebuilt/components/HMSVideo/VideoTime.
|
351
|
+
// src/Prebuilt/components/HMSVideo/VideoTime.tsx
|
313
352
|
init_define_process_env();
|
314
|
-
import
|
353
|
+
import React6, { useEffect as useEffect2, useState as useState2 } from "react";
|
315
354
|
import { HMSHLSPlayerEvents } from "@100mslive/hls-player";
|
316
|
-
var VideoTime = (
|
355
|
+
var VideoTime = () => {
|
356
|
+
const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
|
317
357
|
const [videoTime, setVideoTime] = useState2("");
|
318
358
|
useEffect2(() => {
|
319
|
-
const timeupdateHandler = (currentTime) =>
|
359
|
+
const timeupdateHandler = (currentTime) => {
|
360
|
+
const videoEl = hlsPlayer2 == null ? void 0 : hlsPlayer2.getVideoElement();
|
361
|
+
if (videoEl) {
|
362
|
+
setVideoTime(getDurationFromSeconds2(videoEl.duration - currentTime));
|
363
|
+
} else {
|
364
|
+
setVideoTime(getDurationFromSeconds2(currentTime));
|
365
|
+
}
|
366
|
+
};
|
320
367
|
if (hlsPlayer2) {
|
321
368
|
hlsPlayer2.on(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
|
322
369
|
}
|
323
370
|
return function cleanup() {
|
324
|
-
|
325
|
-
hlsPlayer2.off(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
|
326
|
-
}
|
371
|
+
hlsPlayer2 == null ? void 0 : hlsPlayer2.off(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
|
327
372
|
};
|
328
373
|
}, [hlsPlayer2]);
|
329
|
-
return hlsPlayer2 ? /* @__PURE__ */
|
374
|
+
return hlsPlayer2 ? /* @__PURE__ */ React6.createElement(
|
330
375
|
Text,
|
331
376
|
{
|
377
|
+
variant: "body1",
|
332
378
|
css: {
|
333
379
|
minWidth: "$16",
|
334
380
|
c: "$on_surface_medium",
|
335
381
|
display: "flex",
|
336
|
-
justifyContent: "center"
|
382
|
+
justifyContent: "center",
|
383
|
+
fontWeight: "$regular"
|
337
384
|
}
|
338
385
|
},
|
386
|
+
"-",
|
339
387
|
videoTime
|
340
388
|
) : null;
|
341
389
|
};
|
342
390
|
|
343
|
-
// src/Prebuilt/components/HMSVideo/VolumeControl.
|
391
|
+
// src/Prebuilt/components/HMSVideo/VolumeControl.tsx
|
344
392
|
init_define_process_env();
|
345
|
-
import
|
393
|
+
import React7, { useState as useState3 } from "react";
|
346
394
|
import { VolumeOneIcon, VolumeTwoIcon, VolumeZeroIcon } from "@100mslive/react-icons";
|
347
|
-
var VolumeControl = (
|
348
|
-
|
349
|
-
const [volume, setVolume] = useState3((
|
395
|
+
var VolumeControl = () => {
|
396
|
+
const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
|
397
|
+
const [volume, setVolume] = useState3((hlsPlayer2 == null ? void 0 : hlsPlayer2.volume) || 0);
|
350
398
|
const [showSlider, setShowSlider] = useState3(false);
|
351
|
-
return /* @__PURE__ */
|
399
|
+
return /* @__PURE__ */ React7.createElement(
|
352
400
|
Flex,
|
353
401
|
{
|
354
402
|
align: "center",
|
@@ -362,7 +410,7 @@ var VolumeControl = ({ hlsPlayer: hlsPlayer2 }) => {
|
|
362
410
|
setShowSlider(false);
|
363
411
|
}
|
364
412
|
},
|
365
|
-
/* @__PURE__ */
|
413
|
+
/* @__PURE__ */ React7.createElement(
|
366
414
|
VolumeIcon,
|
367
415
|
{
|
368
416
|
volume,
|
@@ -377,7 +425,7 @@ var VolumeControl = ({ hlsPlayer: hlsPlayer2 }) => {
|
|
377
425
|
}
|
378
426
|
}
|
379
427
|
),
|
380
|
-
/* @__PURE__ */
|
428
|
+
/* @__PURE__ */ React7.createElement(
|
381
429
|
Slider,
|
382
430
|
{
|
383
431
|
css: {
|
@@ -395,7 +443,7 @@ var VolumeControl = ({ hlsPlayer: hlsPlayer2 }) => {
|
|
395
443
|
step: 1,
|
396
444
|
value: [volume],
|
397
445
|
onValueChange: (volume2) => {
|
398
|
-
hlsPlayer2.setVolume(volume2[0]);
|
446
|
+
hlsPlayer2 == null ? void 0 : hlsPlayer2.setVolume(volume2[0]);
|
399
447
|
setVolume(volume2[0]);
|
400
448
|
},
|
401
449
|
thumbStyles: { w: "$6", h: "$6" }
|
@@ -405,12 +453,12 @@ var VolumeControl = ({ hlsPlayer: hlsPlayer2 }) => {
|
|
405
453
|
};
|
406
454
|
var VolumeIcon = ({ volume, onClick }) => {
|
407
455
|
if (volume === 0) {
|
408
|
-
return /* @__PURE__ */
|
456
|
+
return /* @__PURE__ */ React7.createElement(VolumeZeroIcon, { style: { cursor: "pointer", transition: "color 0.3s" }, onClick });
|
409
457
|
}
|
410
|
-
return volume < 50 ? /* @__PURE__ */
|
458
|
+
return volume < 50 ? /* @__PURE__ */ React7.createElement(VolumeOneIcon, { style: { cursor: "pointer", transition: "color 0.3s" }, onClick }) : /* @__PURE__ */ React7.createElement(VolumeTwoIcon, { style: { cursor: "pointer", transition: "color 0.3s" }, onClick });
|
411
459
|
};
|
412
460
|
|
413
|
-
// src/Prebuilt/components/HMSVideo/index.
|
461
|
+
// src/Prebuilt/components/HMSVideo/index.ts
|
414
462
|
var HMSVideoPlayer = {
|
415
463
|
Root: HMSVideo,
|
416
464
|
PlayButton,
|
@@ -424,44 +472,38 @@ var HMSVideoPlayer = {
|
|
424
472
|
}
|
425
473
|
};
|
426
474
|
|
427
|
-
// src/Prebuilt/components/HMSVideo/FullscreenButton.
|
475
|
+
// src/Prebuilt/components/HMSVideo/FullscreenButton.tsx
|
428
476
|
init_define_process_env();
|
429
|
-
import
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
{
|
434
|
-
variant: "standard",
|
435
|
-
css: { margin: "0px" },
|
436
|
-
onClick: onToggle,
|
437
|
-
key: "fullscreen_btn",
|
438
|
-
"data-testid": "fullscreen_btn"
|
439
|
-
},
|
440
|
-
/* @__PURE__ */ React7.createElement(Flex, null, icon)
|
441
|
-
));
|
477
|
+
import React8 from "react";
|
478
|
+
import { ExpandIcon, ShrinkIcon } from "@100mslive/react-icons";
|
479
|
+
var FullScreenButton = ({ isFullScreen, onToggle }) => {
|
480
|
+
return /* @__PURE__ */ React8.createElement(Tooltip, { title: `${isFullScreen ? "Exit" : "Go"} fullscreen`, side: "top" }, /* @__PURE__ */ React8.createElement(IconButton, { css: { margin: "0px" }, onClick: onToggle, key: "fullscreen_btn", "data-testid": "fullscreen_btn" }, /* @__PURE__ */ React8.createElement(Flex, null, isFullScreen ? /* @__PURE__ */ React8.createElement(ShrinkIcon, null) : /* @__PURE__ */ React8.createElement(ExpandIcon, null))));
|
442
481
|
};
|
443
482
|
|
444
|
-
// src/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.
|
483
|
+
// src/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.tsx
|
445
484
|
init_define_process_env();
|
446
|
-
import
|
447
|
-
function HLSAutoplayBlockedPrompt({
|
448
|
-
|
485
|
+
import React9 from "react";
|
486
|
+
function HLSAutoplayBlockedPrompt({
|
487
|
+
open,
|
488
|
+
unblockAutoPlay
|
489
|
+
}) {
|
490
|
+
return /* @__PURE__ */ React9.createElement(
|
449
491
|
Dialog.Root,
|
450
492
|
{
|
451
493
|
open,
|
452
|
-
onOpenChange: (value) => {
|
494
|
+
onOpenChange: (value) => __async(this, null, function* () {
|
453
495
|
if (!value) {
|
454
|
-
unblockAutoPlay();
|
496
|
+
yield unblockAutoPlay();
|
455
497
|
}
|
456
|
-
}
|
498
|
+
})
|
457
499
|
},
|
458
|
-
/* @__PURE__ */
|
500
|
+
/* @__PURE__ */ React9.createElement(DialogContent, { title: "Attention", closeable: false }, /* @__PURE__ */ React9.createElement(DialogRow, null, /* @__PURE__ */ React9.createElement(Text, { variant: "md" }, 'The browser wants us to get a confirmation for playing the HLS Stream. Please click "play stream" to proceed.')), /* @__PURE__ */ React9.createElement(DialogRow, { justify: "end" }, /* @__PURE__ */ React9.createElement(
|
459
501
|
Button,
|
460
502
|
{
|
461
503
|
variant: "primary",
|
462
|
-
onClick: () => {
|
463
|
-
unblockAutoPlay();
|
464
|
-
}
|
504
|
+
onClick: () => __async(this, null, function* () {
|
505
|
+
yield unblockAutoPlay();
|
506
|
+
})
|
465
507
|
},
|
466
508
|
"Play stream"
|
467
509
|
)))
|
@@ -470,18 +512,104 @@ function HLSAutoplayBlockedPrompt({ open, unblockAutoPlay }) {
|
|
470
512
|
|
471
513
|
// src/Prebuilt/components/HMSVideo/HLSCaptionSelector.tsx
|
472
514
|
init_define_process_env();
|
473
|
-
import
|
515
|
+
import React10 from "react";
|
474
516
|
import { ClosedCaptionIcon, OpenCaptionIcon } from "@100mslive/react-icons";
|
475
|
-
function HLSCaptionSelector({ isEnabled
|
476
|
-
|
517
|
+
function HLSCaptionSelector({ isEnabled }) {
|
518
|
+
const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
|
519
|
+
return /* @__PURE__ */ React10.createElement(Tooltip, { title: "Subtitles/closed captions", side: "top" }, /* @__PURE__ */ React10.createElement(IconButton, { css: { p: "$2" }, onClick: () => hlsPlayer2 == null ? void 0 : hlsPlayer2.toggleCaption() }, isEnabled ? /* @__PURE__ */ React10.createElement(ClosedCaptionIcon, { width: "20", height: "20px" }) : /* @__PURE__ */ React10.createElement(OpenCaptionIcon, { width: "20", height: "20px" })));
|
477
520
|
}
|
478
521
|
|
479
|
-
// src/Prebuilt/components/HMSVideo/HLSQualitySelector.
|
522
|
+
// src/Prebuilt/components/HMSVideo/HLSQualitySelector.tsx
|
480
523
|
init_define_process_env();
|
481
|
-
import
|
482
|
-
import {
|
483
|
-
|
484
|
-
|
524
|
+
import React11 from "react";
|
525
|
+
import { useMedia } from "react-use";
|
526
|
+
import { CheckIcon, CrossIcon as CrossIcon2, SettingsIcon } from "@100mslive/react-icons";
|
527
|
+
function HLSQualitySelector({
|
528
|
+
open,
|
529
|
+
onOpenChange,
|
530
|
+
layers,
|
531
|
+
onQualityChange,
|
532
|
+
selection,
|
533
|
+
isAuto
|
534
|
+
}) {
|
535
|
+
const isMobile = useMedia(config.media.md);
|
536
|
+
const isLandscape = useIsLandscape();
|
537
|
+
if (isMobile || isLandscape) {
|
538
|
+
return /* @__PURE__ */ React11.createElement(Sheet.Root, { open, onOpenChange }, /* @__PURE__ */ React11.createElement(Sheet.Trigger, { asChild: true, "data-testid": "quality_selector" }, /* @__PURE__ */ React11.createElement(
|
539
|
+
Flex,
|
540
|
+
{
|
541
|
+
css: {
|
542
|
+
color: "$on_primary_high",
|
543
|
+
r: "$1",
|
544
|
+
cursor: "pointer",
|
545
|
+
p: "$2"
|
546
|
+
}
|
547
|
+
},
|
548
|
+
/* @__PURE__ */ React11.createElement(SettingsIcon, null)
|
549
|
+
)), layers.length > 0 && /* @__PURE__ */ React11.createElement(Sheet.Content, { css: { bg: "$surface_default", pb: "$1" }, onClick: () => onOpenChange(false) }, /* @__PURE__ */ React11.createElement(
|
550
|
+
Sheet.Title,
|
551
|
+
{
|
552
|
+
css: {
|
553
|
+
display: "flex",
|
554
|
+
color: "$on_surface_high",
|
555
|
+
w: "100%",
|
556
|
+
justifyContent: "space-between",
|
557
|
+
mt: "$8",
|
558
|
+
fontSize: "$md",
|
559
|
+
px: "$10",
|
560
|
+
pb: "$8",
|
561
|
+
borderBottom: "1px solid $border_bright",
|
562
|
+
alignItems: "center"
|
563
|
+
}
|
564
|
+
},
|
565
|
+
"Quality",
|
566
|
+
/* @__PURE__ */ React11.createElement(Sheet.Close, { css: { color: "$on_surface_high" }, onClick: () => onOpenChange(false) }, /* @__PURE__ */ React11.createElement(CrossIcon2, null))
|
567
|
+
), layers.map((layer) => {
|
568
|
+
return /* @__PURE__ */ React11.createElement(
|
569
|
+
Flex,
|
570
|
+
{
|
571
|
+
align: "center",
|
572
|
+
css: {
|
573
|
+
w: "100%",
|
574
|
+
bg: "$surface_default",
|
575
|
+
"&:hover": {
|
576
|
+
bg: "$surface_brighter"
|
577
|
+
},
|
578
|
+
cursor: "pointer",
|
579
|
+
gap: "$4",
|
580
|
+
py: "$8",
|
581
|
+
px: "$10"
|
582
|
+
},
|
583
|
+
key: layer.width,
|
584
|
+
onClick: () => onQualityChange(layer)
|
585
|
+
},
|
586
|
+
/* @__PURE__ */ React11.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold" } }, getQualityText(layer)),
|
587
|
+
/* @__PURE__ */ React11.createElement(Text, { variant: "caption", css: { flex: "1 1 0", c: "$on_surface_low", pl: "$2" } }, getBitrateText(layer)),
|
588
|
+
!isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) && /* @__PURE__ */ React11.createElement(CheckIcon, { width: "16px", height: "16px" })
|
589
|
+
);
|
590
|
+
}), /* @__PURE__ */ React11.createElement(
|
591
|
+
Flex,
|
592
|
+
{
|
593
|
+
align: "center",
|
594
|
+
css: {
|
595
|
+
w: "100%",
|
596
|
+
bg: "$surface_default",
|
597
|
+
"&:hover": {
|
598
|
+
bg: "$surface_brighter"
|
599
|
+
},
|
600
|
+
cursor: "pointer",
|
601
|
+
gap: "$4",
|
602
|
+
py: "$8",
|
603
|
+
px: "$10"
|
604
|
+
},
|
605
|
+
key: "auto",
|
606
|
+
onClick: () => onQualityChange({ height: "auto" })
|
607
|
+
},
|
608
|
+
/* @__PURE__ */ React11.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold", flex: "1 1 0" } }, "Auto"),
|
609
|
+
isAuto && /* @__PURE__ */ React11.createElement(CheckIcon, { width: "16px", height: "16px" })
|
610
|
+
)));
|
611
|
+
}
|
612
|
+
return /* @__PURE__ */ React11.createElement(Dropdown.Root, { open, onOpenChange: (value) => onOpenChange(value) }, /* @__PURE__ */ React11.createElement(Dropdown.Trigger, { asChild: true, "data-testid": "quality_selector" }, /* @__PURE__ */ React11.createElement(
|
485
613
|
Flex,
|
486
614
|
{
|
487
615
|
css: {
|
@@ -491,7 +619,7 @@ function HLSQualitySelector({ open, onOpen, layers, onQualityChange, selection,
|
|
491
619
|
p: "$2"
|
492
620
|
}
|
493
621
|
},
|
494
|
-
/* @__PURE__ */
|
622
|
+
/* @__PURE__ */ React11.createElement(Tooltip, { title: "Select Quality", side: "top" }, /* @__PURE__ */ React11.createElement(Flex, { align: "center" }, /* @__PURE__ */ React11.createElement(
|
495
623
|
Box,
|
496
624
|
{
|
497
625
|
css: {
|
@@ -502,8 +630,8 @@ function HLSQualitySelector({ open, onOpen, layers, onQualityChange, selection,
|
|
502
630
|
c: "$on_surface_high"
|
503
631
|
}
|
504
632
|
},
|
505
|
-
/* @__PURE__ */
|
506
|
-
), /* @__PURE__ */
|
633
|
+
/* @__PURE__ */ React11.createElement(SettingsIcon, null)
|
634
|
+
), /* @__PURE__ */ React11.createElement(
|
507
635
|
Text,
|
508
636
|
{
|
509
637
|
variant: {
|
@@ -513,7 +641,7 @@ function HLSQualitySelector({ open, onOpen, layers, onQualityChange, selection,
|
|
513
641
|
},
|
514
642
|
css: { display: "flex", alignItems: "center", ml: "$2", c: "$on_surface_medium" }
|
515
643
|
},
|
516
|
-
isAuto && /* @__PURE__ */
|
644
|
+
isAuto && /* @__PURE__ */ React11.createElement(React11.Fragment, null, "Auto", /* @__PURE__ */ React11.createElement(
|
517
645
|
Box,
|
518
646
|
{
|
519
647
|
css: {
|
@@ -525,10 +653,10 @@ function HLSQualitySelector({ open, onOpen, layers, onQualityChange, selection,
|
|
525
653
|
}
|
526
654
|
}
|
527
655
|
)),
|
528
|
-
selection && Math.min(selection.width, selection.height),
|
656
|
+
selection && Math.min(selection.width || 0, selection.height || 0),
|
529
657
|
"p"
|
530
658
|
)))
|
531
|
-
)), layers.length > 0 && /* @__PURE__ */
|
659
|
+
)), layers.length > 0 && /* @__PURE__ */ React11.createElement(
|
532
660
|
Dropdown.Content,
|
533
661
|
{
|
534
662
|
sideOffset: 5,
|
@@ -544,7 +672,7 @@ function HLSQualitySelector({ open, onOpen, layers, onQualityChange, selection,
|
|
544
672
|
}
|
545
673
|
},
|
546
674
|
layers.map((layer) => {
|
547
|
-
return /* @__PURE__ */
|
675
|
+
return /* @__PURE__ */ React11.createElement(
|
548
676
|
Dropdown.Item,
|
549
677
|
{
|
550
678
|
onClick: () => onQualityChange(layer),
|
@@ -559,12 +687,12 @@ function HLSQualitySelector({ open, onOpen, layers, onQualityChange, selection,
|
|
559
687
|
gap: "$2"
|
560
688
|
}
|
561
689
|
},
|
562
|
-
/* @__PURE__ */
|
563
|
-
/* @__PURE__ */
|
564
|
-
!isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) && /* @__PURE__ */
|
690
|
+
/* @__PURE__ */ React11.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold" } }, getQualityText(layer)),
|
691
|
+
/* @__PURE__ */ React11.createElement(Text, { variant: "caption", css: { flex: "1 1 0", c: "$on_surface_low", pl: "$2" } }, getBitrateText(layer)),
|
692
|
+
!isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) && /* @__PURE__ */ React11.createElement(CheckIcon, { width: "16px", height: "16px" })
|
565
693
|
);
|
566
694
|
}),
|
567
|
-
/* @__PURE__ */
|
695
|
+
/* @__PURE__ */ React11.createElement(
|
568
696
|
Dropdown.Item,
|
569
697
|
{
|
570
698
|
onClick: () => onQualityChange({ height: "auto" }),
|
@@ -579,52 +707,131 @@ function HLSQualitySelector({ open, onOpen, layers, onQualityChange, selection,
|
|
579
707
|
gap: "$2"
|
580
708
|
}
|
581
709
|
},
|
582
|
-
/* @__PURE__ */
|
583
|
-
isAuto && /* @__PURE__ */
|
710
|
+
/* @__PURE__ */ React11.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold", flex: "1 1 0" } }, "Auto"),
|
711
|
+
isAuto && /* @__PURE__ */ React11.createElement(CheckIcon, { width: "16px", height: "16px" })
|
584
712
|
)
|
585
713
|
));
|
586
714
|
}
|
587
|
-
var getQualityText = (layer) => `${Math.min(layer.height, layer.width)}p `;
|
715
|
+
var getQualityText = (layer) => `${Math.min(layer.height || 0, layer.width || 0)}p `;
|
588
716
|
var getBitrateText = (layer) => `(${(Number(layer.bitrate / 1e3) / 1e3).toFixed(2)} Mbps)`;
|
589
717
|
|
718
|
+
// src/Prebuilt/components/HMSVideo/MwebHLSViewTitle.tsx
|
719
|
+
init_define_process_env();
|
720
|
+
import React12, { useCallback, useEffect as useEffect3, useRef, useState as useState4 } from "react";
|
721
|
+
import { selectHLSState, selectPeerCount, useHMSStore } from "@100mslive/react-sdk";
|
722
|
+
var HLSViewTitle = () => {
|
723
|
+
const peerCount = useHMSStore(selectPeerCount);
|
724
|
+
const hlsState = useHMSStore(selectHLSState);
|
725
|
+
const intervalRef = useRef(null);
|
726
|
+
const { screenType } = useRoomLayoutConferencingScreen();
|
727
|
+
const [liveTime, setLiveTime] = useState4(0);
|
728
|
+
const startTimer = useCallback(() => {
|
729
|
+
intervalRef.current = setInterval(() => {
|
730
|
+
var _a;
|
731
|
+
const timeStamp = (_a = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _a[screenType === "hls_live_streaming" ? "startedAt" : "initialisedAt"];
|
732
|
+
if ((hlsState == null ? void 0 : hlsState.running) && timeStamp) {
|
733
|
+
setLiveTime(Date.now() - timeStamp.getTime());
|
734
|
+
}
|
735
|
+
}, 6e4);
|
736
|
+
}, [hlsState == null ? void 0 : hlsState.running, hlsState == null ? void 0 : hlsState.variants, screenType]);
|
737
|
+
useEffect3(() => {
|
738
|
+
var _a;
|
739
|
+
if (hlsState == null ? void 0 : hlsState.running) {
|
740
|
+
startTimer();
|
741
|
+
const timeStamp = (_a = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _a[screenType === "hls_live_streaming" ? "startedAt" : "initialisedAt"];
|
742
|
+
if ((hlsState == null ? void 0 : hlsState.running) && timeStamp) {
|
743
|
+
setLiveTime(Date.now() - timeStamp.getTime());
|
744
|
+
}
|
745
|
+
}
|
746
|
+
if (!(hlsState == null ? void 0 : hlsState.running) && intervalRef.current) {
|
747
|
+
clearInterval(intervalRef.current);
|
748
|
+
}
|
749
|
+
return () => {
|
750
|
+
if (intervalRef.current) {
|
751
|
+
clearInterval(intervalRef.current);
|
752
|
+
}
|
753
|
+
};
|
754
|
+
}, [hlsState == null ? void 0 : hlsState.running, hlsState == null ? void 0 : hlsState.variants, screenType, startTimer]);
|
755
|
+
return /* @__PURE__ */ React12.createElement(
|
756
|
+
Flex,
|
757
|
+
{
|
758
|
+
gap: "4",
|
759
|
+
align: "center",
|
760
|
+
css: {
|
761
|
+
position: "relative",
|
762
|
+
h: "fit-content",
|
763
|
+
w: "100%",
|
764
|
+
borderBottom: "1px solid $border_bright",
|
765
|
+
p: "$8",
|
766
|
+
backgroundColor: "$surface_dim"
|
767
|
+
}
|
768
|
+
},
|
769
|
+
/* @__PURE__ */ React12.createElement(Logo, null),
|
770
|
+
/* @__PURE__ */ React12.createElement(Flex, { direction: "column" }, /* @__PURE__ */ React12.createElement(Text, { variant: "sub2", css: { fontWeight: "$semiBold" } }, "Tech Talk"), /* @__PURE__ */ React12.createElement(Flex, { gap: "1" }, /* @__PURE__ */ React12.createElement(Text, { variant: "caption", css: { color: "$on_surface_medium" } }, getFormattedCount(peerCount) + " watching"), /* @__PURE__ */ React12.createElement(
|
771
|
+
Flex,
|
772
|
+
{
|
773
|
+
direction: "column",
|
774
|
+
css: {
|
775
|
+
w: "$3",
|
776
|
+
h: "$3",
|
777
|
+
backgroundColor: "$on_surface_medium",
|
778
|
+
borderRadius: "50%",
|
779
|
+
alignSelf: "center"
|
780
|
+
}
|
781
|
+
}
|
782
|
+
), /* @__PURE__ */ React12.createElement(Text, { variant: "caption", css: { color: "$on_surface_medium" } }, "Started " + getTime(liveTime) + " ago")))
|
783
|
+
);
|
784
|
+
};
|
785
|
+
|
590
786
|
// src/Prebuilt/layouts/HLSView.jsx
|
591
787
|
var hlsPlayer;
|
592
788
|
var toastMap = {};
|
593
789
|
var HLSView = () => {
|
594
|
-
var _a;
|
790
|
+
var _a, _b, _c;
|
595
791
|
const videoRef = useRef2(null);
|
596
792
|
const hlsViewRef = useRef2(null);
|
597
|
-
const hlsState =
|
598
|
-
const enablHlsStats =
|
793
|
+
const hlsState = useHMSStore2(selectHLSState2);
|
794
|
+
const enablHlsStats = useHMSStore2(selectAppData(APP_DATA.hlsStats));
|
795
|
+
const { elements, screenType } = useRoomLayoutConferencingScreen();
|
599
796
|
const notification = useHMSNotifications(HMSNotificationTypes.POLL_STOPPED);
|
600
797
|
const hmsActions = useHMSActions();
|
601
|
-
const { themeType
|
602
|
-
const [streamEnded, setStreamEnded] =
|
603
|
-
let [hlsStatsState, setHlsStatsState] =
|
798
|
+
const { themeType } = useTheme();
|
799
|
+
const [streamEnded, setStreamEnded] = useState5(false);
|
800
|
+
let [hlsStatsState, setHlsStatsState] = useState5(null);
|
604
801
|
const hlsUrl = (_a = hlsState.variants[0]) == null ? void 0 : _a.url;
|
605
|
-
const [availableLayers, setAvailableLayers] =
|
606
|
-
const [isVideoLive, setIsVideoLive] =
|
607
|
-
const [
|
608
|
-
const [
|
609
|
-
const [
|
610
|
-
const [
|
611
|
-
const [
|
612
|
-
const [isPaused, setIsPaused] = useState4(false);
|
613
|
-
const isFullScreenSupported = screenfull.isEnabled;
|
802
|
+
const [availableLayers, setAvailableLayers] = useState5([]);
|
803
|
+
const [isVideoLive, setIsVideoLive] = useState5(true);
|
804
|
+
const [isCaptionEnabled, setIsCaptionEnabled] = useState5(true);
|
805
|
+
const [hasCaptions, setHasCaptions] = useState5(false);
|
806
|
+
const [currentSelectedQuality, setCurrentSelectedQuality] = useState5(null);
|
807
|
+
const [isHlsAutoplayBlocked, setIsHlsAutoplayBlocked] = useState5(false);
|
808
|
+
const [isPaused, setIsPaused] = useState5(false);
|
614
809
|
const [show, toggle] = useToggle(false);
|
615
|
-
const [controlsVisible, setControlsVisible] = useState4(true);
|
616
|
-
const controlsRef = useRef2();
|
617
|
-
const controlsTimerRef = useRef2();
|
618
|
-
const [qualityDropDownOpen, setQualityDropDownOpen] = useState4(false);
|
619
810
|
const lastHlsUrl = usePrevious(hlsUrl);
|
620
811
|
const togglePollView = usePollViewToggle();
|
621
812
|
const vanillaStore = useHMSVanillaStore();
|
622
|
-
const
|
813
|
+
const [controlsVisible, setControlsVisible] = useState5(true);
|
814
|
+
const [isUserSelectedAuto, setIsUserSelectedAuto] = useState5(true);
|
815
|
+
const [qualityDropDownOpen, setQualityDropDownOpen] = useState5(false);
|
816
|
+
const controlsRef = useRef2(null);
|
817
|
+
const controlsTimerRef = useRef2();
|
818
|
+
const sidepane = useHMSStore2(selectAppData(APP_DATA.sidePane));
|
819
|
+
const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
|
820
|
+
const showChat = !!(elements == null ? void 0 : elements.chat);
|
821
|
+
const isFullScreenSupported = screenfull.isEnabled;
|
822
|
+
const isMobile = useMedia2(config.media.md);
|
823
|
+
const isLandscape = useIsLandscape();
|
623
824
|
const isFullScreen = useFullscreen(hlsViewRef, show, {
|
624
825
|
onClose: () => toggle(false)
|
625
826
|
});
|
626
|
-
const [showLoader, setShowLoader] =
|
627
|
-
|
827
|
+
const [showLoader, setShowLoader] = useState5(false);
|
828
|
+
const isMwebHLSStream = screenType === "hls_live_streaming" && isMobile;
|
829
|
+
useEffect4(() => {
|
830
|
+
if (sidepane === "" && isMwebHLSStream && showChat) {
|
831
|
+
toggleChat();
|
832
|
+
}
|
833
|
+
}, [sidepane, isMwebHLSStream, toggleChat, showChat]);
|
834
|
+
useEffect4(() => {
|
628
835
|
const videoEl = videoRef.current;
|
629
836
|
const showLoader2 = () => setShowLoader(true);
|
630
837
|
const hideLoader = () => setShowLoader(false);
|
@@ -635,12 +842,12 @@ var HLSView = () => {
|
|
635
842
|
videoEl == null ? void 0 : videoEl.removeEventListener("waiting", showLoader2);
|
636
843
|
};
|
637
844
|
}, []);
|
638
|
-
|
845
|
+
useEffect4(() => {
|
639
846
|
if (streamEnded && lastHlsUrl !== hlsUrl) {
|
640
847
|
setStreamEnded(false);
|
641
848
|
}
|
642
849
|
}, [hlsUrl, streamEnded, lastHlsUrl]);
|
643
|
-
|
850
|
+
useEffect4(() => {
|
644
851
|
if (!notification)
|
645
852
|
return;
|
646
853
|
const toastID = toastMap == null ? void 0 : toastMap[notification.data.id];
|
@@ -649,7 +856,7 @@ var HLSView = () => {
|
|
649
856
|
delete toastMap[notification.data.id];
|
650
857
|
}
|
651
858
|
}, [notification]);
|
652
|
-
|
859
|
+
useEffect4(() => {
|
653
860
|
const videoElem = videoRef.current;
|
654
861
|
const setStreamEndedCallback = () => {
|
655
862
|
setStreamEnded(true);
|
@@ -660,7 +867,18 @@ var HLSView = () => {
|
|
660
867
|
videoElem == null ? void 0 : videoElem.removeEventListener("ended", setStreamEndedCallback);
|
661
868
|
};
|
662
869
|
}, [hlsUrl]);
|
663
|
-
|
870
|
+
const handleQuality = useCallback2(
|
871
|
+
(quality) => {
|
872
|
+
var _a2;
|
873
|
+
if (hlsPlayer) {
|
874
|
+
setIsUserSelectedAuto(((_a2 = quality.height) == null ? void 0 : _a2.toString().toLowerCase()) === "auto");
|
875
|
+
hlsPlayer == null ? void 0 : hlsPlayer.setLayer(quality);
|
876
|
+
}
|
877
|
+
},
|
878
|
+
[availableLayers]
|
879
|
+
//eslint-disable-line
|
880
|
+
);
|
881
|
+
useEffect4(() => {
|
664
882
|
let videoEl = videoRef.current;
|
665
883
|
const manifestLoadedHandler = ({ layers }) => {
|
666
884
|
setAvailableLayers(layers);
|
@@ -670,7 +888,7 @@ var HLSView = () => {
|
|
670
888
|
setCurrentSelectedQuality(layer);
|
671
889
|
};
|
672
890
|
const metadataLoadedHandler = (_a2) => {
|
673
|
-
var
|
891
|
+
var _b2 = _a2, { payload } = _b2, rest = __objRest(_b2, ["payload"]);
|
674
892
|
var _a3;
|
675
893
|
const parsePayload = (str) => {
|
676
894
|
try {
|
@@ -687,7 +905,7 @@ var HLSView = () => {
|
|
687
905
|
const pollStartedBy = vanillaStore.getState(selectPeerNameByID(poll.startedBy)) || "Participant";
|
688
906
|
const toastID = ToastManager.addToast({
|
689
907
|
title: `${pollStartedBy} started a ${poll.type}: ${poll.title}`,
|
690
|
-
action: /* @__PURE__ */
|
908
|
+
action: /* @__PURE__ */ React13.createElement(
|
691
909
|
Button,
|
692
910
|
{
|
693
911
|
onClick: () => togglePollView(pollId),
|
@@ -752,11 +970,10 @@ var HLSView = () => {
|
|
752
970
|
hlsPlayer.off(HMSHLSPlayerEvents2.MANIFEST_LOADED, manifestLoadedHandler);
|
753
971
|
hlsPlayer.off(HMSHLSPlayerEvents2.LAYER_UPDATED, layerUpdatedHandler);
|
754
972
|
hlsPlayer.reset();
|
755
|
-
hlsPlayer = null;
|
756
973
|
};
|
757
974
|
}
|
758
|
-
}, [hlsUrl]);
|
759
|
-
|
975
|
+
}, [hlsUrl, togglePollView, vanillaStore]);
|
976
|
+
useEffect4(() => {
|
760
977
|
const onHLSStats = (state) => setHlsStatsState(state);
|
761
978
|
if (enablHlsStats) {
|
762
979
|
hlsPlayer == null ? void 0 : hlsPlayer.on(HMSHLSPlayerEvents2.STATS, onHLSStats);
|
@@ -775,20 +992,10 @@ var HLSView = () => {
|
|
775
992
|
console.error("Tried to unblock Autoplay failed with", error.message);
|
776
993
|
}
|
777
994
|
});
|
778
|
-
const handleQuality = useCallback(
|
779
|
-
(quality) => {
|
780
|
-
if (hlsPlayer) {
|
781
|
-
setIsUserSelectedAuto(quality.height.toString().toLowerCase() === "auto");
|
782
|
-
hlsPlayer.setLayer(quality);
|
783
|
-
}
|
784
|
-
},
|
785
|
-
[availableLayers]
|
786
|
-
//eslint-disable-line
|
787
|
-
);
|
788
995
|
const sfnOverlayClose = () => {
|
789
996
|
hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats);
|
790
997
|
};
|
791
|
-
|
998
|
+
useEffect4(() => {
|
792
999
|
if (controlsVisible && isFullScreen && !qualityDropDownOpen) {
|
793
1000
|
if (controlsTimerRef.current) {
|
794
1001
|
clearTimeout(controlsTimerRef.current);
|
@@ -806,7 +1013,27 @@ var HLSView = () => {
|
|
806
1013
|
}
|
807
1014
|
};
|
808
1015
|
}, [controlsVisible, isFullScreen, qualityDropDownOpen]);
|
809
|
-
const
|
1016
|
+
const onTouchHandler = useCallback2(
|
1017
|
+
(event) => {
|
1018
|
+
event.preventDefault();
|
1019
|
+
if (event.type === "ontouchstart" && controlsVisible) {
|
1020
|
+
setControlsVisible(false);
|
1021
|
+
return;
|
1022
|
+
}
|
1023
|
+
if (event.type === "ontouchstart" || qualityDropDownOpen) {
|
1024
|
+
setControlsVisible(true);
|
1025
|
+
return;
|
1026
|
+
}
|
1027
|
+
if (isFullScreen && !controlsVisible && event.type === "touchmove") {
|
1028
|
+
setControlsVisible(true);
|
1029
|
+
if (controlsTimerRef.current) {
|
1030
|
+
clearTimeout(controlsTimerRef.current);
|
1031
|
+
}
|
1032
|
+
}
|
1033
|
+
},
|
1034
|
+
[controlsVisible, isFullScreen, qualityDropDownOpen]
|
1035
|
+
);
|
1036
|
+
const onHoverHandler = useCallback2(
|
810
1037
|
(event) => {
|
811
1038
|
if (event.type === "mouseenter" || qualityDropDownOpen) {
|
812
1039
|
setControlsVisible(true);
|
@@ -823,31 +1050,31 @@ var HLSView = () => {
|
|
823
1050
|
},
|
824
1051
|
[controlsVisible, isFullScreen, qualityDropDownOpen]
|
825
1052
|
);
|
826
|
-
return /* @__PURE__ */
|
1053
|
+
return /* @__PURE__ */ React13.createElement(
|
827
1054
|
Flex,
|
828
1055
|
{
|
829
1056
|
key: "hls-viewer",
|
830
1057
|
id: `hls-viewer-${themeType}`,
|
831
1058
|
ref: hlsViewRef,
|
1059
|
+
direction: isMobile || isLandscape ? "column" : "row",
|
832
1060
|
css: {
|
833
|
-
|
1061
|
+
w: sidepane !== "" && isLandscape ? "55%" : "100%",
|
1062
|
+
h: sidepane !== "" && isMobile ? "36%" : "100%"
|
834
1063
|
}
|
835
1064
|
},
|
836
|
-
(hlsStatsState == null ? void 0 : hlsStatsState.url) && enablHlsStats ? /* @__PURE__ */
|
837
|
-
hlsUrl && !streamEnded ? /* @__PURE__ */ React11.createElement(
|
1065
|
+
hlsUrl && !streamEnded ? /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(HMSPlayerContext.Provider, { value: { hlsPlayer } }, (hlsStatsState == null ? void 0 : hlsStatsState.url) && enablHlsStats && !(isMobile || isLandscape) ? /* @__PURE__ */ React13.createElement(HlsStatsOverlay, { hlsStatsState, onClose: sfnOverlayClose }) : null, /* @__PURE__ */ React13.createElement(
|
838
1066
|
Flex,
|
839
1067
|
{
|
840
1068
|
id: "hls-player-container",
|
841
1069
|
align: "center",
|
842
1070
|
justify: "center",
|
843
1071
|
css: {
|
844
|
-
|
845
|
-
margin: "0 auto"
|
846
|
-
height: "100%"
|
1072
|
+
size: "100%",
|
1073
|
+
margin: "0 auto"
|
847
1074
|
}
|
848
1075
|
},
|
849
|
-
/* @__PURE__ */
|
850
|
-
showLoader && /* @__PURE__ */
|
1076
|
+
/* @__PURE__ */ React13.createElement(HLSAutoplayBlockedPrompt, { open: isHlsAutoplayBlocked, unblockAutoPlay }),
|
1077
|
+
showLoader && /* @__PURE__ */ React13.createElement(
|
851
1078
|
Flex,
|
852
1079
|
{
|
853
1080
|
align: "center",
|
@@ -856,17 +1083,19 @@ var HLSView = () => {
|
|
856
1083
|
position: "absolute"
|
857
1084
|
}
|
858
1085
|
},
|
859
|
-
/* @__PURE__ */
|
1086
|
+
/* @__PURE__ */ React13.createElement(Loading, { width: 72, height: 72 })
|
860
1087
|
),
|
861
|
-
/* @__PURE__ */
|
1088
|
+
/* @__PURE__ */ React13.createElement(
|
862
1089
|
HMSVideoPlayer.Root,
|
863
1090
|
{
|
864
1091
|
ref: videoRef,
|
865
1092
|
onMouseEnter: onHoverHandler,
|
866
1093
|
onMouseMove: onHoverHandler,
|
867
|
-
onMouseLeave: onHoverHandler
|
1094
|
+
onMouseLeave: onHoverHandler,
|
1095
|
+
onTouchStart: onTouchHandler,
|
1096
|
+
onTouchMove: onTouchHandler
|
868
1097
|
},
|
869
|
-
isMobile
|
1098
|
+
/* @__PURE__ */ React13.createElement(React13.Fragment, null, isMobile || isLandscape ? /* @__PURE__ */ React13.createElement(React13.Fragment, null, !showLoader && /* @__PURE__ */ React13.createElement(
|
870
1099
|
Box,
|
871
1100
|
{
|
872
1101
|
css: {
|
@@ -874,30 +1103,83 @@ var HLSView = () => {
|
|
874
1103
|
top: "40%",
|
875
1104
|
left: "50%",
|
876
1105
|
transform: "translateY(-40%) translateX(-50%)",
|
877
|
-
padding: "$
|
1106
|
+
padding: "$4",
|
878
1107
|
display: "inline-flex",
|
879
|
-
r: "
|
1108
|
+
r: "$round",
|
880
1109
|
gap: "$1",
|
881
|
-
bg: "
|
882
|
-
zIndex:
|
1110
|
+
bg: "rgba(0, 0, 0, 0.6)",
|
1111
|
+
zIndex: 1,
|
1112
|
+
visibility: controlsVisible ? `` : `hidden`,
|
1113
|
+
opacity: controlsVisible ? `1` : "0"
|
1114
|
+
}
|
1115
|
+
},
|
1116
|
+
isPaused ? /* @__PURE__ */ React13.createElement(
|
1117
|
+
IconButton,
|
1118
|
+
{
|
1119
|
+
onClick: () => __async(void 0, null, function* () {
|
1120
|
+
yield hlsPlayer == null ? void 0 : hlsPlayer.play();
|
1121
|
+
}),
|
1122
|
+
"data-testid": "play_btn"
|
1123
|
+
},
|
1124
|
+
/* @__PURE__ */ React13.createElement(PlayIcon2, { width: "48px", height: "48px" })
|
1125
|
+
) : /* @__PURE__ */ React13.createElement(
|
1126
|
+
IconButton,
|
1127
|
+
{
|
1128
|
+
onClick: () => __async(void 0, null, function* () {
|
1129
|
+
yield hlsPlayer == null ? void 0 : hlsPlayer.pause();
|
1130
|
+
}),
|
1131
|
+
"data-testid": "pause_btn"
|
1132
|
+
},
|
1133
|
+
/* @__PURE__ */ React13.createElement(PauseIcon2, { width: "48px", height: "48px" })
|
1134
|
+
)
|
1135
|
+
), /* @__PURE__ */ React13.createElement(
|
1136
|
+
Flex,
|
1137
|
+
{
|
1138
|
+
ref: controlsRef,
|
1139
|
+
direction: "column",
|
1140
|
+
justify: "start",
|
1141
|
+
align: "start",
|
1142
|
+
css: {
|
1143
|
+
position: "absolute",
|
1144
|
+
top: "0",
|
1145
|
+
left: "0",
|
1146
|
+
width: "100%",
|
1147
|
+
flexShrink: 0,
|
1148
|
+
visibility: controlsVisible ? `` : `hidden`,
|
1149
|
+
opacity: controlsVisible ? `1` : "0"
|
883
1150
|
}
|
884
1151
|
},
|
885
|
-
/* @__PURE__ */
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
1152
|
+
/* @__PURE__ */ React13.createElement(
|
1153
|
+
HMSVideoPlayer.Controls.Root,
|
1154
|
+
{
|
1155
|
+
css: {
|
1156
|
+
p: "$4 $8"
|
1157
|
+
}
|
1158
|
+
},
|
1159
|
+
/* @__PURE__ */ React13.createElement(HMSVideoPlayer.Controls.Right, null, isLandscape && /* @__PURE__ */ React13.createElement(ChatToggle, null), hasCaptions && /* @__PURE__ */ React13.createElement(HLSCaptionSelector, { isEnabled: isCaptionEnabled }), availableLayers.length > 0 ? /* @__PURE__ */ React13.createElement(
|
1160
|
+
HLSQualitySelector,
|
1161
|
+
{
|
1162
|
+
layers: availableLayers,
|
1163
|
+
onOpenChange: setQualityDropDownOpen,
|
1164
|
+
open: qualityDropDownOpen,
|
1165
|
+
selection: currentSelectedQuality,
|
1166
|
+
onQualityChange: handleQuality,
|
1167
|
+
isAuto: isUserSelectedAuto
|
1168
|
+
}
|
1169
|
+
) : null)
|
1170
|
+
)
|
1171
|
+
)) : null, /* @__PURE__ */ React13.createElement(
|
890
1172
|
Flex,
|
891
1173
|
{
|
892
1174
|
ref: controlsRef,
|
893
1175
|
direction: "column",
|
894
|
-
justify: "
|
895
|
-
align: "
|
1176
|
+
justify: "end",
|
1177
|
+
align: "start",
|
896
1178
|
css: {
|
897
1179
|
position: "absolute",
|
898
1180
|
bottom: "0",
|
899
1181
|
left: "0",
|
900
|
-
background: `linear-gradient(180deg, ${theme.colors.background_dim.value}00 29.46%, ${theme.colors.background_dim.value}A3 100%);`,
|
1182
|
+
background: isMobile || isLandscape ? "" : `linear-gradient(180deg, ${theme.colors.background_dim.value}00 29.46%, ${theme.colors.background_dim.value}A3 100%);`,
|
901
1183
|
width: "100%",
|
902
1184
|
pt: "$8",
|
903
1185
|
flexShrink: 0,
|
@@ -906,14 +1188,15 @@ var HLSView = () => {
|
|
906
1188
|
opacity: controlsVisible ? `1` : "0"
|
907
1189
|
}
|
908
1190
|
},
|
909
|
-
!isMobile && /* @__PURE__ */
|
1191
|
+
!(isMobile || isLandscape) && ((_b = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _b.playlist_type) === HLSPlaylistType.DVR && /* @__PURE__ */ React13.createElement(HMSVideoPlayer.Progress, null),
|
1192
|
+
/* @__PURE__ */ React13.createElement(
|
910
1193
|
HMSVideoPlayer.Controls.Root,
|
911
1194
|
{
|
912
1195
|
css: {
|
913
1196
|
p: "$4 $8"
|
914
1197
|
}
|
915
1198
|
},
|
916
|
-
/* @__PURE__ */
|
1199
|
+
/* @__PURE__ */ React13.createElement(HMSVideoPlayer.Controls.Left, null, !(isMobile || isLandscape) && /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
|
917
1200
|
HMSVideoPlayer.PlayButton,
|
918
1201
|
{
|
919
1202
|
onClick: () => __async(void 0, null, function* () {
|
@@ -921,19 +1204,18 @@ var HLSView = () => {
|
|
921
1204
|
}),
|
922
1205
|
isPaused
|
923
1206
|
}
|
924
|
-
), /* @__PURE__ */
|
1207
|
+
), !isVideoLive ? /* @__PURE__ */ React13.createElement(HMSVideoPlayer.Duration, null) : null, /* @__PURE__ */ React13.createElement(HMSVideoPlayer.Volume, null)), /* @__PURE__ */ React13.createElement(
|
925
1208
|
IconButton,
|
926
1209
|
{
|
927
|
-
variant: "standard",
|
928
1210
|
css: { px: "$2" },
|
929
1211
|
onClick: () => __async(void 0, null, function* () {
|
930
|
-
yield hlsPlayer.seekToLivePosition();
|
1212
|
+
yield hlsPlayer == null ? void 0 : hlsPlayer.seekToLivePosition();
|
931
1213
|
setIsVideoLive(true);
|
932
1214
|
}),
|
933
1215
|
key: "jump-to-live_btn",
|
934
1216
|
"data-testid": "jump-to-live_btn"
|
935
1217
|
},
|
936
|
-
/* @__PURE__ */
|
1218
|
+
/* @__PURE__ */ React13.createElement(Tooltip, { title: isVideoLive ? "Live" : "Go to Live", side: "top" }, /* @__PURE__ */ React13.createElement(Flex, { justify: "center", gap: 2, align: "center" }, /* @__PURE__ */ React13.createElement(
|
937
1219
|
Box,
|
938
1220
|
{
|
939
1221
|
css: {
|
@@ -943,45 +1225,38 @@ var HLSView = () => {
|
|
943
1225
|
r: "$1"
|
944
1226
|
}
|
945
1227
|
}
|
946
|
-
), /* @__PURE__ */
|
1228
|
+
), /* @__PURE__ */ React13.createElement(
|
947
1229
|
Text,
|
948
1230
|
{
|
949
|
-
variant:
|
950
|
-
"@sm": "xs"
|
951
|
-
},
|
1231
|
+
variant: "$body1",
|
952
1232
|
css: {
|
953
|
-
c: isVideoLive ? "$on_surface_high" : "$on_surface_medium"
|
1233
|
+
c: isVideoLive ? "$on_surface_high" : "$on_surface_medium",
|
1234
|
+
fontWeight: "$semiBold"
|
954
1235
|
}
|
955
1236
|
},
|
956
1237
|
isVideoLive ? "LIVE" : "GO LIVE"
|
957
1238
|
)))
|
958
|
-
)),
|
959
|
-
/* @__PURE__ */
|
1239
|
+
), (isMobile || isLandscape) && !isVideoLive ? /* @__PURE__ */ React13.createElement(HMSVideoPlayer.Duration, null) : null),
|
1240
|
+
/* @__PURE__ */ React13.createElement(HMSVideoPlayer.Controls.Right, null, hasCaptions && !(isMobile || isLandscape) && /* @__PURE__ */ React13.createElement(HLSCaptionSelector, { isEnabled: isCaptionEnabled }), availableLayers.length > 0 && !(isMobile || isLandscape) ? /* @__PURE__ */ React13.createElement(
|
960
1241
|
HLSQualitySelector,
|
961
1242
|
{
|
962
1243
|
layers: availableLayers,
|
963
|
-
|
1244
|
+
onOpenChange: setQualityDropDownOpen,
|
964
1245
|
open: qualityDropDownOpen,
|
965
1246
|
selection: currentSelectedQuality,
|
966
1247
|
onQualityChange: handleQuality,
|
967
1248
|
isAuto: isUserSelectedAuto
|
968
1249
|
}
|
969
|
-
) : null, isFullScreenSupported ? /* @__PURE__ */
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
onToggle: toggle,
|
974
|
-
icon: isFullScreen ? /* @__PURE__ */ React11.createElement(ShrinkIcon, null) : /* @__PURE__ */ React11.createElement(ExpandIcon, null)
|
975
|
-
}
|
976
|
-
) : null)
|
977
|
-
)
|
978
|
-
)
|
1250
|
+
) : null, isFullScreenSupported ? /* @__PURE__ */ React13.createElement(FullScreenButton, { isFullScreen, onToggle: toggle }) : null)
|
1251
|
+
),
|
1252
|
+
(isMobile || isLandscape) && ((_c = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _c.playlist_type) === HLSPlaylistType.DVR ? /* @__PURE__ */ React13.createElement(HMSVideoPlayer.Progress, null) : null
|
1253
|
+
))
|
979
1254
|
)
|
980
|
-
) : /* @__PURE__ */
|
1255
|
+
)), isMobile && !isFullScreen && /* @__PURE__ */ React13.createElement(HLSViewTitle, null)) : /* @__PURE__ */ React13.createElement(Flex, { align: "center", justify: "center", direction: "column", css: { size: "100%", px: "$10" } }, /* @__PURE__ */ React13.createElement(Flex, { css: { c: "$on_surface_high", r: "$round", bg: "$surface_default", p: "$2" } }, streamEnded ? /* @__PURE__ */ React13.createElement(ColoredHandIcon, { height: 56, width: 56 }) : /* @__PURE__ */ React13.createElement(GoLiveIcon, { height: 56, width: 56 })), /* @__PURE__ */ React13.createElement(Text, { variant: "h5", css: { c: "$on_surface_high", mt: "$10", mb: 0, textAlign: "center" } }, streamEnded ? "Stream has ended" : "Stream yet to start"), /* @__PURE__ */ React13.createElement(Text, { variant: "md", css: { textAlign: "center", mt: "$4", c: "$on_surface_medium" } }, streamEnded ? "Have a nice day!" : "Sit back and relax"))
|
981
1256
|
);
|
982
1257
|
};
|
983
1258
|
var HLSView_default = HLSView;
|
984
1259
|
export {
|
985
1260
|
HLSView_default as default
|
986
1261
|
};
|
987
|
-
//# sourceMappingURL=HLSView-
|
1262
|
+
//# sourceMappingURL=HLSView-CVNJNDUQ.js.map
|