@mottosports/motto-video-player 1.0.1-rc.57 → 1.0.1-rc.58
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.mjs
CHANGED
|
@@ -326,6 +326,9 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
326
326
|
.z-10 {
|
|
327
327
|
z-index: 10;
|
|
328
328
|
}
|
|
329
|
+
.z-20 {
|
|
330
|
+
z-index: 20;
|
|
331
|
+
}
|
|
329
332
|
.z-50 {
|
|
330
333
|
z-index: 50;
|
|
331
334
|
}
|
|
@@ -434,6 +437,9 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
434
437
|
.rounded-md {
|
|
435
438
|
border-radius: var(--radius-md);
|
|
436
439
|
}
|
|
440
|
+
.bg-\\[\\#111111\\] {
|
|
441
|
+
background-color: #111111;
|
|
442
|
+
}
|
|
437
443
|
.bg-\\[\\#151515\\] {
|
|
438
444
|
background-color: #151515;
|
|
439
445
|
}
|
|
@@ -443,6 +449,9 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
443
449
|
.bg-red-600 {
|
|
444
450
|
background-color: var(--color-red-600);
|
|
445
451
|
}
|
|
452
|
+
.bg-transparent {
|
|
453
|
+
background-color: transparent;
|
|
454
|
+
}
|
|
446
455
|
.bg-white {
|
|
447
456
|
background-color: var(--color-white);
|
|
448
457
|
}
|
|
@@ -975,7 +984,7 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
975
984
|
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;
|
|
976
985
|
}
|
|
977
986
|
.motto-video-container {
|
|
978
|
-
background:
|
|
987
|
+
background: #111111;
|
|
979
988
|
}
|
|
980
989
|
.motto-video-container video {
|
|
981
990
|
width: 100% !important;
|
|
@@ -1175,11 +1184,11 @@ var supportsWidevinePersistentLicenses = () => {
|
|
|
1175
1184
|
import initShakaPlayerMux from "@mux/mux-data-shakaplayer";
|
|
1176
1185
|
|
|
1177
1186
|
// package.json
|
|
1178
|
-
var version = "1.0.1-rc.
|
|
1187
|
+
var version = "1.0.1-rc.58";
|
|
1179
1188
|
|
|
1180
1189
|
// src/utils/licenseCache.ts
|
|
1181
1190
|
var PERSISTENT_LICENSE_PREFIX = "motto_lic_";
|
|
1182
|
-
var LICENSE_EXPIRY_MS =
|
|
1191
|
+
var LICENSE_EXPIRY_MS = 2 * 60 * 60 * 1e3;
|
|
1183
1192
|
var LICENSE_MAX_RETRY_ATTEMPTS = 10;
|
|
1184
1193
|
var getAllLicenseCacheKeys = () => {
|
|
1185
1194
|
const keys = [];
|
|
@@ -1341,6 +1350,10 @@ var useShakaPlayer = ({
|
|
|
1341
1350
|
const playerRef = useRef(null);
|
|
1342
1351
|
const [isRetrying, setIsRetrying] = useState(false);
|
|
1343
1352
|
const videoElementRef = useRef(null);
|
|
1353
|
+
const waitingForKeyTimerRef = useRef(null);
|
|
1354
|
+
const waitingForKeyHandlerRef = useRef(null);
|
|
1355
|
+
const playbackResumedHandlerRef = useRef(null);
|
|
1356
|
+
const usingPersistentLicenseRef = useRef(false);
|
|
1344
1357
|
const getManifestUrl = useCallback(() => {
|
|
1345
1358
|
let manifestUrl = src.url;
|
|
1346
1359
|
const isDRM = Boolean(src.drm);
|
|
@@ -1421,7 +1434,52 @@ var useShakaPlayer = ({
|
|
|
1421
1434
|
initDataType: session.initDataType
|
|
1422
1435
|
}));
|
|
1423
1436
|
}
|
|
1437
|
+
usingPersistentLicenseRef.current = storedSessionsMetadata.length > 0;
|
|
1424
1438
|
player.configure({ drm: drmConfig2 });
|
|
1439
|
+
const clearWaitingForKeyTimer = () => {
|
|
1440
|
+
if (waitingForKeyTimerRef.current !== null) {
|
|
1441
|
+
window.clearTimeout(waitingForKeyTimerRef.current);
|
|
1442
|
+
waitingForKeyTimerRef.current = null;
|
|
1443
|
+
}
|
|
1444
|
+
};
|
|
1445
|
+
const onPlaybackResumed = () => {
|
|
1446
|
+
clearWaitingForKeyTimer();
|
|
1447
|
+
};
|
|
1448
|
+
const onWaitingForKey = () => {
|
|
1449
|
+
if (!usingPersistentLicenseRef.current) return;
|
|
1450
|
+
if (isRetrying) return;
|
|
1451
|
+
clearWaitingForKeyTimer();
|
|
1452
|
+
waitingForKeyTimerRef.current = window.setTimeout(async () => {
|
|
1453
|
+
try {
|
|
1454
|
+
if (isRetrying) return;
|
|
1455
|
+
console.warn("Stuck waiting for decryption key; attempting license cache reset and reload...");
|
|
1456
|
+
const clearedCount = clearAllPersistentLicenses();
|
|
1457
|
+
if (clearedCount > 0 && playerRef.current) {
|
|
1458
|
+
setIsRetrying(true);
|
|
1459
|
+
await playerRef.current.load(getManifestUrl());
|
|
1460
|
+
console.log("Reloaded manifest after clearing cached licenses");
|
|
1461
|
+
} else {
|
|
1462
|
+
console.warn("No cached licenses found to clear, skipping reload");
|
|
1463
|
+
}
|
|
1464
|
+
} catch (e) {
|
|
1465
|
+
console.error("Failed during recovery from waitingforkey state:", e);
|
|
1466
|
+
onError?.(e);
|
|
1467
|
+
} finally {
|
|
1468
|
+
setIsRetrying(false);
|
|
1469
|
+
clearWaitingForKeyTimer();
|
|
1470
|
+
}
|
|
1471
|
+
}, 3e3);
|
|
1472
|
+
};
|
|
1473
|
+
try {
|
|
1474
|
+
video.addEventListener("waitingforkey", onWaitingForKey);
|
|
1475
|
+
video.addEventListener("playing", onPlaybackResumed);
|
|
1476
|
+
video.addEventListener("ended", onPlaybackResumed);
|
|
1477
|
+
video.addEventListener("pause", onPlaybackResumed);
|
|
1478
|
+
waitingForKeyHandlerRef.current = onWaitingForKey;
|
|
1479
|
+
playbackResumedHandlerRef.current = onPlaybackResumed;
|
|
1480
|
+
} catch (e) {
|
|
1481
|
+
console.warn("Failed to attach waitingforkey/playback listeners:", e);
|
|
1482
|
+
}
|
|
1425
1483
|
const netEngine = player.getNetworkingEngine();
|
|
1426
1484
|
if (netEngine) {
|
|
1427
1485
|
netEngine.registerRequestFilter((type, request) => {
|
|
@@ -1544,6 +1602,24 @@ var useShakaPlayer = ({
|
|
|
1544
1602
|
const destroyPlayer = useCallback(async () => {
|
|
1545
1603
|
if (playerRef.current) {
|
|
1546
1604
|
try {
|
|
1605
|
+
if (videoElementRef.current) {
|
|
1606
|
+
try {
|
|
1607
|
+
if (waitingForKeyHandlerRef.current) {
|
|
1608
|
+
videoElementRef.current.removeEventListener("waitingforkey", waitingForKeyHandlerRef.current);
|
|
1609
|
+
}
|
|
1610
|
+
if (playbackResumedHandlerRef.current) {
|
|
1611
|
+
videoElementRef.current.removeEventListener("playing", playbackResumedHandlerRef.current);
|
|
1612
|
+
videoElementRef.current.removeEventListener("ended", playbackResumedHandlerRef.current);
|
|
1613
|
+
videoElementRef.current.removeEventListener("pause", playbackResumedHandlerRef.current);
|
|
1614
|
+
}
|
|
1615
|
+
} catch (e) {
|
|
1616
|
+
console.warn("Error removing media event listeners:", e);
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
if (waitingForKeyTimerRef.current !== null) {
|
|
1620
|
+
window.clearTimeout(waitingForKeyTimerRef.current);
|
|
1621
|
+
waitingForKeyTimerRef.current = null;
|
|
1622
|
+
}
|
|
1547
1623
|
await playerRef.current.destroy();
|
|
1548
1624
|
} catch (error) {
|
|
1549
1625
|
console.warn("Error destroying Shaka Player:", error);
|
|
@@ -2395,7 +2471,11 @@ var Loading = ({ className }) => /* @__PURE__ */ jsxs3(
|
|
|
2395
2471
|
cy: "32",
|
|
2396
2472
|
r: "28",
|
|
2397
2473
|
strokeWidth: "4",
|
|
2398
|
-
strokeLinecap: "round"
|
|
2474
|
+
strokeLinecap: "round",
|
|
2475
|
+
stroke: "currentColor",
|
|
2476
|
+
fill: "none",
|
|
2477
|
+
strokeDasharray: "176",
|
|
2478
|
+
strokeDashoffset: "120"
|
|
2399
2479
|
}
|
|
2400
2480
|
)
|
|
2401
2481
|
}
|
|
@@ -2780,6 +2860,9 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
2780
2860
|
.z-10 {
|
|
2781
2861
|
z-index: 10;
|
|
2782
2862
|
}
|
|
2863
|
+
.z-20 {
|
|
2864
|
+
z-index: 20;
|
|
2865
|
+
}
|
|
2783
2866
|
.z-50 {
|
|
2784
2867
|
z-index: 50;
|
|
2785
2868
|
}
|
|
@@ -2888,6 +2971,9 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
2888
2971
|
.rounded-md {
|
|
2889
2972
|
border-radius: var(--radius-md);
|
|
2890
2973
|
}
|
|
2974
|
+
.bg-\\[\\#111111\\] {
|
|
2975
|
+
background-color: #111111;
|
|
2976
|
+
}
|
|
2891
2977
|
.bg-\\[\\#151515\\] {
|
|
2892
2978
|
background-color: #151515;
|
|
2893
2979
|
}
|
|
@@ -2897,6 +2983,9 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
2897
2983
|
.bg-red-600 {
|
|
2898
2984
|
background-color: var(--color-red-600);
|
|
2899
2985
|
}
|
|
2986
|
+
.bg-transparent {
|
|
2987
|
+
background-color: transparent;
|
|
2988
|
+
}
|
|
2900
2989
|
.bg-white {
|
|
2901
2990
|
background-color: var(--color-white);
|
|
2902
2991
|
}
|
|
@@ -3429,7 +3518,7 @@ styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
|
3429
3518
|
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;
|
|
3430
3519
|
}
|
|
3431
3520
|
.motto-video-container {
|
|
3432
|
-
background:
|
|
3521
|
+
background: #111111;
|
|
3433
3522
|
}
|
|
3434
3523
|
.motto-video-container video {
|
|
3435
3524
|
width: 100% !important;
|
|
@@ -3679,6 +3768,7 @@ var Player = forwardRef(
|
|
|
3679
3768
|
const videoRef = useRef8(null);
|
|
3680
3769
|
const containerRef = useRef8(null);
|
|
3681
3770
|
const [isScriptsLoaded, setIsScriptsLoaded] = useState4(false);
|
|
3771
|
+
const [isInitialLoading, setIsInitialLoading] = useState4(true);
|
|
3682
3772
|
useImperativeHandle(ref, () => videoRef.current, []);
|
|
3683
3773
|
const { playerRef, initializePlayer, destroyPlayer, isRetrying } = useShakaPlayer({
|
|
3684
3774
|
src,
|
|
@@ -3831,6 +3921,7 @@ var Player = forwardRef(
|
|
|
3831
3921
|
if (!video || !isScriptsLoaded) return;
|
|
3832
3922
|
const initialize = async () => {
|
|
3833
3923
|
try {
|
|
3924
|
+
setIsInitialLoading(true);
|
|
3834
3925
|
let system73Wrapper = null;
|
|
3835
3926
|
if (system73Config?.apiKey && window.S73ShakaPlayerWrapper) {
|
|
3836
3927
|
const playerConfig = { ...shakaConfig };
|
|
@@ -3865,6 +3956,27 @@ var Player = forwardRef(
|
|
|
3865
3956
|
destroyPlayer();
|
|
3866
3957
|
};
|
|
3867
3958
|
}, [src, isScriptsLoaded]);
|
|
3959
|
+
useEffect5(() => {
|
|
3960
|
+
const video = videoRef.current;
|
|
3961
|
+
if (!video) return;
|
|
3962
|
+
const onLoadStart = () => {
|
|
3963
|
+
setIsInitialLoading(true);
|
|
3964
|
+
};
|
|
3965
|
+
const onCanPlay = () => {
|
|
3966
|
+
setIsInitialLoading(false);
|
|
3967
|
+
};
|
|
3968
|
+
const onPlaying = () => {
|
|
3969
|
+
setIsInitialLoading(false);
|
|
3970
|
+
};
|
|
3971
|
+
video.addEventListener("loadstart", onLoadStart);
|
|
3972
|
+
video.addEventListener("canplay", onCanPlay);
|
|
3973
|
+
video.addEventListener("playing", onPlaying);
|
|
3974
|
+
return () => {
|
|
3975
|
+
video.removeEventListener("loadstart", onLoadStart);
|
|
3976
|
+
video.removeEventListener("canplay", onCanPlay);
|
|
3977
|
+
video.removeEventListener("playing", onPlaying);
|
|
3978
|
+
};
|
|
3979
|
+
}, []);
|
|
3868
3980
|
useEffect5(() => {
|
|
3869
3981
|
const video = videoRef.current;
|
|
3870
3982
|
if (!video) return;
|
|
@@ -3912,7 +4024,7 @@ var Player = forwardRef(
|
|
|
3912
4024
|
getMuxMonitor: () => null
|
|
3913
4025
|
}), [getAvailableQualities, setQuality, skipBack, skipForward, updateMuxData]);
|
|
3914
4026
|
const isResponsive = !width && !height;
|
|
3915
|
-
const containerClasses = twMerge2(containerClassName, "motto-video-container bg-
|
|
4027
|
+
const containerClasses = twMerge2(containerClassName, "motto-video-container relative bg-[#111111] ");
|
|
3916
4028
|
const containerStyle = isResponsive ? {
|
|
3917
4029
|
aspectRatio: aspectRatio.toString()
|
|
3918
4030
|
} : { width, height };
|
|
@@ -3940,6 +4052,7 @@ var Player = forwardRef(
|
|
|
3940
4052
|
...filteredVideoProps
|
|
3941
4053
|
}
|
|
3942
4054
|
),
|
|
4055
|
+
isInitialLoading && /* @__PURE__ */ jsx8("div", { className: "absolute inset-0 flex items-center justify-center z-20", children: /* @__PURE__ */ jsx8(Loading, { className: "bg-transparent" }) }),
|
|
3943
4056
|
/* @__PURE__ */ jsx8(LiveBadge, { isVisible: isLiveBadgeVisible })
|
|
3944
4057
|
]
|
|
3945
4058
|
}
|