@100mslive/roomkit-react 0.2.8-alpha.1 → 0.2.8-alpha.11
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/HLSView-EDROW5VZ.js +1411 -0
- package/dist/HLSView-EDROW5VZ.js.map +7 -0
- package/dist/Prebuilt/common/hooks.d.ts +3 -0
- package/dist/Prebuilt/components/Chat/MwebChatOption.d.ts +1 -1
- 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 +13 -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/PlayPauseButton.d.ts +6 -0
- package/dist/Prebuilt/components/HMSVideo/PlayerContext.d.ts +8 -0
- package/dist/Prebuilt/components/HMSVideo/SeekControls.d.ts +7 -0
- package/dist/Prebuilt/components/HMSVideo/VideoProgress.d.ts +5 -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 +26 -0
- package/dist/Prebuilt/components/HMSVideo/utils.d.ts +8 -0
- package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +2 -1
- package/dist/Prebuilt/components/Leave/LeaveRoom.d.ts +2 -1
- package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +2 -3
- package/dist/Prebuilt/components/MwebLandscapePrompt.d.ts +1 -1
- package/dist/Prebuilt/components/RaiseHand.d.ts +5 -0
- package/dist/Prebuilt/components/SidePaneTabs.d.ts +1 -1
- package/dist/Sheet/Sheet.d.ts +1 -0
- package/dist/{chunk-ERIM35YN.js → chunk-YFJQ4B6X.js} +1544 -1174
- package/dist/chunk-YFJQ4B6X.js.map +7 -0
- package/dist/index.cjs.js +2727 -1899
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.js +1 -1
- package/dist/meta.cjs.json +777 -290
- package/dist/meta.esbuild.json +798 -299
- package/package.json +7 -6
- package/src/Button/Button.tsx +4 -4
- package/src/Fieldset/Fieldset.tsx +1 -1
- package/src/Input/PasswordInput.stories.tsx +1 -1
- package/src/Pagination/StyledPagination.stories.tsx +2 -2
- package/src/Prebuilt/IconButton.tsx +1 -1
- package/src/Prebuilt/common/hooks.ts +21 -0
- package/src/Prebuilt/components/AppData/useSidepane.js +34 -7
- package/src/Prebuilt/components/AuthToken.jsx +1 -1
- package/src/Prebuilt/components/Chat/Chat.tsx +41 -1
- package/src/Prebuilt/components/Chat/ChatFooter.tsx +33 -13
- package/src/Prebuilt/components/Chat/MwebChatOption.tsx +1 -1
- package/src/Prebuilt/components/ConferenceScreen.tsx +48 -7
- package/src/Prebuilt/components/EmojiReaction.jsx +33 -23
- package/src/Prebuilt/components/Footer/Footer.tsx +0 -1
- package/src/Prebuilt/components/Footer/RoleOptions.tsx +141 -125
- package/src/Prebuilt/components/HMSVideo/Controls.jsx +1 -1
- package/src/Prebuilt/components/HMSVideo/FullscreenButton.tsx +13 -0
- package/src/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.tsx +72 -0
- package/src/Prebuilt/components/HMSVideo/HLSCaptionSelector.tsx +4 -2
- package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.tsx +248 -0
- package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +18 -7
- package/src/Prebuilt/components/HMSVideo/MwebHLSViewTitle.tsx +84 -0
- package/src/Prebuilt/components/HMSVideo/PlayButton.tsx +27 -0
- package/src/Prebuilt/components/HMSVideo/PlayPauseButton.tsx +27 -0
- package/src/Prebuilt/components/HMSVideo/PlayerContext.tsx +15 -0
- package/src/Prebuilt/components/HMSVideo/SeekControls.tsx +22 -0
- package/src/Prebuilt/components/HMSVideo/VideoProgress.tsx +95 -0
- package/src/Prebuilt/components/HMSVideo/VideoTime.tsx +43 -0
- package/src/Prebuilt/components/HMSVideo/{VolumeControl.jsx → VolumeControl.tsx} +6 -4
- package/src/Prebuilt/components/HMSVideo/{index.js → index.ts} +6 -2
- package/src/Prebuilt/components/HMSVideo/{HMSVIdeoUtils.js → utils.ts} +5 -5
- package/src/Prebuilt/components/Header/StreamActions.tsx +1 -1
- package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.tsx +1 -1
- package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +50 -46
- package/src/Prebuilt/components/Leave/LeaveRoom.tsx +15 -4
- package/src/Prebuilt/components/Leave/MwebLeaveRoom.tsx +46 -27
- package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +3 -1
- package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +37 -31
- package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +12 -8
- package/src/Prebuilt/components/MwebLandscapePrompt.tsx +14 -3
- package/src/Prebuilt/components/Notifications/HandRaisedNotifications.tsx +5 -2
- package/src/Prebuilt/components/Notifications/PeerNotifications.tsx +1 -1
- package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +19 -8
- package/src/Prebuilt/components/Polls/Voting/Voting.tsx +3 -2
- package/src/Prebuilt/components/Polls/common/OptionInputWithDelete.tsx +1 -1
- package/src/Prebuilt/components/Polls/common/utils.ts +2 -2
- package/src/Prebuilt/components/RaiseHand.tsx +24 -0
- package/src/Prebuilt/components/RoomDetails/RoomDetailsPane.tsx +41 -14
- package/src/Prebuilt/components/SidePaneTabs.tsx +56 -48
- package/src/Prebuilt/components/StatsForNerds.jsx +14 -6
- package/src/Prebuilt/components/Streaming/Common.jsx +1 -1
- package/src/Prebuilt/components/TileMenu/TileMenuContent.tsx +2 -2
- package/src/Prebuilt/components/Toast/ToastBatcher.js +8 -1
- package/src/Prebuilt/components/Toast/ToastConfig.jsx +17 -0
- package/src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx +2 -2
- package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +1 -1
- package/src/Prebuilt/layouts/HLSView.jsx +379 -179
- package/src/Prebuilt/layouts/SidePane.tsx +145 -59
- package/src/Prebuilt/layouts/VideoStreamingSection.tsx +22 -2
- package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
- package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +1 -1
- package/src/Sheet/Sheet.tsx +7 -3
- package/dist/HLSView-SJCF34GE.js +0 -987
- package/dist/HLSView-SJCF34GE.js.map +0 -7
- package/dist/chunk-ERIM35YN.js.map +0 -7
- package/src/Prebuilt/components/HMSVideo/FullscreenButton.jsx +0 -18
- package/src/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.jsx +0 -35
- package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +0 -127
- package/src/Prebuilt/components/HMSVideo/PlayButton.jsx +0 -13
- package/src/Prebuilt/components/HMSVideo/VideoProgress.jsx +0 -76
- package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +0 -33
- package/src/Prebuilt/components/RaiseHand.jsx +0 -17
package/dist/HLSView-SJCF34GE.js
DELETED
@@ -1,987 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
APP_DATA,
|
3
|
-
Box,
|
4
|
-
Button,
|
5
|
-
Dialog,
|
6
|
-
DialogContent,
|
7
|
-
DialogRow,
|
8
|
-
Dropdown,
|
9
|
-
EMOJI_REACTION_TYPE,
|
10
|
-
Flex,
|
11
|
-
IconButton,
|
12
|
-
IconButton_default,
|
13
|
-
Loading,
|
14
|
-
Slider,
|
15
|
-
Text,
|
16
|
-
ToastManager,
|
17
|
-
Tooltip,
|
18
|
-
__async,
|
19
|
-
__objRest,
|
20
|
-
__spreadValues,
|
21
|
-
config,
|
22
|
-
init_define_process_env,
|
23
|
-
styled,
|
24
|
-
usePollViewToggle,
|
25
|
-
useTheme
|
26
|
-
} from "./chunk-ERIM35YN.js";
|
27
|
-
|
28
|
-
// src/Prebuilt/layouts/HLSView.jsx
|
29
|
-
init_define_process_env();
|
30
|
-
import React11, { useCallback, useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
|
31
|
-
import { useFullscreen, useMedia, usePrevious, useToggle } from "react-use";
|
32
|
-
import { HLSPlaybackState, HMSHLSPlayer, HMSHLSPlayerEvents as HMSHLSPlayerEvents2 } from "@100mslive/hls-player";
|
33
|
-
import screenfull from "screenfull";
|
34
|
-
import {
|
35
|
-
HMSNotificationTypes,
|
36
|
-
selectAppData,
|
37
|
-
selectHLSState,
|
38
|
-
selectPeerNameByID,
|
39
|
-
selectPollByID,
|
40
|
-
useHMSActions,
|
41
|
-
useHMSNotifications,
|
42
|
-
useHMSStore,
|
43
|
-
useHMSVanillaStore
|
44
|
-
} from "@100mslive/react-sdk";
|
45
|
-
import { ColoredHandIcon, ExpandIcon, GoLiveIcon, PlayIcon as PlayIcon2, ShrinkIcon } from "@100mslive/react-icons";
|
46
|
-
|
47
|
-
// src/Prebuilt/components/HlsStatsOverlay.jsx
|
48
|
-
init_define_process_env();
|
49
|
-
import React, { memo } from "react";
|
50
|
-
import { CrossIcon } from "@100mslive/react-icons";
|
51
|
-
function HlsStatsOverlay({ hlsStatsState, onClose }) {
|
52
|
-
var _a, _b, _c;
|
53
|
-
return /* @__PURE__ */ React.createElement(
|
54
|
-
Flex,
|
55
|
-
{
|
56
|
-
css: {
|
57
|
-
position: "absolute",
|
58
|
-
width: "$80",
|
59
|
-
marginLeft: "$8",
|
60
|
-
padding: "$8 $8 $10",
|
61
|
-
zIndex: 10,
|
62
|
-
backgroundColor: "$surface_brighter",
|
63
|
-
borderRadius: "$1"
|
64
|
-
},
|
65
|
-
direction: "column"
|
66
|
-
},
|
67
|
-
/* @__PURE__ */ React.createElement(IconButton_default, { css: { position: "absolute", top: "$2", right: "$2" }, onClick: onClose }, /* @__PURE__ */ React.createElement(CrossIcon, null)),
|
68
|
-
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "URL" }, /* @__PURE__ */ React.createElement(Flex, { align: "center" }, /* @__PURE__ */ React.createElement(
|
69
|
-
"a",
|
70
|
-
{
|
71
|
-
style: { cursor: "pointer", textDecoration: "underline" },
|
72
|
-
href: hlsStatsState == null ? void 0 : hlsStatsState.url,
|
73
|
-
target: "_blank",
|
74
|
-
rel: "noreferrer"
|
75
|
-
},
|
76
|
-
"Stream url"
|
77
|
-
))),
|
78
|
-
/* @__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}`),
|
79
|
-
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Buffer duration" }, (_c = hlsStatsState == null ? void 0 : hlsStatsState.bufferedDuration) == null ? void 0 : _c.toFixed(2), " "),
|
80
|
-
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Connection speed" }, `${((hlsStatsState == null ? void 0 : hlsStatsState.bandwidthEstimate) / (1e3 * 1e3)).toFixed(2)} Mbps`),
|
81
|
-
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Bitrate" }, `${((hlsStatsState == null ? void 0 : hlsStatsState.bitrate) / (1e3 * 1e3)).toFixed(2)} Mbps`),
|
82
|
-
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "distance from live" }, getDurationFromSeconds(hlsStatsState.distanceFromLive / 1e3)),
|
83
|
-
/* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Dropped frames" }, hlsStatsState == null ? void 0 : hlsStatsState.droppedFrames)
|
84
|
-
);
|
85
|
-
}
|
86
|
-
function getDurationFromSeconds(timeInSeconds) {
|
87
|
-
let time = Math.floor(timeInSeconds);
|
88
|
-
const hours = Math.floor(time / 3600);
|
89
|
-
time = time - hours * 3600;
|
90
|
-
const minutes = Math.floor(time / 60);
|
91
|
-
const seconds = Math.floor(time - minutes * 60);
|
92
|
-
const prefixedMinutes = `${minutes < 10 ? "0" + minutes : minutes}`;
|
93
|
-
const prefixedSeconds = `${seconds < 10 ? "0" + seconds : seconds}`;
|
94
|
-
let videoTimeStr = `${prefixedMinutes}:${prefixedSeconds}`;
|
95
|
-
if (hours) {
|
96
|
-
const prefixedHours = `${hours < 10 ? "0" + hours : hours}`;
|
97
|
-
videoTimeStr = `${prefixedHours}:${prefixedMinutes}:${prefixedSeconds}`;
|
98
|
-
}
|
99
|
-
return videoTimeStr;
|
100
|
-
}
|
101
|
-
var HlsStatsRow = memo(({ label, children }) => {
|
102
|
-
return /* @__PURE__ */ React.createElement(Flex, { gap: 4, justify: "center", css: { width: "100%" } }, /* @__PURE__ */ React.createElement(
|
103
|
-
Text,
|
104
|
-
{
|
105
|
-
css: {
|
106
|
-
width: "50%",
|
107
|
-
"@md": { fontSize: "$md" },
|
108
|
-
"@sm": { fontSize: "$sm" }
|
109
|
-
// textAlign: "right",
|
110
|
-
}
|
111
|
-
},
|
112
|
-
label
|
113
|
-
), /* @__PURE__ */ React.createElement(
|
114
|
-
Text,
|
115
|
-
{
|
116
|
-
css: {
|
117
|
-
"@md": { fontSize: "$md" },
|
118
|
-
"@sm": { fontSize: "$sm" },
|
119
|
-
width: "50%",
|
120
|
-
overflowWrap: "break-word"
|
121
|
-
// textAlign: "left",
|
122
|
-
}
|
123
|
-
},
|
124
|
-
children
|
125
|
-
));
|
126
|
-
});
|
127
|
-
|
128
|
-
// src/Prebuilt/components/HMSVideo/index.js
|
129
|
-
init_define_process_env();
|
130
|
-
|
131
|
-
// src/Prebuilt/components/HMSVideo/Controls.jsx
|
132
|
-
init_define_process_env();
|
133
|
-
var VideoControls = styled(Flex, {
|
134
|
-
justifyContent: "center",
|
135
|
-
alignItems: "center",
|
136
|
-
alignSelf: "stretch",
|
137
|
-
width: "100%",
|
138
|
-
gap: "$2"
|
139
|
-
});
|
140
|
-
var LeftControls = styled(Flex, {
|
141
|
-
justifyContent: "flex-start",
|
142
|
-
alignItems: "center",
|
143
|
-
width: "100%",
|
144
|
-
gap: "$4"
|
145
|
-
});
|
146
|
-
var RightControls = styled(Flex, {
|
147
|
-
justifyContent: "flex-end",
|
148
|
-
alignItems: "center",
|
149
|
-
width: "100%",
|
150
|
-
gap: "$4"
|
151
|
-
});
|
152
|
-
|
153
|
-
// src/Prebuilt/components/HMSVideo/HMSVideo.jsx
|
154
|
-
init_define_process_env();
|
155
|
-
import React2, { forwardRef } from "react";
|
156
|
-
var HMSVideo = forwardRef((_a, videoRef) => {
|
157
|
-
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
158
|
-
return /* @__PURE__ */ React2.createElement(
|
159
|
-
Flex,
|
160
|
-
__spreadValues({
|
161
|
-
"data-testid": "hms-video",
|
162
|
-
css: {
|
163
|
-
size: "100%",
|
164
|
-
position: "relative",
|
165
|
-
"& video::cue": {
|
166
|
-
color: "white",
|
167
|
-
// textShadow: '0px 0px 4px #000',
|
168
|
-
whiteSpace: "pre-line",
|
169
|
-
fontSize: "$lg",
|
170
|
-
fontStyle: "normal",
|
171
|
-
fontWeight: "$semiBold",
|
172
|
-
lineHeight: "$sm",
|
173
|
-
letterSpacing: "0.5px"
|
174
|
-
},
|
175
|
-
"& video::-webkit-media-text-track-display": {
|
176
|
-
padding: "0 $4"
|
177
|
-
},
|
178
|
-
"& video::-webkit-media-text-track-container": {
|
179
|
-
fontSize: "$space$10 !important"
|
180
|
-
}
|
181
|
-
},
|
182
|
-
direction: "column"
|
183
|
-
}, props),
|
184
|
-
/* @__PURE__ */ React2.createElement(
|
185
|
-
"video",
|
186
|
-
{
|
187
|
-
style: {
|
188
|
-
flex: "1 1 0",
|
189
|
-
margin: "0 auto",
|
190
|
-
minHeight: "0"
|
191
|
-
},
|
192
|
-
ref: videoRef,
|
193
|
-
playsInline: true
|
194
|
-
}
|
195
|
-
),
|
196
|
-
children
|
197
|
-
);
|
198
|
-
});
|
199
|
-
|
200
|
-
// src/Prebuilt/components/HMSVideo/PlayButton.jsx
|
201
|
-
init_define_process_env();
|
202
|
-
import React3 from "react";
|
203
|
-
import { PauseIcon, PlayIcon } from "@100mslive/react-icons";
|
204
|
-
var PlayButton = ({ onClick, isPaused }) => {
|
205
|
-
return /* @__PURE__ */ React3.createElement(Tooltip, { title: isPaused ? "Play" : "Pause", side: "top" }, /* @__PURE__ */ React3.createElement(IconButton, { onClick, "data-testid": "play_pause_btn" }, isPaused ? /* @__PURE__ */ React3.createElement(PlayIcon, { width: 20, height: 20 }) : /* @__PURE__ */ React3.createElement(PauseIcon, { width: 20, height: 20 })));
|
206
|
-
};
|
207
|
-
|
208
|
-
// src/Prebuilt/components/HMSVideo/VideoProgress.jsx
|
209
|
-
init_define_process_env();
|
210
|
-
import React4, { useEffect, useRef, useState } from "react";
|
211
|
-
|
212
|
-
// src/Prebuilt/components/HMSVideo/HMSVIdeoUtils.js
|
213
|
-
init_define_process_env();
|
214
|
-
function getPercentage(a, b) {
|
215
|
-
return a / b * 100;
|
216
|
-
}
|
217
|
-
function getDurationFromSeconds2(timeInSeconds) {
|
218
|
-
let time = Math.floor(timeInSeconds);
|
219
|
-
const hours = Math.floor(time / 3600);
|
220
|
-
time = time - hours * 3600;
|
221
|
-
const minutes = Math.floor(time / 60);
|
222
|
-
const seconds = Math.floor(time - minutes * 60);
|
223
|
-
const prefixedMinutes = `${minutes < 10 ? `0${minutes}` : minutes}`;
|
224
|
-
const prefixedSeconds = `${seconds < 10 ? `0${seconds}` : seconds}`;
|
225
|
-
let videoTimeStr = `${prefixedMinutes}:${prefixedSeconds}`;
|
226
|
-
if (hours) {
|
227
|
-
const prefixedHours = `${hours < 10 ? `0${hours}` : hours}`;
|
228
|
-
videoTimeStr = `${prefixedHours}:${prefixedMinutes}:${prefixedSeconds}`;
|
229
|
-
}
|
230
|
-
return videoTimeStr;
|
231
|
-
}
|
232
|
-
|
233
|
-
// src/Prebuilt/components/HMSVideo/VideoProgress.jsx
|
234
|
-
var VideoProgress = ({ onValueChange, hlsPlayer: hlsPlayer2 }) => {
|
235
|
-
const [videoProgress, setVideoProgress] = useState(0);
|
236
|
-
const [bufferProgress, setBufferProgress] = useState(0);
|
237
|
-
const progressRootRef = useRef();
|
238
|
-
useEffect(() => {
|
239
|
-
const videoEl = hlsPlayer2.getVideoElement();
|
240
|
-
const timeupdateHandler = () => {
|
241
|
-
var _a;
|
242
|
-
const videoProgress2 = Math.floor(getPercentage(videoEl.currentTime, videoEl.duration));
|
243
|
-
let bufferProgress2 = 0;
|
244
|
-
if (videoEl.buffered.length > 0) {
|
245
|
-
bufferProgress2 = Math.floor(getPercentage((_a = videoEl.buffered) == null ? void 0 : _a.end(0), videoEl.duration));
|
246
|
-
}
|
247
|
-
setVideoProgress(isNaN(videoProgress2) ? 0 : videoProgress2);
|
248
|
-
setBufferProgress(isNaN(bufferProgress2) ? 0 : bufferProgress2);
|
249
|
-
};
|
250
|
-
if (videoEl) {
|
251
|
-
videoEl.addEventListener("timeupdate", timeupdateHandler);
|
252
|
-
}
|
253
|
-
return function cleanup() {
|
254
|
-
if (videoEl) {
|
255
|
-
videoEl.removeEventListener("timeupdate", timeupdateHandler);
|
256
|
-
}
|
257
|
-
};
|
258
|
-
}, [hlsPlayer2]);
|
259
|
-
const onProgressChangeHandler = (e) => {
|
260
|
-
const userClickedX = e.clientX - progressRootRef.current.offsetLeft;
|
261
|
-
const progressBarWidth = progressRootRef.current.offsetWidth;
|
262
|
-
const progress = Math.floor(getPercentage(userClickedX, progressBarWidth));
|
263
|
-
const videoEl = hlsPlayer2.getVideoElement();
|
264
|
-
const currentTime = progress * videoEl.duration / 100;
|
265
|
-
if (onValueChange) {
|
266
|
-
onValueChange(currentTime);
|
267
|
-
}
|
268
|
-
};
|
269
|
-
return hlsPlayer2.getVideoElement() ? /* @__PURE__ */ React4.createElement(
|
270
|
-
Flex,
|
271
|
-
{
|
272
|
-
ref: progressRootRef,
|
273
|
-
css: { cursor: "pointer", h: "$2", alignSelf: "stretch" },
|
274
|
-
onClick: onProgressChangeHandler
|
275
|
-
},
|
276
|
-
/* @__PURE__ */ React4.createElement(
|
277
|
-
Box,
|
278
|
-
{
|
279
|
-
id: "video-actual",
|
280
|
-
css: {
|
281
|
-
display: "inline",
|
282
|
-
width: `${videoProgress}%`,
|
283
|
-
background: "$primary_default"
|
284
|
-
}
|
285
|
-
}
|
286
|
-
),
|
287
|
-
/* @__PURE__ */ React4.createElement(
|
288
|
-
Box,
|
289
|
-
{
|
290
|
-
id: "video-buffer",
|
291
|
-
css: {
|
292
|
-
width: `${bufferProgress - videoProgress}%`,
|
293
|
-
background: "$on_surface_high",
|
294
|
-
opacity: "25%"
|
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
|
-
}
|
307
|
-
}
|
308
|
-
)
|
309
|
-
) : null;
|
310
|
-
};
|
311
|
-
|
312
|
-
// src/Prebuilt/components/HMSVideo/VideoTime.jsx
|
313
|
-
init_define_process_env();
|
314
|
-
import React5, { useEffect as useEffect2, useState as useState2 } from "react";
|
315
|
-
import { HMSHLSPlayerEvents } from "@100mslive/hls-player";
|
316
|
-
var VideoTime = ({ hlsPlayer: hlsPlayer2 }) => {
|
317
|
-
const [videoTime, setVideoTime] = useState2("");
|
318
|
-
useEffect2(() => {
|
319
|
-
const timeupdateHandler = (currentTime) => setVideoTime(getDurationFromSeconds2(currentTime));
|
320
|
-
if (hlsPlayer2) {
|
321
|
-
hlsPlayer2.on(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
|
322
|
-
}
|
323
|
-
return function cleanup() {
|
324
|
-
if (hlsPlayer2) {
|
325
|
-
hlsPlayer2.off(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
|
326
|
-
}
|
327
|
-
};
|
328
|
-
}, [hlsPlayer2]);
|
329
|
-
return hlsPlayer2 ? /* @__PURE__ */ React5.createElement(
|
330
|
-
Text,
|
331
|
-
{
|
332
|
-
css: {
|
333
|
-
minWidth: "$16",
|
334
|
-
c: "$on_surface_medium",
|
335
|
-
display: "flex",
|
336
|
-
justifyContent: "center"
|
337
|
-
}
|
338
|
-
},
|
339
|
-
videoTime
|
340
|
-
) : null;
|
341
|
-
};
|
342
|
-
|
343
|
-
// src/Prebuilt/components/HMSVideo/VolumeControl.jsx
|
344
|
-
init_define_process_env();
|
345
|
-
import React6, { useState as useState3 } from "react";
|
346
|
-
import { VolumeOneIcon, VolumeTwoIcon, VolumeZeroIcon } from "@100mslive/react-icons";
|
347
|
-
var VolumeControl = ({ hlsPlayer: hlsPlayer2 }) => {
|
348
|
-
var _a;
|
349
|
-
const [volume, setVolume] = useState3((_a = hlsPlayer2 == null ? void 0 : hlsPlayer2.volume) != null ? _a : 100);
|
350
|
-
const [showSlider, setShowSlider] = useState3(false);
|
351
|
-
return /* @__PURE__ */ React6.createElement(
|
352
|
-
Flex,
|
353
|
-
{
|
354
|
-
align: "center",
|
355
|
-
css: { color: "$on_surface_high" },
|
356
|
-
onMouseOver: (event) => {
|
357
|
-
event.stopPropagation();
|
358
|
-
setShowSlider(true);
|
359
|
-
},
|
360
|
-
onMouseLeave: (event) => {
|
361
|
-
event.stopPropagation();
|
362
|
-
setShowSlider(false);
|
363
|
-
}
|
364
|
-
},
|
365
|
-
/* @__PURE__ */ React6.createElement(
|
366
|
-
VolumeIcon,
|
367
|
-
{
|
368
|
-
volume,
|
369
|
-
onClick: () => {
|
370
|
-
if (volume > 0) {
|
371
|
-
setVolume(0);
|
372
|
-
hlsPlayer2 == null ? void 0 : hlsPlayer2.setVolume(0);
|
373
|
-
} else {
|
374
|
-
setVolume(100);
|
375
|
-
hlsPlayer2 == null ? void 0 : hlsPlayer2.setVolume(100);
|
376
|
-
}
|
377
|
-
}
|
378
|
-
}
|
379
|
-
),
|
380
|
-
/* @__PURE__ */ React6.createElement(
|
381
|
-
Slider,
|
382
|
-
{
|
383
|
-
css: {
|
384
|
-
mx: "$4",
|
385
|
-
w: "$20",
|
386
|
-
cursor: "pointer",
|
387
|
-
"@sm": { w: "$14" },
|
388
|
-
"@xs": { w: "$14" },
|
389
|
-
opacity: showSlider ? "1" : "0",
|
390
|
-
display: showSlider ? "" : "none",
|
391
|
-
transition: `all .2s ease .5s`
|
392
|
-
},
|
393
|
-
min: 0,
|
394
|
-
max: 100,
|
395
|
-
step: 1,
|
396
|
-
value: [volume],
|
397
|
-
onValueChange: (volume2) => {
|
398
|
-
hlsPlayer2.setVolume(volume2[0]);
|
399
|
-
setVolume(volume2[0]);
|
400
|
-
},
|
401
|
-
thumbStyles: { w: "$6", h: "$6" }
|
402
|
-
}
|
403
|
-
)
|
404
|
-
);
|
405
|
-
};
|
406
|
-
var VolumeIcon = ({ volume, onClick }) => {
|
407
|
-
if (volume === 0) {
|
408
|
-
return /* @__PURE__ */ React6.createElement(VolumeZeroIcon, { style: { cursor: "pointer", transition: "color 0.3s" }, onClick });
|
409
|
-
}
|
410
|
-
return volume < 50 ? /* @__PURE__ */ React6.createElement(VolumeOneIcon, { style: { cursor: "pointer", transition: "color 0.3s" }, onClick }) : /* @__PURE__ */ React6.createElement(VolumeTwoIcon, { style: { cursor: "pointer", transition: "color 0.3s" }, onClick });
|
411
|
-
};
|
412
|
-
|
413
|
-
// src/Prebuilt/components/HMSVideo/index.js
|
414
|
-
var HMSVideoPlayer = {
|
415
|
-
Root: HMSVideo,
|
416
|
-
PlayButton,
|
417
|
-
Progress: VideoProgress,
|
418
|
-
Duration: VideoTime,
|
419
|
-
Volume: VolumeControl,
|
420
|
-
Controls: {
|
421
|
-
Root: VideoControls,
|
422
|
-
Left: LeftControls,
|
423
|
-
Right: RightControls
|
424
|
-
}
|
425
|
-
};
|
426
|
-
|
427
|
-
// src/Prebuilt/components/HMSVideo/FullscreenButton.jsx
|
428
|
-
init_define_process_env();
|
429
|
-
import React7 from "react";
|
430
|
-
var FullScreenButton = ({ isFullScreen, icon, onToggle }) => {
|
431
|
-
return /* @__PURE__ */ React7.createElement(Tooltip, { title: `${isFullScreen ? "Exit" : "Go"} fullscreen`, side: "top" }, /* @__PURE__ */ React7.createElement(
|
432
|
-
IconButton,
|
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
|
-
));
|
442
|
-
};
|
443
|
-
|
444
|
-
// src/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.jsx
|
445
|
-
init_define_process_env();
|
446
|
-
import React8 from "react";
|
447
|
-
function HLSAutoplayBlockedPrompt({ open, unblockAutoPlay }) {
|
448
|
-
return /* @__PURE__ */ React8.createElement(
|
449
|
-
Dialog.Root,
|
450
|
-
{
|
451
|
-
open,
|
452
|
-
onOpenChange: (value) => {
|
453
|
-
if (!value) {
|
454
|
-
unblockAutoPlay();
|
455
|
-
}
|
456
|
-
}
|
457
|
-
},
|
458
|
-
/* @__PURE__ */ React8.createElement(DialogContent, { title: "Attention", closeable: false }, /* @__PURE__ */ React8.createElement(DialogRow, null, /* @__PURE__ */ React8.createElement(Text, { variant: "md" }, 'The browser wants us to get a confirmation for playing the HLS Stream. Please click "play stream" to proceed.')), /* @__PURE__ */ React8.createElement(DialogRow, { justify: "end" }, /* @__PURE__ */ React8.createElement(
|
459
|
-
Button,
|
460
|
-
{
|
461
|
-
variant: "primary",
|
462
|
-
onClick: () => {
|
463
|
-
unblockAutoPlay();
|
464
|
-
}
|
465
|
-
},
|
466
|
-
"Play stream"
|
467
|
-
)))
|
468
|
-
);
|
469
|
-
}
|
470
|
-
|
471
|
-
// src/Prebuilt/components/HMSVideo/HLSCaptionSelector.tsx
|
472
|
-
init_define_process_env();
|
473
|
-
import React9 from "react";
|
474
|
-
import { ClosedCaptionIcon, OpenCaptionIcon } from "@100mslive/react-icons";
|
475
|
-
function HLSCaptionSelector({ isEnabled, onClick }) {
|
476
|
-
return /* @__PURE__ */ React9.createElement(Tooltip, { title: "Subtitles/closed captions", side: "top" }, /* @__PURE__ */ React9.createElement(IconButton, { css: { p: "$2" }, onClick: () => onClick() }, isEnabled ? /* @__PURE__ */ React9.createElement(ClosedCaptionIcon, { width: "20", height: "20px" }) : /* @__PURE__ */ React9.createElement(OpenCaptionIcon, { width: "20", height: "20px" })));
|
477
|
-
}
|
478
|
-
|
479
|
-
// src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx
|
480
|
-
init_define_process_env();
|
481
|
-
import React10 from "react";
|
482
|
-
import { CheckIcon, SettingsIcon } from "@100mslive/react-icons";
|
483
|
-
function HLSQualitySelector({ open, onOpen, layers, onQualityChange, selection, isAuto }) {
|
484
|
-
return /* @__PURE__ */ React10.createElement(Dropdown.Root, { open, onOpenChange: (value) => onOpen(value) }, /* @__PURE__ */ React10.createElement(Dropdown.Trigger, { asChild: true, "data-testid": "quality_selector" }, /* @__PURE__ */ React10.createElement(
|
485
|
-
Flex,
|
486
|
-
{
|
487
|
-
css: {
|
488
|
-
color: "$on_primary_high",
|
489
|
-
r: "$1",
|
490
|
-
cursor: "pointer",
|
491
|
-
p: "$2"
|
492
|
-
}
|
493
|
-
},
|
494
|
-
/* @__PURE__ */ React10.createElement(Tooltip, { title: "Select Quality", side: "top" }, /* @__PURE__ */ React10.createElement(Flex, { align: "center" }, /* @__PURE__ */ React10.createElement(
|
495
|
-
Box,
|
496
|
-
{
|
497
|
-
css: {
|
498
|
-
w: "$9",
|
499
|
-
h: "$9",
|
500
|
-
display: "inline-flex",
|
501
|
-
alignItems: "center",
|
502
|
-
c: "$on_surface_high"
|
503
|
-
}
|
504
|
-
},
|
505
|
-
/* @__PURE__ */ React10.createElement(SettingsIcon, null)
|
506
|
-
), /* @__PURE__ */ React10.createElement(
|
507
|
-
Text,
|
508
|
-
{
|
509
|
-
variant: {
|
510
|
-
"@md": "sm",
|
511
|
-
"@sm": "xs",
|
512
|
-
"@xs": "tiny"
|
513
|
-
},
|
514
|
-
css: { display: "flex", alignItems: "center", ml: "$2", c: "$on_surface_medium" }
|
515
|
-
},
|
516
|
-
isAuto && /* @__PURE__ */ React10.createElement(React10.Fragment, null, "Auto", /* @__PURE__ */ React10.createElement(
|
517
|
-
Box,
|
518
|
-
{
|
519
|
-
css: {
|
520
|
-
mx: "$2",
|
521
|
-
w: "$2",
|
522
|
-
h: "$2",
|
523
|
-
background: "$on_surface_medium",
|
524
|
-
r: "$1"
|
525
|
-
}
|
526
|
-
}
|
527
|
-
)),
|
528
|
-
selection && Math.min(selection.width, selection.height),
|
529
|
-
"p"
|
530
|
-
)))
|
531
|
-
)), layers.length > 0 && /* @__PURE__ */ React10.createElement(
|
532
|
-
Dropdown.Content,
|
533
|
-
{
|
534
|
-
sideOffset: 5,
|
535
|
-
align: "end",
|
536
|
-
css: {
|
537
|
-
height: "auto",
|
538
|
-
maxHeight: "$52",
|
539
|
-
w: "$40",
|
540
|
-
bg: "$surface_bright",
|
541
|
-
py: "$4",
|
542
|
-
gap: "$4",
|
543
|
-
display: "grid"
|
544
|
-
}
|
545
|
-
},
|
546
|
-
layers.map((layer) => {
|
547
|
-
return /* @__PURE__ */ React10.createElement(
|
548
|
-
Dropdown.Item,
|
549
|
-
{
|
550
|
-
onClick: () => onQualityChange(layer),
|
551
|
-
key: layer.width,
|
552
|
-
css: {
|
553
|
-
bg: !isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) ? "$surface_default" : "$surface_bright",
|
554
|
-
"&:hover": {
|
555
|
-
bg: "$surface_brighter"
|
556
|
-
},
|
557
|
-
p: "$2 $4 $2 $8",
|
558
|
-
h: "$12",
|
559
|
-
gap: "$2"
|
560
|
-
}
|
561
|
-
},
|
562
|
-
/* @__PURE__ */ React10.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold" } }, getQualityText(layer)),
|
563
|
-
/* @__PURE__ */ React10.createElement(Text, { variant: "caption", css: { flex: "1 1 0", c: "$on_surface_low", pl: "$2" } }, getBitrateText(layer)),
|
564
|
-
!isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) && /* @__PURE__ */ React10.createElement(CheckIcon, { width: "16px", height: "16px" })
|
565
|
-
);
|
566
|
-
}),
|
567
|
-
/* @__PURE__ */ React10.createElement(
|
568
|
-
Dropdown.Item,
|
569
|
-
{
|
570
|
-
onClick: () => onQualityChange({ height: "auto" }),
|
571
|
-
key: "auto",
|
572
|
-
css: {
|
573
|
-
bg: !isAuto ? "$surface_bright" : "$surface_default",
|
574
|
-
"&:hover": {
|
575
|
-
bg: "$surface_brighter"
|
576
|
-
},
|
577
|
-
p: "$2 $4 $2 $8",
|
578
|
-
h: "$12",
|
579
|
-
gap: "$2"
|
580
|
-
}
|
581
|
-
},
|
582
|
-
/* @__PURE__ */ React10.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold", flex: "1 1 0" } }, "Auto"),
|
583
|
-
isAuto && /* @__PURE__ */ React10.createElement(CheckIcon, { width: "16px", height: "16px" })
|
584
|
-
)
|
585
|
-
));
|
586
|
-
}
|
587
|
-
var getQualityText = (layer) => `${Math.min(layer.height, layer.width)}p `;
|
588
|
-
var getBitrateText = (layer) => `(${(Number(layer.bitrate / 1e3) / 1e3).toFixed(2)} Mbps)`;
|
589
|
-
|
590
|
-
// src/Prebuilt/layouts/HLSView.jsx
|
591
|
-
var hlsPlayer;
|
592
|
-
var toastMap = {};
|
593
|
-
var HLSView = () => {
|
594
|
-
var _a;
|
595
|
-
const videoRef = useRef2(null);
|
596
|
-
const hlsViewRef = useRef2(null);
|
597
|
-
const hlsState = useHMSStore(selectHLSState);
|
598
|
-
const enablHlsStats = useHMSStore(selectAppData(APP_DATA.hlsStats));
|
599
|
-
const notification = useHMSNotifications(HMSNotificationTypes.POLL_STOPPED);
|
600
|
-
const hmsActions = useHMSActions();
|
601
|
-
const { themeType, theme } = useTheme();
|
602
|
-
const [streamEnded, setStreamEnded] = useState4(false);
|
603
|
-
let [hlsStatsState, setHlsStatsState] = useState4(null);
|
604
|
-
const hlsUrl = (_a = hlsState.variants[0]) == null ? void 0 : _a.url;
|
605
|
-
const [availableLayers, setAvailableLayers] = useState4([]);
|
606
|
-
const [isVideoLive, setIsVideoLive] = useState4(true);
|
607
|
-
const [isUserSelectedAuto, setIsUserSelectedAuto] = useState4(true);
|
608
|
-
const [isCaptionEnabled, setIsCaptionEnabled] = useState4(true);
|
609
|
-
const [hasCaptions, setHasCaptions] = useState4(false);
|
610
|
-
const [currentSelectedQuality, setCurrentSelectedQuality] = useState4(null);
|
611
|
-
const [isHlsAutoplayBlocked, setIsHlsAutoplayBlocked] = useState4(false);
|
612
|
-
const [isPaused, setIsPaused] = useState4(false);
|
613
|
-
const isFullScreenSupported = screenfull.isEnabled;
|
614
|
-
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
|
-
const lastHlsUrl = usePrevious(hlsUrl);
|
620
|
-
const togglePollView = usePollViewToggle();
|
621
|
-
const vanillaStore = useHMSVanillaStore();
|
622
|
-
const isMobile = useMedia(config.media.md);
|
623
|
-
const isFullScreen = useFullscreen(hlsViewRef, show, {
|
624
|
-
onClose: () => toggle(false)
|
625
|
-
});
|
626
|
-
const [showLoader, setShowLoader] = useState4(false);
|
627
|
-
useEffect3(() => {
|
628
|
-
const videoEl = videoRef.current;
|
629
|
-
const showLoader2 = () => setShowLoader(true);
|
630
|
-
const hideLoader = () => setShowLoader(false);
|
631
|
-
videoEl == null ? void 0 : videoEl.addEventListener("playing", hideLoader);
|
632
|
-
videoEl == null ? void 0 : videoEl.addEventListener("waiting", showLoader2);
|
633
|
-
return () => {
|
634
|
-
videoEl == null ? void 0 : videoEl.removeEventListener("playing", hideLoader);
|
635
|
-
videoEl == null ? void 0 : videoEl.removeEventListener("waiting", showLoader2);
|
636
|
-
};
|
637
|
-
}, []);
|
638
|
-
useEffect3(() => {
|
639
|
-
if (streamEnded && lastHlsUrl !== hlsUrl) {
|
640
|
-
setStreamEnded(false);
|
641
|
-
}
|
642
|
-
}, [hlsUrl, streamEnded, lastHlsUrl]);
|
643
|
-
useEffect3(() => {
|
644
|
-
if (!notification)
|
645
|
-
return;
|
646
|
-
const toastID = toastMap == null ? void 0 : toastMap[notification.data.id];
|
647
|
-
if (toastID) {
|
648
|
-
ToastManager.removeToast(toastMap[notification.data.id]);
|
649
|
-
delete toastMap[notification.data.id];
|
650
|
-
}
|
651
|
-
}, [notification]);
|
652
|
-
useEffect3(() => {
|
653
|
-
const videoElem = videoRef.current;
|
654
|
-
const setStreamEndedCallback = () => {
|
655
|
-
setStreamEnded(true);
|
656
|
-
videoElem == null ? void 0 : videoElem.removeEventListener("ended", setStreamEndedCallback);
|
657
|
-
};
|
658
|
-
videoElem == null ? void 0 : videoElem.addEventListener("ended", setStreamEndedCallback);
|
659
|
-
return () => {
|
660
|
-
videoElem == null ? void 0 : videoElem.removeEventListener("ended", setStreamEndedCallback);
|
661
|
-
};
|
662
|
-
}, [hlsUrl]);
|
663
|
-
useEffect3(() => {
|
664
|
-
let videoEl = videoRef.current;
|
665
|
-
const manifestLoadedHandler = ({ layers }) => {
|
666
|
-
setAvailableLayers(layers);
|
667
|
-
setHasCaptions(hlsPlayer == null ? void 0 : hlsPlayer.hasCaptions());
|
668
|
-
};
|
669
|
-
const layerUpdatedHandler = ({ layer }) => {
|
670
|
-
setCurrentSelectedQuality(layer);
|
671
|
-
};
|
672
|
-
const metadataLoadedHandler = (_a2) => {
|
673
|
-
var _b = _a2, { payload } = _b, rest = __objRest(_b, ["payload"]);
|
674
|
-
var _a3;
|
675
|
-
const parsePayload = (str) => {
|
676
|
-
try {
|
677
|
-
return JSON.parse(str);
|
678
|
-
} catch (e) {
|
679
|
-
return str;
|
680
|
-
}
|
681
|
-
};
|
682
|
-
const duration = rest.duration;
|
683
|
-
const parsedPayload = parsePayload(payload);
|
684
|
-
if (parsedPayload.startsWith("poll:")) {
|
685
|
-
const pollId = parsedPayload.substr(parsedPayload.indexOf(":") + 1);
|
686
|
-
const poll = vanillaStore.getState(selectPollByID(pollId));
|
687
|
-
const pollStartedBy = vanillaStore.getState(selectPeerNameByID(poll.startedBy)) || "Participant";
|
688
|
-
const toastID = ToastManager.addToast({
|
689
|
-
title: `${pollStartedBy} started a ${poll.type}: ${poll.title}`,
|
690
|
-
action: /* @__PURE__ */ React11.createElement(
|
691
|
-
Button,
|
692
|
-
{
|
693
|
-
onClick: () => togglePollView(pollId),
|
694
|
-
variant: "standard",
|
695
|
-
css: {
|
696
|
-
backgroundColor: "$surface_bright",
|
697
|
-
fontWeight: "$semiBold",
|
698
|
-
color: "$on_surface_high",
|
699
|
-
p: "$xs $md"
|
700
|
-
}
|
701
|
-
},
|
702
|
-
poll.type === "quiz" ? "Answer" : "Vote"
|
703
|
-
),
|
704
|
-
duration: Infinity
|
705
|
-
});
|
706
|
-
toastMap[pollId] = toastID;
|
707
|
-
return;
|
708
|
-
}
|
709
|
-
switch (parsedPayload.type) {
|
710
|
-
case EMOJI_REACTION_TYPE:
|
711
|
-
(_a3 = window.showFlyingEmoji) == null ? void 0 : _a3.call(window, { emojiId: parsedPayload == null ? void 0 : parsedPayload.emojiId, senderId: parsedPayload == null ? void 0 : parsedPayload.senderId });
|
712
|
-
break;
|
713
|
-
default: {
|
714
|
-
const toast = {
|
715
|
-
title: `Payload from timed Metadata ${parsedPayload}`,
|
716
|
-
duration: duration || 3e3
|
717
|
-
};
|
718
|
-
console.debug("Added toast ", JSON.stringify(toast));
|
719
|
-
ToastManager.addToast(toast);
|
720
|
-
break;
|
721
|
-
}
|
722
|
-
}
|
723
|
-
};
|
724
|
-
const handleError = (data) => {
|
725
|
-
console.error("[HLSView] error in hls", `${data}`);
|
726
|
-
};
|
727
|
-
const handleNoLongerLive = ({ isLive }) => {
|
728
|
-
setIsVideoLive(isLive);
|
729
|
-
};
|
730
|
-
const playbackEventHandler = (data) => setIsPaused(data.state === HLSPlaybackState.paused);
|
731
|
-
const captionEnabledEventHandler = (isCaptionEnabled2) => {
|
732
|
-
setIsCaptionEnabled(isCaptionEnabled2);
|
733
|
-
};
|
734
|
-
const handleAutoplayBlock = (data) => setIsHlsAutoplayBlocked(!!data);
|
735
|
-
if (videoEl && hlsUrl) {
|
736
|
-
hlsPlayer = new HMSHLSPlayer(hlsUrl, videoEl);
|
737
|
-
hlsPlayer.on(HMSHLSPlayerEvents2.SEEK_POS_BEHIND_LIVE_EDGE, handleNoLongerLive);
|
738
|
-
hlsPlayer.on(HMSHLSPlayerEvents2.TIMED_METADATA_LOADED, metadataLoadedHandler);
|
739
|
-
hlsPlayer.on(HMSHLSPlayerEvents2.ERROR, handleError);
|
740
|
-
hlsPlayer.on(HMSHLSPlayerEvents2.PLAYBACK_STATE, playbackEventHandler);
|
741
|
-
hlsPlayer.on(HMSHLSPlayerEvents2.CAPTION_ENABLED, captionEnabledEventHandler);
|
742
|
-
hlsPlayer.on(HMSHLSPlayerEvents2.AUTOPLAY_BLOCKED, handleAutoplayBlock);
|
743
|
-
hlsPlayer.on(HMSHLSPlayerEvents2.MANIFEST_LOADED, manifestLoadedHandler);
|
744
|
-
hlsPlayer.on(HMSHLSPlayerEvents2.LAYER_UPDATED, layerUpdatedHandler);
|
745
|
-
return () => {
|
746
|
-
hlsPlayer.off(HMSHLSPlayerEvents2.SEEK_POS_BEHIND_LIVE_EDGE, handleNoLongerLive);
|
747
|
-
hlsPlayer.off(HMSHLSPlayerEvents2.ERROR, handleError);
|
748
|
-
hlsPlayer.off(HMSHLSPlayerEvents2.TIMED_METADATA_LOADED, metadataLoadedHandler);
|
749
|
-
hlsPlayer.off(HMSHLSPlayerEvents2.PLAYBACK_STATE, playbackEventHandler);
|
750
|
-
hlsPlayer.off(HMSHLSPlayerEvents2.CAPTION_ENABLED, captionEnabledEventHandler);
|
751
|
-
hlsPlayer.off(HMSHLSPlayerEvents2.AUTOPLAY_BLOCKED, handleAutoplayBlock);
|
752
|
-
hlsPlayer.off(HMSHLSPlayerEvents2.MANIFEST_LOADED, manifestLoadedHandler);
|
753
|
-
hlsPlayer.off(HMSHLSPlayerEvents2.LAYER_UPDATED, layerUpdatedHandler);
|
754
|
-
hlsPlayer.reset();
|
755
|
-
hlsPlayer = null;
|
756
|
-
};
|
757
|
-
}
|
758
|
-
}, [hlsUrl]);
|
759
|
-
useEffect3(() => {
|
760
|
-
const onHLSStats = (state) => setHlsStatsState(state);
|
761
|
-
if (enablHlsStats) {
|
762
|
-
hlsPlayer == null ? void 0 : hlsPlayer.on(HMSHLSPlayerEvents2.STATS, onHLSStats);
|
763
|
-
} else {
|
764
|
-
hlsPlayer == null ? void 0 : hlsPlayer.off(HMSHLSPlayerEvents2.STATS, onHLSStats);
|
765
|
-
}
|
766
|
-
return () => {
|
767
|
-
hlsPlayer == null ? void 0 : hlsPlayer.off(HMSHLSPlayerEvents2.STATS, onHLSStats);
|
768
|
-
};
|
769
|
-
}, [enablHlsStats]);
|
770
|
-
const unblockAutoPlay = () => __async(void 0, null, function* () {
|
771
|
-
try {
|
772
|
-
yield hlsPlayer.play();
|
773
|
-
setIsHlsAutoplayBlocked(false);
|
774
|
-
} catch (error) {
|
775
|
-
console.error("Tried to unblock Autoplay failed with", error.message);
|
776
|
-
}
|
777
|
-
});
|
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
|
-
const sfnOverlayClose = () => {
|
789
|
-
hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats);
|
790
|
-
};
|
791
|
-
useEffect3(() => {
|
792
|
-
if (controlsVisible && isFullScreen && !qualityDropDownOpen) {
|
793
|
-
if (controlsTimerRef.current) {
|
794
|
-
clearTimeout(controlsTimerRef.current);
|
795
|
-
}
|
796
|
-
controlsTimerRef.current = setTimeout(() => {
|
797
|
-
setControlsVisible(false);
|
798
|
-
}, 5e3);
|
799
|
-
}
|
800
|
-
if (!isFullScreen && controlsTimerRef.current) {
|
801
|
-
clearTimeout(controlsTimerRef.current);
|
802
|
-
}
|
803
|
-
return () => {
|
804
|
-
if (controlsTimerRef.current) {
|
805
|
-
clearTimeout(controlsTimerRef.current);
|
806
|
-
}
|
807
|
-
};
|
808
|
-
}, [controlsVisible, isFullScreen, qualityDropDownOpen]);
|
809
|
-
const onHoverHandler = useCallback(
|
810
|
-
(event) => {
|
811
|
-
if (event.type === "mouseenter" || qualityDropDownOpen) {
|
812
|
-
setControlsVisible(true);
|
813
|
-
return;
|
814
|
-
}
|
815
|
-
if (event.type === "mouseleave") {
|
816
|
-
setControlsVisible(false);
|
817
|
-
} else if (isFullScreen && !controlsVisible && event.type === "mousemove") {
|
818
|
-
setControlsVisible(true);
|
819
|
-
if (controlsTimerRef.current) {
|
820
|
-
clearTimeout(controlsTimerRef.current);
|
821
|
-
}
|
822
|
-
}
|
823
|
-
},
|
824
|
-
[controlsVisible, isFullScreen, qualityDropDownOpen]
|
825
|
-
);
|
826
|
-
return /* @__PURE__ */ React11.createElement(
|
827
|
-
Flex,
|
828
|
-
{
|
829
|
-
key: "hls-viewer",
|
830
|
-
id: `hls-viewer-${themeType}`,
|
831
|
-
ref: hlsViewRef,
|
832
|
-
css: {
|
833
|
-
size: "100%"
|
834
|
-
}
|
835
|
-
},
|
836
|
-
(hlsStatsState == null ? void 0 : hlsStatsState.url) && enablHlsStats ? /* @__PURE__ */ React11.createElement(HlsStatsOverlay, { hlsStatsState, onClose: sfnOverlayClose }) : null,
|
837
|
-
hlsUrl && !streamEnded ? /* @__PURE__ */ React11.createElement(
|
838
|
-
Flex,
|
839
|
-
{
|
840
|
-
id: "hls-player-container",
|
841
|
-
align: "center",
|
842
|
-
justify: "center",
|
843
|
-
css: {
|
844
|
-
width: "100%",
|
845
|
-
margin: "0 auto",
|
846
|
-
height: "100%"
|
847
|
-
}
|
848
|
-
},
|
849
|
-
/* @__PURE__ */ React11.createElement(HLSAutoplayBlockedPrompt, { open: isHlsAutoplayBlocked, unblockAutoPlay }),
|
850
|
-
showLoader && /* @__PURE__ */ React11.createElement(
|
851
|
-
Flex,
|
852
|
-
{
|
853
|
-
align: "center",
|
854
|
-
justify: "center",
|
855
|
-
css: {
|
856
|
-
position: "absolute"
|
857
|
-
}
|
858
|
-
},
|
859
|
-
/* @__PURE__ */ React11.createElement(Loading, { width: 72, height: 72 })
|
860
|
-
),
|
861
|
-
/* @__PURE__ */ React11.createElement(
|
862
|
-
HMSVideoPlayer.Root,
|
863
|
-
{
|
864
|
-
ref: videoRef,
|
865
|
-
onMouseEnter: onHoverHandler,
|
866
|
-
onMouseMove: onHoverHandler,
|
867
|
-
onMouseLeave: onHoverHandler
|
868
|
-
},
|
869
|
-
isMobile && isPaused && /* @__PURE__ */ React11.createElement(
|
870
|
-
Box,
|
871
|
-
{
|
872
|
-
css: {
|
873
|
-
position: "absolute",
|
874
|
-
top: "40%",
|
875
|
-
left: "50%",
|
876
|
-
transform: "translateY(-40%) translateX(-50%)",
|
877
|
-
padding: "$8 14px $8 18px",
|
878
|
-
display: "inline-flex",
|
879
|
-
r: "50%",
|
880
|
-
gap: "$1",
|
881
|
-
bg: "$primary_default",
|
882
|
-
zIndex: 21
|
883
|
-
}
|
884
|
-
},
|
885
|
-
/* @__PURE__ */ React11.createElement(IconButton, { onClick: () => __async(void 0, null, function* () {
|
886
|
-
return yield hlsPlayer == null ? void 0 : hlsPlayer.play();
|
887
|
-
}), "data-testid": "play_btn" }, /* @__PURE__ */ React11.createElement(PlayIcon2, { width: "60px", height: "60px" }))
|
888
|
-
),
|
889
|
-
/* @__PURE__ */ React11.createElement(
|
890
|
-
Flex,
|
891
|
-
{
|
892
|
-
ref: controlsRef,
|
893
|
-
direction: "column",
|
894
|
-
justify: "flex-end",
|
895
|
-
align: "flex-start",
|
896
|
-
css: {
|
897
|
-
position: "absolute",
|
898
|
-
bottom: "0",
|
899
|
-
left: "0",
|
900
|
-
background: `linear-gradient(180deg, ${theme.colors.background_dim.value}00 29.46%, ${theme.colors.background_dim.value}A3 100%);`,
|
901
|
-
width: "100%",
|
902
|
-
pt: "$8",
|
903
|
-
flexShrink: 0,
|
904
|
-
transition: "visibility 0s 0.5s, opacity 0.5s linear",
|
905
|
-
visibility: controlsVisible ? `` : `hidden`,
|
906
|
-
opacity: controlsVisible ? `1` : "0"
|
907
|
-
}
|
908
|
-
},
|
909
|
-
!isMobile && /* @__PURE__ */ React11.createElement(
|
910
|
-
HMSVideoPlayer.Controls.Root,
|
911
|
-
{
|
912
|
-
css: {
|
913
|
-
p: "$4 $8"
|
914
|
-
}
|
915
|
-
},
|
916
|
-
/* @__PURE__ */ React11.createElement(HMSVideoPlayer.Controls.Left, null, /* @__PURE__ */ React11.createElement(
|
917
|
-
HMSVideoPlayer.PlayButton,
|
918
|
-
{
|
919
|
-
onClick: () => __async(void 0, null, function* () {
|
920
|
-
isPaused ? yield hlsPlayer == null ? void 0 : hlsPlayer.play() : hlsPlayer == null ? void 0 : hlsPlayer.pause();
|
921
|
-
}),
|
922
|
-
isPaused
|
923
|
-
}
|
924
|
-
), /* @__PURE__ */ React11.createElement(HMSVideoPlayer.Duration, { hlsPlayer }), /* @__PURE__ */ React11.createElement(HMSVideoPlayer.Volume, { hlsPlayer }), /* @__PURE__ */ React11.createElement(
|
925
|
-
IconButton,
|
926
|
-
{
|
927
|
-
variant: "standard",
|
928
|
-
css: { px: "$2" },
|
929
|
-
onClick: () => __async(void 0, null, function* () {
|
930
|
-
yield hlsPlayer.seekToLivePosition();
|
931
|
-
setIsVideoLive(true);
|
932
|
-
}),
|
933
|
-
key: "jump-to-live_btn",
|
934
|
-
"data-testid": "jump-to-live_btn"
|
935
|
-
},
|
936
|
-
/* @__PURE__ */ React11.createElement(Tooltip, { title: "Go to Live", side: "top" }, /* @__PURE__ */ React11.createElement(Flex, { justify: "center", gap: 2, align: "center" }, /* @__PURE__ */ React11.createElement(
|
937
|
-
Box,
|
938
|
-
{
|
939
|
-
css: {
|
940
|
-
height: "$4",
|
941
|
-
width: "$4",
|
942
|
-
background: isVideoLive ? "$alert_error_default" : "$on_primary_medium",
|
943
|
-
r: "$1"
|
944
|
-
}
|
945
|
-
}
|
946
|
-
), /* @__PURE__ */ React11.createElement(
|
947
|
-
Text,
|
948
|
-
{
|
949
|
-
variant: {
|
950
|
-
"@sm": "xs"
|
951
|
-
},
|
952
|
-
css: {
|
953
|
-
c: isVideoLive ? "$on_surface_high" : "$on_surface_medium"
|
954
|
-
}
|
955
|
-
},
|
956
|
-
isVideoLive ? "LIVE" : "GO LIVE"
|
957
|
-
)))
|
958
|
-
)),
|
959
|
-
/* @__PURE__ */ React11.createElement(HMSVideoPlayer.Controls.Right, null, hasCaptions && /* @__PURE__ */ React11.createElement(HLSCaptionSelector, { onClick: () => hlsPlayer == null ? void 0 : hlsPlayer.toggleCaption(), isEnabled: isCaptionEnabled }), availableLayers.length > 0 ? /* @__PURE__ */ React11.createElement(
|
960
|
-
HLSQualitySelector,
|
961
|
-
{
|
962
|
-
layers: availableLayers,
|
963
|
-
onOpen: setQualityDropDownOpen,
|
964
|
-
open: qualityDropDownOpen,
|
965
|
-
selection: currentSelectedQuality,
|
966
|
-
onQualityChange: handleQuality,
|
967
|
-
isAuto: isUserSelectedAuto
|
968
|
-
}
|
969
|
-
) : null, isFullScreenSupported ? /* @__PURE__ */ React11.createElement(
|
970
|
-
FullScreenButton,
|
971
|
-
{
|
972
|
-
isFullScreen,
|
973
|
-
onToggle: toggle,
|
974
|
-
icon: isFullScreen ? /* @__PURE__ */ React11.createElement(ShrinkIcon, null) : /* @__PURE__ */ React11.createElement(ExpandIcon, null)
|
975
|
-
}
|
976
|
-
) : null)
|
977
|
-
)
|
978
|
-
)
|
979
|
-
)
|
980
|
-
) : /* @__PURE__ */ React11.createElement(Flex, { align: "center", justify: "center", direction: "column", css: { size: "100%", px: "$10" } }, /* @__PURE__ */ React11.createElement(Flex, { css: { c: "$on_surface_high", r: "$round", bg: "$surface_default", p: "$2" } }, streamEnded ? /* @__PURE__ */ React11.createElement(ColoredHandIcon, { height: 56, width: 56 }) : /* @__PURE__ */ React11.createElement(GoLiveIcon, { height: 56, width: 56 })), /* @__PURE__ */ React11.createElement(Text, { variant: "h5", css: { c: "$on_surface_high", mt: "$10", mb: 0, textAlign: "center" } }, streamEnded ? "Stream has ended" : "Stream yet to start"), /* @__PURE__ */ React11.createElement(Text, { variant: "md", css: { textAlign: "center", mt: "$4", c: "$on_surface_medium" } }, streamEnded ? "Have a nice day!" : "Sit back and relax"))
|
981
|
-
);
|
982
|
-
};
|
983
|
-
var HLSView_default = HLSView;
|
984
|
-
export {
|
985
|
-
HLSView_default as default
|
986
|
-
};
|
987
|
-
//# sourceMappingURL=HLSView-SJCF34GE.js.map
|