@mottosports/motto-video-player 1.0.1-rc.57 → 1.0.1-rc.59
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.js +119 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +119 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -367,6 +367,9 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
367
367
|
.z-10 {
|
|
368
368
|
z-index: 10;
|
|
369
369
|
}
|
|
370
|
+
.z-20 {
|
|
371
|
+
z-index: 20;
|
|
372
|
+
}
|
|
370
373
|
.z-50 {
|
|
371
374
|
z-index: 50;
|
|
372
375
|
}
|
|
@@ -475,6 +478,9 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
475
478
|
.rounded-md {
|
|
476
479
|
border-radius: var(--radius-md);
|
|
477
480
|
}
|
|
481
|
+
.bg-\\[\\#111111\\] {
|
|
482
|
+
background-color: #111111;
|
|
483
|
+
}
|
|
478
484
|
.bg-\\[\\#151515\\] {
|
|
479
485
|
background-color: #151515;
|
|
480
486
|
}
|
|
@@ -484,6 +490,9 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
484
490
|
.bg-red-600 {
|
|
485
491
|
background-color: var(--color-red-600);
|
|
486
492
|
}
|
|
493
|
+
.bg-transparent {
|
|
494
|
+
background-color: transparent;
|
|
495
|
+
}
|
|
487
496
|
.bg-white {
|
|
488
497
|
background-color: var(--color-white);
|
|
489
498
|
}
|
|
@@ -1016,7 +1025,7 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
1016
1025
|
background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path fill-rule="evenodd" d="M6.75 5.25a.75.75 0 0 1 .75-.75H9a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H7.5a.75.75 0 0 1-.75-.75V5.25Zm7.5 0A.75.75 0 0 1 15 4.5h1.5a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H15a.75.75 0 0 1-.75-.75V5.25Z" clip-rule="evenodd" /></svg>') !important;
|
|
1017
1026
|
}
|
|
1018
1027
|
.motto-video-container {
|
|
1019
|
-
background:
|
|
1028
|
+
background: #111111;
|
|
1020
1029
|
}
|
|
1021
1030
|
.motto-video-container video {
|
|
1022
1031
|
width: 100% !important;
|
|
@@ -1216,11 +1225,11 @@ var supportsWidevinePersistentLicenses = () => {
|
|
|
1216
1225
|
var import_mux_data_shakaplayer = __toESM(require("@mux/mux-data-shakaplayer"));
|
|
1217
1226
|
|
|
1218
1227
|
// package.json
|
|
1219
|
-
var version = "1.0.1-rc.
|
|
1228
|
+
var version = "1.0.1-rc.59";
|
|
1220
1229
|
|
|
1221
1230
|
// src/utils/licenseCache.ts
|
|
1222
1231
|
var PERSISTENT_LICENSE_PREFIX = "motto_lic_";
|
|
1223
|
-
var LICENSE_EXPIRY_MS =
|
|
1232
|
+
var LICENSE_EXPIRY_MS = 2 * 60 * 60 * 1e3;
|
|
1224
1233
|
var LICENSE_MAX_RETRY_ATTEMPTS = 10;
|
|
1225
1234
|
var getAllLicenseCacheKeys = () => {
|
|
1226
1235
|
const keys = [];
|
|
@@ -1382,6 +1391,10 @@ var useShakaPlayer = ({
|
|
|
1382
1391
|
const playerRef = (0, import_react.useRef)(null);
|
|
1383
1392
|
const [isRetrying, setIsRetrying] = (0, import_react.useState)(false);
|
|
1384
1393
|
const videoElementRef = (0, import_react.useRef)(null);
|
|
1394
|
+
const waitingForKeyTimerRef = (0, import_react.useRef)(null);
|
|
1395
|
+
const waitingForKeyHandlerRef = (0, import_react.useRef)(null);
|
|
1396
|
+
const playbackResumedHandlerRef = (0, import_react.useRef)(null);
|
|
1397
|
+
const usingPersistentLicenseRef = (0, import_react.useRef)(false);
|
|
1385
1398
|
const getManifestUrl = (0, import_react.useCallback)(() => {
|
|
1386
1399
|
let manifestUrl = src.url;
|
|
1387
1400
|
const isDRM = Boolean(src.drm);
|
|
@@ -1462,7 +1475,52 @@ var useShakaPlayer = ({
|
|
|
1462
1475
|
initDataType: session.initDataType
|
|
1463
1476
|
}));
|
|
1464
1477
|
}
|
|
1478
|
+
usingPersistentLicenseRef.current = storedSessionsMetadata.length > 0;
|
|
1465
1479
|
player.configure({ drm: drmConfig2 });
|
|
1480
|
+
const clearWaitingForKeyTimer = () => {
|
|
1481
|
+
if (waitingForKeyTimerRef.current !== null) {
|
|
1482
|
+
window.clearTimeout(waitingForKeyTimerRef.current);
|
|
1483
|
+
waitingForKeyTimerRef.current = null;
|
|
1484
|
+
}
|
|
1485
|
+
};
|
|
1486
|
+
const onPlaybackResumed = () => {
|
|
1487
|
+
clearWaitingForKeyTimer();
|
|
1488
|
+
};
|
|
1489
|
+
const onWaitingForKey = () => {
|
|
1490
|
+
if (!usingPersistentLicenseRef.current) return;
|
|
1491
|
+
if (isRetrying) return;
|
|
1492
|
+
clearWaitingForKeyTimer();
|
|
1493
|
+
waitingForKeyTimerRef.current = window.setTimeout(async () => {
|
|
1494
|
+
try {
|
|
1495
|
+
if (isRetrying) return;
|
|
1496
|
+
console.warn("Stuck waiting for decryption key; attempting license cache reset and reload...");
|
|
1497
|
+
const clearedCount = clearAllPersistentLicenses();
|
|
1498
|
+
if (clearedCount > 0 && playerRef.current) {
|
|
1499
|
+
setIsRetrying(true);
|
|
1500
|
+
await playerRef.current.load(getManifestUrl());
|
|
1501
|
+
console.log("Reloaded manifest after clearing cached licenses");
|
|
1502
|
+
} else {
|
|
1503
|
+
console.warn("No cached licenses found to clear, skipping reload");
|
|
1504
|
+
}
|
|
1505
|
+
} catch (e) {
|
|
1506
|
+
console.error("Failed during recovery from waitingforkey state:", e);
|
|
1507
|
+
onError?.(e);
|
|
1508
|
+
} finally {
|
|
1509
|
+
setIsRetrying(false);
|
|
1510
|
+
clearWaitingForKeyTimer();
|
|
1511
|
+
}
|
|
1512
|
+
}, 3e3);
|
|
1513
|
+
};
|
|
1514
|
+
try {
|
|
1515
|
+
video.addEventListener("waitingforkey", onWaitingForKey);
|
|
1516
|
+
video.addEventListener("playing", onPlaybackResumed);
|
|
1517
|
+
video.addEventListener("ended", onPlaybackResumed);
|
|
1518
|
+
video.addEventListener("pause", onPlaybackResumed);
|
|
1519
|
+
waitingForKeyHandlerRef.current = onWaitingForKey;
|
|
1520
|
+
playbackResumedHandlerRef.current = onPlaybackResumed;
|
|
1521
|
+
} catch (e) {
|
|
1522
|
+
console.warn("Failed to attach waitingforkey/playback listeners:", e);
|
|
1523
|
+
}
|
|
1466
1524
|
const netEngine = player.getNetworkingEngine();
|
|
1467
1525
|
if (netEngine) {
|
|
1468
1526
|
netEngine.registerRequestFilter((type, request) => {
|
|
@@ -1585,6 +1643,24 @@ var useShakaPlayer = ({
|
|
|
1585
1643
|
const destroyPlayer = (0, import_react.useCallback)(async () => {
|
|
1586
1644
|
if (playerRef.current) {
|
|
1587
1645
|
try {
|
|
1646
|
+
if (videoElementRef.current) {
|
|
1647
|
+
try {
|
|
1648
|
+
if (waitingForKeyHandlerRef.current) {
|
|
1649
|
+
videoElementRef.current.removeEventListener("waitingforkey", waitingForKeyHandlerRef.current);
|
|
1650
|
+
}
|
|
1651
|
+
if (playbackResumedHandlerRef.current) {
|
|
1652
|
+
videoElementRef.current.removeEventListener("playing", playbackResumedHandlerRef.current);
|
|
1653
|
+
videoElementRef.current.removeEventListener("ended", playbackResumedHandlerRef.current);
|
|
1654
|
+
videoElementRef.current.removeEventListener("pause", playbackResumedHandlerRef.current);
|
|
1655
|
+
}
|
|
1656
|
+
} catch (e) {
|
|
1657
|
+
console.warn("Error removing media event listeners:", e);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
if (waitingForKeyTimerRef.current !== null) {
|
|
1661
|
+
window.clearTimeout(waitingForKeyTimerRef.current);
|
|
1662
|
+
waitingForKeyTimerRef.current = null;
|
|
1663
|
+
}
|
|
1588
1664
|
await playerRef.current.destroy();
|
|
1589
1665
|
} catch (error) {
|
|
1590
1666
|
console.warn("Error destroying Shaka Player:", error);
|
|
@@ -2436,7 +2512,11 @@ var Loading = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
|
2436
2512
|
cy: "32",
|
|
2437
2513
|
r: "28",
|
|
2438
2514
|
strokeWidth: "4",
|
|
2439
|
-
strokeLinecap: "round"
|
|
2515
|
+
strokeLinecap: "round",
|
|
2516
|
+
stroke: "currentColor",
|
|
2517
|
+
fill: "none",
|
|
2518
|
+
strokeDasharray: "176",
|
|
2519
|
+
strokeDashoffset: "120"
|
|
2440
2520
|
}
|
|
2441
2521
|
)
|
|
2442
2522
|
}
|
|
@@ -2821,6 +2901,9 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
2821
2901
|
.z-10 {
|
|
2822
2902
|
z-index: 10;
|
|
2823
2903
|
}
|
|
2904
|
+
.z-20 {
|
|
2905
|
+
z-index: 20;
|
|
2906
|
+
}
|
|
2824
2907
|
.z-50 {
|
|
2825
2908
|
z-index: 50;
|
|
2826
2909
|
}
|
|
@@ -2929,6 +3012,9 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
2929
3012
|
.rounded-md {
|
|
2930
3013
|
border-radius: var(--radius-md);
|
|
2931
3014
|
}
|
|
3015
|
+
.bg-\\[\\#111111\\] {
|
|
3016
|
+
background-color: #111111;
|
|
3017
|
+
}
|
|
2932
3018
|
.bg-\\[\\#151515\\] {
|
|
2933
3019
|
background-color: #151515;
|
|
2934
3020
|
}
|
|
@@ -2938,6 +3024,9 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
2938
3024
|
.bg-red-600 {
|
|
2939
3025
|
background-color: var(--color-red-600);
|
|
2940
3026
|
}
|
|
3027
|
+
.bg-transparent {
|
|
3028
|
+
background-color: transparent;
|
|
3029
|
+
}
|
|
2941
3030
|
.bg-white {
|
|
2942
3031
|
background-color: var(--color-white);
|
|
2943
3032
|
}
|
|
@@ -3470,7 +3559,7 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
3470
3559
|
background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path fill-rule="evenodd" d="M6.75 5.25a.75.75 0 0 1 .75-.75H9a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H7.5a.75.75 0 0 1-.75-.75V5.25Zm7.5 0A.75.75 0 0 1 15 4.5h1.5a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H15a.75.75 0 0 1-.75-.75V5.25Z" clip-rule="evenodd" /></svg>') !important;
|
|
3471
3560
|
}
|
|
3472
3561
|
.motto-video-container {
|
|
3473
|
-
background:
|
|
3562
|
+
background: #111111;
|
|
3474
3563
|
}
|
|
3475
3564
|
.motto-video-container video {
|
|
3476
3565
|
width: 100% !important;
|
|
@@ -3720,6 +3809,7 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3720
3809
|
const videoRef = (0, import_react12.useRef)(null);
|
|
3721
3810
|
const containerRef = (0, import_react12.useRef)(null);
|
|
3722
3811
|
const [isScriptsLoaded, setIsScriptsLoaded] = (0, import_react12.useState)(false);
|
|
3812
|
+
const [isInitialLoading, setIsInitialLoading] = (0, import_react12.useState)(true);
|
|
3723
3813
|
(0, import_react12.useImperativeHandle)(ref, () => videoRef.current, []);
|
|
3724
3814
|
const { playerRef, initializePlayer, destroyPlayer, isRetrying } = useShakaPlayer({
|
|
3725
3815
|
src,
|
|
@@ -3872,6 +3962,7 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3872
3962
|
if (!video || !isScriptsLoaded) return;
|
|
3873
3963
|
const initialize = async () => {
|
|
3874
3964
|
try {
|
|
3965
|
+
setIsInitialLoading(true);
|
|
3875
3966
|
let system73Wrapper = null;
|
|
3876
3967
|
if (system73Config?.apiKey && window.S73ShakaPlayerWrapper) {
|
|
3877
3968
|
const playerConfig = { ...shakaConfig };
|
|
@@ -3906,6 +3997,27 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3906
3997
|
destroyPlayer();
|
|
3907
3998
|
};
|
|
3908
3999
|
}, [src, isScriptsLoaded]);
|
|
4000
|
+
(0, import_react12.useEffect)(() => {
|
|
4001
|
+
const video = videoRef.current;
|
|
4002
|
+
if (!video) return;
|
|
4003
|
+
const onLoadStart = () => {
|
|
4004
|
+
setIsInitialLoading(true);
|
|
4005
|
+
};
|
|
4006
|
+
const onCanPlay = () => {
|
|
4007
|
+
setIsInitialLoading(false);
|
|
4008
|
+
};
|
|
4009
|
+
const onPlaying = () => {
|
|
4010
|
+
setIsInitialLoading(false);
|
|
4011
|
+
};
|
|
4012
|
+
video.addEventListener("loadstart", onLoadStart);
|
|
4013
|
+
video.addEventListener("canplay", onCanPlay);
|
|
4014
|
+
video.addEventListener("playing", onPlaying);
|
|
4015
|
+
return () => {
|
|
4016
|
+
video.removeEventListener("loadstart", onLoadStart);
|
|
4017
|
+
video.removeEventListener("canplay", onCanPlay);
|
|
4018
|
+
video.removeEventListener("playing", onPlaying);
|
|
4019
|
+
};
|
|
4020
|
+
}, []);
|
|
3909
4021
|
(0, import_react12.useEffect)(() => {
|
|
3910
4022
|
const video = videoRef.current;
|
|
3911
4023
|
if (!video) return;
|
|
@@ -3953,7 +4065,7 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3953
4065
|
getMuxMonitor: () => null
|
|
3954
4066
|
}), [getAvailableQualities, setQuality, skipBack, skipForward, updateMuxData]);
|
|
3955
4067
|
const isResponsive = !width && !height;
|
|
3956
|
-
const containerClasses = (0, import_tailwind_merge2.twMerge)(containerClassName, "motto-video-container bg-
|
|
4068
|
+
const containerClasses = (0, import_tailwind_merge2.twMerge)(containerClassName, "motto-video-container relative bg-[#111111] ");
|
|
3957
4069
|
const containerStyle = isResponsive ? {
|
|
3958
4070
|
aspectRatio: aspectRatio.toString()
|
|
3959
4071
|
} : { width, height };
|
|
@@ -3981,6 +4093,7 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3981
4093
|
...filteredVideoProps
|
|
3982
4094
|
}
|
|
3983
4095
|
),
|
|
4096
|
+
isInitialLoading && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute inset-0 flex items-center justify-center z-20 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Loading, { className: "bg-transparent" }) }),
|
|
3984
4097
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LiveBadge, { isVisible: isLiveBadgeVisible })
|
|
3985
4098
|
]
|
|
3986
4099
|
}
|