@mottosports/motto-video-player 1.0.1-rc.79 → 1.0.1-rc.80
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/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +318 -399
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +308 -389
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -393,7 +393,7 @@ html[dir=rtl] .shaka-overflow-menu .shaka-overflow-button .material-svg-icon:fir
|
|
|
393
393
|
`);
|
|
394
394
|
|
|
395
395
|
// src/Player.tsx
|
|
396
|
-
import { forwardRef, useEffect as
|
|
396
|
+
import { forwardRef, useEffect as useEffect4, useRef as useRef8, useImperativeHandle, useCallback as useCallback9, useState as useState3 } from "react";
|
|
397
397
|
import shaka3 from "shaka-player/dist/shaka-player.ui";
|
|
398
398
|
|
|
399
399
|
// src/hooks/useShakaPlayer.ts
|
|
@@ -449,7 +449,7 @@ var supportsWidevinePersistentLicenses = () => {
|
|
|
449
449
|
import initShakaPlayerMux from "@mux/mux-data-shakaplayer";
|
|
450
450
|
|
|
451
451
|
// package.json
|
|
452
|
-
var version = "1.0.1-rc.
|
|
452
|
+
var version = "1.0.1-rc.80";
|
|
453
453
|
|
|
454
454
|
// src/utils/licenseCache.ts
|
|
455
455
|
var PERSISTENT_LICENSE_PREFIX = "motto_lic_";
|
|
@@ -1597,176 +1597,146 @@ var useEventHandlers = (videoRef, handlers) => {
|
|
|
1597
1597
|
};
|
|
1598
1598
|
};
|
|
1599
1599
|
|
|
1600
|
-
// src/hooks/useLiveBadge.ts
|
|
1601
|
-
import { useEffect, useState as useState2, useRef as useRef5 } from "react";
|
|
1602
|
-
var useLiveBadge = (playerRef, options = {}) => {
|
|
1603
|
-
const [isLive, setIsLive] = useState2(false);
|
|
1604
|
-
const [isVisible, setIsVisible] = useState2(false);
|
|
1605
|
-
const [isNearLiveEdge, setIsNearLiveEdge] = useState2(false);
|
|
1606
|
-
const intervalRef = useRef5(null);
|
|
1607
|
-
const { enabled = true, onLiveStateChange, liveThresholdSeconds = 15 } = options;
|
|
1608
|
-
const checkLiveStatus = () => {
|
|
1609
|
-
if (!playerRef.current || !enabled) {
|
|
1610
|
-
return;
|
|
1611
|
-
}
|
|
1612
|
-
try {
|
|
1613
|
-
const player = playerRef.current;
|
|
1614
|
-
if (!player.getManifest || !player.getPresentationTimeline || typeof player.getPresentationTimeline !== "function") {
|
|
1615
|
-
return;
|
|
1616
|
-
}
|
|
1617
|
-
const manifest = player.getManifest();
|
|
1618
|
-
if (!manifest) {
|
|
1619
|
-
return;
|
|
1620
|
-
}
|
|
1621
|
-
const timeline = player.getPresentationTimeline();
|
|
1622
|
-
if (!timeline || typeof timeline.isLive !== "function") {
|
|
1623
|
-
return;
|
|
1624
|
-
}
|
|
1625
|
-
const liveStatus = timeline.isLive();
|
|
1626
|
-
let nearLiveEdge = false;
|
|
1627
|
-
if (liveStatus) {
|
|
1628
|
-
try {
|
|
1629
|
-
const seekRange = player.getSeekRange();
|
|
1630
|
-
const videoElement = player.getMediaElement();
|
|
1631
|
-
if (seekRange && videoElement) {
|
|
1632
|
-
const liveEdge = seekRange.end;
|
|
1633
|
-
const currentTime = videoElement.currentTime;
|
|
1634
|
-
const timeBehindLive = liveEdge - currentTime;
|
|
1635
|
-
nearLiveEdge = timeBehindLive <= liveThresholdSeconds;
|
|
1636
|
-
}
|
|
1637
|
-
} catch (error) {
|
|
1638
|
-
console.error("Error checking live edge position:", error);
|
|
1639
|
-
nearLiveEdge = liveStatus;
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
if (liveStatus !== isLive) {
|
|
1643
|
-
setIsLive(liveStatus);
|
|
1644
|
-
onLiveStateChange?.(liveStatus);
|
|
1645
|
-
}
|
|
1646
|
-
if (nearLiveEdge !== isNearLiveEdge) {
|
|
1647
|
-
setIsNearLiveEdge(nearLiveEdge);
|
|
1648
|
-
setIsVisible(nearLiveEdge);
|
|
1649
|
-
}
|
|
1650
|
-
} catch (error) {
|
|
1651
|
-
if (error instanceof Error && !error.message.includes("not a function")) {
|
|
1652
|
-
console.error("Error checking live status:", error);
|
|
1653
|
-
}
|
|
1654
|
-
}
|
|
1655
|
-
};
|
|
1656
|
-
useEffect(() => {
|
|
1657
|
-
if (!enabled) {
|
|
1658
|
-
setIsLive(false);
|
|
1659
|
-
setIsVisible(false);
|
|
1660
|
-
setIsNearLiveEdge(false);
|
|
1661
|
-
return;
|
|
1662
|
-
}
|
|
1663
|
-
checkLiveStatus();
|
|
1664
|
-
intervalRef.current = setInterval(checkLiveStatus, 1e3);
|
|
1665
|
-
return () => {
|
|
1666
|
-
if (intervalRef.current) {
|
|
1667
|
-
clearInterval(intervalRef.current);
|
|
1668
|
-
intervalRef.current = null;
|
|
1669
|
-
}
|
|
1670
|
-
};
|
|
1671
|
-
}, [enabled, playerRef.current, liveThresholdSeconds]);
|
|
1672
|
-
useEffect(() => {
|
|
1673
|
-
return () => {
|
|
1674
|
-
if (intervalRef.current) {
|
|
1675
|
-
clearInterval(intervalRef.current);
|
|
1676
|
-
}
|
|
1677
|
-
};
|
|
1678
|
-
}, []);
|
|
1679
|
-
const hideBadge = () => setIsVisible(false);
|
|
1680
|
-
const showBadge = () => setIsVisible(true);
|
|
1681
|
-
return {
|
|
1682
|
-
isLive,
|
|
1683
|
-
isVisible,
|
|
1684
|
-
isNearLiveEdge,
|
|
1685
|
-
hideBadge,
|
|
1686
|
-
showBadge,
|
|
1687
|
-
checkLiveStatus
|
|
1688
|
-
};
|
|
1689
|
-
};
|
|
1690
|
-
|
|
1691
1600
|
// src/hooks/usePosterFallback.ts
|
|
1692
|
-
import { useEffect
|
|
1601
|
+
import { useEffect, useState as useState2 } from "react";
|
|
1693
1602
|
|
|
1694
1603
|
// src/hooks/useLiveIndicator.ts
|
|
1695
|
-
import { useEffect as
|
|
1604
|
+
import { useEffect as useEffect2, useRef as useRef6 } from "react";
|
|
1696
1605
|
var useLiveIndicator = (containerRef, playerRef, options = {}) => {
|
|
1697
|
-
const observerRef =
|
|
1698
|
-
const intervalRef =
|
|
1606
|
+
const observerRef = useRef6(null);
|
|
1607
|
+
const intervalRef = useRef6(null);
|
|
1608
|
+
const lastStatusRef = useRef6(null);
|
|
1699
1609
|
const {
|
|
1700
1610
|
enabled = true,
|
|
1701
1611
|
indicatorColor = "#ff0000",
|
|
1702
1612
|
indicatorSize = 8,
|
|
1703
1613
|
showPulseAnimation = true,
|
|
1704
|
-
liveThresholdSeconds = 15
|
|
1614
|
+
liveThresholdSeconds = 15,
|
|
1615
|
+
onLiveStatusChange
|
|
1705
1616
|
} = options;
|
|
1706
|
-
const
|
|
1707
|
-
if (!player)
|
|
1617
|
+
const getLiveStatus = (player) => {
|
|
1618
|
+
if (!player) {
|
|
1619
|
+
return { isLive: false, isNearEdge: false };
|
|
1620
|
+
}
|
|
1708
1621
|
try {
|
|
1709
|
-
if (!player.getManifest ||
|
|
1710
|
-
return false;
|
|
1622
|
+
if (!player.getManifest || typeof player.getManifest !== "function") {
|
|
1623
|
+
return { isLive: false, isNearEdge: false };
|
|
1711
1624
|
}
|
|
1712
1625
|
const manifest = player.getManifest();
|
|
1713
1626
|
if (!manifest) {
|
|
1714
|
-
return false;
|
|
1627
|
+
return { isLive: false, isNearEdge: false };
|
|
1715
1628
|
}
|
|
1716
|
-
const timeline =
|
|
1629
|
+
const timeline = manifest.presentationTimeline;
|
|
1717
1630
|
if (!timeline || typeof timeline.isLive !== "function") {
|
|
1718
|
-
return false;
|
|
1631
|
+
return { isLive: false, isNearEdge: false };
|
|
1632
|
+
}
|
|
1633
|
+
const isLiveStream = timeline.isLive();
|
|
1634
|
+
if (!isLiveStream) return { isLive: false, isNearEdge: false };
|
|
1635
|
+
const videoElement = player.getMediaElement?.();
|
|
1636
|
+
if (!videoElement) return { isLive: true, isNearEdge: false };
|
|
1637
|
+
const liveEdge = timeline.getSeekRangeEnd?.() ?? timeline.getSegmentAvailabilityEnd?.();
|
|
1638
|
+
if (liveEdge === void 0) return { isLive: true, isNearEdge: false };
|
|
1639
|
+
const currentTime = videoElement.currentTime;
|
|
1640
|
+
const timeBehindLive = liveEdge - currentTime;
|
|
1641
|
+
return {
|
|
1642
|
+
isLive: true,
|
|
1643
|
+
isNearEdge: timeBehindLive <= liveThresholdSeconds,
|
|
1644
|
+
liveEdge
|
|
1645
|
+
};
|
|
1646
|
+
} catch (error) {
|
|
1647
|
+
console.error("Error checking live status:", error);
|
|
1648
|
+
return { isLive: false, isNearEdge: false };
|
|
1649
|
+
}
|
|
1650
|
+
};
|
|
1651
|
+
const seekToLiveEdge = () => {
|
|
1652
|
+
const player = playerRef.current;
|
|
1653
|
+
if (!player) return;
|
|
1654
|
+
try {
|
|
1655
|
+
const manifest = player.getManifest();
|
|
1656
|
+
if (!manifest) return;
|
|
1657
|
+
const timeline = manifest.presentationTimeline;
|
|
1658
|
+
const liveEdge = timeline?.getSeekRangeEnd?.() ?? timeline?.getSegmentAvailabilityEnd?.();
|
|
1659
|
+
if (liveEdge !== void 0) {
|
|
1660
|
+
const videoElement = player.getMediaElement?.();
|
|
1661
|
+
if (videoElement) {
|
|
1662
|
+
videoElement.currentTime = liveEdge;
|
|
1663
|
+
}
|
|
1719
1664
|
}
|
|
1720
|
-
const liveStatus = timeline.isLive();
|
|
1721
|
-
if (!liveStatus) return false;
|
|
1722
|
-
const seekRange = player.getSeekRange();
|
|
1723
|
-
const videoElement = player.getMediaElement();
|
|
1724
|
-
if (seekRange && videoElement) {
|
|
1725
|
-
const liveEdge = seekRange.end;
|
|
1726
|
-
const currentTime = videoElement.currentTime;
|
|
1727
|
-
const timeBehindLive = liveEdge - currentTime;
|
|
1728
|
-
return timeBehindLive <= liveThresholdSeconds;
|
|
1729
|
-
}
|
|
1730
|
-
return false;
|
|
1731
1665
|
} catch (error) {
|
|
1732
|
-
console.error("Error
|
|
1733
|
-
return false;
|
|
1666
|
+
console.error("Error seeking to live edge:", error);
|
|
1734
1667
|
}
|
|
1735
1668
|
};
|
|
1736
|
-
|
|
1737
|
-
if (!containerRef.current || !
|
|
1669
|
+
useEffect2(() => {
|
|
1670
|
+
if (!containerRef.current || !enabled) {
|
|
1738
1671
|
return;
|
|
1739
1672
|
}
|
|
1740
|
-
const
|
|
1741
|
-
|
|
1673
|
+
const updateLiveIndicator = (currentTimeElement, status) => {
|
|
1674
|
+
const parent = currentTimeElement.parentElement;
|
|
1675
|
+
if (!parent) return;
|
|
1676
|
+
const existingContainer = parent.querySelector(".live-indicator-container");
|
|
1677
|
+
const isCurrentlyNearEdge = existingContainer?.getAttribute("data-near-edge") === "true";
|
|
1678
|
+
if (existingContainer && status.isNearEdge === isCurrentlyNearEdge) {
|
|
1742
1679
|
return;
|
|
1743
1680
|
}
|
|
1681
|
+
if (existingContainer) {
|
|
1682
|
+
existingContainer.remove();
|
|
1683
|
+
}
|
|
1684
|
+
const container = document.createElement("span");
|
|
1685
|
+
container.className = "live-indicator-container";
|
|
1686
|
+
container.setAttribute("data-near-edge", status.isNearEdge.toString());
|
|
1687
|
+
container.style.cssText = `
|
|
1688
|
+
display: inline-flex;
|
|
1689
|
+
align-items: center;
|
|
1690
|
+
width: 80px;
|
|
1691
|
+
${!status.isNearEdge ? "cursor: pointer;" : ""}
|
|
1692
|
+
`;
|
|
1744
1693
|
const indicator = document.createElement("span");
|
|
1745
1694
|
indicator.className = "live-indicator-dot";
|
|
1746
1695
|
indicator.style.cssText = `
|
|
1747
1696
|
display: inline-block;
|
|
1748
1697
|
width: ${indicatorSize}px;
|
|
1749
1698
|
height: ${indicatorSize}px;
|
|
1750
|
-
background-color: ${indicatorColor};
|
|
1699
|
+
background-color: ${status.isNearEdge ? indicatorColor : "#888888"};
|
|
1751
1700
|
border-radius: 50%;
|
|
1752
1701
|
margin-right: 6px;
|
|
1753
|
-
|
|
1754
|
-
${showPulseAnimation ? "animation: pulse-live 2s infinite;" : ""}
|
|
1702
|
+
${status.isNearEdge && showPulseAnimation ? "animation: pulse-live 2s infinite;" : ""}
|
|
1755
1703
|
`;
|
|
1756
|
-
|
|
1704
|
+
const liveText = document.createElement("span");
|
|
1705
|
+
liveText.className = "live-indicator-text";
|
|
1706
|
+
liveText.textContent = status.isNearEdge ? "LIVE" : "GO TO LIVE";
|
|
1707
|
+
container.appendChild(indicator);
|
|
1708
|
+
container.appendChild(liveText);
|
|
1709
|
+
if (!status.isNearEdge) {
|
|
1710
|
+
container.addEventListener("click", seekToLiveEdge);
|
|
1711
|
+
}
|
|
1712
|
+
if (status.isNearEdge) {
|
|
1713
|
+
parent.insertBefore(container, currentTimeElement);
|
|
1714
|
+
currentTimeElement.style.display = "none";
|
|
1715
|
+
} else {
|
|
1716
|
+
currentTimeElement.insertAdjacentElement("afterend", container);
|
|
1717
|
+
currentTimeElement.style.display = "";
|
|
1718
|
+
}
|
|
1757
1719
|
};
|
|
1758
1720
|
const removeLiveIndicator = (currentTimeElement) => {
|
|
1759
|
-
const
|
|
1760
|
-
if (
|
|
1761
|
-
|
|
1721
|
+
const parent = currentTimeElement.parentElement;
|
|
1722
|
+
if (!parent) return;
|
|
1723
|
+
const container = parent.querySelector(".live-indicator-container");
|
|
1724
|
+
if (container) {
|
|
1725
|
+
container.remove();
|
|
1726
|
+
currentTimeElement.style.display = "";
|
|
1762
1727
|
}
|
|
1763
1728
|
};
|
|
1764
1729
|
const checkForLiveContent = () => {
|
|
1765
1730
|
const currentTimeElements = containerRef.current?.querySelectorAll(".shaka-current-time");
|
|
1731
|
+
const status = getLiveStatus(playerRef.current);
|
|
1732
|
+
const lastStatus = lastStatusRef.current;
|
|
1733
|
+
if (onLiveStatusChange && (!lastStatus || lastStatus.isLive !== status.isLive || lastStatus.isNearEdge !== status.isNearEdge)) {
|
|
1734
|
+
onLiveStatusChange(status);
|
|
1735
|
+
lastStatusRef.current = { isLive: status.isLive, isNearEdge: status.isNearEdge };
|
|
1736
|
+
}
|
|
1766
1737
|
currentTimeElements?.forEach((element) => {
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
addLiveIndicator(element);
|
|
1738
|
+
if (status.isLive) {
|
|
1739
|
+
updateLiveIndicator(element, status);
|
|
1770
1740
|
} else {
|
|
1771
1741
|
removeLiveIndicator(element);
|
|
1772
1742
|
}
|
|
@@ -1807,22 +1777,15 @@ var useLiveIndicator = (containerRef, playerRef, options = {}) => {
|
|
|
1807
1777
|
clearInterval(intervalRef.current);
|
|
1808
1778
|
}
|
|
1809
1779
|
};
|
|
1810
|
-
}, [containerRef,
|
|
1780
|
+
}, [containerRef, enabled, indicatorColor, indicatorSize, showPulseAnimation, liveThresholdSeconds]);
|
|
1811
1781
|
return {
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
const currentTimeElements = containerRef.current?.querySelectorAll(".shaka-current-time");
|
|
1815
|
-
currentTimeElements?.forEach((element) => {
|
|
1816
|
-
const textContent = element.textContent?.trim() || "";
|
|
1817
|
-
if (textContent.toLowerCase().includes("live") && isNearLiveEdge(playerRef.current)) {
|
|
1818
|
-
}
|
|
1819
|
-
});
|
|
1820
|
-
}
|
|
1782
|
+
seekToLiveEdge,
|
|
1783
|
+
getLiveStatus: () => getLiveStatus(playerRef.current)
|
|
1821
1784
|
};
|
|
1822
1785
|
};
|
|
1823
1786
|
|
|
1824
1787
|
// src/hooks/useKeyboardControls.ts
|
|
1825
|
-
import { useCallback as useCallback7, useEffect as
|
|
1788
|
+
import { useCallback as useCallback7, useEffect as useEffect3 } from "react";
|
|
1826
1789
|
var useKeyboardControls = (videoRef, options = {}) => {
|
|
1827
1790
|
const { skipBack, skipForward, enabled = true } = options;
|
|
1828
1791
|
const isDesktop = useCallback7(() => {
|
|
@@ -1854,7 +1817,7 @@ var useKeyboardControls = (videoRef, options = {}) => {
|
|
|
1854
1817
|
break;
|
|
1855
1818
|
}
|
|
1856
1819
|
}, [enabled, videoRef, skipBack, skipForward, isDesktop]);
|
|
1857
|
-
|
|
1820
|
+
useEffect3(() => {
|
|
1858
1821
|
if (!enabled || !isDesktop()) return;
|
|
1859
1822
|
document.addEventListener("keydown", handleKeydown);
|
|
1860
1823
|
return () => {
|
|
@@ -1867,9 +1830,9 @@ var useKeyboardControls = (videoRef, options = {}) => {
|
|
|
1867
1830
|
};
|
|
1868
1831
|
|
|
1869
1832
|
// src/hooks/useAdEvents.ts
|
|
1870
|
-
import { useCallback as useCallback8, useRef as
|
|
1833
|
+
import { useCallback as useCallback8, useRef as useRef7 } from "react";
|
|
1871
1834
|
var useAdEvents = (playerRef, handlers) => {
|
|
1872
|
-
const listenersRef =
|
|
1835
|
+
const listenersRef = useRef7([]);
|
|
1873
1836
|
const setupAdEventListeners = useCallback8(() => {
|
|
1874
1837
|
const player = playerRef.current;
|
|
1875
1838
|
if (!player) return;
|
|
@@ -2009,117 +1972,6 @@ var useAdEvents = (playerRef, handlers) => {
|
|
|
2009
1972
|
};
|
|
2010
1973
|
};
|
|
2011
1974
|
|
|
2012
|
-
// src/components/Loading.tsx
|
|
2013
|
-
import { twMerge } from "tailwind-merge";
|
|
2014
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2015
|
-
var Loading = ({ className }) => /* @__PURE__ */ jsx4(
|
|
2016
|
-
"div",
|
|
2017
|
-
{
|
|
2018
|
-
className: twMerge(
|
|
2019
|
-
"relative bg-[#151515] md:rounded-2xl! overflow-hidden aspect-video text-white w-full h-full flex justify-center items-center text-[10px]",
|
|
2020
|
-
className
|
|
2021
|
-
),
|
|
2022
|
-
role: "status",
|
|
2023
|
-
children: /* @__PURE__ */ jsx4("div", { className: " flex justify-center items-center", children: /* @__PURE__ */ jsx4(
|
|
2024
|
-
"svg",
|
|
2025
|
-
{
|
|
2026
|
-
className: "shaka-spinner-svg animate-spin h-12 w-12",
|
|
2027
|
-
viewBox: "0 0 64 64",
|
|
2028
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2029
|
-
children: /* @__PURE__ */ jsx4(
|
|
2030
|
-
"circle",
|
|
2031
|
-
{
|
|
2032
|
-
className: "shaka-spinner-path",
|
|
2033
|
-
cx: "32",
|
|
2034
|
-
cy: "32",
|
|
2035
|
-
r: "28",
|
|
2036
|
-
strokeWidth: "4",
|
|
2037
|
-
strokeLinecap: "round",
|
|
2038
|
-
stroke: "currentColor",
|
|
2039
|
-
fill: "none",
|
|
2040
|
-
strokeDasharray: "176",
|
|
2041
|
-
strokeDashoffset: "120"
|
|
2042
|
-
}
|
|
2043
|
-
)
|
|
2044
|
-
}
|
|
2045
|
-
) })
|
|
2046
|
-
}
|
|
2047
|
-
);
|
|
2048
|
-
|
|
2049
|
-
// src/components/ErrorScreen.tsx
|
|
2050
|
-
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2051
|
-
var ErrorScreen = ({ title, description }) => /* @__PURE__ */ jsx5("div", { className: "w-full h-full md:rounded-2xl! aspect-video bg-black flex", children: /* @__PURE__ */ jsxs3("div", { className: "bg-[#151515] text-white w-full h-full flex justify-center items-center", children: [
|
|
2052
|
-
/* @__PURE__ */ jsx5(
|
|
2053
|
-
"svg",
|
|
2054
|
-
{
|
|
2055
|
-
className: "w-24 h-24 m-6",
|
|
2056
|
-
fill: "none",
|
|
2057
|
-
stroke: "currentColor",
|
|
2058
|
-
strokeWidth: "2",
|
|
2059
|
-
style: { width: 96 },
|
|
2060
|
-
viewBox: "0 0 24 24",
|
|
2061
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2062
|
-
children: /* @__PURE__ */ jsx5(
|
|
2063
|
-
"path",
|
|
2064
|
-
{
|
|
2065
|
-
d: "M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z",
|
|
2066
|
-
strokeLinecap: "round",
|
|
2067
|
-
strokeLinejoin: "round"
|
|
2068
|
-
}
|
|
2069
|
-
)
|
|
2070
|
-
}
|
|
2071
|
-
),
|
|
2072
|
-
/* @__PURE__ */ jsxs3("div", { children: [
|
|
2073
|
-
/* @__PURE__ */ jsx5("h3", { className: "text-2xl mb-2", children: title || "Playback Error" }),
|
|
2074
|
-
/* @__PURE__ */ jsx5("div", { className: "text-lg", children: description || "Unable to play the video. Please try again later." })
|
|
2075
|
-
] })
|
|
2076
|
-
] }) });
|
|
2077
|
-
|
|
2078
|
-
// src/components/Title.tsx
|
|
2079
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
2080
|
-
var Title = ({ title }) => /* @__PURE__ */ jsx6("div", { className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4", children: /* @__PURE__ */ jsx6("h2", { className: "text-white text-xl font-semibold", children: title }) });
|
|
2081
|
-
|
|
2082
|
-
// src/components/LiveBadge.tsx
|
|
2083
|
-
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2084
|
-
var LiveBadge = ({
|
|
2085
|
-
isVisible,
|
|
2086
|
-
position = "top-right",
|
|
2087
|
-
className = "",
|
|
2088
|
-
style = {},
|
|
2089
|
-
text = "LIVE"
|
|
2090
|
-
}) => {
|
|
2091
|
-
if (!isVisible) return null;
|
|
2092
|
-
const positionClasses = {
|
|
2093
|
-
"top-left": "top-4 left-4",
|
|
2094
|
-
"top-right": "top-4 right-4",
|
|
2095
|
-
"bottom-left": "bottom-4 left-4",
|
|
2096
|
-
"bottom-right": "bottom-4 right-4"
|
|
2097
|
-
};
|
|
2098
|
-
return /* @__PURE__ */ jsx7(
|
|
2099
|
-
"div",
|
|
2100
|
-
{
|
|
2101
|
-
className: `
|
|
2102
|
-
absolute z-50
|
|
2103
|
-
${positionClasses[position]}
|
|
2104
|
-
bg-red-600 text-white
|
|
2105
|
-
px-2 py-1
|
|
2106
|
-
rounded-md
|
|
2107
|
-
text-xs font-bold
|
|
2108
|
-
uppercase tracking-wide
|
|
2109
|
-
shadow-lg
|
|
2110
|
-
animate-pulse
|
|
2111
|
-
pointer-events-none
|
|
2112
|
-
${className}
|
|
2113
|
-
`,
|
|
2114
|
-
style,
|
|
2115
|
-
children: /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-1", children: [
|
|
2116
|
-
/* @__PURE__ */ jsx7("span", { className: "w-2 h-2 bg-white rounded-full animate-pulse" }),
|
|
2117
|
-
text
|
|
2118
|
-
] })
|
|
2119
|
-
}
|
|
2120
|
-
);
|
|
2121
|
-
};
|
|
2122
|
-
|
|
2123
1975
|
// src/Player.tsx
|
|
2124
1976
|
import { twMerge as twMerge2 } from "tailwind-merge";
|
|
2125
1977
|
|
|
@@ -2196,8 +2048,78 @@ async function waitForGlobals(globalNames, timeout = 5e3) {
|
|
|
2196
2048
|
await Promise.all(promises);
|
|
2197
2049
|
}
|
|
2198
2050
|
|
|
2051
|
+
// src/components/Loading.tsx
|
|
2052
|
+
import { twMerge } from "tailwind-merge";
|
|
2053
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2054
|
+
var Loading = ({ className }) => /* @__PURE__ */ jsx4(
|
|
2055
|
+
"div",
|
|
2056
|
+
{
|
|
2057
|
+
className: twMerge(
|
|
2058
|
+
"relative bg-[#151515] md:rounded-2xl! overflow-hidden aspect-video text-white w-full h-full flex justify-center items-center text-[10px]",
|
|
2059
|
+
className
|
|
2060
|
+
),
|
|
2061
|
+
role: "status",
|
|
2062
|
+
children: /* @__PURE__ */ jsx4("div", { className: " flex justify-center items-center", children: /* @__PURE__ */ jsx4(
|
|
2063
|
+
"svg",
|
|
2064
|
+
{
|
|
2065
|
+
className: "shaka-spinner-svg animate-spin h-12 w-12",
|
|
2066
|
+
viewBox: "0 0 64 64",
|
|
2067
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2068
|
+
children: /* @__PURE__ */ jsx4(
|
|
2069
|
+
"circle",
|
|
2070
|
+
{
|
|
2071
|
+
className: "shaka-spinner-path",
|
|
2072
|
+
cx: "32",
|
|
2073
|
+
cy: "32",
|
|
2074
|
+
r: "28",
|
|
2075
|
+
strokeWidth: "4",
|
|
2076
|
+
strokeLinecap: "round",
|
|
2077
|
+
stroke: "currentColor",
|
|
2078
|
+
fill: "none",
|
|
2079
|
+
strokeDasharray: "176",
|
|
2080
|
+
strokeDashoffset: "120"
|
|
2081
|
+
}
|
|
2082
|
+
)
|
|
2083
|
+
}
|
|
2084
|
+
) })
|
|
2085
|
+
}
|
|
2086
|
+
);
|
|
2087
|
+
|
|
2088
|
+
// src/components/ErrorScreen.tsx
|
|
2089
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2090
|
+
var ErrorScreen = ({ title, description }) => /* @__PURE__ */ jsx5("div", { className: "w-full h-full md:rounded-2xl! aspect-video bg-black flex", children: /* @__PURE__ */ jsxs3("div", { className: "bg-[#151515] text-white w-full h-full flex justify-center items-center", children: [
|
|
2091
|
+
/* @__PURE__ */ jsx5(
|
|
2092
|
+
"svg",
|
|
2093
|
+
{
|
|
2094
|
+
className: "w-24 h-24 m-6",
|
|
2095
|
+
fill: "none",
|
|
2096
|
+
stroke: "currentColor",
|
|
2097
|
+
strokeWidth: "2",
|
|
2098
|
+
style: { width: 96 },
|
|
2099
|
+
viewBox: "0 0 24 24",
|
|
2100
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2101
|
+
children: /* @__PURE__ */ jsx5(
|
|
2102
|
+
"path",
|
|
2103
|
+
{
|
|
2104
|
+
d: "M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z",
|
|
2105
|
+
strokeLinecap: "round",
|
|
2106
|
+
strokeLinejoin: "round"
|
|
2107
|
+
}
|
|
2108
|
+
)
|
|
2109
|
+
}
|
|
2110
|
+
),
|
|
2111
|
+
/* @__PURE__ */ jsxs3("div", { children: [
|
|
2112
|
+
/* @__PURE__ */ jsx5("h3", { className: "text-2xl mb-2", children: title || "Playback Error" }),
|
|
2113
|
+
/* @__PURE__ */ jsx5("div", { className: "text-lg", children: description || "Unable to play the video. Please try again later." })
|
|
2114
|
+
] })
|
|
2115
|
+
] }) });
|
|
2116
|
+
|
|
2117
|
+
// src/components/Title.tsx
|
|
2118
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
2119
|
+
var Title = ({ title }) => /* @__PURE__ */ jsx6("div", { className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4", children: /* @__PURE__ */ jsx6("h2", { className: "text-white text-xl font-semibold", children: title }) });
|
|
2120
|
+
|
|
2199
2121
|
// src/Player.tsx
|
|
2200
|
-
import { jsx as
|
|
2122
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2201
2123
|
var Player = forwardRef(
|
|
2202
2124
|
({
|
|
2203
2125
|
src,
|
|
@@ -2222,15 +2144,16 @@ var Player = forwardRef(
|
|
|
2222
2144
|
events,
|
|
2223
2145
|
locale = "en",
|
|
2224
2146
|
containerClassName,
|
|
2147
|
+
liveThresholdSeconds = 15,
|
|
2225
2148
|
publicKey,
|
|
2226
2149
|
auth,
|
|
2227
2150
|
...videoProps
|
|
2228
2151
|
}, ref) => {
|
|
2229
|
-
const videoRef =
|
|
2230
|
-
const containerRef =
|
|
2231
|
-
const [isScriptsLoaded, setIsScriptsLoaded] =
|
|
2232
|
-
const [isInitialLoading, setIsInitialLoading] =
|
|
2233
|
-
const [bfResetKey, setBfResetKey] =
|
|
2152
|
+
const videoRef = useRef8(null);
|
|
2153
|
+
const containerRef = useRef8(null);
|
|
2154
|
+
const [isScriptsLoaded, setIsScriptsLoaded] = useState3(false);
|
|
2155
|
+
const [isInitialLoading, setIsInitialLoading] = useState3(true);
|
|
2156
|
+
const [bfResetKey, setBfResetKey] = useState3(0);
|
|
2234
2157
|
const hasPlaylist = !!src && (typeof src === "string" || !!(src.url || src.drm?.widevine?.playlistUrl || src.drm?.playready?.playlistUrl || src.drm?.fairplay?.playlistUrl));
|
|
2235
2158
|
useImperativeHandle(ref, () => videoRef.current, []);
|
|
2236
2159
|
const { playerRef, initializePlayer, loadManifest, destroyPlayer, isRetrying } = useShakaPlayer({
|
|
@@ -2290,19 +2213,13 @@ var Player = forwardRef(
|
|
|
2290
2213
|
iconSizes,
|
|
2291
2214
|
locale
|
|
2292
2215
|
);
|
|
2293
|
-
const {
|
|
2294
|
-
enabled: true,
|
|
2295
|
-
liveThresholdSeconds: 15,
|
|
2296
|
-
onLiveStateChange: (isLive2) => {
|
|
2297
|
-
events?.onLiveStateChange?.(isLive2);
|
|
2298
|
-
}
|
|
2299
|
-
});
|
|
2300
|
-
useLiveIndicator(containerRef, playerRef, {
|
|
2216
|
+
const { getLiveStatus, seekToLiveEdge } = useLiveIndicator(containerRef, playerRef, {
|
|
2301
2217
|
enabled: true,
|
|
2302
2218
|
indicatorColor: "#ff0000",
|
|
2303
2219
|
indicatorSize: 8,
|
|
2304
2220
|
showPulseAnimation: true,
|
|
2305
|
-
liveThresholdSeconds
|
|
2221
|
+
liveThresholdSeconds,
|
|
2222
|
+
onLiveStatusChange: events?.onLiveStatusChange
|
|
2306
2223
|
});
|
|
2307
2224
|
const { setupAdEventListeners, cleanupAdEventListeners } = useAdEvents(playerRef, {
|
|
2308
2225
|
onAdStart: events?.onAdStart,
|
|
@@ -2372,7 +2289,7 @@ var Player = forwardRef(
|
|
|
2372
2289
|
console.error("Error initializing ads:", error);
|
|
2373
2290
|
}
|
|
2374
2291
|
}, [imaConfig, autoPlay, setupAdEventListeners, loadManifest]);
|
|
2375
|
-
|
|
2292
|
+
useEffect4(() => {
|
|
2376
2293
|
const loadRequiredScripts = async () => {
|
|
2377
2294
|
try {
|
|
2378
2295
|
const scriptLoaders = getRequiredScriptLoaders(!!imaConfig?.adTagUrl, !!system73Config?.apiKey);
|
|
@@ -2395,7 +2312,7 @@ var Player = forwardRef(
|
|
|
2395
2312
|
};
|
|
2396
2313
|
loadRequiredScripts();
|
|
2397
2314
|
}, [imaConfig?.adTagUrl, system73Config?.apiKey]);
|
|
2398
|
-
|
|
2315
|
+
useEffect4(() => {
|
|
2399
2316
|
const onPageShow = (e) => {
|
|
2400
2317
|
if (e && e.persisted) {
|
|
2401
2318
|
setBfResetKey((k) => k + 1);
|
|
@@ -2404,7 +2321,7 @@ var Player = forwardRef(
|
|
|
2404
2321
|
window.addEventListener("pageshow", onPageShow);
|
|
2405
2322
|
return () => window.removeEventListener("pageshow", onPageShow);
|
|
2406
2323
|
}, []);
|
|
2407
|
-
|
|
2324
|
+
useEffect4(() => {
|
|
2408
2325
|
const video = videoRef.current;
|
|
2409
2326
|
if (!video || !isScriptsLoaded) return;
|
|
2410
2327
|
const initialize = async () => {
|
|
@@ -2463,7 +2380,7 @@ var Player = forwardRef(
|
|
|
2463
2380
|
destroyPlayer();
|
|
2464
2381
|
};
|
|
2465
2382
|
}, [managedMode ? hasPlaylist : src, isScriptsLoaded, bfResetKey, managedMode]);
|
|
2466
|
-
|
|
2383
|
+
useEffect4(() => {
|
|
2467
2384
|
const video = videoRef.current;
|
|
2468
2385
|
if (!video) return;
|
|
2469
2386
|
const onLoadStart = () => {
|
|
@@ -2484,7 +2401,7 @@ var Player = forwardRef(
|
|
|
2484
2401
|
video.removeEventListener("playing", onPlaying);
|
|
2485
2402
|
};
|
|
2486
2403
|
}, []);
|
|
2487
|
-
|
|
2404
|
+
useEffect4(() => {
|
|
2488
2405
|
const video = videoRef.current;
|
|
2489
2406
|
if (!video) return;
|
|
2490
2407
|
video.autoplay = autoPlay;
|
|
@@ -2492,7 +2409,7 @@ var Player = forwardRef(
|
|
|
2492
2409
|
video.controls = false;
|
|
2493
2410
|
if (poster) video.poster = poster;
|
|
2494
2411
|
}, [autoPlay, loop, muted, poster, imaConfig?.adTagUrl]);
|
|
2495
|
-
|
|
2412
|
+
useEffect4(() => {
|
|
2496
2413
|
const video = videoRef.current;
|
|
2497
2414
|
if (!video) return;
|
|
2498
2415
|
video.controls = false;
|
|
@@ -2526,10 +2443,13 @@ var Player = forwardRef(
|
|
|
2526
2443
|
skipForward,
|
|
2527
2444
|
// Mux methods
|
|
2528
2445
|
updateMuxData,
|
|
2446
|
+
// Live status methods
|
|
2447
|
+
getLiveStatus,
|
|
2448
|
+
seekToLiveEdge,
|
|
2529
2449
|
// Access to underlying instances
|
|
2530
2450
|
getPlayer: () => playerRef.current,
|
|
2531
2451
|
getMuxMonitor: () => null
|
|
2532
|
-
}), [getAvailableQualities, setQuality, skipBack, skipForward, updateMuxData]);
|
|
2452
|
+
}), [getAvailableQualities, setQuality, skipBack, skipForward, updateMuxData, getLiveStatus, seekToLiveEdge]);
|
|
2533
2453
|
const isResponsive = !width && !height;
|
|
2534
2454
|
const containerClasses = twMerge2(containerClassName, "motto-video-container relative bg-[#111111] ");
|
|
2535
2455
|
const containerStyle = isResponsive ? {
|
|
@@ -2539,14 +2459,14 @@ var Player = forwardRef(
|
|
|
2539
2459
|
const videoStyle = isResponsive ? {} : { width, height };
|
|
2540
2460
|
const filteredVideoProps = { ...videoProps };
|
|
2541
2461
|
delete filteredVideoProps.controls;
|
|
2542
|
-
return /* @__PURE__ */
|
|
2462
|
+
return /* @__PURE__ */ jsxs4(
|
|
2543
2463
|
"div",
|
|
2544
2464
|
{
|
|
2545
2465
|
ref: containerRef,
|
|
2546
2466
|
className: containerClasses,
|
|
2547
2467
|
style: containerStyle,
|
|
2548
2468
|
children: [
|
|
2549
|
-
/* @__PURE__ */
|
|
2469
|
+
/* @__PURE__ */ jsx7(
|
|
2550
2470
|
"video",
|
|
2551
2471
|
{
|
|
2552
2472
|
ref: videoRef,
|
|
@@ -2559,8 +2479,7 @@ var Player = forwardRef(
|
|
|
2559
2479
|
...filteredVideoProps
|
|
2560
2480
|
}
|
|
2561
2481
|
),
|
|
2562
|
-
isInitialLoading && /* @__PURE__ */
|
|
2563
|
-
/* @__PURE__ */ jsx8(LiveBadge, { isVisible: isLiveBadgeVisible })
|
|
2482
|
+
isInitialLoading && /* @__PURE__ */ jsx7("div", { className: "absolute inset-0 flex items-center justify-center z-20 pointer-events-none", children: /* @__PURE__ */ jsx7(Loading, { className: "bg-transparent" }) })
|
|
2564
2483
|
]
|
|
2565
2484
|
}
|
|
2566
2485
|
);
|
|
@@ -2569,7 +2488,7 @@ var Player = forwardRef(
|
|
|
2569
2488
|
Player.displayName = "Player";
|
|
2570
2489
|
|
|
2571
2490
|
// src/Video.tsx
|
|
2572
|
-
import { useEffect as
|
|
2491
|
+
import { useEffect as useEffect6 } from "react";
|
|
2573
2492
|
import { twMerge as twMerge3 } from "tailwind-merge";
|
|
2574
2493
|
import { useQuery } from "@tanstack/react-query";
|
|
2575
2494
|
|
|
@@ -2710,7 +2629,7 @@ var getErrorType = (error, video) => {
|
|
|
2710
2629
|
};
|
|
2711
2630
|
|
|
2712
2631
|
// src/messages/useMessages.tsx
|
|
2713
|
-
import { useState as
|
|
2632
|
+
import { useState as useState4, useEffect as useEffect5 } from "react";
|
|
2714
2633
|
|
|
2715
2634
|
// src/messages/en.json
|
|
2716
2635
|
var en_default = {
|
|
@@ -3012,9 +2931,9 @@ var getBrowserLanguage = () => {
|
|
|
3012
2931
|
return availableLanguages[language] ? language : "en";
|
|
3013
2932
|
};
|
|
3014
2933
|
var useMessages = (locale) => {
|
|
3015
|
-
const [language, setLanguage] =
|
|
3016
|
-
const [translations, setTranslations] =
|
|
3017
|
-
|
|
2934
|
+
const [language, setLanguage] = useState4("en");
|
|
2935
|
+
const [translations, setTranslations] = useState4(availableLanguages.en);
|
|
2936
|
+
useEffect5(() => {
|
|
3018
2937
|
const lang = !!availableLanguages?.[locale] ? locale : getBrowserLanguage();
|
|
3019
2938
|
;
|
|
3020
2939
|
setLanguage(lang);
|
|
@@ -3040,7 +2959,7 @@ var useMessages = (locale) => {
|
|
|
3040
2959
|
var useMessages_default = useMessages;
|
|
3041
2960
|
|
|
3042
2961
|
// src/Video.tsx
|
|
3043
|
-
import { jsx as
|
|
2962
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3044
2963
|
var Video = ({
|
|
3045
2964
|
videoId,
|
|
3046
2965
|
publicKey,
|
|
@@ -3079,13 +2998,13 @@ var Video = ({
|
|
|
3079
2998
|
const activePlaylist = findHLSPlaylist(video);
|
|
3080
2999
|
const activePlaylistUrl = activePlaylist?.url ?? activePlaylist?.drm?.widevine?.playlistUrl ?? activePlaylist?.drm?.playready?.playlistUrl ?? activePlaylist?.drm?.fairplay?.playlistUrl;
|
|
3081
3000
|
const activePlaylistHasUrl = !!activePlaylistUrl;
|
|
3082
|
-
|
|
3001
|
+
useEffect6(() => {
|
|
3083
3002
|
if (events?.onVideoData && video) {
|
|
3084
3003
|
events.onVideoData(video);
|
|
3085
3004
|
}
|
|
3086
3005
|
}, [video, events]);
|
|
3087
3006
|
if (isLoading || !providedVideoData && !video) {
|
|
3088
|
-
return /* @__PURE__ */
|
|
3007
|
+
return /* @__PURE__ */ jsx8("div", { className: twMerge3("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx8("div", { className: "relative w-full h-full bg-[#151515]", children: /* @__PURE__ */ jsx8(Loading, {}) }) });
|
|
3089
3008
|
}
|
|
3090
3009
|
if (!isLoading && video && !activePlaylistHasUrl && events?.onEmptyPlaylists) {
|
|
3091
3010
|
events.onEmptyPlaylists();
|
|
@@ -3098,8 +3017,8 @@ var Video = ({
|
|
|
3098
3017
|
}
|
|
3099
3018
|
const title = t(errorKey) || t("DEFAULT_ERROR");
|
|
3100
3019
|
const description = t(`${errorKey}_DESCRIPTION`) || t("DEFAULT_ERROR_DESCRIPTION");
|
|
3101
|
-
return /* @__PURE__ */
|
|
3102
|
-
/* @__PURE__ */
|
|
3020
|
+
return /* @__PURE__ */ jsx8("div", { className: twMerge3("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsxs5("div", { className: "relative w-full h-full", children: [
|
|
3021
|
+
/* @__PURE__ */ jsx8(
|
|
3103
3022
|
ErrorScreen,
|
|
3104
3023
|
{
|
|
3105
3024
|
title,
|
|
@@ -3110,12 +3029,12 @@ var Video = ({
|
|
|
3110
3029
|
] }) });
|
|
3111
3030
|
}
|
|
3112
3031
|
if (!activePlaylist || !activePlaylistHasUrl) {
|
|
3113
|
-
return /* @__PURE__ */
|
|
3114
|
-
/* @__PURE__ */
|
|
3032
|
+
return /* @__PURE__ */ jsx8("div", { className: twMerge3("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsxs5("div", { className: "relative w-full h-full bg-[#151515]", children: [
|
|
3033
|
+
/* @__PURE__ */ jsx8(Title, { title: video?.name || "" }),
|
|
3115
3034
|
children
|
|
3116
3035
|
] }) });
|
|
3117
3036
|
}
|
|
3118
|
-
return /* @__PURE__ */
|
|
3037
|
+
return /* @__PURE__ */ jsx8("div", { className: twMerge3("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx8("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx8(
|
|
3119
3038
|
Player,
|
|
3120
3039
|
{
|
|
3121
3040
|
...props,
|
|
@@ -3134,10 +3053,10 @@ var Video = ({
|
|
|
3134
3053
|
};
|
|
3135
3054
|
|
|
3136
3055
|
// src/Event.tsx
|
|
3137
|
-
import { useCallback as useCallback10, useEffect as
|
|
3056
|
+
import { useCallback as useCallback10, useEffect as useEffect7, useState as useState5 } from "react";
|
|
3138
3057
|
import { twMerge as twMerge4 } from "tailwind-merge";
|
|
3139
3058
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
3140
|
-
import { Fragment, jsx as
|
|
3059
|
+
import { Fragment, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3141
3060
|
var Event = ({
|
|
3142
3061
|
publicKey,
|
|
3143
3062
|
eventId,
|
|
@@ -3168,8 +3087,8 @@ var Event = ({
|
|
|
3168
3087
|
retry: queryOptions.retry ?? 3,
|
|
3169
3088
|
retryDelay: queryOptions.retryDelay ?? ((attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4))
|
|
3170
3089
|
});
|
|
3171
|
-
const [activePlaylist, setActivePlaylist] =
|
|
3172
|
-
const [activeVideoId, setActiveVideoId] =
|
|
3090
|
+
const [activePlaylist, setActivePlaylist] = useState5();
|
|
3091
|
+
const [activeVideoId, setActiveVideoId] = useState5();
|
|
3173
3092
|
const videoIds = eventData?.videoIds ?? [];
|
|
3174
3093
|
const {
|
|
3175
3094
|
data: videosData,
|
|
@@ -3185,8 +3104,8 @@ var Event = ({
|
|
|
3185
3104
|
retry: queryOptions.retry ?? 3,
|
|
3186
3105
|
retryDelay: queryOptions.retryDelay ?? ((attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4))
|
|
3187
3106
|
});
|
|
3188
|
-
const [loadingApisState, setLoadingApisState] =
|
|
3189
|
-
|
|
3107
|
+
const [loadingApisState, setLoadingApisState] = useState5(true);
|
|
3108
|
+
useEffect7(() => {
|
|
3190
3109
|
if (videosData !== void 0) {
|
|
3191
3110
|
setLoadingApisState(false);
|
|
3192
3111
|
const videosWithPlaylists = videosData.filter(
|
|
@@ -3220,12 +3139,12 @@ var Event = ({
|
|
|
3220
3139
|
}
|
|
3221
3140
|
}, [videosData, eventData]);
|
|
3222
3141
|
const { t } = useMessages_default(locale);
|
|
3223
|
-
|
|
3142
|
+
useEffect7(() => {
|
|
3224
3143
|
if (events?.onEventData && eventData) {
|
|
3225
3144
|
events.onEventData(eventData);
|
|
3226
3145
|
}
|
|
3227
3146
|
}, [eventData, events]);
|
|
3228
|
-
|
|
3147
|
+
useEffect7(() => {
|
|
3229
3148
|
if (events?.onVideoData && activeVideoId && videosData) {
|
|
3230
3149
|
const activeVideo = videosData.find((video) => video.id === activeVideoId);
|
|
3231
3150
|
if (activeVideo) {
|
|
@@ -3233,10 +3152,10 @@ var Event = ({
|
|
|
3233
3152
|
}
|
|
3234
3153
|
}
|
|
3235
3154
|
}, [activeVideoId, videosData, events]);
|
|
3236
|
-
const [error, setError] =
|
|
3237
|
-
const [loadingPlaylist, setLoadingPlaylist] =
|
|
3155
|
+
const [error, setError] = useState5(null);
|
|
3156
|
+
const [loadingPlaylist, setLoadingPlaylist] = useState5(true);
|
|
3238
3157
|
const videosDataError = videosData?.some((video) => !!video.error);
|
|
3239
|
-
|
|
3158
|
+
useEffect7(() => {
|
|
3240
3159
|
if (isEventLoading || videosIsLoading || loadingApisState) {
|
|
3241
3160
|
return;
|
|
3242
3161
|
}
|
|
@@ -3262,7 +3181,7 @@ var Event = ({
|
|
|
3262
3181
|
videosIsLoading,
|
|
3263
3182
|
loadingApisState
|
|
3264
3183
|
]);
|
|
3265
|
-
|
|
3184
|
+
useEffect7(() => {
|
|
3266
3185
|
const eventLoadedWithNoVideos = !isEventLoading && eventData && eventData.videoIds && (!eventData.videoIds || eventData?.videoIds?.length === 0) && !loadingApisState;
|
|
3267
3186
|
const allApisLoadedWithPotentialVideos = !isEventLoading && !videosIsLoading && eventData && !loadingApisState;
|
|
3268
3187
|
if (eventLoadedWithNoVideos || allApisLoadedWithPotentialVideos) {
|
|
@@ -3272,7 +3191,7 @@ var Event = ({
|
|
|
3272
3191
|
if (error) {
|
|
3273
3192
|
const title = t(error.message)?.length ? t(error.message) : t("DEFAULT_ERROR");
|
|
3274
3193
|
const description = t(`${error.message}_DESCRIPTION`)?.length ? t(`${error.message}_DESCRIPTION`) : t("DEFAULT_ERROR_DESCRIPTION");
|
|
3275
|
-
return /* @__PURE__ */
|
|
3194
|
+
return /* @__PURE__ */ jsx9("div", { className: twMerge4("md:rounded-2xl overflow-hidden aspect-video", className), children: /* @__PURE__ */ jsx9("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx9(
|
|
3276
3195
|
ErrorScreen,
|
|
3277
3196
|
{
|
|
3278
3197
|
title,
|
|
@@ -3284,13 +3203,13 @@ var Event = ({
|
|
|
3284
3203
|
events.onEmptyPlaylists();
|
|
3285
3204
|
}
|
|
3286
3205
|
if (loadingPlaylist) {
|
|
3287
|
-
return /* @__PURE__ */
|
|
3206
|
+
return /* @__PURE__ */ jsx9("div", { className: twMerge4("", className), children: /* @__PURE__ */ jsx9("div", { className: "relative w-full aspect-video bg-[#151515]", children: /* @__PURE__ */ jsx9(Loading, {}) }) });
|
|
3288
3207
|
}
|
|
3289
3208
|
if (activePlaylist && activeVideoId && videosData) {
|
|
3290
3209
|
const activeVideo = videosData.find((video) => video.id === activeVideoId);
|
|
3291
3210
|
console.log("activeVideo?.ad?.adTagUrl", activeVideo?.ad?.adTagUrl);
|
|
3292
|
-
return /* @__PURE__ */
|
|
3293
|
-
/* @__PURE__ */
|
|
3211
|
+
return /* @__PURE__ */ jsxs6("div", { className: twMerge4("", className), children: [
|
|
3212
|
+
/* @__PURE__ */ jsx9("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx9(
|
|
3294
3213
|
Player,
|
|
3295
3214
|
{
|
|
3296
3215
|
...props,
|
|
@@ -3305,7 +3224,7 @@ var Event = ({
|
|
|
3305
3224
|
...adsEnabled && activeVideo ? { imaConfig: { adTagUrl: activeVideo?.ad?.adTagUrl } } : {}
|
|
3306
3225
|
}
|
|
3307
3226
|
) }),
|
|
3308
|
-
!hideTitle && eventData && /* @__PURE__ */
|
|
3227
|
+
!hideTitle && eventData && /* @__PURE__ */ jsx9(
|
|
3309
3228
|
TitleAndDescription,
|
|
3310
3229
|
{
|
|
3311
3230
|
title: eventData.title,
|
|
@@ -3317,7 +3236,7 @@ var Event = ({
|
|
|
3317
3236
|
] });
|
|
3318
3237
|
}
|
|
3319
3238
|
if (eventData) {
|
|
3320
|
-
return /* @__PURE__ */
|
|
3239
|
+
return /* @__PURE__ */ jsx9("div", { className: twMerge4("", className), children: /* @__PURE__ */ jsx9("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx9(
|
|
3321
3240
|
PreEvent,
|
|
3322
3241
|
{
|
|
3323
3242
|
event: eventData,
|
|
@@ -3339,12 +3258,12 @@ function PreEvent({
|
|
|
3339
3258
|
}) {
|
|
3340
3259
|
const date = new Date(event.startTime);
|
|
3341
3260
|
const now = /* @__PURE__ */ new Date();
|
|
3342
|
-
const [remainingTime, setRemainingTime] =
|
|
3261
|
+
const [remainingTime, setRemainingTime] = useState5(
|
|
3343
3262
|
date.getTime() - now.getTime()
|
|
3344
3263
|
);
|
|
3345
3264
|
const shouldBeStarted = remainingTime < 0;
|
|
3346
3265
|
const { t } = useMessages_default(locale);
|
|
3347
|
-
|
|
3266
|
+
useEffect7(() => {
|
|
3348
3267
|
const interval = setInterval(() => {
|
|
3349
3268
|
if (remainingTime < 0) {
|
|
3350
3269
|
clearInterval(interval);
|
|
@@ -3356,15 +3275,15 @@ function PreEvent({
|
|
|
3356
3275
|
}, [date, remainingTime]);
|
|
3357
3276
|
const renderCountdown = useCallback10(() => {
|
|
3358
3277
|
if (shouldBeStarted) {
|
|
3359
|
-
return /* @__PURE__ */
|
|
3278
|
+
return /* @__PURE__ */ jsx9("span", { className: "text-base-content text-xl", children: t("EVENT_NOT_STARTED") });
|
|
3360
3279
|
}
|
|
3361
3280
|
const seconds = Math.floor(remainingTime / 1e3) % 60;
|
|
3362
3281
|
const minutes = Math.floor(remainingTime / 1e3 / 60) % 60;
|
|
3363
3282
|
const hours = Math.floor(remainingTime / 1e3 / 60 / 60) % 24;
|
|
3364
3283
|
const days = Math.floor(remainingTime / 1e3 / 60 / 60 / 24);
|
|
3365
|
-
return /* @__PURE__ */
|
|
3366
|
-
/* @__PURE__ */
|
|
3367
|
-
/* @__PURE__ */
|
|
3284
|
+
return /* @__PURE__ */ jsxs6("div", { className: "grid grid-flow-col gap-1 md:gap-5 text-center auto-cols-max", children: [
|
|
3285
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
|
|
3286
|
+
/* @__PURE__ */ jsx9("span", { className: "font-mono text-lg md:text-5xl", children: /* @__PURE__ */ jsx9(
|
|
3368
3287
|
"span",
|
|
3369
3288
|
{
|
|
3370
3289
|
"aria-live": "polite",
|
|
@@ -3372,10 +3291,10 @@ function PreEvent({
|
|
|
3372
3291
|
children: days.toString()
|
|
3373
3292
|
}
|
|
3374
3293
|
) }),
|
|
3375
|
-
/* @__PURE__ */
|
|
3294
|
+
/* @__PURE__ */ jsx9("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("DAYS") })
|
|
3376
3295
|
] }),
|
|
3377
|
-
/* @__PURE__ */
|
|
3378
|
-
/* @__PURE__ */
|
|
3296
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
|
|
3297
|
+
/* @__PURE__ */ jsx9("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ jsx9(
|
|
3379
3298
|
"span",
|
|
3380
3299
|
{
|
|
3381
3300
|
style: { "--value": hours },
|
|
@@ -3384,10 +3303,10 @@ function PreEvent({
|
|
|
3384
3303
|
children: hours?.toString()?.padStart(2, "0")
|
|
3385
3304
|
}
|
|
3386
3305
|
) }),
|
|
3387
|
-
/* @__PURE__ */
|
|
3306
|
+
/* @__PURE__ */ jsx9("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("HOURS") })
|
|
3388
3307
|
] }),
|
|
3389
|
-
/* @__PURE__ */
|
|
3390
|
-
/* @__PURE__ */
|
|
3308
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
|
|
3309
|
+
/* @__PURE__ */ jsx9("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ jsx9(
|
|
3391
3310
|
"span",
|
|
3392
3311
|
{
|
|
3393
3312
|
style: { "--value": minutes },
|
|
@@ -3396,10 +3315,10 @@ function PreEvent({
|
|
|
3396
3315
|
children: minutes?.toString()?.padStart(2, "0")
|
|
3397
3316
|
}
|
|
3398
3317
|
) }),
|
|
3399
|
-
/* @__PURE__ */
|
|
3318
|
+
/* @__PURE__ */ jsx9("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("MINUTES") })
|
|
3400
3319
|
] }),
|
|
3401
|
-
/* @__PURE__ */
|
|
3402
|
-
/* @__PURE__ */
|
|
3320
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
|
|
3321
|
+
/* @__PURE__ */ jsx9("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ jsx9(
|
|
3403
3322
|
"span",
|
|
3404
3323
|
{
|
|
3405
3324
|
style: { "--value": seconds },
|
|
@@ -3408,12 +3327,12 @@ function PreEvent({
|
|
|
3408
3327
|
children: seconds?.toString()?.padStart(2, "0")
|
|
3409
3328
|
}
|
|
3410
3329
|
) }),
|
|
3411
|
-
/* @__PURE__ */
|
|
3330
|
+
/* @__PURE__ */ jsx9("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("SECONDS") })
|
|
3412
3331
|
] })
|
|
3413
3332
|
] });
|
|
3414
3333
|
}, [remainingTime, shouldBeStarted, t]);
|
|
3415
|
-
return /* @__PURE__ */
|
|
3416
|
-
/* @__PURE__ */
|
|
3334
|
+
return /* @__PURE__ */ jsx9(Fragment, { children: event?.posterUrl ? /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
3335
|
+
/* @__PURE__ */ jsx9(
|
|
3417
3336
|
"div",
|
|
3418
3337
|
{
|
|
3419
3338
|
className: "relative overflow-hidden bg-base-200 aspect-video text-base-content w-full h-full flex justify-center items-center flex-col bg-no-repeat bg-cover md:rounded-2xl",
|
|
@@ -3422,10 +3341,10 @@ function PreEvent({
|
|
|
3422
3341
|
backgroundRepeat: "no-repeat",
|
|
3423
3342
|
backgroundSize: "cover"
|
|
3424
3343
|
},
|
|
3425
|
-
children: /* @__PURE__ */
|
|
3344
|
+
children: /* @__PURE__ */ jsx9("div", { className: "relative z-10", children: renderCountdown() })
|
|
3426
3345
|
}
|
|
3427
3346
|
),
|
|
3428
|
-
!hideTitle && /* @__PURE__ */
|
|
3347
|
+
!hideTitle && /* @__PURE__ */ jsx9(
|
|
3429
3348
|
TitleAndDescription,
|
|
3430
3349
|
{
|
|
3431
3350
|
title: event.title,
|
|
@@ -3434,18 +3353,18 @@ function PreEvent({
|
|
|
3434
3353
|
locale
|
|
3435
3354
|
}
|
|
3436
3355
|
)
|
|
3437
|
-
] }) : /* @__PURE__ */
|
|
3438
|
-
/* @__PURE__ */
|
|
3356
|
+
] }) : /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
3357
|
+
/* @__PURE__ */ jsx9(
|
|
3439
3358
|
"div",
|
|
3440
3359
|
{
|
|
3441
3360
|
className: "relative overflow-hidden md:rounded-2xl bg-base-200 aspect-video text-base-content flex flex-col justify-center items-center w-full h-full bg-cover bg-center bg-no-repeat",
|
|
3442
3361
|
style: {
|
|
3443
3362
|
backgroundImage: backgroundImageUrl ? `url(${backgroundImageUrl})` : ""
|
|
3444
3363
|
},
|
|
3445
|
-
children: /* @__PURE__ */
|
|
3364
|
+
children: /* @__PURE__ */ jsx9("div", { className: "relative z-10", children: renderCountdown() })
|
|
3446
3365
|
}
|
|
3447
3366
|
),
|
|
3448
|
-
!hideTitle && /* @__PURE__ */
|
|
3367
|
+
!hideTitle && /* @__PURE__ */ jsx9(
|
|
3449
3368
|
TitleAndDescription,
|
|
3450
3369
|
{
|
|
3451
3370
|
title: event.title,
|
|
@@ -3463,9 +3382,9 @@ var TitleAndDescription = ({
|
|
|
3463
3382
|
locale = "en",
|
|
3464
3383
|
className
|
|
3465
3384
|
}) => {
|
|
3466
|
-
return /* @__PURE__ */
|
|
3467
|
-
/* @__PURE__ */
|
|
3468
|
-
startTime ? /* @__PURE__ */
|
|
3385
|
+
return /* @__PURE__ */ jsxs6("div", { className: twMerge4("mt-3 mb-6 m-event-details-ctn px-4 text-left w-full", className), children: [
|
|
3386
|
+
/* @__PURE__ */ jsx9("div", { className: "text-base md:text-xl m-event-title text-base-content font-medium", children: title }),
|
|
3387
|
+
startTime ? /* @__PURE__ */ jsxs6("div", { className: "text-xs md:text-base text-base-content/70 m-event-start-time", children: [
|
|
3469
3388
|
new Date(startTime || "").toLocaleDateString(locale || "default", {
|
|
3470
3389
|
month: "long",
|
|
3471
3390
|
year: "numeric",
|
|
@@ -3478,15 +3397,15 @@ var TitleAndDescription = ({
|
|
|
3478
3397
|
minute: "2-digit"
|
|
3479
3398
|
})
|
|
3480
3399
|
] }) : null,
|
|
3481
|
-
description && /* @__PURE__ */
|
|
3400
|
+
description && /* @__PURE__ */ jsx9("div", { className: "text-xs md:text-xs text-base-content/60 uppercase", children: description })
|
|
3482
3401
|
] });
|
|
3483
3402
|
};
|
|
3484
3403
|
|
|
3485
3404
|
// src/CreativeWork.tsx
|
|
3486
|
-
import { useEffect as
|
|
3405
|
+
import { useEffect as useEffect8, useState as useState6 } from "react";
|
|
3487
3406
|
import { twMerge as twMerge5 } from "tailwind-merge";
|
|
3488
3407
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
3489
|
-
import { Fragment as Fragment2, jsx as
|
|
3408
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3490
3409
|
var CreativeWork = ({
|
|
3491
3410
|
publicKey,
|
|
3492
3411
|
creativeWorkId,
|
|
@@ -3517,9 +3436,9 @@ var CreativeWork = ({
|
|
|
3517
3436
|
retry: queryOptions.retry ?? 3,
|
|
3518
3437
|
retryDelay: queryOptions.retryDelay ?? ((attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4))
|
|
3519
3438
|
});
|
|
3520
|
-
const [activePlaylist, setActivePlaylist] =
|
|
3521
|
-
const [activeVideoId, setActiveVideoId] =
|
|
3522
|
-
const [showCountDown, setShowCountDown] =
|
|
3439
|
+
const [activePlaylist, setActivePlaylist] = useState6();
|
|
3440
|
+
const [activeVideoId, setActiveVideoId] = useState6();
|
|
3441
|
+
const [showCountDown, setShowCountDown] = useState6(false);
|
|
3523
3442
|
const videoIds = creativeWorkData?.videoIds ?? [];
|
|
3524
3443
|
const {
|
|
3525
3444
|
data: videosData,
|
|
@@ -3535,8 +3454,8 @@ var CreativeWork = ({
|
|
|
3535
3454
|
retry: queryOptions.retry ?? 3,
|
|
3536
3455
|
retryDelay: queryOptions.retryDelay ?? ((attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4))
|
|
3537
3456
|
});
|
|
3538
|
-
const [loadingApisState, setLoadingApisState] =
|
|
3539
|
-
|
|
3457
|
+
const [loadingApisState, setLoadingApisState] = useState6(true);
|
|
3458
|
+
useEffect8(() => {
|
|
3540
3459
|
if (videosData !== void 0) {
|
|
3541
3460
|
setLoadingApisState(false);
|
|
3542
3461
|
const videosWithPlaylists = videosData.filter(
|
|
@@ -3570,7 +3489,7 @@ var CreativeWork = ({
|
|
|
3570
3489
|
}
|
|
3571
3490
|
}, [videosData, creativeWorkData]);
|
|
3572
3491
|
const { t } = useMessages_default(locale);
|
|
3573
|
-
|
|
3492
|
+
useEffect8(() => {
|
|
3574
3493
|
if (events?.onCreativeWorkData && creativeWorkData) {
|
|
3575
3494
|
events.onCreativeWorkData(creativeWorkData);
|
|
3576
3495
|
}
|
|
@@ -3578,7 +3497,7 @@ var CreativeWork = ({
|
|
|
3578
3497
|
setShowCountDown(true);
|
|
3579
3498
|
}
|
|
3580
3499
|
}, [creativeWorkData, events]);
|
|
3581
|
-
|
|
3500
|
+
useEffect8(() => {
|
|
3582
3501
|
if (events?.onVideoData && activeVideoId && videosData) {
|
|
3583
3502
|
const activeVideo = videosData.find((video) => video.id === activeVideoId);
|
|
3584
3503
|
if (activeVideo) {
|
|
@@ -3586,9 +3505,9 @@ var CreativeWork = ({
|
|
|
3586
3505
|
}
|
|
3587
3506
|
}
|
|
3588
3507
|
}, [activeVideoId, videosData, events]);
|
|
3589
|
-
const [error, setError] =
|
|
3508
|
+
const [error, setError] = useState6(null);
|
|
3590
3509
|
const videosDataError = videosData?.some((video) => !!video.error);
|
|
3591
|
-
|
|
3510
|
+
useEffect8(() => {
|
|
3592
3511
|
if (creativeWorkError || videosError || videosDataError) {
|
|
3593
3512
|
const errorObj = creativeWorkError || videosError || videosData?.find((video) => !!video.error)?.error && new Error(videosData?.find((video) => !!video.error)?.error) || new Error("default");
|
|
3594
3513
|
setError(errorObj);
|
|
@@ -3602,7 +3521,7 @@ var CreativeWork = ({
|
|
|
3602
3521
|
if (error) {
|
|
3603
3522
|
const title = t(error.message)?.length ? t(error.message) : t("DEFAULT_ERROR");
|
|
3604
3523
|
const description = t(`${error.message}_DESCRIPTION`)?.length ? t(`${error.message}_DESCRIPTION`) : t("DEFAULT_ERROR_DESCRIPTION");
|
|
3605
|
-
return /* @__PURE__ */
|
|
3524
|
+
return /* @__PURE__ */ jsx10("div", { className: twMerge5("", className), children: /* @__PURE__ */ jsx10("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx10(
|
|
3606
3525
|
ErrorScreen,
|
|
3607
3526
|
{
|
|
3608
3527
|
title,
|
|
@@ -3610,8 +3529,8 @@ var CreativeWork = ({
|
|
|
3610
3529
|
}
|
|
3611
3530
|
) }) });
|
|
3612
3531
|
}
|
|
3613
|
-
const [loadingPlaylist, setLoadingPlaylist] =
|
|
3614
|
-
|
|
3532
|
+
const [loadingPlaylist, setLoadingPlaylist] = useState6(true);
|
|
3533
|
+
useEffect8(() => {
|
|
3615
3534
|
const creativeWorkLoadedWithNoVideos = !isCreativeWorkLoading && creativeWorkData && creativeWorkData.videoIds && creativeWorkData.videoIds.length === 0;
|
|
3616
3535
|
const creativeWorkLoadedWithNoData = !isCreativeWorkLoading && creativeWorkData && !creativeWorkData.videoIds;
|
|
3617
3536
|
const isEventsFinished = !videosIsLoading && videosData && videosData.length > 0 && videosData.every((video) => video.playlists && video.playlists.length === 0);
|
|
@@ -3632,10 +3551,10 @@ var CreativeWork = ({
|
|
|
3632
3551
|
events
|
|
3633
3552
|
]);
|
|
3634
3553
|
if (isCreativeWorkLoading || videosIsLoading || loadingApisState) {
|
|
3635
|
-
return /* @__PURE__ */
|
|
3554
|
+
return /* @__PURE__ */ jsx10("div", { className: twMerge5("", className), children: /* @__PURE__ */ jsx10("div", { className: "relative w-full aspect-video bg-[#151515]", children: /* @__PURE__ */ jsx10(Loading, {}) }) });
|
|
3636
3555
|
}
|
|
3637
3556
|
if (showCountDown && creativeWorkData) {
|
|
3638
|
-
return /* @__PURE__ */
|
|
3557
|
+
return /* @__PURE__ */ jsx10("div", { className: twMerge5("", className), children: /* @__PURE__ */ jsx10("div", { className: "relative w-full h-full bg-base-200 text-base-content flex justify-center items-center flex-col", children: /* @__PURE__ */ jsx10(
|
|
3639
3558
|
PreCreativeWork,
|
|
3640
3559
|
{
|
|
3641
3560
|
creativeWork: creativeWorkData,
|
|
@@ -3648,8 +3567,8 @@ var CreativeWork = ({
|
|
|
3648
3567
|
}
|
|
3649
3568
|
if (activeVideoId && activePlaylist && !loadingPlaylist) {
|
|
3650
3569
|
const activeVideo = videosData?.find((video) => video.id === activeVideoId);
|
|
3651
|
-
return /* @__PURE__ */
|
|
3652
|
-
/* @__PURE__ */
|
|
3570
|
+
return /* @__PURE__ */ jsx10("div", { className: twMerge5("", className), children: /* @__PURE__ */ jsxs7("div", { className: "relative w-full h-full", children: [
|
|
3571
|
+
/* @__PURE__ */ jsx10(
|
|
3653
3572
|
Player,
|
|
3654
3573
|
{
|
|
3655
3574
|
...props,
|
|
@@ -3666,7 +3585,7 @@ var CreativeWork = ({
|
|
|
3666
3585
|
...adsEnabled && activeVideo?.ad?.adTagUrl ? { imaConfig: { adTagUrl: activeVideo?.ad?.adTagUrl } } : {}
|
|
3667
3586
|
}
|
|
3668
3587
|
),
|
|
3669
|
-
!hideTitle && /* @__PURE__ */
|
|
3588
|
+
!hideTitle && /* @__PURE__ */ jsx10(
|
|
3670
3589
|
TitleAndDescription2,
|
|
3671
3590
|
{
|
|
3672
3591
|
title: creativeWorkData?.title || "",
|
|
@@ -3679,7 +3598,7 @@ var CreativeWork = ({
|
|
|
3679
3598
|
] }) });
|
|
3680
3599
|
}
|
|
3681
3600
|
if (loadingPlaylist) {
|
|
3682
|
-
return /* @__PURE__ */
|
|
3601
|
+
return /* @__PURE__ */ jsx10("div", { className: twMerge5("", className), children: /* @__PURE__ */ jsx10("div", { className: "relative w-full aspect-video bg-[#151515]", children: /* @__PURE__ */ jsx10(Loading, {}) }) });
|
|
3683
3602
|
}
|
|
3684
3603
|
return null;
|
|
3685
3604
|
};
|
|
@@ -3692,12 +3611,12 @@ function PreCreativeWork({
|
|
|
3692
3611
|
}) {
|
|
3693
3612
|
const date = new Date(creativeWork.releaseTime);
|
|
3694
3613
|
const now = /* @__PURE__ */ new Date();
|
|
3695
|
-
const [remainingTime, setRemainingTime] =
|
|
3614
|
+
const [remainingTime, setRemainingTime] = useState6(
|
|
3696
3615
|
date.getTime() - now.getTime()
|
|
3697
3616
|
);
|
|
3698
3617
|
const shouldBeStarted = remainingTime < 0;
|
|
3699
3618
|
const { t } = useMessages_default(locale);
|
|
3700
|
-
|
|
3619
|
+
useEffect8(() => {
|
|
3701
3620
|
const interval = setInterval(() => {
|
|
3702
3621
|
if (remainingTime < 0) {
|
|
3703
3622
|
clearInterval(interval);
|
|
@@ -3711,15 +3630,15 @@ function PreCreativeWork({
|
|
|
3711
3630
|
}, [date, remainingTime]);
|
|
3712
3631
|
const renderCountdown = () => {
|
|
3713
3632
|
if (shouldBeStarted) {
|
|
3714
|
-
return /* @__PURE__ */
|
|
3633
|
+
return /* @__PURE__ */ jsx10("span", { className: "text-base-content text-xl", children: t("EVENT_NOT_STARTED") });
|
|
3715
3634
|
}
|
|
3716
3635
|
const seconds = Math.floor(remainingTime / 1e3) % 60;
|
|
3717
3636
|
const minutes = Math.floor(remainingTime / 1e3 / 60) % 60;
|
|
3718
3637
|
const hours = Math.floor(remainingTime / 1e3 / 60 / 60) % 24;
|
|
3719
3638
|
const days = Math.floor(remainingTime / 1e3 / 60 / 60 / 24);
|
|
3720
|
-
return /* @__PURE__ */
|
|
3721
|
-
/* @__PURE__ */
|
|
3722
|
-
/* @__PURE__ */
|
|
3639
|
+
return /* @__PURE__ */ jsxs7("div", { className: "grid grid-flow-col md:gap-5 gap-1 text-center auto-cols-max", children: [
|
|
3640
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
|
|
3641
|
+
/* @__PURE__ */ jsx10("span", { className: "font-mono text-lg md:text-5xl", children: /* @__PURE__ */ jsx10(
|
|
3723
3642
|
"span",
|
|
3724
3643
|
{
|
|
3725
3644
|
"aria-live": "polite",
|
|
@@ -3727,10 +3646,10 @@ function PreCreativeWork({
|
|
|
3727
3646
|
children: days.toString()
|
|
3728
3647
|
}
|
|
3729
3648
|
) }),
|
|
3730
|
-
/* @__PURE__ */
|
|
3649
|
+
/* @__PURE__ */ jsx10("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("DAYS") })
|
|
3731
3650
|
] }),
|
|
3732
|
-
/* @__PURE__ */
|
|
3733
|
-
/* @__PURE__ */
|
|
3651
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
|
|
3652
|
+
/* @__PURE__ */ jsx10("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ jsx10(
|
|
3734
3653
|
"span",
|
|
3735
3654
|
{
|
|
3736
3655
|
style: { "--value": hours },
|
|
@@ -3739,10 +3658,10 @@ function PreCreativeWork({
|
|
|
3739
3658
|
children: hours?.toString()?.padStart(2, "0")
|
|
3740
3659
|
}
|
|
3741
3660
|
) }),
|
|
3742
|
-
/* @__PURE__ */
|
|
3661
|
+
/* @__PURE__ */ jsx10("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("HOURS") })
|
|
3743
3662
|
] }),
|
|
3744
|
-
/* @__PURE__ */
|
|
3745
|
-
/* @__PURE__ */
|
|
3663
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
|
|
3664
|
+
/* @__PURE__ */ jsx10("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ jsx10(
|
|
3746
3665
|
"span",
|
|
3747
3666
|
{
|
|
3748
3667
|
style: { "--value": minutes },
|
|
@@ -3751,10 +3670,10 @@ function PreCreativeWork({
|
|
|
3751
3670
|
children: minutes?.toString()?.padStart(2, "0")
|
|
3752
3671
|
}
|
|
3753
3672
|
) }),
|
|
3754
|
-
/* @__PURE__ */
|
|
3673
|
+
/* @__PURE__ */ jsx10("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("MINUTES") })
|
|
3755
3674
|
] }),
|
|
3756
|
-
/* @__PURE__ */
|
|
3757
|
-
/* @__PURE__ */
|
|
3675
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col p-2 bg-neutral rounded-box text-neutral-content", children: [
|
|
3676
|
+
/* @__PURE__ */ jsx10("span", { className: "countdown font-mono text-lg md:text-5xl", children: /* @__PURE__ */ jsx10(
|
|
3758
3677
|
"span",
|
|
3759
3678
|
{
|
|
3760
3679
|
style: { "--value": seconds },
|
|
@@ -3763,12 +3682,12 @@ function PreCreativeWork({
|
|
|
3763
3682
|
children: seconds?.toString()?.padStart(2, "0")
|
|
3764
3683
|
}
|
|
3765
3684
|
) }),
|
|
3766
|
-
/* @__PURE__ */
|
|
3685
|
+
/* @__PURE__ */ jsx10("span", { className: "text-xs uppercase tracking-widest mt-1", children: t("SECONDS") })
|
|
3767
3686
|
] })
|
|
3768
3687
|
] });
|
|
3769
3688
|
};
|
|
3770
|
-
return /* @__PURE__ */
|
|
3771
|
-
/* @__PURE__ */
|
|
3689
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
3690
|
+
/* @__PURE__ */ jsxs7(
|
|
3772
3691
|
"div",
|
|
3773
3692
|
{
|
|
3774
3693
|
className: "relative overflow-hidden md:rounded-2xl bg-base-200 aspect-video text-base-content flex flex-col justify-center items-center w-full h-full bg-cover bg-center bg-no-repeat",
|
|
@@ -3776,12 +3695,12 @@ function PreCreativeWork({
|
|
|
3776
3695
|
backgroundImage: backgroundImageUrl ? `url(${backgroundImageUrl})` : ""
|
|
3777
3696
|
},
|
|
3778
3697
|
children: [
|
|
3779
|
-
backgroundImageUrl && /* @__PURE__ */
|
|
3780
|
-
/* @__PURE__ */
|
|
3698
|
+
backgroundImageUrl && /* @__PURE__ */ jsx10("div", { className: "absolute inset-0 bg-black bg-opacity-40" }),
|
|
3699
|
+
/* @__PURE__ */ jsx10("div", { className: "relative z-10", children: renderCountdown() })
|
|
3781
3700
|
]
|
|
3782
3701
|
}
|
|
3783
3702
|
),
|
|
3784
|
-
!hideTitle && /* @__PURE__ */
|
|
3703
|
+
!hideTitle && /* @__PURE__ */ jsx10(
|
|
3785
3704
|
TitleAndDescription2,
|
|
3786
3705
|
{
|
|
3787
3706
|
title: creativeWork.title,
|
|
@@ -3799,9 +3718,9 @@ var TitleAndDescription2 = ({
|
|
|
3799
3718
|
locale = "en",
|
|
3800
3719
|
className
|
|
3801
3720
|
}) => {
|
|
3802
|
-
return /* @__PURE__ */
|
|
3803
|
-
/* @__PURE__ */
|
|
3804
|
-
releaseTime ? /* @__PURE__ */
|
|
3721
|
+
return /* @__PURE__ */ jsxs7("div", { className: twMerge5("mt-3 mb-6 m-event-details-ctn px-4 text-left w-full", className), children: [
|
|
3722
|
+
/* @__PURE__ */ jsx10("div", { className: "text-base md:text-xl m-event-title text-base-content font-medium", children: title }),
|
|
3723
|
+
releaseTime ? /* @__PURE__ */ jsxs7("div", { className: "text-sm md:text-base text-base-content/70 m-event-start-time", children: [
|
|
3805
3724
|
new Date(releaseTime || "").toLocaleDateString(locale || "default", {
|
|
3806
3725
|
month: "long",
|
|
3807
3726
|
year: "numeric",
|
|
@@ -3814,13 +3733,13 @@ var TitleAndDescription2 = ({
|
|
|
3814
3733
|
minute: "2-digit"
|
|
3815
3734
|
})
|
|
3816
3735
|
] }) : null,
|
|
3817
|
-
description && /* @__PURE__ */
|
|
3736
|
+
description && /* @__PURE__ */ jsx10("div", { className: "text-xs md:text-sm text-base-content/60 uppercase", children: description })
|
|
3818
3737
|
] });
|
|
3819
3738
|
};
|
|
3820
3739
|
|
|
3821
3740
|
// src/QueryProvider.tsx
|
|
3822
3741
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3823
|
-
import { jsx as
|
|
3742
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
3824
3743
|
var queryClient = new QueryClient({
|
|
3825
3744
|
defaultOptions: {
|
|
3826
3745
|
queries: {
|
|
@@ -3834,7 +3753,7 @@ var queryClient = new QueryClient({
|
|
|
3834
3753
|
}
|
|
3835
3754
|
});
|
|
3836
3755
|
var QueryProvider = ({ children }) => {
|
|
3837
|
-
return /* @__PURE__ */
|
|
3756
|
+
return /* @__PURE__ */ jsx11(QueryClientProvider, { client: queryClient, children });
|
|
3838
3757
|
};
|
|
3839
3758
|
export {
|
|
3840
3759
|
BigPlayIcon,
|