@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260704091052 → 0.8.1-dev.20260706114046
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CopyButton-UPJPMJUB.mjs +57 -0
- package/dist/DateTimeViewClient-R3M6ISVK.mjs +16 -0
- package/dist/DateViewClient-VLTRN47D.mjs +9 -0
- package/dist/{chunk-SDNYBQSI.mjs → HlsPlayer-57543DTW.mjs} +3 -2
- package/dist/HlsPlayer-5AWFZ2P6.mjs +601 -0
- package/dist/IframeClient-RGJFZ5P2.mjs +98 -0
- package/dist/InputControlClient-NJV6B65M.mjs +604 -0
- package/dist/InputControlClient-OQDLYA4S.mjs +604 -0
- package/dist/InputControlClient-TW664WIJ.mjs +602 -0
- package/dist/{LinkNodeButton-WDDPNYWI.mjs → LinkNodeButton-FUL3J5HR.mjs} +6 -5
- package/dist/LinkNodeButton-IGJOGOKI.mjs +362 -0
- package/dist/LinkNodeButton-ZONM74OO.mjs +174 -0
- package/dist/Pagination-6OFACRMQ.mjs +229 -0
- package/dist/Pagination-FSYLYKUA.mjs +181 -0
- package/dist/Pagination-YCD5CU2L.mjs +183 -0
- package/dist/Slider-554BKC7N.mjs +322 -0
- package/dist/Slider-PEIVH6A5.mjs +320 -0
- package/dist/chunk-2GSYECIS.mjs +109 -0
- package/dist/chunk-3GWLDT7C.mjs +204 -0
- package/dist/chunk-3R4VVVNK.mjs +903 -0
- package/dist/chunk-47HD7QP7.mjs +199 -0
- package/dist/chunk-56HSDML5.mjs +22 -0
- package/dist/chunk-67IG5NBU.mjs +200 -0
- package/dist/chunk-7ZFZLN56.mjs +903 -0
- package/dist/chunk-CM7LUGCH.mjs +107 -0
- package/dist/chunk-IKIXEQPV.mjs +198 -0
- package/dist/chunk-IMNQO57B.mjs +25 -0
- package/dist/chunk-R2HV35IB.mjs +201 -0
- package/dist/chunk-SPRVN5IM.mjs +118 -0
- package/dist/chunk-TVL6KVD5.mjs +229 -0
- package/dist/chunk-WEV5U33G.mjs +207 -0
- package/dist/chunk-YG6FKKQJ.mjs +900 -0
- package/dist/index.d.mts +56 -169
- package/dist/index.d.ts +56 -169
- package/dist/index.js +3940 -3807
- package/dist/index.mjs +591 -2923
- package/dist/server.d.mts +72 -0
- package/dist/server.d.ts +72 -0
- package/dist/server.js +5126 -0
- package/dist/server.mjs +2698 -0
- package/package.json +18 -4
- package/dist/HlsPlayer-DZNDKG2P.mjs +0 -7
- package/dist/chunk-DOKQUUH3.mjs +0 -414
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
|
|
5
|
+
// src/components/HlsPlayer.tsx
|
|
6
|
+
import React, { useRef, useEffect, useState, useCallback } from "react";
|
|
7
|
+
import Hls from "hls.js";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var pickSource = (sources) => {
|
|
10
|
+
for (const { src, media } of sources) {
|
|
11
|
+
if (media && window.matchMedia(media).matches) return src;
|
|
12
|
+
}
|
|
13
|
+
return sources.find((s) => !s.media)?.src ?? sources[0]?.src ?? "";
|
|
14
|
+
};
|
|
15
|
+
var requestFullscreen = (el) => {
|
|
16
|
+
if (el.requestFullscreen) return el.requestFullscreen();
|
|
17
|
+
const anyEl = el;
|
|
18
|
+
if (anyEl.webkitRequestFullscreen) return anyEl.webkitRequestFullscreen();
|
|
19
|
+
if (anyEl.mozRequestFullScreen) return anyEl.mozRequestFullScreen();
|
|
20
|
+
return Promise.resolve();
|
|
21
|
+
};
|
|
22
|
+
var exitFullscreen = () => {
|
|
23
|
+
if (document.exitFullscreen) return document.exitFullscreen();
|
|
24
|
+
const anyDoc = document;
|
|
25
|
+
if (anyDoc.webkitExitFullscreen) return anyDoc.webkitExitFullscreen();
|
|
26
|
+
if (anyDoc.mozCancelFullScreen) return anyDoc.mozCancelFullScreen();
|
|
27
|
+
return Promise.resolve();
|
|
28
|
+
};
|
|
29
|
+
var getFullscreenElement = () => (
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
+
document.fullscreenElement ?? document.webkitFullscreenElement ?? null
|
|
32
|
+
);
|
|
33
|
+
var HlsPlayer = React.memo(
|
|
34
|
+
({
|
|
35
|
+
sources,
|
|
36
|
+
assetUrl,
|
|
37
|
+
posterUrl,
|
|
38
|
+
intrinsicWidth,
|
|
39
|
+
intrinsicHeight,
|
|
40
|
+
showControls = true,
|
|
41
|
+
loop = false,
|
|
42
|
+
playOptions = "autoplay",
|
|
43
|
+
placementCode = "",
|
|
44
|
+
styles
|
|
45
|
+
}) => {
|
|
46
|
+
const containerRef = useRef(null);
|
|
47
|
+
const videoRef = useRef(null);
|
|
48
|
+
const hlsRef = useRef(null);
|
|
49
|
+
const isPlayOnHover = playOptions === "playOnHover";
|
|
50
|
+
const startsMuted = playOptions === "autoplay" || isPlayOnHover;
|
|
51
|
+
const [isPlaying, setIsPlaying] = useState(playOptions === "autoplay");
|
|
52
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
53
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
54
|
+
const [isControlsVisible, setIsControlsVisible] = useState(true);
|
|
55
|
+
const [isPosterVisible, setIsPosterVisible] = useState(true);
|
|
56
|
+
const [isMuted, setIsMuted] = useState(startsMuted);
|
|
57
|
+
const [isFullscreen, setIsFullscreen] = useState(false);
|
|
58
|
+
const [isBuffering, setIsBuffering] = useState(false);
|
|
59
|
+
const wasManuallyPausedRef = useRef(false);
|
|
60
|
+
const inactivityTimerRef = useRef(null);
|
|
61
|
+
const clickTimerRef = useRef(null);
|
|
62
|
+
const hlsInitializedRef = useRef(false);
|
|
63
|
+
const [isInView, setIsInView] = useState(false);
|
|
64
|
+
const INACTIVITY_DELAY = 2500;
|
|
65
|
+
const CLICK_DEBOUNCE = 220;
|
|
66
|
+
const resolvedSources = sources && sources.length > 0 ? sources : assetUrl ? [{ src: assetUrl, posterUrl }] : [];
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const checkMobile = () => {
|
|
69
|
+
const hasTouch = "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
70
|
+
const isSmallScreen = window.innerWidth <= 768;
|
|
71
|
+
const isMobileUA = /android|iphone|ipad|ipod/i.test(
|
|
72
|
+
navigator.userAgent.toLowerCase()
|
|
73
|
+
);
|
|
74
|
+
setIsMobile(hasTouch || isSmallScreen || isMobileUA);
|
|
75
|
+
};
|
|
76
|
+
checkMobile();
|
|
77
|
+
window.addEventListener("resize", checkMobile);
|
|
78
|
+
return () => window.removeEventListener("resize", checkMobile);
|
|
79
|
+
}, []);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
const container = containerRef.current;
|
|
82
|
+
if (!container || typeof IntersectionObserver === "undefined") {
|
|
83
|
+
setIsInView(true);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const observer = new IntersectionObserver(
|
|
87
|
+
([entry]) => {
|
|
88
|
+
if (entry.isIntersecting) {
|
|
89
|
+
setIsInView(true);
|
|
90
|
+
observer.disconnect();
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{ threshold: 0.25 }
|
|
94
|
+
// 25% of the player must be visible to trigger
|
|
95
|
+
);
|
|
96
|
+
observer.observe(container);
|
|
97
|
+
return () => observer.disconnect();
|
|
98
|
+
}, []);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
const onFullscreenChange = () => {
|
|
101
|
+
setIsFullscreen(getFullscreenElement() === containerRef.current);
|
|
102
|
+
};
|
|
103
|
+
document.addEventListener("fullscreenchange", onFullscreenChange);
|
|
104
|
+
document.addEventListener("webkitfullscreenchange", onFullscreenChange);
|
|
105
|
+
return () => {
|
|
106
|
+
document.removeEventListener("fullscreenchange", onFullscreenChange);
|
|
107
|
+
document.removeEventListener("webkitfullscreenchange", onFullscreenChange);
|
|
108
|
+
};
|
|
109
|
+
}, []);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (isPlaying) {
|
|
112
|
+
setIsPosterVisible(false);
|
|
113
|
+
} else {
|
|
114
|
+
const v = videoRef.current;
|
|
115
|
+
if (!v || v.currentTime === 0) setIsPosterVisible(true);
|
|
116
|
+
}
|
|
117
|
+
}, [isPlaying]);
|
|
118
|
+
const resetInactivityTimer = useCallback(() => {
|
|
119
|
+
setIsControlsVisible(true);
|
|
120
|
+
if (inactivityTimerRef.current) clearTimeout(inactivityTimerRef.current);
|
|
121
|
+
if (isPlaying) {
|
|
122
|
+
inactivityTimerRef.current = setTimeout(
|
|
123
|
+
() => setIsControlsVisible(false),
|
|
124
|
+
INACTIVITY_DELAY
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
}, [isPlaying]);
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (!isPlaying) {
|
|
130
|
+
if (inactivityTimerRef.current) clearTimeout(inactivityTimerRef.current);
|
|
131
|
+
setIsControlsVisible(true);
|
|
132
|
+
}
|
|
133
|
+
}, [isPlaying]);
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
return () => {
|
|
136
|
+
if (inactivityTimerRef.current) clearTimeout(inactivityTimerRef.current);
|
|
137
|
+
if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
|
|
138
|
+
};
|
|
139
|
+
}, []);
|
|
140
|
+
const initHls = useCallback((autoPlayAfterLoad) => {
|
|
141
|
+
const v = videoRef.current;
|
|
142
|
+
if (!v || resolvedSources.length === 0) return;
|
|
143
|
+
if (hlsRef.current) {
|
|
144
|
+
hlsRef.current.destroy();
|
|
145
|
+
hlsRef.current = null;
|
|
146
|
+
}
|
|
147
|
+
const chosenSrc = pickSource(resolvedSources);
|
|
148
|
+
if (!chosenSrc) return;
|
|
149
|
+
hlsInitializedRef.current = true;
|
|
150
|
+
if (Hls.isSupported()) {
|
|
151
|
+
const hlsConfig = isPlayOnHover ? {
|
|
152
|
+
// For hover-play: only buffer enough to start playing smoothly.
|
|
153
|
+
// maxBufferLength – target seconds of forward buffer (default 30s → 10s)
|
|
154
|
+
// maxMaxBufferLength – hard ceiling hls.js won't exceed (default 600s → 15s)
|
|
155
|
+
// maxBufferSize – byte ceiling before hls.js pauses loading (default 60MB → 10MB)
|
|
156
|
+
// lowLatencyMode – off; we don't need ultra-low latency for on-demand hover clips
|
|
157
|
+
maxBufferLength: 10,
|
|
158
|
+
maxMaxBufferLength: 15,
|
|
159
|
+
maxBufferSize: 10 * 1e3 * 1e3,
|
|
160
|
+
// 10 MB
|
|
161
|
+
lowLatencyMode: false
|
|
162
|
+
} : {};
|
|
163
|
+
const hls = new Hls(hlsConfig);
|
|
164
|
+
hls.loadSource(chosenSrc);
|
|
165
|
+
hls.attachMedia(v);
|
|
166
|
+
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
|
167
|
+
if (autoPlayAfterLoad && !wasManuallyPausedRef.current) {
|
|
168
|
+
v.play().catch(console.error).then(() => setIsPlaying(true));
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
v.addEventListener("playing", () => setIsBuffering(false), { once: true });
|
|
172
|
+
v.addEventListener("error", () => setIsBuffering(false), { once: true });
|
|
173
|
+
hlsRef.current = hls;
|
|
174
|
+
} else if (v.canPlayType("application/vnd.apple.mpegurl")) {
|
|
175
|
+
v.src = chosenSrc;
|
|
176
|
+
v.load();
|
|
177
|
+
v.addEventListener("playing", () => setIsBuffering(false), { once: true });
|
|
178
|
+
v.addEventListener("error", () => setIsBuffering(false), { once: true });
|
|
179
|
+
if (autoPlayAfterLoad) {
|
|
180
|
+
v.play().catch(console.error).then(() => setIsPlaying(true));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}, [JSON.stringify(resolvedSources)]);
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
if (!isInView) return;
|
|
186
|
+
if (isPlayOnHover) return;
|
|
187
|
+
if (playOptions !== "autoplay") return;
|
|
188
|
+
initHls(
|
|
189
|
+
/* autoPlayAfterLoad */
|
|
190
|
+
true
|
|
191
|
+
);
|
|
192
|
+
return () => {
|
|
193
|
+
if (hlsRef.current) {
|
|
194
|
+
hlsRef.current.destroy();
|
|
195
|
+
hlsRef.current = null;
|
|
196
|
+
}
|
|
197
|
+
hlsInitializedRef.current = false;
|
|
198
|
+
};
|
|
199
|
+
}, [JSON.stringify(resolvedSources), isPlayOnHover, isInView, playOptions]);
|
|
200
|
+
const handlePlayPause = useCallback(() => {
|
|
201
|
+
const v = videoRef.current;
|
|
202
|
+
if (!v) return;
|
|
203
|
+
if (!hlsInitializedRef.current) {
|
|
204
|
+
setIsBuffering(true);
|
|
205
|
+
initHls(
|
|
206
|
+
/* autoPlayAfterLoad */
|
|
207
|
+
true
|
|
208
|
+
);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (v.paused) {
|
|
212
|
+
wasManuallyPausedRef.current = false;
|
|
213
|
+
v.play().then(() => setIsPlaying(true));
|
|
214
|
+
} else {
|
|
215
|
+
wasManuallyPausedRef.current = true;
|
|
216
|
+
v.pause();
|
|
217
|
+
setIsPlaying(false);
|
|
218
|
+
}
|
|
219
|
+
}, [initHls]);
|
|
220
|
+
const handleMuteToggle = useCallback(() => {
|
|
221
|
+
const v = videoRef.current;
|
|
222
|
+
if (!v) return;
|
|
223
|
+
v.muted = !v.muted;
|
|
224
|
+
setIsMuted(v.muted);
|
|
225
|
+
}, []);
|
|
226
|
+
const handleFullscreenToggle = useCallback(() => {
|
|
227
|
+
const container = containerRef.current;
|
|
228
|
+
if (!container) return;
|
|
229
|
+
if (getFullscreenElement() === container) {
|
|
230
|
+
exitFullscreen().catch(console.error);
|
|
231
|
+
} else {
|
|
232
|
+
requestFullscreen(container).catch(console.error);
|
|
233
|
+
}
|
|
234
|
+
}, []);
|
|
235
|
+
const handleVideoClick = useCallback(() => {
|
|
236
|
+
if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
|
|
237
|
+
clickTimerRef.current = setTimeout(() => {
|
|
238
|
+
handlePlayPause();
|
|
239
|
+
}, CLICK_DEBOUNCE);
|
|
240
|
+
}, [handlePlayPause]);
|
|
241
|
+
const handleVideoDoubleClick = useCallback(() => {
|
|
242
|
+
if (clickTimerRef.current) {
|
|
243
|
+
clearTimeout(clickTimerRef.current);
|
|
244
|
+
clickTimerRef.current = null;
|
|
245
|
+
}
|
|
246
|
+
handleFullscreenToggle();
|
|
247
|
+
}, [handleFullscreenToggle]);
|
|
248
|
+
const handleMouseEnter = useCallback(() => {
|
|
249
|
+
if (isMobile) return;
|
|
250
|
+
setIsHovered(true);
|
|
251
|
+
resetInactivityTimer();
|
|
252
|
+
if (isPlayOnHover && !wasManuallyPausedRef.current) {
|
|
253
|
+
if (!hlsInitializedRef.current) {
|
|
254
|
+
initHls(
|
|
255
|
+
/* autoPlayAfterLoad */
|
|
256
|
+
true
|
|
257
|
+
);
|
|
258
|
+
} else if (videoRef.current) {
|
|
259
|
+
videoRef.current.play().then(() => setIsPlaying(true)).catch(console.error);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}, [isPlayOnHover, isMobile, resetInactivityTimer, initHls]);
|
|
263
|
+
const handleMouseLeave = useCallback(() => {
|
|
264
|
+
if (isMobile) return;
|
|
265
|
+
setIsHovered(false);
|
|
266
|
+
if (inactivityTimerRef.current) clearTimeout(inactivityTimerRef.current);
|
|
267
|
+
if (isPlaying) setIsControlsVisible(false);
|
|
268
|
+
if (isPlayOnHover && videoRef.current) {
|
|
269
|
+
videoRef.current.pause();
|
|
270
|
+
videoRef.current.currentTime = 0;
|
|
271
|
+
setIsPlaying(false);
|
|
272
|
+
if (hlsRef.current) {
|
|
273
|
+
hlsRef.current.destroy();
|
|
274
|
+
hlsRef.current = null;
|
|
275
|
+
hlsInitializedRef.current = false;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}, [isPlayOnHover, isMobile, isPlaying]);
|
|
279
|
+
const handleMouseMove = useCallback(() => {
|
|
280
|
+
if (isMobile) return;
|
|
281
|
+
resetInactivityTimer();
|
|
282
|
+
}, [isMobile, resetInactivityTimer]);
|
|
283
|
+
const posterSources = resolvedSources.filter((s) => s.media && s.posterUrl);
|
|
284
|
+
const fallbackPoster = posterUrl ?? resolvedSources.find((s) => !s.media)?.posterUrl ?? resolvedSources[0]?.posterUrl;
|
|
285
|
+
const playBtnSize = "clamp(44px, 8vmin, 80px)";
|
|
286
|
+
const iconBtnSize = "clamp(28px, 4.5vmin, 40px)";
|
|
287
|
+
const iconSvgSize = "clamp(14px, 2.5vmin, 20px)";
|
|
288
|
+
const playIconSize = "clamp(24px, 4.5vmin, 44px)";
|
|
289
|
+
const iconButtonStyle = {
|
|
290
|
+
pointerEvents: isControlsVisible ? "auto" : "none",
|
|
291
|
+
width: iconBtnSize,
|
|
292
|
+
height: iconBtnSize,
|
|
293
|
+
borderRadius: "50%",
|
|
294
|
+
border: "1.5px solid rgba(255,255,255,0.18)",
|
|
295
|
+
cursor: "pointer",
|
|
296
|
+
display: "flex",
|
|
297
|
+
alignItems: "center",
|
|
298
|
+
justifyContent: "center",
|
|
299
|
+
background: "rgba(0, 0, 0, 0.45)",
|
|
300
|
+
backdropFilter: "blur(10px)",
|
|
301
|
+
WebkitBackdropFilter: "blur(10px)",
|
|
302
|
+
boxShadow: "0 4px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1)",
|
|
303
|
+
transition: "transform 0.18s ease",
|
|
304
|
+
flexShrink: 0
|
|
305
|
+
};
|
|
306
|
+
if (resolvedSources.length === 0) return null;
|
|
307
|
+
const showMuteButton = !showControls && !isPlayOnHover;
|
|
308
|
+
const showExpandButton = !showControls && !isPlayOnHover;
|
|
309
|
+
return /* @__PURE__ */ jsxs(
|
|
310
|
+
"div",
|
|
311
|
+
{
|
|
312
|
+
ref: containerRef,
|
|
313
|
+
className: "relative w-full overflow-hidden aspect-video bg-black",
|
|
314
|
+
style: styles,
|
|
315
|
+
onMouseEnter: handleMouseEnter,
|
|
316
|
+
onMouseLeave: handleMouseLeave,
|
|
317
|
+
onMouseMove: handleMouseMove,
|
|
318
|
+
children: [
|
|
319
|
+
/* @__PURE__ */ jsx(
|
|
320
|
+
"video",
|
|
321
|
+
{
|
|
322
|
+
ref: videoRef,
|
|
323
|
+
className: "w-full h-full object-cover",
|
|
324
|
+
poster: fallbackPoster,
|
|
325
|
+
controls: showControls && (isMobile || isPlaying),
|
|
326
|
+
muted: startsMuted,
|
|
327
|
+
autoPlay: playOptions === "autoplay",
|
|
328
|
+
loop,
|
|
329
|
+
playsInline: true,
|
|
330
|
+
preload: playOptions === "autoplay" ? "auto" : "none",
|
|
331
|
+
onClick: handleVideoClick,
|
|
332
|
+
onDoubleClick: handleVideoDoubleClick,
|
|
333
|
+
children: playOptions === "autoplay" && resolvedSources.map(({ src, media }, i) => /* @__PURE__ */ jsx(
|
|
334
|
+
"source",
|
|
335
|
+
{
|
|
336
|
+
src,
|
|
337
|
+
type: "application/x-mpegURL",
|
|
338
|
+
...media ? { media } : {}
|
|
339
|
+
},
|
|
340
|
+
i
|
|
341
|
+
))
|
|
342
|
+
}
|
|
343
|
+
),
|
|
344
|
+
fallbackPoster && /* @__PURE__ */ jsxs(
|
|
345
|
+
"picture",
|
|
346
|
+
{
|
|
347
|
+
className: "absolute inset-0 pointer-events-none",
|
|
348
|
+
style: {
|
|
349
|
+
opacity: isPosterVisible && (!isPlayOnHover || !isHovered) ? 1 : 0,
|
|
350
|
+
transition: "opacity 0.4s ease"
|
|
351
|
+
},
|
|
352
|
+
children: [
|
|
353
|
+
posterSources.map(({ media, posterUrl: src }, i) => /* @__PURE__ */ jsx("source", { media, srcSet: src }, i)),
|
|
354
|
+
/* @__PURE__ */ jsx(
|
|
355
|
+
"img",
|
|
356
|
+
{
|
|
357
|
+
src: fallbackPoster,
|
|
358
|
+
width: intrinsicWidth,
|
|
359
|
+
height: intrinsicHeight,
|
|
360
|
+
alt: "poster",
|
|
361
|
+
className: "w-full h-full object-cover",
|
|
362
|
+
style: { pointerEvents: "none" }
|
|
363
|
+
}
|
|
364
|
+
)
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
),
|
|
368
|
+
/* @__PURE__ */ jsx("style", { children: `
|
|
369
|
+
.hls-play-btn {
|
|
370
|
+
will-change: transform;
|
|
371
|
+
transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
372
|
+
}
|
|
373
|
+
.hls-play-btn:hover {
|
|
374
|
+
transform: scale(1.08);
|
|
375
|
+
}
|
|
376
|
+
` }),
|
|
377
|
+
isBuffering && /* @__PURE__ */ jsxs(
|
|
378
|
+
"div",
|
|
379
|
+
{
|
|
380
|
+
className: "absolute inset-0 flex items-center justify-center pointer-events-none",
|
|
381
|
+
style: { zIndex: 10 },
|
|
382
|
+
children: [
|
|
383
|
+
/* @__PURE__ */ jsx("style", { children: `
|
|
384
|
+
@keyframes hls-spin {
|
|
385
|
+
to { transform: rotate(360deg); }
|
|
386
|
+
}
|
|
387
|
+
.hls-spinner {
|
|
388
|
+
animation: hls-spin 1s linear infinite;
|
|
389
|
+
filter: drop-shadow(0 0 6px rgba(243, 31, 73, 0.7))
|
|
390
|
+
drop-shadow(0 0 12px rgba(143, 38, 237, 0.5));
|
|
391
|
+
}
|
|
392
|
+
` }),
|
|
393
|
+
/* @__PURE__ */ jsxs(
|
|
394
|
+
"svg",
|
|
395
|
+
{
|
|
396
|
+
className: "hls-spinner",
|
|
397
|
+
width: "clamp(44px, 8vmin, 72px)",
|
|
398
|
+
height: "clamp(44px, 8vmin, 72px)",
|
|
399
|
+
viewBox: "0 0 72 72",
|
|
400
|
+
fill: "none",
|
|
401
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
402
|
+
children: [
|
|
403
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "hls-arc-grad", x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
404
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "rgba(243,31,73,0)" }),
|
|
405
|
+
/* @__PURE__ */ jsx("stop", { offset: "40%", stopColor: "rgba(243,31,73,1)" }),
|
|
406
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "rgba(143,38,237,1)" })
|
|
407
|
+
] }) }),
|
|
408
|
+
Array.from({ length: 18 }).map((_, i) => {
|
|
409
|
+
const angle = i / 18 * 360;
|
|
410
|
+
const opacity = 0.15 + i / 17 * 0.85;
|
|
411
|
+
const rad = (angle - 90) * (Math.PI / 180);
|
|
412
|
+
const r = 30;
|
|
413
|
+
const cx = 36 + r * Math.cos(rad);
|
|
414
|
+
const cy = 36 + r * Math.sin(rad);
|
|
415
|
+
const t = i / 17;
|
|
416
|
+
const r1 = Math.round(243 * (1 - t) + 143 * t);
|
|
417
|
+
const g1 = Math.round(31 * (1 - t) + 38 * t);
|
|
418
|
+
const b1 = Math.round(73 * (1 - t) + 237 * t);
|
|
419
|
+
return /* @__PURE__ */ jsx(
|
|
420
|
+
"rect",
|
|
421
|
+
{
|
|
422
|
+
x: cx - 2.2,
|
|
423
|
+
y: cy - 5.5,
|
|
424
|
+
width: 4.4,
|
|
425
|
+
height: 11,
|
|
426
|
+
rx: 2.2,
|
|
427
|
+
fill: `rgba(${r1},${g1},${b1},${opacity})`,
|
|
428
|
+
transform: `rotate(${angle}, ${cx}, ${cy})`
|
|
429
|
+
},
|
|
430
|
+
i
|
|
431
|
+
);
|
|
432
|
+
})
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
)
|
|
436
|
+
]
|
|
437
|
+
}
|
|
438
|
+
),
|
|
439
|
+
!isPlayOnHover && !isBuffering && /* @__PURE__ */ jsx(
|
|
440
|
+
"div",
|
|
441
|
+
{
|
|
442
|
+
className: "absolute inset-0 flex items-center justify-center pointer-events-none",
|
|
443
|
+
style: {
|
|
444
|
+
opacity: isControlsVisible ? 1 : 0,
|
|
445
|
+
transition: "opacity 0.3s ease"
|
|
446
|
+
},
|
|
447
|
+
children: /* @__PURE__ */ jsxs(
|
|
448
|
+
"button",
|
|
449
|
+
{
|
|
450
|
+
type: "button",
|
|
451
|
+
"aria-label": isPlaying ? "Pause" : "Play",
|
|
452
|
+
className: "hls-play-btn",
|
|
453
|
+
onClick: (e) => {
|
|
454
|
+
e.stopPropagation();
|
|
455
|
+
handlePlayPause();
|
|
456
|
+
},
|
|
457
|
+
style: {
|
|
458
|
+
pointerEvents: isControlsVisible ? "auto" : "none",
|
|
459
|
+
width: playBtnSize,
|
|
460
|
+
height: playBtnSize,
|
|
461
|
+
borderRadius: "50%",
|
|
462
|
+
border: "none",
|
|
463
|
+
cursor: "pointer",
|
|
464
|
+
display: "flex",
|
|
465
|
+
alignItems: "center",
|
|
466
|
+
justifyContent: "center",
|
|
467
|
+
background: "linear-gradient(50deg, rgba(243, 31, 73, 1) 0%, rgba(143, 38, 237, 1) 100%)",
|
|
468
|
+
flexShrink: 0,
|
|
469
|
+
position: "relative",
|
|
470
|
+
overflow: "hidden"
|
|
471
|
+
},
|
|
472
|
+
children: [
|
|
473
|
+
/* @__PURE__ */ jsx(
|
|
474
|
+
"div",
|
|
475
|
+
{
|
|
476
|
+
style: {
|
|
477
|
+
position: "absolute",
|
|
478
|
+
inset: 0,
|
|
479
|
+
borderRadius: "50%",
|
|
480
|
+
background: "radial-gradient(ellipse 70% 55% at 30% 25%, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.08) 55%, transparent 75%)",
|
|
481
|
+
pointerEvents: "none"
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
),
|
|
485
|
+
/* @__PURE__ */ jsx(
|
|
486
|
+
"div",
|
|
487
|
+
{
|
|
488
|
+
style: {
|
|
489
|
+
position: "absolute",
|
|
490
|
+
inset: 0,
|
|
491
|
+
borderRadius: "50%",
|
|
492
|
+
background: "radial-gradient(ellipse 50% 40% at 72% 75%, rgba(255,255,255,0.18) 0%, transparent 70%)",
|
|
493
|
+
pointerEvents: "none"
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
),
|
|
497
|
+
isPlaying ? (
|
|
498
|
+
/* Pause — two rounded bars, sized to match play icon proportions */
|
|
499
|
+
/* @__PURE__ */ jsxs(
|
|
500
|
+
"svg",
|
|
501
|
+
{
|
|
502
|
+
width: playIconSize,
|
|
503
|
+
height: playIconSize,
|
|
504
|
+
viewBox: "0 0 20 20",
|
|
505
|
+
fill: "none",
|
|
506
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
507
|
+
children: [
|
|
508
|
+
/* @__PURE__ */ jsx("rect", { x: "3.5", y: "2.5", width: "4.5", height: "15", rx: "1.5", fill: "white" }),
|
|
509
|
+
/* @__PURE__ */ jsx("rect", { x: "12", y: "2.5", width: "4.5", height: "15", rx: "1.5", fill: "white" })
|
|
510
|
+
]
|
|
511
|
+
}
|
|
512
|
+
)
|
|
513
|
+
) : (
|
|
514
|
+
/*
|
|
515
|
+
* Play — rounded-corner triangle from the provided SVG path.
|
|
516
|
+
* Original viewBox is "0,0,240,250" (with a 5.33x scale group inside).
|
|
517
|
+
* We flatten the transform: effective drawing area is 240×250 units.
|
|
518
|
+
*/
|
|
519
|
+
/* @__PURE__ */ jsx(
|
|
520
|
+
"svg",
|
|
521
|
+
{
|
|
522
|
+
width: playIconSize,
|
|
523
|
+
height: playIconSize,
|
|
524
|
+
viewBox: "0 0 240 250",
|
|
525
|
+
fill: "none",
|
|
526
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
527
|
+
style: { transform: "translateX(4%)" },
|
|
528
|
+
children: /* @__PURE__ */ jsx(
|
|
529
|
+
"path",
|
|
530
|
+
{
|
|
531
|
+
d: "M60.78 21.93C48.57 22.41 37.33 32.78 37.33 45.87v164.26c0 17.92 19.96 29.67 35.64 20.99l148.31-82.17c16.12-8.93 16.12-33.04 0-41.97L72.97 24.81c-3.92-2.17-8.11-3.07-12.19-2.88z",
|
|
532
|
+
fill: "white"
|
|
533
|
+
}
|
|
534
|
+
)
|
|
535
|
+
}
|
|
536
|
+
)
|
|
537
|
+
)
|
|
538
|
+
]
|
|
539
|
+
}
|
|
540
|
+
)
|
|
541
|
+
}
|
|
542
|
+
),
|
|
543
|
+
/* @__PURE__ */ jsxs(
|
|
544
|
+
"div",
|
|
545
|
+
{
|
|
546
|
+
className: "absolute bottom-4 right-4 pointer-events-none",
|
|
547
|
+
style: {
|
|
548
|
+
display: "flex",
|
|
549
|
+
alignItems: "center",
|
|
550
|
+
gap: 8,
|
|
551
|
+
opacity: isControlsVisible ? 1 : 0,
|
|
552
|
+
transition: "opacity 0.3s ease"
|
|
553
|
+
},
|
|
554
|
+
children: [
|
|
555
|
+
showMuteButton && /* @__PURE__ */ jsx(
|
|
556
|
+
"button",
|
|
557
|
+
{
|
|
558
|
+
type: "button",
|
|
559
|
+
"aria-label": isMuted ? "Unmute" : "Mute",
|
|
560
|
+
onClick: (e) => {
|
|
561
|
+
e.stopPropagation();
|
|
562
|
+
handleMuteToggle();
|
|
563
|
+
},
|
|
564
|
+
style: iconButtonStyle,
|
|
565
|
+
children: isMuted ? /* @__PURE__ */ jsxs("svg", { width: iconSvgSize, height: iconSvgSize, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
566
|
+
/* @__PURE__ */ jsx("path", { d: "M11 5L6 9H2v6h4l5 4V5Z", fill: "white" }),
|
|
567
|
+
/* @__PURE__ */ jsx("line", { x1: "23", y1: "9", x2: "17", y2: "15", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }),
|
|
568
|
+
/* @__PURE__ */ jsx("line", { x1: "17", y1: "9", x2: "23", y2: "15", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
|
|
569
|
+
] }) : /* @__PURE__ */ jsxs("svg", { width: iconSvgSize, height: iconSvgSize, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
570
|
+
/* @__PURE__ */ jsx("path", { d: "M11 5L6 9H2v6h4l5 4V5Z", fill: "white" }),
|
|
571
|
+
/* @__PURE__ */ jsx("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }),
|
|
572
|
+
/* @__PURE__ */ jsx("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
|
|
573
|
+
] })
|
|
574
|
+
}
|
|
575
|
+
),
|
|
576
|
+
showExpandButton && /* @__PURE__ */ jsx(
|
|
577
|
+
"button",
|
|
578
|
+
{
|
|
579
|
+
type: "button",
|
|
580
|
+
"aria-label": isFullscreen ? "Exit fullscreen" : "Enter fullscreen",
|
|
581
|
+
onClick: (e) => {
|
|
582
|
+
e.stopPropagation();
|
|
583
|
+
handleFullscreenToggle();
|
|
584
|
+
},
|
|
585
|
+
style: iconButtonStyle,
|
|
586
|
+
children: isFullscreen ? /* @__PURE__ */ jsx("svg", { width: iconSvgSize, height: iconSvgSize, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M8 3v5H3M21 8h-5V3M3 16h5v5M16 21v-5h5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ jsx("svg", { width: iconSvgSize, height: iconSvgSize, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M3 8V3h5M16 3h5v5M21 16v5h-5M8 21H3v-5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
587
|
+
}
|
|
588
|
+
)
|
|
589
|
+
]
|
|
590
|
+
}
|
|
591
|
+
)
|
|
592
|
+
]
|
|
593
|
+
}
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
);
|
|
597
|
+
HlsPlayer.displayName = "HlsPlayer";
|
|
598
|
+
var HlsPlayer_default = HlsPlayer;
|
|
599
|
+
export {
|
|
600
|
+
HlsPlayer_default as default
|
|
601
|
+
};
|