@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260502051234 → 0.8.1-dev.20260502064252
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.
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
import React, { useRef, useEffect, useState, useCallback } from "react";
|
|
3
3
|
import Hls from "hls.js";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
var pickSource = (sources) => {
|
|
6
|
+
for (const { src, media } of sources) {
|
|
7
|
+
if (media && window.matchMedia(media).matches) return src;
|
|
8
|
+
}
|
|
9
|
+
return sources.find((s) => !s.media)?.src ?? sources[0]?.src ?? "";
|
|
10
|
+
};
|
|
5
11
|
var HlsPlayer = React.memo(
|
|
6
12
|
({
|
|
7
13
|
sources,
|
|
@@ -83,28 +89,24 @@ var HlsPlayer = React.memo(
|
|
|
83
89
|
hlsRef.current.destroy();
|
|
84
90
|
hlsRef.current = null;
|
|
85
91
|
}
|
|
92
|
+
const chosenSrc = pickSource(resolvedSources);
|
|
93
|
+
if (!chosenSrc) return;
|
|
86
94
|
if (Hls.isSupported()) {
|
|
87
95
|
const hls = new Hls();
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
v.play().catch(console.error);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
v.addEventListener("loadstart", onLoadStart, { once: true });
|
|
100
|
-
v.load();
|
|
96
|
+
hls.loadSource(chosenSrc);
|
|
97
|
+
hls.attachMedia(v);
|
|
98
|
+
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
|
99
|
+
if (isPlaying && !wasManuallyPausedRef.current) {
|
|
100
|
+
v.play().catch(console.error);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
101
103
|
hlsRef.current = hls;
|
|
102
104
|
return () => {
|
|
103
|
-
v.removeEventListener("loadstart", onLoadStart);
|
|
104
105
|
hls.destroy();
|
|
105
106
|
hlsRef.current = null;
|
|
106
107
|
};
|
|
107
108
|
} else if (v.canPlayType("application/vnd.apple.mpegurl")) {
|
|
109
|
+
v.src = chosenSrc;
|
|
108
110
|
v.load();
|
|
109
111
|
}
|
|
110
112
|
}, [JSON.stringify(resolvedSources)]);
|
|
@@ -283,21 +285,15 @@ var HlsPlayer = React.memo(
|
|
|
283
285
|
style: overlayButtonStyle,
|
|
284
286
|
onMouseEnter: handleButtonMouseEnter,
|
|
285
287
|
onMouseLeave: handleButtonMouseLeave,
|
|
286
|
-
children: isMuted ? (
|
|
287
|
-
/*
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
/* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
296
|
-
/* @__PURE__ */ jsx("path", { d: "M11 5L6 9H2v6h4l5 4V5Z", fill: "white" }),
|
|
297
|
-
/* @__PURE__ */ jsx("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }),
|
|
298
|
-
/* @__PURE__ */ jsx("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
|
|
299
|
-
] })
|
|
300
|
-
)
|
|
288
|
+
children: isMuted ? /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
289
|
+
/* @__PURE__ */ jsx("path", { d: "M11 5L6 9H2v6h4l5 4V5Z", fill: "white" }),
|
|
290
|
+
/* @__PURE__ */ jsx("line", { x1: "23", y1: "9", x2: "17", y2: "15", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }),
|
|
291
|
+
/* @__PURE__ */ jsx("line", { x1: "17", y1: "9", x2: "23", y2: "15", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
|
|
292
|
+
] }) : /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
293
|
+
/* @__PURE__ */ jsx("path", { d: "M11 5L6 9H2v6h4l5 4V5Z", fill: "white" }),
|
|
294
|
+
/* @__PURE__ */ jsx("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }),
|
|
295
|
+
/* @__PURE__ */ jsx("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
|
|
296
|
+
] })
|
|
301
297
|
}
|
|
302
298
|
)
|
|
303
299
|
}
|
package/dist/index.js
CHANGED
|
@@ -520,7 +520,7 @@ var HlsPlayer_exports = {};
|
|
|
520
520
|
__export(HlsPlayer_exports, {
|
|
521
521
|
default: () => HlsPlayer_default
|
|
522
522
|
});
|
|
523
|
-
var import_react32, import_hls, import_jsx_runtime41, HlsPlayer, HlsPlayer_default;
|
|
523
|
+
var import_react32, import_hls, import_jsx_runtime41, pickSource, HlsPlayer, HlsPlayer_default;
|
|
524
524
|
var init_HlsPlayer = __esm({
|
|
525
525
|
"src/components/HlsPlayer.tsx"() {
|
|
526
526
|
"use strict";
|
|
@@ -528,6 +528,12 @@ var init_HlsPlayer = __esm({
|
|
|
528
528
|
import_react32 = __toESM(require("react"));
|
|
529
529
|
import_hls = __toESM(require("hls.js"));
|
|
530
530
|
import_jsx_runtime41 = require("react/jsx-runtime");
|
|
531
|
+
pickSource = (sources) => {
|
|
532
|
+
for (const { src, media } of sources) {
|
|
533
|
+
if (media && window.matchMedia(media).matches) return src;
|
|
534
|
+
}
|
|
535
|
+
return sources.find((s) => !s.media)?.src ?? sources[0]?.src ?? "";
|
|
536
|
+
};
|
|
531
537
|
HlsPlayer = import_react32.default.memo(
|
|
532
538
|
({
|
|
533
539
|
sources,
|
|
@@ -609,28 +615,24 @@ var init_HlsPlayer = __esm({
|
|
|
609
615
|
hlsRef.current.destroy();
|
|
610
616
|
hlsRef.current = null;
|
|
611
617
|
}
|
|
618
|
+
const chosenSrc = pickSource(resolvedSources);
|
|
619
|
+
if (!chosenSrc) return;
|
|
612
620
|
if (import_hls.default.isSupported()) {
|
|
613
621
|
const hls = new import_hls.default();
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
v.play().catch(console.error);
|
|
622
|
-
}
|
|
623
|
-
});
|
|
624
|
-
};
|
|
625
|
-
v.addEventListener("loadstart", onLoadStart, { once: true });
|
|
626
|
-
v.load();
|
|
622
|
+
hls.loadSource(chosenSrc);
|
|
623
|
+
hls.attachMedia(v);
|
|
624
|
+
hls.on(import_hls.default.Events.MANIFEST_PARSED, () => {
|
|
625
|
+
if (isPlaying && !wasManuallyPausedRef.current) {
|
|
626
|
+
v.play().catch(console.error);
|
|
627
|
+
}
|
|
628
|
+
});
|
|
627
629
|
hlsRef.current = hls;
|
|
628
630
|
return () => {
|
|
629
|
-
v.removeEventListener("loadstart", onLoadStart);
|
|
630
631
|
hls.destroy();
|
|
631
632
|
hlsRef.current = null;
|
|
632
633
|
};
|
|
633
634
|
} else if (v.canPlayType("application/vnd.apple.mpegurl")) {
|
|
635
|
+
v.src = chosenSrc;
|
|
634
636
|
v.load();
|
|
635
637
|
}
|
|
636
638
|
}, [JSON.stringify(resolvedSources)]);
|
|
@@ -809,21 +811,15 @@ var init_HlsPlayer = __esm({
|
|
|
809
811
|
style: overlayButtonStyle,
|
|
810
812
|
onMouseEnter: handleButtonMouseEnter,
|
|
811
813
|
onMouseLeave: handleButtonMouseLeave,
|
|
812
|
-
children: isMuted ? (
|
|
813
|
-
/*
|
|
814
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
822
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M11 5L6 9H2v6h4l5 4V5Z", fill: "white" }),
|
|
823
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }),
|
|
824
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
|
|
825
|
-
] })
|
|
826
|
-
)
|
|
814
|
+
children: isMuted ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
815
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M11 5L6 9H2v6h4l5 4V5Z", fill: "white" }),
|
|
816
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("line", { x1: "23", y1: "9", x2: "17", y2: "15", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }),
|
|
817
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("line", { x1: "17", y1: "9", x2: "23", y2: "15", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
|
|
818
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
819
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M11 5L6 9H2v6h4l5 4V5Z", fill: "white" }),
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }),
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
|
|
822
|
+
] })
|
|
827
823
|
}
|
|
828
824
|
)
|
|
829
825
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HlsPlayer_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PJWICSOI.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Button_default,
|
|
6
6
|
ClientButton_default,
|
|
@@ -1963,7 +1963,7 @@ var DeviceAssetSelector_default = DeviceAssetSelector;
|
|
|
1963
1963
|
|
|
1964
1964
|
// src/components/pageRenderingEngine/nodes/ImageNode.tsx
|
|
1965
1965
|
import { Fragment as Fragment2, jsx as jsx37 } from "react/jsx-runtime";
|
|
1966
|
-
var HlsPlayer = dynamic2(() => import("./HlsPlayer-
|
|
1966
|
+
var HlsPlayer = dynamic2(() => import("./HlsPlayer-MSDXB5WD.mjs"), {
|
|
1967
1967
|
ssr: false
|
|
1968
1968
|
});
|
|
1969
1969
|
var getNestedValue = (obj, path) => {
|
|
@@ -3645,7 +3645,7 @@ var Pagination_default = Pagination;
|
|
|
3645
3645
|
// src/components/pageRenderingEngine/nodes/ImageGalleryNode.tsx
|
|
3646
3646
|
import dynamic6 from "next/dynamic";
|
|
3647
3647
|
import { Fragment as Fragment8, jsx as jsx56, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3648
|
-
var HlsPlayer2 = dynamic6(() => import("./HlsPlayer-
|
|
3648
|
+
var HlsPlayer2 = dynamic6(() => import("./HlsPlayer-MSDXB5WD.mjs"), { ssr: false });
|
|
3649
3649
|
var deviceToMediaQuery = (device) => {
|
|
3650
3650
|
switch (device) {
|
|
3651
3651
|
case "sm":
|
package/package.json
CHANGED