@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260521115630 → 0.8.1-dev.20260521120239
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.
|
@@ -53,6 +53,7 @@ var HlsPlayer = React.memo(
|
|
|
53
53
|
const wasManuallyPausedRef = useRef(false);
|
|
54
54
|
const inactivityTimerRef = useRef(null);
|
|
55
55
|
const clickTimerRef = useRef(null);
|
|
56
|
+
const hlsInitializedRef = useRef(false);
|
|
56
57
|
const INACTIVITY_DELAY = 2500;
|
|
57
58
|
const CLICK_DEBOUNCE = 220;
|
|
58
59
|
const resolvedSources = sources && sources.length > 0 ? sources : assetUrl ? [{ src: assetUrl, posterUrl }] : [];
|
|
@@ -110,7 +111,7 @@ var HlsPlayer = React.memo(
|
|
|
110
111
|
if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
|
|
111
112
|
};
|
|
112
113
|
}, []);
|
|
113
|
-
|
|
114
|
+
const initHls = useCallback((autoPlayAfterLoad) => {
|
|
114
115
|
const v = videoRef.current;
|
|
115
116
|
if (!v || resolvedSources.length === 0) return;
|
|
116
117
|
if (hlsRef.current) {
|
|
@@ -119,25 +120,39 @@ var HlsPlayer = React.memo(
|
|
|
119
120
|
}
|
|
120
121
|
const chosenSrc = pickSource(resolvedSources);
|
|
121
122
|
if (!chosenSrc) return;
|
|
123
|
+
hlsInitializedRef.current = true;
|
|
122
124
|
if (Hls.isSupported()) {
|
|
123
125
|
const hls = new Hls();
|
|
124
126
|
hls.loadSource(chosenSrc);
|
|
125
127
|
hls.attachMedia(v);
|
|
126
128
|
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
|
127
|
-
if (
|
|
128
|
-
v.play().catch(console.error);
|
|
129
|
+
if (autoPlayAfterLoad && !wasManuallyPausedRef.current) {
|
|
130
|
+
v.play().catch(console.error).then(() => setIsPlaying(true));
|
|
129
131
|
}
|
|
130
132
|
});
|
|
131
133
|
hlsRef.current = hls;
|
|
132
|
-
return () => {
|
|
133
|
-
hls.destroy();
|
|
134
|
-
hlsRef.current = null;
|
|
135
|
-
};
|
|
136
134
|
} else if (v.canPlayType("application/vnd.apple.mpegurl")) {
|
|
137
135
|
v.src = chosenSrc;
|
|
138
136
|
v.load();
|
|
137
|
+
if (autoPlayAfterLoad) {
|
|
138
|
+
v.play().catch(console.error).then(() => setIsPlaying(true));
|
|
139
|
+
}
|
|
139
140
|
}
|
|
140
141
|
}, [JSON.stringify(resolvedSources)]);
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
if (isPlayOnHover) return;
|
|
144
|
+
initHls(
|
|
145
|
+
/* autoPlayAfterLoad */
|
|
146
|
+
playOptions === "autoplay"
|
|
147
|
+
);
|
|
148
|
+
return () => {
|
|
149
|
+
if (hlsRef.current) {
|
|
150
|
+
hlsRef.current.destroy();
|
|
151
|
+
hlsRef.current = null;
|
|
152
|
+
}
|
|
153
|
+
hlsInitializedRef.current = false;
|
|
154
|
+
};
|
|
155
|
+
}, [JSON.stringify(resolvedSources), isPlayOnHover]);
|
|
141
156
|
const handlePlayPause = useCallback(() => {
|
|
142
157
|
const v = videoRef.current;
|
|
143
158
|
if (!v) return;
|
|
@@ -182,10 +197,17 @@ var HlsPlayer = React.memo(
|
|
|
182
197
|
if (isMobile) return;
|
|
183
198
|
setIsHovered(true);
|
|
184
199
|
resetInactivityTimer();
|
|
185
|
-
if (isPlayOnHover &&
|
|
186
|
-
|
|
200
|
+
if (isPlayOnHover && !wasManuallyPausedRef.current) {
|
|
201
|
+
if (!hlsInitializedRef.current) {
|
|
202
|
+
initHls(
|
|
203
|
+
/* autoPlayAfterLoad */
|
|
204
|
+
true
|
|
205
|
+
);
|
|
206
|
+
} else if (videoRef.current) {
|
|
207
|
+
videoRef.current.play().then(() => setIsPlaying(true)).catch(console.error);
|
|
208
|
+
}
|
|
187
209
|
}
|
|
188
|
-
}, [isPlayOnHover, isMobile, resetInactivityTimer]);
|
|
210
|
+
}, [isPlayOnHover, isMobile, resetInactivityTimer, initHls]);
|
|
189
211
|
const handleMouseLeave = useCallback(() => {
|
|
190
212
|
if (isMobile) return;
|
|
191
213
|
setIsHovered(false);
|
|
@@ -247,9 +269,10 @@ var HlsPlayer = React.memo(
|
|
|
247
269
|
autoPlay: playOptions === "autoplay",
|
|
248
270
|
loop,
|
|
249
271
|
playsInline: true,
|
|
272
|
+
preload: isPlayOnHover ? "none" : "auto",
|
|
250
273
|
onClick: handleVideoClick,
|
|
251
274
|
onDoubleClick: handleVideoDoubleClick,
|
|
252
|
-
children: resolvedSources.map(({ src, media }, i) => /* @__PURE__ */ jsx(
|
|
275
|
+
children: !isPlayOnHover && resolvedSources.map(({ src, media }, i) => /* @__PURE__ */ jsx(
|
|
253
276
|
"source",
|
|
254
277
|
{
|
|
255
278
|
src,
|
package/dist/index.js
CHANGED
|
@@ -478,6 +478,7 @@ var init_HlsPlayer = __esm({
|
|
|
478
478
|
const wasManuallyPausedRef = (0, import_react32.useRef)(false);
|
|
479
479
|
const inactivityTimerRef = (0, import_react32.useRef)(null);
|
|
480
480
|
const clickTimerRef = (0, import_react32.useRef)(null);
|
|
481
|
+
const hlsInitializedRef = (0, import_react32.useRef)(false);
|
|
481
482
|
const INACTIVITY_DELAY = 2500;
|
|
482
483
|
const CLICK_DEBOUNCE = 220;
|
|
483
484
|
const resolvedSources = sources && sources.length > 0 ? sources : assetUrl ? [{ src: assetUrl, posterUrl }] : [];
|
|
@@ -535,7 +536,7 @@ var init_HlsPlayer = __esm({
|
|
|
535
536
|
if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
|
|
536
537
|
};
|
|
537
538
|
}, []);
|
|
538
|
-
(0, import_react32.
|
|
539
|
+
const initHls = (0, import_react32.useCallback)((autoPlayAfterLoad) => {
|
|
539
540
|
const v = videoRef.current;
|
|
540
541
|
if (!v || resolvedSources.length === 0) return;
|
|
541
542
|
if (hlsRef.current) {
|
|
@@ -544,25 +545,39 @@ var init_HlsPlayer = __esm({
|
|
|
544
545
|
}
|
|
545
546
|
const chosenSrc = pickSource(resolvedSources);
|
|
546
547
|
if (!chosenSrc) return;
|
|
548
|
+
hlsInitializedRef.current = true;
|
|
547
549
|
if (import_hls.default.isSupported()) {
|
|
548
550
|
const hls = new import_hls.default();
|
|
549
551
|
hls.loadSource(chosenSrc);
|
|
550
552
|
hls.attachMedia(v);
|
|
551
553
|
hls.on(import_hls.default.Events.MANIFEST_PARSED, () => {
|
|
552
|
-
if (
|
|
553
|
-
v.play().catch(console.error);
|
|
554
|
+
if (autoPlayAfterLoad && !wasManuallyPausedRef.current) {
|
|
555
|
+
v.play().catch(console.error).then(() => setIsPlaying(true));
|
|
554
556
|
}
|
|
555
557
|
});
|
|
556
558
|
hlsRef.current = hls;
|
|
557
|
-
return () => {
|
|
558
|
-
hls.destroy();
|
|
559
|
-
hlsRef.current = null;
|
|
560
|
-
};
|
|
561
559
|
} else if (v.canPlayType("application/vnd.apple.mpegurl")) {
|
|
562
560
|
v.src = chosenSrc;
|
|
563
561
|
v.load();
|
|
562
|
+
if (autoPlayAfterLoad) {
|
|
563
|
+
v.play().catch(console.error).then(() => setIsPlaying(true));
|
|
564
|
+
}
|
|
564
565
|
}
|
|
565
566
|
}, [JSON.stringify(resolvedSources)]);
|
|
567
|
+
(0, import_react32.useEffect)(() => {
|
|
568
|
+
if (isPlayOnHover) return;
|
|
569
|
+
initHls(
|
|
570
|
+
/* autoPlayAfterLoad */
|
|
571
|
+
playOptions === "autoplay"
|
|
572
|
+
);
|
|
573
|
+
return () => {
|
|
574
|
+
if (hlsRef.current) {
|
|
575
|
+
hlsRef.current.destroy();
|
|
576
|
+
hlsRef.current = null;
|
|
577
|
+
}
|
|
578
|
+
hlsInitializedRef.current = false;
|
|
579
|
+
};
|
|
580
|
+
}, [JSON.stringify(resolvedSources), isPlayOnHover]);
|
|
566
581
|
const handlePlayPause = (0, import_react32.useCallback)(() => {
|
|
567
582
|
const v = videoRef.current;
|
|
568
583
|
if (!v) return;
|
|
@@ -607,10 +622,17 @@ var init_HlsPlayer = __esm({
|
|
|
607
622
|
if (isMobile) return;
|
|
608
623
|
setIsHovered(true);
|
|
609
624
|
resetInactivityTimer();
|
|
610
|
-
if (isPlayOnHover &&
|
|
611
|
-
|
|
625
|
+
if (isPlayOnHover && !wasManuallyPausedRef.current) {
|
|
626
|
+
if (!hlsInitializedRef.current) {
|
|
627
|
+
initHls(
|
|
628
|
+
/* autoPlayAfterLoad */
|
|
629
|
+
true
|
|
630
|
+
);
|
|
631
|
+
} else if (videoRef.current) {
|
|
632
|
+
videoRef.current.play().then(() => setIsPlaying(true)).catch(console.error);
|
|
633
|
+
}
|
|
612
634
|
}
|
|
613
|
-
}, [isPlayOnHover, isMobile, resetInactivityTimer]);
|
|
635
|
+
}, [isPlayOnHover, isMobile, resetInactivityTimer, initHls]);
|
|
614
636
|
const handleMouseLeave = (0, import_react32.useCallback)(() => {
|
|
615
637
|
if (isMobile) return;
|
|
616
638
|
setIsHovered(false);
|
|
@@ -672,9 +694,10 @@ var init_HlsPlayer = __esm({
|
|
|
672
694
|
autoPlay: playOptions === "autoplay",
|
|
673
695
|
loop,
|
|
674
696
|
playsInline: true,
|
|
697
|
+
preload: isPlayOnHover ? "none" : "auto",
|
|
675
698
|
onClick: handleVideoClick,
|
|
676
699
|
onDoubleClick: handleVideoDoubleClick,
|
|
677
|
-
children: resolvedSources.map(({ src, media }, i) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
700
|
+
children: !isPlayOnHover && resolvedSources.map(({ src, media }, i) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
678
701
|
"source",
|
|
679
702
|
{
|
|
680
703
|
src,
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HlsPlayer_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-72PHGKW4.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Button_default,
|
|
6
6
|
ClientButton_default,
|
|
@@ -1989,7 +1989,7 @@ var DeviceAssetSelector_default = DeviceAssetSelector;
|
|
|
1989
1989
|
|
|
1990
1990
|
// src/components/pageRenderingEngine/nodes/ImageNode.tsx
|
|
1991
1991
|
import { Fragment as Fragment2, jsx as jsx37 } from "react/jsx-runtime";
|
|
1992
|
-
var HlsPlayer = dynamic3(() => import("./HlsPlayer-
|
|
1992
|
+
var HlsPlayer = dynamic3(() => import("./HlsPlayer-GZR4QXJY.mjs"), {
|
|
1993
1993
|
ssr: false
|
|
1994
1994
|
});
|
|
1995
1995
|
var getNestedValue = (obj, path) => {
|
|
@@ -3671,7 +3671,7 @@ var Pagination_default = Pagination;
|
|
|
3671
3671
|
// src/components/pageRenderingEngine/nodes/ImageGalleryNode.tsx
|
|
3672
3672
|
import dynamic7 from "next/dynamic";
|
|
3673
3673
|
import { Fragment as Fragment8, jsx as jsx56, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3674
|
-
var HlsPlayer2 = dynamic7(() => import("./HlsPlayer-
|
|
3674
|
+
var HlsPlayer2 = dynamic7(() => import("./HlsPlayer-GZR4QXJY.mjs"), { ssr: false });
|
|
3675
3675
|
var deviceToMediaQuery = (device) => {
|
|
3676
3676
|
switch (device) {
|
|
3677
3677
|
case "sm":
|
package/package.json
CHANGED