@100mslive/roomkit-react 0.3.5 → 0.3.7-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-K5AMEE25.js → HLSView-4GYBPDV3.js} +111 -121
- package/dist/HLSView-4GYBPDV3.js.map +7 -0
- package/dist/HLSView-B3CVWA37.css +2765 -0
- package/dist/HLSView-B3CVWA37.css.map +7 -0
- package/dist/Prebuilt/components/VideoLayouts/WhiteboardLayout.d.ts +1 -0
- package/dist/{chunk-6EGSZGLA.js → chunk-3KJZ5DTM.js} +1345 -1651
- package/dist/chunk-3KJZ5DTM.js.map +7 -0
- package/dist/index.cjs.css +2765 -0
- package/dist/index.cjs.css.map +7 -0
- package/dist/index.cjs.js +1463 -1757
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.css +2765 -0
- package/dist/index.css.map +7 -0
- package/dist/index.js +1 -1
- package/dist/meta.cjs.json +332 -752
- package/dist/meta.esbuild.json +408 -765
- package/package.json +7 -6
- package/src/Modal/DialogContent.tsx +2 -0
- package/src/Prebuilt/components/Footer/Footer.tsx +1 -0
- package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +2 -1
- package/src/Prebuilt/components/RoleChangeRequest/RequestPrompt.tsx +2 -2
- package/src/Prebuilt/components/ScreenShareToggle.jsx +1 -1
- package/src/Prebuilt/components/VideoLayouts/WhiteboardLayout.tsx +7 -13
- package/src/Prebuilt/layouts/VideoStreamingSection.tsx +4 -1
- package/dist/HLSView-K5AMEE25.js.map +0 -7
- package/dist/chunk-6EGSZGLA.js.map +0 -7
@@ -23,10 +23,6 @@ import {
|
|
23
23
|
Text,
|
24
24
|
ToastManager,
|
25
25
|
Tooltip,
|
26
|
-
__async,
|
27
|
-
__objRest,
|
28
|
-
__spreadProps,
|
29
|
-
__spreadValues,
|
30
26
|
config,
|
31
27
|
init_define_process_env,
|
32
28
|
styled,
|
@@ -38,7 +34,7 @@ import {
|
|
38
34
|
useRoomLayoutHeader,
|
39
35
|
useSidepaneToggle,
|
40
36
|
useTheme
|
41
|
-
} from "./chunk-
|
37
|
+
} from "./chunk-3KJZ5DTM.js";
|
42
38
|
|
43
39
|
// src/Prebuilt/layouts/HLSView.jsx
|
44
40
|
init_define_process_env();
|
@@ -66,7 +62,6 @@ init_define_process_env();
|
|
66
62
|
import React, { memo } from "react";
|
67
63
|
import { CrossIcon } from "@100mslive/react-icons";
|
68
64
|
function HlsStatsOverlay({ hlsStatsState, onClose }) {
|
69
|
-
var _a, _b, _c;
|
70
65
|
return /* @__PURE__ */ React.createElement(
|
71
66
|
Flex,
|
72
67
|
{
|
@@ -86,18 +81,18 @@ function HlsStatsOverlay({ hlsStatsState, onClose }) {
|
|
86
81
|
"a",
|
87
82
|
{
|
88
83
|
style: { cursor: "pointer", textDecoration: "underline" },
|
89
|
-
href: hlsStatsState
|
84
|
+
href: hlsStatsState?.url,
|
90
85
|
target: "_blank",
|
91
86
|
rel: "noreferrer"
|
92
87
|
},
|
93
88
|
"Stream url"
|
94
89
|
))),
|
95
|
-
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Video size" }, ` ${
|
96
|
-
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Buffer duration" },
|
97
|
-
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Connection speed" }, `${(
|
98
|
-
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Bitrate" }, `${(
|
90
|
+
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Video size" }, ` ${hlsStatsState?.videoSize?.width}x${hlsStatsState?.videoSize?.height}`),
|
91
|
+
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Buffer duration" }, hlsStatsState?.bufferedDuration?.toFixed(2), " "),
|
92
|
+
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Connection speed" }, `${(hlsStatsState?.bandwidthEstimate / (1e3 * 1e3)).toFixed(2)} Mbps`),
|
93
|
+
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Bitrate" }, `${(hlsStatsState?.bitrate / (1e3 * 1e3)).toFixed(2)} Mbps`),
|
99
94
|
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "distance from live" }, getDurationFromSeconds(hlsStatsState.distanceFromLive / 1e3)),
|
100
|
-
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Dropped frames" }, hlsStatsState
|
95
|
+
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Dropped frames" }, hlsStatsState?.droppedFrames)
|
101
96
|
);
|
102
97
|
}
|
103
98
|
function getDurationFromSeconds(timeInSeconds) {
|
@@ -170,11 +165,10 @@ var RightControls = styled(Flex, {
|
|
170
165
|
// src/Prebuilt/components/HMSVideo/HMSVideo.jsx
|
171
166
|
init_define_process_env();
|
172
167
|
import React2, { forwardRef } from "react";
|
173
|
-
var HMSVideo = forwardRef((
|
174
|
-
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
168
|
+
var HMSVideo = forwardRef(({ children, ...props }, videoRef) => {
|
175
169
|
return /* @__PURE__ */ React2.createElement(
|
176
170
|
Flex,
|
177
|
-
|
171
|
+
{
|
178
172
|
"data-testid": "hms-video",
|
179
173
|
css: {
|
180
174
|
size: "100%",
|
@@ -188,7 +182,8 @@ var HMSVideo = forwardRef((_a, videoRef) => {
|
|
188
182
|
}
|
189
183
|
},
|
190
184
|
"& video::cue": {
|
191
|
-
|
185
|
+
// default for on-surface-high
|
186
|
+
color: "#EFF0FA",
|
192
187
|
whiteSpace: "pre-line",
|
193
188
|
fontSize: "$sm",
|
194
189
|
fontStyle: "normal",
|
@@ -204,8 +199,9 @@ var HMSVideo = forwardRef((_a, videoRef) => {
|
|
204
199
|
fontSize: "$space$10 !important"
|
205
200
|
}
|
206
201
|
},
|
207
|
-
direction: "column"
|
208
|
-
|
202
|
+
direction: "column",
|
203
|
+
...props
|
204
|
+
},
|
209
205
|
/* @__PURE__ */ React2.createElement(
|
210
206
|
"video",
|
211
207
|
{
|
@@ -254,10 +250,10 @@ var PlayPauseButton = ({
|
|
254
250
|
height = 20
|
255
251
|
}) => {
|
256
252
|
const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
|
257
|
-
const onClick = (event) =>
|
258
|
-
event
|
259
|
-
isPaused ?
|
260
|
-
}
|
253
|
+
const onClick = async (event) => {
|
254
|
+
event?.stopPropagation();
|
255
|
+
isPaused ? await hlsPlayer2?.play() : hlsPlayer2?.pause();
|
256
|
+
};
|
261
257
|
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 })));
|
262
258
|
};
|
263
259
|
|
@@ -435,17 +431,16 @@ var VideoProgress = ({
|
|
435
431
|
const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
|
436
432
|
const [videoProgress, setVideoProgress] = useState(0);
|
437
433
|
const [bufferProgress, setBufferProgress] = useState(0);
|
438
|
-
const videoEl = hlsPlayer2
|
434
|
+
const videoEl = hlsPlayer2?.getVideoElement();
|
439
435
|
const setProgress = useCallback(() => {
|
440
|
-
var _a, _b;
|
441
436
|
if (!videoEl) {
|
442
437
|
return;
|
443
438
|
}
|
444
|
-
const duration = isFinite(videoEl.duration) ? videoEl.duration :
|
439
|
+
const duration = isFinite(videoEl.duration) ? videoEl.duration : videoEl.seekable?.end(0) || 0;
|
445
440
|
const videoProgress2 = Math.floor(getPercentage(videoEl.currentTime, duration));
|
446
441
|
let bufferProgress2 = 0;
|
447
442
|
if (videoEl.buffered.length > 0) {
|
448
|
-
bufferProgress2 = Math.floor(getPercentage(
|
443
|
+
bufferProgress2 = Math.floor(getPercentage(videoEl.buffered?.end(0), duration));
|
449
444
|
}
|
450
445
|
if (!isNaN(videoProgress2)) {
|
451
446
|
setVideoProgress(videoProgress2);
|
@@ -466,19 +461,18 @@ var VideoProgress = ({
|
|
466
461
|
}
|
467
462
|
videoEl.addEventListener("timeupdate", timeupdateHandler);
|
468
463
|
return function cleanup() {
|
469
|
-
videoEl
|
464
|
+
videoEl?.removeEventListener("timeupdate", timeupdateHandler);
|
470
465
|
};
|
471
466
|
}, [setProgress, timeupdateHandler, videoEl]);
|
472
467
|
const onProgress = (progress) => {
|
473
|
-
var _a;
|
474
468
|
const progress1 = Math.floor(getPercentage(progress[0], 100));
|
475
|
-
const videoEl2 = hlsPlayer2
|
469
|
+
const videoEl2 = hlsPlayer2?.getVideoElement();
|
476
470
|
if (!videoEl2) {
|
477
471
|
return;
|
478
472
|
}
|
479
|
-
const duration = isFinite(videoEl2.duration) ? videoEl2.duration :
|
473
|
+
const duration = isFinite(videoEl2.duration) ? videoEl2.duration : videoEl2.seekable?.end(0) || 0;
|
480
474
|
const currentTime = progress1 * duration / 100;
|
481
|
-
hlsPlayer2
|
475
|
+
hlsPlayer2?.seekTo(currentTime);
|
482
476
|
setProgress();
|
483
477
|
};
|
484
478
|
if (!videoEl) {
|
@@ -529,7 +523,7 @@ var VideoTime = () => {
|
|
529
523
|
const [videoTime, setVideoTime] = useState2("");
|
530
524
|
useEffect2(() => {
|
531
525
|
const timeupdateHandler = (currentTime) => {
|
532
|
-
const videoEl = hlsPlayer2
|
526
|
+
const videoEl = hlsPlayer2?.getVideoElement();
|
533
527
|
if (videoEl) {
|
534
528
|
const duration = isFinite(videoEl.duration) ? videoEl.duration : videoEl.seekable.end(0) || 0;
|
535
529
|
setVideoTime(getDurationFromSeconds2(duration - currentTime));
|
@@ -541,7 +535,7 @@ var VideoTime = () => {
|
|
541
535
|
hlsPlayer2.on(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
|
542
536
|
}
|
543
537
|
return function cleanup() {
|
544
|
-
hlsPlayer2
|
538
|
+
hlsPlayer2?.off(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
|
545
539
|
};
|
546
540
|
}, [hlsPlayer2]);
|
547
541
|
return hlsPlayer2 ? /* @__PURE__ */ React8.createElement(
|
@@ -566,9 +560,8 @@ init_define_process_env();
|
|
566
560
|
import React9, { useState as useState3 } from "react";
|
567
561
|
import { VolumeOneIcon, VolumeTwoIcon, VolumeZeroIcon } from "@100mslive/react-icons";
|
568
562
|
var VolumeControl = () => {
|
569
|
-
var _a;
|
570
563
|
const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
|
571
|
-
const [volume, setVolume] = useState3(
|
564
|
+
const [volume, setVolume] = useState3(hlsPlayer2?.volume ?? 100);
|
572
565
|
const [showSlider, setShowSlider] = useState3(false);
|
573
566
|
return /* @__PURE__ */ React9.createElement(
|
574
567
|
Flex,
|
@@ -591,10 +584,10 @@ var VolumeControl = () => {
|
|
591
584
|
onClick: () => {
|
592
585
|
if (volume > 0) {
|
593
586
|
setVolume(0);
|
594
|
-
hlsPlayer2
|
587
|
+
hlsPlayer2?.setVolume(0);
|
595
588
|
} else {
|
596
589
|
setVolume(100);
|
597
|
-
hlsPlayer2
|
590
|
+
hlsPlayer2?.setVolume(100);
|
598
591
|
}
|
599
592
|
}
|
600
593
|
}
|
@@ -617,7 +610,7 @@ var VolumeControl = () => {
|
|
617
610
|
step: 1,
|
618
611
|
value: [volume],
|
619
612
|
onValueChange: (volume2) => {
|
620
|
-
hlsPlayer2
|
613
|
+
hlsPlayer2?.setVolume(volume2[0]);
|
621
614
|
setVolume(volume2[0]);
|
622
615
|
},
|
623
616
|
thumbStyles: { w: "$6", h: "$6" }
|
@@ -678,9 +671,7 @@ function HLSAutoplayBlockedPrompt({
|
|
678
671
|
color: "#000",
|
679
672
|
r: "$2"
|
680
673
|
},
|
681
|
-
onClick: () =>
|
682
|
-
return yield unblockAutoPlay();
|
683
|
-
})
|
674
|
+
onClick: async () => await unblockAutoPlay()
|
684
675
|
},
|
685
676
|
/* @__PURE__ */ React11.createElement(VolumeTwoIcon2, { width: "32", height: "32" }),
|
686
677
|
/* @__PURE__ */ React11.createElement(
|
@@ -701,19 +692,19 @@ function HLSAutoplayBlockedPrompt({
|
|
701
692
|
Dialog.Root,
|
702
693
|
{
|
703
694
|
open,
|
704
|
-
onOpenChange: (value) =>
|
695
|
+
onOpenChange: async (value) => {
|
705
696
|
if (!value) {
|
706
|
-
|
697
|
+
await unblockAutoPlay();
|
707
698
|
}
|
708
|
-
}
|
699
|
+
}
|
709
700
|
},
|
710
701
|
/* @__PURE__ */ React11.createElement(DialogContent, { title: "Attention", closeable: false }, /* @__PURE__ */ React11.createElement(DialogRow, null, /* @__PURE__ */ React11.createElement(Text, { variant: "md" }, 'The browser wants us to get a confirmation for playing the HLS Stream. Please click "play stream" to proceed.')), /* @__PURE__ */ React11.createElement(DialogRow, { justify: "end" }, /* @__PURE__ */ React11.createElement(
|
711
702
|
Button,
|
712
703
|
{
|
713
704
|
variant: "primary",
|
714
|
-
onClick: () =>
|
715
|
-
|
716
|
-
}
|
705
|
+
onClick: async () => {
|
706
|
+
await unblockAutoPlay();
|
707
|
+
}
|
717
708
|
},
|
718
709
|
"Play stream"
|
719
710
|
)))
|
@@ -726,7 +717,7 @@ import React12 from "react";
|
|
726
717
|
import { ClosedCaptionIcon, OpenCaptionIcon } from "@100mslive/react-icons";
|
727
718
|
function HLSCaptionSelector({ isEnabled }) {
|
728
719
|
const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
|
729
|
-
return /* @__PURE__ */ React12.createElement(Tooltip, { title: "Subtitles/closed captions", side: "top" }, /* @__PURE__ */ React12.createElement(IconButton, { css: { p: "$2" }, onClick: () => hlsPlayer2
|
720
|
+
return /* @__PURE__ */ React12.createElement(Tooltip, { title: "Subtitles/closed captions", side: "top" }, /* @__PURE__ */ React12.createElement(IconButton, { css: { p: "$2" }, onClick: () => hlsPlayer2?.toggleCaption() }, isEnabled ? /* @__PURE__ */ React12.createElement(ClosedCaptionIcon, { width: "20", height: "20px" }) : /* @__PURE__ */ React12.createElement(OpenCaptionIcon, { width: "20", height: "20px" })));
|
730
721
|
}
|
731
722
|
|
732
723
|
// src/Prebuilt/components/HMSVideo/HLSQualitySelector.tsx
|
@@ -807,7 +798,7 @@ function HLSQualitySelector({
|
|
807
798
|
},
|
808
799
|
/* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold" } }, getQualityText(layer)),
|
809
800
|
/* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { flex: "1 1 0", c: "$on_surface_low", pl: "$2" } }, getBitrateText(layer)),
|
810
|
-
!isAuto && layer.width ===
|
801
|
+
!isAuto && layer.width === selection?.width && layer.height === selection?.height && /* @__PURE__ */ React13.createElement(CheckIcon, { width: "16px", height: "16px" })
|
811
802
|
);
|
812
803
|
}),
|
813
804
|
/* @__PURE__ */ React13.createElement(
|
@@ -902,7 +893,7 @@ function HLSQualitySelector({
|
|
902
893
|
onClick: () => onQualityChange(layer),
|
903
894
|
key: layer.width,
|
904
895
|
css: {
|
905
|
-
bg: !isAuto && layer.width ===
|
896
|
+
bg: !isAuto && layer.width === selection?.width && layer.height === selection?.height ? "$surface_default" : "$surface_bright",
|
906
897
|
"&:hover": {
|
907
898
|
bg: "$surface_brighter"
|
908
899
|
},
|
@@ -913,7 +904,7 @@ function HLSQualitySelector({
|
|
913
904
|
},
|
914
905
|
/* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold" } }, getQualityText(layer)),
|
915
906
|
/* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { flex: "1 1 0", c: "$on_surface_low", pl: "$2" } }, getBitrateText(layer)),
|
916
|
-
!isAuto && layer.width ===
|
907
|
+
!isAuto && layer.width === selection?.width && layer.height === selection?.height && /* @__PURE__ */ React13.createElement(CheckIcon, { width: "16px", height: "16px" })
|
917
908
|
);
|
918
909
|
}),
|
919
910
|
/* @__PURE__ */ React13.createElement(
|
@@ -1004,7 +995,7 @@ var ToggleChat = ({ isFullScreen = false }) => {
|
|
1004
995
|
const { elements } = useRoomLayoutConferencingScreen();
|
1005
996
|
const sidepane = useHMSStore(selectAppData(APP_DATA.sidePane));
|
1006
997
|
const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
|
1007
|
-
const showChat = !!
|
998
|
+
const showChat = !!elements?.chat;
|
1008
999
|
const isMobile = useMedia4(config.media.md);
|
1009
1000
|
const hmsActions = useHMSActions();
|
1010
1001
|
useEffect3(() => {
|
@@ -1020,7 +1011,6 @@ var ToggleChat = ({ isFullScreen = false }) => {
|
|
1020
1011
|
return null;
|
1021
1012
|
};
|
1022
1013
|
var HLSView = () => {
|
1023
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
1024
1014
|
const videoRef = useRef(null);
|
1025
1015
|
const hlsViewRef = useRef();
|
1026
1016
|
const { elements } = useRoomLayoutConferencingScreen();
|
@@ -1031,7 +1021,7 @@ var HLSView = () => {
|
|
1031
1021
|
const { themeType } = useTheme();
|
1032
1022
|
const [streamEnded, setStreamEnded] = useState4(false);
|
1033
1023
|
let [hlsStatsState, setHlsStatsState] = useState4(null);
|
1034
|
-
const hlsUrl =
|
1024
|
+
const hlsUrl = hlsState.variants[0]?.url;
|
1035
1025
|
const [availableLayers, setAvailableLayers] = useState4([]);
|
1036
1026
|
const [isVideoLive, setIsVideoLive] = useState4(true);
|
1037
1027
|
const [isCaptionEnabled, setIsCaptionEnabled] = useState4(true);
|
@@ -1055,7 +1045,7 @@ var HLSView = () => {
|
|
1055
1045
|
const [seekProgress, setSeekProgress] = useState4(false);
|
1056
1046
|
const isFullScreenSupported = screenfull.isEnabled;
|
1057
1047
|
const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
|
1058
|
-
const showChat = !!
|
1048
|
+
const showChat = !!elements?.chat;
|
1059
1049
|
const isMobile = useMedia4(config.media.md);
|
1060
1050
|
const isLandscape = useIsLandscape();
|
1061
1051
|
const isFullScreen = useFullscreen(hlsViewRef, show, {
|
@@ -1066,11 +1056,11 @@ var HLSView = () => {
|
|
1066
1056
|
const videoEl = videoRef.current;
|
1067
1057
|
const showLoader2 = () => setShowLoader(true);
|
1068
1058
|
const hideLoader = () => setShowLoader(false);
|
1069
|
-
videoEl
|
1070
|
-
videoEl
|
1059
|
+
videoEl?.addEventListener("playing", hideLoader);
|
1060
|
+
videoEl?.addEventListener("waiting", showLoader2);
|
1071
1061
|
return () => {
|
1072
|
-
videoEl
|
1073
|
-
videoEl
|
1062
|
+
videoEl?.removeEventListener("playing", hideLoader);
|
1063
|
+
videoEl?.removeEventListener("waiting", showLoader2);
|
1074
1064
|
};
|
1075
1065
|
}, []);
|
1076
1066
|
useEffect3(() => {
|
@@ -1081,7 +1071,7 @@ var HLSView = () => {
|
|
1081
1071
|
useEffect3(() => {
|
1082
1072
|
if (!notification)
|
1083
1073
|
return;
|
1084
|
-
const toastID = toastMap
|
1074
|
+
const toastID = toastMap?.[notification.data.id];
|
1085
1075
|
if (toastID) {
|
1086
1076
|
ToastManager.removeToast(toastMap[notification.data.id]);
|
1087
1077
|
delete toastMap[notification.data.id];
|
@@ -1091,19 +1081,18 @@ var HLSView = () => {
|
|
1091
1081
|
const videoElem = videoRef.current;
|
1092
1082
|
const setStreamEndedCallback = () => {
|
1093
1083
|
setStreamEnded(true);
|
1094
|
-
videoElem
|
1084
|
+
videoElem?.removeEventListener("ended", setStreamEndedCallback);
|
1095
1085
|
};
|
1096
|
-
videoElem
|
1086
|
+
videoElem?.addEventListener("ended", setStreamEndedCallback);
|
1097
1087
|
return () => {
|
1098
|
-
videoElem
|
1088
|
+
videoElem?.removeEventListener("ended", setStreamEndedCallback);
|
1099
1089
|
};
|
1100
1090
|
}, [hlsUrl]);
|
1101
1091
|
const handleQuality = useCallback2(
|
1102
1092
|
(quality) => {
|
1103
|
-
var _a2;
|
1104
1093
|
if (hlsPlayer) {
|
1105
|
-
setIsUserSelectedAuto(
|
1106
|
-
hlsPlayer
|
1094
|
+
setIsUserSelectedAuto(quality.height?.toString().toLowerCase() === "auto");
|
1095
|
+
hlsPlayer?.setLayer(quality);
|
1107
1096
|
}
|
1108
1097
|
},
|
1109
1098
|
[availableLayers]
|
@@ -1113,14 +1102,12 @@ var HLSView = () => {
|
|
1113
1102
|
let videoEl = videoRef.current;
|
1114
1103
|
const manifestLoadedHandler = ({ layers }) => {
|
1115
1104
|
setAvailableLayers(layers);
|
1116
|
-
setHasCaptions(hlsPlayer
|
1105
|
+
setHasCaptions(hlsPlayer?.hasCaptions());
|
1117
1106
|
};
|
1118
1107
|
const layerUpdatedHandler = ({ layer }) => {
|
1119
1108
|
setCurrentSelectedQuality(layer);
|
1120
1109
|
};
|
1121
|
-
const metadataLoadedHandler = (
|
1122
|
-
var _b2 = _a2, { payload } = _b2, rest = __objRest(_b2, ["payload"]);
|
1123
|
-
var _a3;
|
1110
|
+
const metadataLoadedHandler = ({ payload, ...rest }) => {
|
1124
1111
|
const parsePayload = (str) => {
|
1125
1112
|
try {
|
1126
1113
|
return JSON.parse(str);
|
@@ -1165,7 +1152,7 @@ var HLSView = () => {
|
|
1165
1152
|
}
|
1166
1153
|
switch (parsedPayload.type) {
|
1167
1154
|
case EMOJI_REACTION_TYPE:
|
1168
|
-
|
1155
|
+
window.showFlyingEmoji?.({ emojiId: parsedPayload?.emojiId, senderId: parsedPayload?.senderId });
|
1169
1156
|
break;
|
1170
1157
|
default: {
|
1171
1158
|
const toast = {
|
@@ -1186,13 +1173,15 @@ var HLSView = () => {
|
|
1186
1173
|
};
|
1187
1174
|
const playbackEventHandler = (data) => {
|
1188
1175
|
setIsPaused(data.state === HLSPlaybackState.paused);
|
1189
|
-
setHoverControlsVisible(
|
1176
|
+
setHoverControlsVisible({
|
1177
|
+
...hoverControlsVisible,
|
1190
1178
|
pausePlay: true
|
1191
|
-
})
|
1179
|
+
});
|
1192
1180
|
setTimeout(() => {
|
1193
|
-
setHoverControlsVisible(
|
1181
|
+
setHoverControlsVisible({
|
1182
|
+
...hoverControlsVisible,
|
1194
1183
|
pausePlay: false
|
1195
|
-
})
|
1184
|
+
});
|
1196
1185
|
}, 2e3);
|
1197
1186
|
};
|
1198
1187
|
const captionEnabledEventHandler = (isCaptionEnabled2) => {
|
@@ -1225,22 +1214,22 @@ var HLSView = () => {
|
|
1225
1214
|
useEffect3(() => {
|
1226
1215
|
const onHLSStats = (state) => setHlsStatsState(state);
|
1227
1216
|
if (enablHlsStats) {
|
1228
|
-
hlsPlayer
|
1217
|
+
hlsPlayer?.on(HMSHLSPlayerEvents2.STATS, onHLSStats);
|
1229
1218
|
} else {
|
1230
|
-
hlsPlayer
|
1219
|
+
hlsPlayer?.off(HMSHLSPlayerEvents2.STATS, onHLSStats);
|
1231
1220
|
}
|
1232
1221
|
return () => {
|
1233
|
-
hlsPlayer
|
1222
|
+
hlsPlayer?.off(HMSHLSPlayerEvents2.STATS, onHLSStats);
|
1234
1223
|
};
|
1235
1224
|
}, [enablHlsStats]);
|
1236
|
-
const unblockAutoPlay = () =>
|
1225
|
+
const unblockAutoPlay = async () => {
|
1237
1226
|
try {
|
1238
|
-
|
1227
|
+
await hlsPlayer.play();
|
1239
1228
|
setIsHlsAutoplayBlocked(false);
|
1240
1229
|
} catch (error) {
|
1241
1230
|
console.error("Tried to unblock Autoplay failed with", error.message);
|
1242
1231
|
}
|
1243
|
-
}
|
1232
|
+
};
|
1244
1233
|
const sfnOverlayClose = () => {
|
1245
1234
|
hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats);
|
1246
1235
|
};
|
@@ -1266,62 +1255,64 @@ var HLSView = () => {
|
|
1266
1255
|
}, [controlsVisible, isFullScreen, seekProgress, qualityDropDownOpen]);
|
1267
1256
|
const onSeekTo = useCallback2(
|
1268
1257
|
(seek) => {
|
1269
|
-
var _a2;
|
1270
1258
|
match({ isLandscape, isMobile, seek }).with({ seek: -10, isMobile: false, isLandscape: false }, () => {
|
1271
|
-
setHoverControlsVisible(
|
1259
|
+
setHoverControlsVisible({ ...hoverControlsVisible, seekBackward: true });
|
1272
1260
|
setTimeout(() => {
|
1273
|
-
setHoverControlsVisible(
|
1261
|
+
setHoverControlsVisible({
|
1262
|
+
...hoverControlsVisible,
|
1274
1263
|
seekBackward: false
|
1275
|
-
})
|
1264
|
+
});
|
1276
1265
|
}, 1e3);
|
1277
1266
|
}).with({ seek: 10, isMobile: false, isLandscape: false }, () => {
|
1278
|
-
setHoverControlsVisible(
|
1267
|
+
setHoverControlsVisible({ ...hoverControlsVisible, seekForward: true });
|
1279
1268
|
setTimeout(() => {
|
1280
|
-
setHoverControlsVisible(
|
1269
|
+
setHoverControlsVisible({
|
1270
|
+
...hoverControlsVisible,
|
1281
1271
|
seekForward: false
|
1282
|
-
})
|
1272
|
+
});
|
1283
1273
|
}, 1e3);
|
1284
1274
|
}).otherwise(() => null);
|
1285
|
-
hlsPlayer
|
1275
|
+
hlsPlayer?.seekTo(videoRef.current?.currentTime + seek);
|
1286
1276
|
},
|
1287
1277
|
[hoverControlsVisible, isLandscape, isMobile]
|
1288
1278
|
);
|
1289
1279
|
const onDoubleClickHandler = useCallback2(
|
1290
1280
|
(event) => {
|
1291
|
-
|
1292
|
-
if (!(isMobile || isLandscape) || ((_a2 = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _a2.playlist_type) !== HLSPlaylistType.DVR) {
|
1281
|
+
if (!(isMobile || isLandscape) || hlsState?.variants[0]?.playlist_type !== HLSPlaylistType.DVR) {
|
1293
1282
|
return;
|
1294
1283
|
}
|
1295
1284
|
const sidePercentage = event.screenX * 100 / event.target.clientWidth;
|
1296
1285
|
if (sidePercentage < 45) {
|
1297
|
-
setHoverControlsVisible(
|
1286
|
+
setHoverControlsVisible({
|
1287
|
+
...hoverControlsVisible,
|
1298
1288
|
seekBackward: true
|
1299
|
-
})
|
1289
|
+
});
|
1300
1290
|
onSeekTo(-10);
|
1301
1291
|
} else {
|
1302
|
-
setHoverControlsVisible(
|
1292
|
+
setHoverControlsVisible({
|
1293
|
+
...hoverControlsVisible,
|
1303
1294
|
seekForward: true
|
1304
|
-
})
|
1295
|
+
});
|
1305
1296
|
onSeekTo(10);
|
1306
1297
|
}
|
1307
1298
|
setTimeout(() => {
|
1308
|
-
setHoverControlsVisible(
|
1299
|
+
setHoverControlsVisible({
|
1300
|
+
...hoverControlsVisible,
|
1309
1301
|
seekForward: false,
|
1310
1302
|
seekBackward: false
|
1311
|
-
})
|
1303
|
+
});
|
1312
1304
|
}, 1e3);
|
1313
1305
|
},
|
1314
|
-
[hlsState
|
1306
|
+
[hlsState?.variants, hoverControlsVisible, isLandscape, isMobile, onSeekTo]
|
1315
1307
|
);
|
1316
|
-
const onClickHandler = useCallback2(() =>
|
1317
|
-
|
1318
|
-
match({ isMobile, isLandscape, playlist_type: (_a2 = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _a2.playlist_type }).with({ playlist_type: HLSPlaylistType.DVR, isMobile: false, isLandscape: false }, () => __async(void 0, null, function* () {
|
1308
|
+
const onClickHandler = useCallback2(async () => {
|
1309
|
+
match({ isMobile, isLandscape, playlist_type: hlsState?.variants[0]?.playlist_type }).with({ playlist_type: HLSPlaylistType.DVR, isMobile: false, isLandscape: false }, async () => {
|
1319
1310
|
if (isPaused) {
|
1320
|
-
|
1311
|
+
await hlsPlayer?.play();
|
1321
1312
|
} else {
|
1322
|
-
hlsPlayer
|
1313
|
+
hlsPlayer?.pause();
|
1323
1314
|
}
|
1324
|
-
})
|
1315
|
+
}).when(
|
1325
1316
|
({ isMobile: isMobile2, isLandscape: isLandscape2 }) => isMobile2 || isLandscape2,
|
1326
1317
|
() => {
|
1327
1318
|
setControlsVisible((value) => !value);
|
@@ -1330,7 +1321,7 @@ var HLSView = () => {
|
|
1330
1321
|
}
|
1331
1322
|
}
|
1332
1323
|
).otherwise(() => null);
|
1333
|
-
}
|
1324
|
+
}, [hlsState?.variants, isLandscape, isMobile, isPaused]);
|
1334
1325
|
const onHoverHandler = useCallback2(
|
1335
1326
|
(event) => {
|
1336
1327
|
event.preventDefault();
|
@@ -1388,7 +1379,7 @@ var HLSView = () => {
|
|
1388
1379
|
}
|
1389
1380
|
},
|
1390
1381
|
hlsViewRef.current && (isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(Box, { css: { position: "fixed", left: "$4", top: "$4", zIndex: 11 } }, /* @__PURE__ */ React15.createElement(LeaveRoom, { screenType: "hls_live_streaming", container: hlsViewRef.current })),
|
1391
|
-
/* @__PURE__ */ React15.createElement(HMSPlayerContext.Provider, { value: { hlsPlayer } },
|
1382
|
+
/* @__PURE__ */ React15.createElement(HMSPlayerContext.Provider, { value: { hlsPlayer } }, hlsStatsState?.url && enablHlsStats && !(isMobile || isLandscape) ? /* @__PURE__ */ React15.createElement(HlsStatsOverlay, { hlsStatsState, onClose: sfnOverlayClose }) : null, /* @__PURE__ */ React15.createElement(
|
1392
1383
|
Flex,
|
1393
1384
|
{
|
1394
1385
|
id: "hls-player-container",
|
@@ -1402,12 +1393,11 @@ var HLSView = () => {
|
|
1402
1393
|
},
|
1403
1394
|
outline: "none"
|
1404
1395
|
},
|
1405
|
-
onKeyDown: (event) =>
|
1406
|
-
|
1407
|
-
|
1408
|
-
yield keyHandler(event);
|
1396
|
+
onKeyDown: async (event) => {
|
1397
|
+
if (hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR) {
|
1398
|
+
await keyHandler(event);
|
1409
1399
|
}
|
1410
|
-
}
|
1400
|
+
},
|
1411
1401
|
tabIndex: "0"
|
1412
1402
|
},
|
1413
1403
|
!(isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(HLSAutoplayBlockedPrompt, { open: isHlsAutoplayBlocked, unblockAutoPlay }),
|
@@ -1448,7 +1438,7 @@ var HLSView = () => {
|
|
1448
1438
|
size: "100%"
|
1449
1439
|
}
|
1450
1440
|
},
|
1451
|
-
!showLoader &&
|
1441
|
+
!showLoader && hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR && /* @__PURE__ */ React15.createElement(
|
1452
1442
|
HMSVideoPlayer.PlayPauseSeekControls.Overlay,
|
1453
1443
|
{
|
1454
1444
|
isPaused,
|
@@ -1456,7 +1446,7 @@ var HLSView = () => {
|
|
1456
1446
|
hoverControlsVisible
|
1457
1447
|
}
|
1458
1448
|
)
|
1459
|
-
), isMobile || isLandscape ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, !showLoader &&
|
1449
|
+
), isMobile || isLandscape ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, !showLoader && hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR && /* @__PURE__ */ React15.createElement(
|
1460
1450
|
HMSVideoPlayer.PlayPauseSeekControls.Overlay,
|
1461
1451
|
{
|
1462
1452
|
isPaused,
|
@@ -1523,7 +1513,7 @@ var HLSView = () => {
|
|
1523
1513
|
align: "start",
|
1524
1514
|
css: {
|
1525
1515
|
position: "absolute",
|
1526
|
-
bottom: isFullScreen &&
|
1516
|
+
bottom: isFullScreen && hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR ? "$8" : "0",
|
1527
1517
|
left: "0",
|
1528
1518
|
zIndex: 1,
|
1529
1519
|
background: isMobile || isLandscape ? "" : `linear-gradient(180deg, ${theme.colors.background_dim.value}00 29.46%, ${theme.colors.background_dim.value}A3 100%);`,
|
@@ -1533,7 +1523,7 @@ var HLSView = () => {
|
|
1533
1523
|
transition: "visibility 0s 0.5s, opacity 0.5s linear"
|
1534
1524
|
}
|
1535
1525
|
},
|
1536
|
-
|
1526
|
+
hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR ? /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Progress, { seekProgress, setSeekProgress }) : null,
|
1537
1527
|
/* @__PURE__ */ React15.createElement(
|
1538
1528
|
HMSVideoPlayer.Controls.Root,
|
1539
1529
|
{
|
@@ -1542,15 +1532,15 @@ var HLSView = () => {
|
|
1542
1532
|
},
|
1543
1533
|
onClick: (e) => e.stopPropagation()
|
1544
1534
|
},
|
1545
|
-
/* @__PURE__ */ React15.createElement(HMSVideoPlayer.Controls.Left, null, !(isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(React15.Fragment, null,
|
1535
|
+
/* @__PURE__ */ React15.createElement(HMSVideoPlayer.Controls.Left, null, !(isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(React15.Fragment, null, hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(HMSVideoPlayer.PlayPauseSeekControls.Button, { isPaused, onSeekTo }), !isVideoLive ? /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Duration, null) : null) : null, /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Volume, null)), /* @__PURE__ */ React15.createElement(
|
1546
1536
|
IconButton,
|
1547
1537
|
{
|
1548
1538
|
css: { px: "$2" },
|
1549
|
-
onClick: (e) =>
|
1539
|
+
onClick: async (e) => {
|
1550
1540
|
e.stopPropagation();
|
1551
|
-
|
1541
|
+
await hlsPlayer?.seekToLivePosition();
|
1552
1542
|
setIsVideoLive(true);
|
1553
|
-
}
|
1543
|
+
},
|
1554
1544
|
key: "jump-to-live_btn",
|
1555
1545
|
"data-testid": "jump-to-live_btn"
|
1556
1546
|
},
|
@@ -1575,7 +1565,7 @@ var HLSView = () => {
|
|
1575
1565
|
},
|
1576
1566
|
isVideoLive ? "LIVE" : "GO LIVE"
|
1577
1567
|
)))
|
1578
|
-
), (isMobile || isLandscape) && !isVideoLive &&
|
1568
|
+
), (isMobile || isLandscape) && !isVideoLive && hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR ? /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Duration, null) : null),
|
1579
1569
|
/* @__PURE__ */ React15.createElement(HMSVideoPlayer.Controls.Right, null, hasCaptions && !(isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(HLSCaptionSelector, { isEnabled: isCaptionEnabled }), availableLayers.length > 0 && !(isMobile || isLandscape) ? /* @__PURE__ */ React15.createElement(
|
1580
1570
|
HLSQualitySelector,
|
1581
1571
|
{
|
@@ -1599,4 +1589,4 @@ var HLSView_default = HLSView;
|
|
1599
1589
|
export {
|
1600
1590
|
HLSView_default as default
|
1601
1591
|
};
|
1602
|
-
//# sourceMappingURL=HLSView-
|
1592
|
+
//# sourceMappingURL=HLSView-4GYBPDV3.js.map
|