@mottosports/motto-video-player 1.0.1-rc.56 → 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 +133 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +133 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -26,7 +26,7 @@ function styleInject(css, { insertAt } = {}) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// src/index.css
|
|
29
|
-
styleInject(`/*! tailwindcss v4.1.
|
|
29
|
+
styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
30
30
|
@layer properties;
|
|
31
31
|
@layer theme, base, components, utilities;
|
|
32
32
|
@layer theme {
|
|
@@ -253,9 +253,6 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
253
253
|
::-webkit-datetime-edit-meridiem-field {
|
|
254
254
|
padding-block: 0;
|
|
255
255
|
}
|
|
256
|
-
::-webkit-calendar-picker-indicator {
|
|
257
|
-
line-height: 1;
|
|
258
|
-
}
|
|
259
256
|
:-moz-ui-invalid {
|
|
260
257
|
box-shadow: none;
|
|
261
258
|
}
|
|
@@ -286,7 +283,7 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
286
283
|
padding: 0;
|
|
287
284
|
margin: -1px;
|
|
288
285
|
overflow: hidden;
|
|
289
|
-
clip
|
|
286
|
+
clip: rect(0, 0, 0, 0);
|
|
290
287
|
white-space: nowrap;
|
|
291
288
|
border-width: 0;
|
|
292
289
|
}
|
|
@@ -329,6 +326,9 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
329
326
|
.z-10 {
|
|
330
327
|
z-index: 10;
|
|
331
328
|
}
|
|
329
|
+
.z-20 {
|
|
330
|
+
z-index: 20;
|
|
331
|
+
}
|
|
332
332
|
.z-50 {
|
|
333
333
|
z-index: 50;
|
|
334
334
|
}
|
|
@@ -437,6 +437,9 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
437
437
|
.rounded-md {
|
|
438
438
|
border-radius: var(--radius-md);
|
|
439
439
|
}
|
|
440
|
+
.bg-\\[\\#111111\\] {
|
|
441
|
+
background-color: #111111;
|
|
442
|
+
}
|
|
440
443
|
.bg-\\[\\#151515\\] {
|
|
441
444
|
background-color: #151515;
|
|
442
445
|
}
|
|
@@ -446,6 +449,9 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
446
449
|
.bg-red-600 {
|
|
447
450
|
background-color: var(--color-red-600);
|
|
448
451
|
}
|
|
452
|
+
.bg-transparent {
|
|
453
|
+
background-color: transparent;
|
|
454
|
+
}
|
|
449
455
|
.bg-white {
|
|
450
456
|
background-color: var(--color-white);
|
|
451
457
|
}
|
|
@@ -978,7 +984,7 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
978
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;
|
|
979
985
|
}
|
|
980
986
|
.motto-video-container {
|
|
981
|
-
background:
|
|
987
|
+
background: #111111;
|
|
982
988
|
}
|
|
983
989
|
.motto-video-container video {
|
|
984
990
|
width: 100% !important;
|
|
@@ -1004,6 +1010,11 @@ html[dir=rtl] .shaka-overflow-menu .shaka-overflow-button .material-svg-icon:fir
|
|
|
1004
1010
|
margin-right: 0 !important;
|
|
1005
1011
|
margin-left: 12px !important;
|
|
1006
1012
|
}
|
|
1013
|
+
.shaka-hidden-fast-forward-container,
|
|
1014
|
+
.shaka-hidden-rewind-container {
|
|
1015
|
+
pointer-events: none !important;
|
|
1016
|
+
display: none !important;
|
|
1017
|
+
}
|
|
1007
1018
|
@property --tw-gradient-position { syntax: "*"; inherits: false; }
|
|
1008
1019
|
@property --tw-gradient-from { syntax: "<color>"; inherits: false; initial-value: #0000; }
|
|
1009
1020
|
@property --tw-gradient-via { syntax: "<color>"; inherits: false; initial-value: #0000; }
|
|
@@ -1173,11 +1184,11 @@ var supportsWidevinePersistentLicenses = () => {
|
|
|
1173
1184
|
import initShakaPlayerMux from "@mux/mux-data-shakaplayer";
|
|
1174
1185
|
|
|
1175
1186
|
// package.json
|
|
1176
|
-
var version = "1.0.1-rc.
|
|
1187
|
+
var version = "1.0.1-rc.58";
|
|
1177
1188
|
|
|
1178
1189
|
// src/utils/licenseCache.ts
|
|
1179
1190
|
var PERSISTENT_LICENSE_PREFIX = "motto_lic_";
|
|
1180
|
-
var LICENSE_EXPIRY_MS =
|
|
1191
|
+
var LICENSE_EXPIRY_MS = 2 * 60 * 60 * 1e3;
|
|
1181
1192
|
var LICENSE_MAX_RETRY_ATTEMPTS = 10;
|
|
1182
1193
|
var getAllLicenseCacheKeys = () => {
|
|
1183
1194
|
const keys = [];
|
|
@@ -1339,6 +1350,10 @@ var useShakaPlayer = ({
|
|
|
1339
1350
|
const playerRef = useRef(null);
|
|
1340
1351
|
const [isRetrying, setIsRetrying] = useState(false);
|
|
1341
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);
|
|
1342
1357
|
const getManifestUrl = useCallback(() => {
|
|
1343
1358
|
let manifestUrl = src.url;
|
|
1344
1359
|
const isDRM = Boolean(src.drm);
|
|
@@ -1419,7 +1434,52 @@ var useShakaPlayer = ({
|
|
|
1419
1434
|
initDataType: session.initDataType
|
|
1420
1435
|
}));
|
|
1421
1436
|
}
|
|
1437
|
+
usingPersistentLicenseRef.current = storedSessionsMetadata.length > 0;
|
|
1422
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
|
+
}
|
|
1423
1483
|
const netEngine = player.getNetworkingEngine();
|
|
1424
1484
|
if (netEngine) {
|
|
1425
1485
|
netEngine.registerRequestFilter((type, request) => {
|
|
@@ -1542,6 +1602,24 @@ var useShakaPlayer = ({
|
|
|
1542
1602
|
const destroyPlayer = useCallback(async () => {
|
|
1543
1603
|
if (playerRef.current) {
|
|
1544
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
|
+
}
|
|
1545
1623
|
await playerRef.current.destroy();
|
|
1546
1624
|
} catch (error) {
|
|
1547
1625
|
console.warn("Error destroying Shaka Player:", error);
|
|
@@ -2393,7 +2471,11 @@ var Loading = ({ className }) => /* @__PURE__ */ jsxs3(
|
|
|
2393
2471
|
cy: "32",
|
|
2394
2472
|
r: "28",
|
|
2395
2473
|
strokeWidth: "4",
|
|
2396
|
-
strokeLinecap: "round"
|
|
2474
|
+
strokeLinecap: "round",
|
|
2475
|
+
stroke: "currentColor",
|
|
2476
|
+
fill: "none",
|
|
2477
|
+
strokeDasharray: "176",
|
|
2478
|
+
strokeDashoffset: "120"
|
|
2397
2479
|
}
|
|
2398
2480
|
)
|
|
2399
2481
|
}
|
|
@@ -2478,7 +2560,7 @@ var LiveBadge = ({
|
|
|
2478
2560
|
};
|
|
2479
2561
|
|
|
2480
2562
|
// src/styles.css
|
|
2481
|
-
styleInject(`/*! tailwindcss v4.1.
|
|
2563
|
+
styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
2482
2564
|
@layer properties;
|
|
2483
2565
|
@layer theme, base, components, utilities;
|
|
2484
2566
|
@layer theme {
|
|
@@ -2705,9 +2787,6 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
2705
2787
|
::-webkit-datetime-edit-meridiem-field {
|
|
2706
2788
|
padding-block: 0;
|
|
2707
2789
|
}
|
|
2708
|
-
::-webkit-calendar-picker-indicator {
|
|
2709
|
-
line-height: 1;
|
|
2710
|
-
}
|
|
2711
2790
|
:-moz-ui-invalid {
|
|
2712
2791
|
box-shadow: none;
|
|
2713
2792
|
}
|
|
@@ -2738,7 +2817,7 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
2738
2817
|
padding: 0;
|
|
2739
2818
|
margin: -1px;
|
|
2740
2819
|
overflow: hidden;
|
|
2741
|
-
clip
|
|
2820
|
+
clip: rect(0, 0, 0, 0);
|
|
2742
2821
|
white-space: nowrap;
|
|
2743
2822
|
border-width: 0;
|
|
2744
2823
|
}
|
|
@@ -2781,6 +2860,9 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
2781
2860
|
.z-10 {
|
|
2782
2861
|
z-index: 10;
|
|
2783
2862
|
}
|
|
2863
|
+
.z-20 {
|
|
2864
|
+
z-index: 20;
|
|
2865
|
+
}
|
|
2784
2866
|
.z-50 {
|
|
2785
2867
|
z-index: 50;
|
|
2786
2868
|
}
|
|
@@ -2889,6 +2971,9 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
2889
2971
|
.rounded-md {
|
|
2890
2972
|
border-radius: var(--radius-md);
|
|
2891
2973
|
}
|
|
2974
|
+
.bg-\\[\\#111111\\] {
|
|
2975
|
+
background-color: #111111;
|
|
2976
|
+
}
|
|
2892
2977
|
.bg-\\[\\#151515\\] {
|
|
2893
2978
|
background-color: #151515;
|
|
2894
2979
|
}
|
|
@@ -2898,6 +2983,9 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
2898
2983
|
.bg-red-600 {
|
|
2899
2984
|
background-color: var(--color-red-600);
|
|
2900
2985
|
}
|
|
2986
|
+
.bg-transparent {
|
|
2987
|
+
background-color: transparent;
|
|
2988
|
+
}
|
|
2901
2989
|
.bg-white {
|
|
2902
2990
|
background-color: var(--color-white);
|
|
2903
2991
|
}
|
|
@@ -3430,7 +3518,7 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
3430
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;
|
|
3431
3519
|
}
|
|
3432
3520
|
.motto-video-container {
|
|
3433
|
-
background:
|
|
3521
|
+
background: #111111;
|
|
3434
3522
|
}
|
|
3435
3523
|
.motto-video-container video {
|
|
3436
3524
|
width: 100% !important;
|
|
@@ -3456,6 +3544,11 @@ html[dir=rtl] .shaka-overflow-menu .shaka-overflow-button .material-svg-icon:fir
|
|
|
3456
3544
|
margin-right: 0 !important;
|
|
3457
3545
|
margin-left: 12px !important;
|
|
3458
3546
|
}
|
|
3547
|
+
.shaka-hidden-fast-forward-container,
|
|
3548
|
+
.shaka-hidden-rewind-container {
|
|
3549
|
+
pointer-events: none !important;
|
|
3550
|
+
display: none !important;
|
|
3551
|
+
}
|
|
3459
3552
|
@property --tw-gradient-position { syntax: "*"; inherits: false; }
|
|
3460
3553
|
@property --tw-gradient-from { syntax: "<color>"; inherits: false; initial-value: #0000; }
|
|
3461
3554
|
@property --tw-gradient-via { syntax: "<color>"; inherits: false; initial-value: #0000; }
|
|
@@ -3675,6 +3768,7 @@ var Player = forwardRef(
|
|
|
3675
3768
|
const videoRef = useRef8(null);
|
|
3676
3769
|
const containerRef = useRef8(null);
|
|
3677
3770
|
const [isScriptsLoaded, setIsScriptsLoaded] = useState4(false);
|
|
3771
|
+
const [isInitialLoading, setIsInitialLoading] = useState4(true);
|
|
3678
3772
|
useImperativeHandle(ref, () => videoRef.current, []);
|
|
3679
3773
|
const { playerRef, initializePlayer, destroyPlayer, isRetrying } = useShakaPlayer({
|
|
3680
3774
|
src,
|
|
@@ -3827,6 +3921,7 @@ var Player = forwardRef(
|
|
|
3827
3921
|
if (!video || !isScriptsLoaded) return;
|
|
3828
3922
|
const initialize = async () => {
|
|
3829
3923
|
try {
|
|
3924
|
+
setIsInitialLoading(true);
|
|
3830
3925
|
let system73Wrapper = null;
|
|
3831
3926
|
if (system73Config?.apiKey && window.S73ShakaPlayerWrapper) {
|
|
3832
3927
|
const playerConfig = { ...shakaConfig };
|
|
@@ -3861,6 +3956,27 @@ var Player = forwardRef(
|
|
|
3861
3956
|
destroyPlayer();
|
|
3862
3957
|
};
|
|
3863
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
|
+
}, []);
|
|
3864
3980
|
useEffect5(() => {
|
|
3865
3981
|
const video = videoRef.current;
|
|
3866
3982
|
if (!video) return;
|
|
@@ -3908,7 +4024,7 @@ var Player = forwardRef(
|
|
|
3908
4024
|
getMuxMonitor: () => null
|
|
3909
4025
|
}), [getAvailableQualities, setQuality, skipBack, skipForward, updateMuxData]);
|
|
3910
4026
|
const isResponsive = !width && !height;
|
|
3911
|
-
const containerClasses = twMerge2(containerClassName, "motto-video-container bg-
|
|
4027
|
+
const containerClasses = twMerge2(containerClassName, "motto-video-container relative bg-[#111111] ");
|
|
3912
4028
|
const containerStyle = isResponsive ? {
|
|
3913
4029
|
aspectRatio: aspectRatio.toString()
|
|
3914
4030
|
} : { width, height };
|
|
@@ -3936,6 +4052,7 @@ var Player = forwardRef(
|
|
|
3936
4052
|
...filteredVideoProps
|
|
3937
4053
|
}
|
|
3938
4054
|
),
|
|
4055
|
+
isInitialLoading && /* @__PURE__ */ jsx8("div", { className: "absolute inset-0 flex items-center justify-center z-20", children: /* @__PURE__ */ jsx8(Loading, { className: "bg-transparent" }) }),
|
|
3939
4056
|
/* @__PURE__ */ jsx8(LiveBadge, { isVisible: isLiveBadgeVisible })
|
|
3940
4057
|
]
|
|
3941
4058
|
}
|