@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.js
CHANGED
|
@@ -67,7 +67,7 @@ function styleInject(css, { insertAt } = {}) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// src/index.css
|
|
70
|
-
styleInject(`/*! tailwindcss v4.1.
|
|
70
|
+
styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
71
71
|
@layer properties;
|
|
72
72
|
@layer theme, base, components, utilities;
|
|
73
73
|
@layer theme {
|
|
@@ -294,9 +294,6 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
294
294
|
::-webkit-datetime-edit-meridiem-field {
|
|
295
295
|
padding-block: 0;
|
|
296
296
|
}
|
|
297
|
-
::-webkit-calendar-picker-indicator {
|
|
298
|
-
line-height: 1;
|
|
299
|
-
}
|
|
300
297
|
:-moz-ui-invalid {
|
|
301
298
|
box-shadow: none;
|
|
302
299
|
}
|
|
@@ -327,7 +324,7 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
327
324
|
padding: 0;
|
|
328
325
|
margin: -1px;
|
|
329
326
|
overflow: hidden;
|
|
330
|
-
clip
|
|
327
|
+
clip: rect(0, 0, 0, 0);
|
|
331
328
|
white-space: nowrap;
|
|
332
329
|
border-width: 0;
|
|
333
330
|
}
|
|
@@ -370,6 +367,9 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
370
367
|
.z-10 {
|
|
371
368
|
z-index: 10;
|
|
372
369
|
}
|
|
370
|
+
.z-20 {
|
|
371
|
+
z-index: 20;
|
|
372
|
+
}
|
|
373
373
|
.z-50 {
|
|
374
374
|
z-index: 50;
|
|
375
375
|
}
|
|
@@ -478,6 +478,9 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
478
478
|
.rounded-md {
|
|
479
479
|
border-radius: var(--radius-md);
|
|
480
480
|
}
|
|
481
|
+
.bg-\\[\\#111111\\] {
|
|
482
|
+
background-color: #111111;
|
|
483
|
+
}
|
|
481
484
|
.bg-\\[\\#151515\\] {
|
|
482
485
|
background-color: #151515;
|
|
483
486
|
}
|
|
@@ -487,6 +490,9 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
487
490
|
.bg-red-600 {
|
|
488
491
|
background-color: var(--color-red-600);
|
|
489
492
|
}
|
|
493
|
+
.bg-transparent {
|
|
494
|
+
background-color: transparent;
|
|
495
|
+
}
|
|
490
496
|
.bg-white {
|
|
491
497
|
background-color: var(--color-white);
|
|
492
498
|
}
|
|
@@ -1019,7 +1025,7 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
1019
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;
|
|
1020
1026
|
}
|
|
1021
1027
|
.motto-video-container {
|
|
1022
|
-
background:
|
|
1028
|
+
background: #111111;
|
|
1023
1029
|
}
|
|
1024
1030
|
.motto-video-container video {
|
|
1025
1031
|
width: 100% !important;
|
|
@@ -1045,6 +1051,11 @@ html[dir=rtl] .shaka-overflow-menu .shaka-overflow-button .material-svg-icon:fir
|
|
|
1045
1051
|
margin-right: 0 !important;
|
|
1046
1052
|
margin-left: 12px !important;
|
|
1047
1053
|
}
|
|
1054
|
+
.shaka-hidden-fast-forward-container,
|
|
1055
|
+
.shaka-hidden-rewind-container {
|
|
1056
|
+
pointer-events: none !important;
|
|
1057
|
+
display: none !important;
|
|
1058
|
+
}
|
|
1048
1059
|
@property --tw-gradient-position { syntax: "*"; inherits: false; }
|
|
1049
1060
|
@property --tw-gradient-from { syntax: "<color>"; inherits: false; initial-value: #0000; }
|
|
1050
1061
|
@property --tw-gradient-via { syntax: "<color>"; inherits: false; initial-value: #0000; }
|
|
@@ -1214,11 +1225,11 @@ var supportsWidevinePersistentLicenses = () => {
|
|
|
1214
1225
|
var import_mux_data_shakaplayer = __toESM(require("@mux/mux-data-shakaplayer"));
|
|
1215
1226
|
|
|
1216
1227
|
// package.json
|
|
1217
|
-
var version = "1.0.1-rc.
|
|
1228
|
+
var version = "1.0.1-rc.58";
|
|
1218
1229
|
|
|
1219
1230
|
// src/utils/licenseCache.ts
|
|
1220
1231
|
var PERSISTENT_LICENSE_PREFIX = "motto_lic_";
|
|
1221
|
-
var LICENSE_EXPIRY_MS =
|
|
1232
|
+
var LICENSE_EXPIRY_MS = 2 * 60 * 60 * 1e3;
|
|
1222
1233
|
var LICENSE_MAX_RETRY_ATTEMPTS = 10;
|
|
1223
1234
|
var getAllLicenseCacheKeys = () => {
|
|
1224
1235
|
const keys = [];
|
|
@@ -1380,6 +1391,10 @@ var useShakaPlayer = ({
|
|
|
1380
1391
|
const playerRef = (0, import_react.useRef)(null);
|
|
1381
1392
|
const [isRetrying, setIsRetrying] = (0, import_react.useState)(false);
|
|
1382
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);
|
|
1383
1398
|
const getManifestUrl = (0, import_react.useCallback)(() => {
|
|
1384
1399
|
let manifestUrl = src.url;
|
|
1385
1400
|
const isDRM = Boolean(src.drm);
|
|
@@ -1460,7 +1475,52 @@ var useShakaPlayer = ({
|
|
|
1460
1475
|
initDataType: session.initDataType
|
|
1461
1476
|
}));
|
|
1462
1477
|
}
|
|
1478
|
+
usingPersistentLicenseRef.current = storedSessionsMetadata.length > 0;
|
|
1463
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
|
+
}
|
|
1464
1524
|
const netEngine = player.getNetworkingEngine();
|
|
1465
1525
|
if (netEngine) {
|
|
1466
1526
|
netEngine.registerRequestFilter((type, request) => {
|
|
@@ -1583,6 +1643,24 @@ var useShakaPlayer = ({
|
|
|
1583
1643
|
const destroyPlayer = (0, import_react.useCallback)(async () => {
|
|
1584
1644
|
if (playerRef.current) {
|
|
1585
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
|
+
}
|
|
1586
1664
|
await playerRef.current.destroy();
|
|
1587
1665
|
} catch (error) {
|
|
1588
1666
|
console.warn("Error destroying Shaka Player:", error);
|
|
@@ -2434,7 +2512,11 @@ var Loading = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
|
2434
2512
|
cy: "32",
|
|
2435
2513
|
r: "28",
|
|
2436
2514
|
strokeWidth: "4",
|
|
2437
|
-
strokeLinecap: "round"
|
|
2515
|
+
strokeLinecap: "round",
|
|
2516
|
+
stroke: "currentColor",
|
|
2517
|
+
fill: "none",
|
|
2518
|
+
strokeDasharray: "176",
|
|
2519
|
+
strokeDashoffset: "120"
|
|
2438
2520
|
}
|
|
2439
2521
|
)
|
|
2440
2522
|
}
|
|
@@ -2519,7 +2601,7 @@ var LiveBadge = ({
|
|
|
2519
2601
|
};
|
|
2520
2602
|
|
|
2521
2603
|
// src/styles.css
|
|
2522
|
-
styleInject(`/*! tailwindcss v4.1.
|
|
2604
|
+
styleInject(`/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com */
|
|
2523
2605
|
@layer properties;
|
|
2524
2606
|
@layer theme, base, components, utilities;
|
|
2525
2607
|
@layer theme {
|
|
@@ -2746,9 +2828,6 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
2746
2828
|
::-webkit-datetime-edit-meridiem-field {
|
|
2747
2829
|
padding-block: 0;
|
|
2748
2830
|
}
|
|
2749
|
-
::-webkit-calendar-picker-indicator {
|
|
2750
|
-
line-height: 1;
|
|
2751
|
-
}
|
|
2752
2831
|
:-moz-ui-invalid {
|
|
2753
2832
|
box-shadow: none;
|
|
2754
2833
|
}
|
|
@@ -2779,7 +2858,7 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
2779
2858
|
padding: 0;
|
|
2780
2859
|
margin: -1px;
|
|
2781
2860
|
overflow: hidden;
|
|
2782
|
-
clip
|
|
2861
|
+
clip: rect(0, 0, 0, 0);
|
|
2783
2862
|
white-space: nowrap;
|
|
2784
2863
|
border-width: 0;
|
|
2785
2864
|
}
|
|
@@ -2822,6 +2901,9 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
2822
2901
|
.z-10 {
|
|
2823
2902
|
z-index: 10;
|
|
2824
2903
|
}
|
|
2904
|
+
.z-20 {
|
|
2905
|
+
z-index: 20;
|
|
2906
|
+
}
|
|
2825
2907
|
.z-50 {
|
|
2826
2908
|
z-index: 50;
|
|
2827
2909
|
}
|
|
@@ -2930,6 +3012,9 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
2930
3012
|
.rounded-md {
|
|
2931
3013
|
border-radius: var(--radius-md);
|
|
2932
3014
|
}
|
|
3015
|
+
.bg-\\[\\#111111\\] {
|
|
3016
|
+
background-color: #111111;
|
|
3017
|
+
}
|
|
2933
3018
|
.bg-\\[\\#151515\\] {
|
|
2934
3019
|
background-color: #151515;
|
|
2935
3020
|
}
|
|
@@ -2939,6 +3024,9 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
2939
3024
|
.bg-red-600 {
|
|
2940
3025
|
background-color: var(--color-red-600);
|
|
2941
3026
|
}
|
|
3027
|
+
.bg-transparent {
|
|
3028
|
+
background-color: transparent;
|
|
3029
|
+
}
|
|
2942
3030
|
.bg-white {
|
|
2943
3031
|
background-color: var(--color-white);
|
|
2944
3032
|
}
|
|
@@ -3471,7 +3559,7 @@ styleInject(`/*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
|
|
|
3471
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;
|
|
3472
3560
|
}
|
|
3473
3561
|
.motto-video-container {
|
|
3474
|
-
background:
|
|
3562
|
+
background: #111111;
|
|
3475
3563
|
}
|
|
3476
3564
|
.motto-video-container video {
|
|
3477
3565
|
width: 100% !important;
|
|
@@ -3497,6 +3585,11 @@ html[dir=rtl] .shaka-overflow-menu .shaka-overflow-button .material-svg-icon:fir
|
|
|
3497
3585
|
margin-right: 0 !important;
|
|
3498
3586
|
margin-left: 12px !important;
|
|
3499
3587
|
}
|
|
3588
|
+
.shaka-hidden-fast-forward-container,
|
|
3589
|
+
.shaka-hidden-rewind-container {
|
|
3590
|
+
pointer-events: none !important;
|
|
3591
|
+
display: none !important;
|
|
3592
|
+
}
|
|
3500
3593
|
@property --tw-gradient-position { syntax: "*"; inherits: false; }
|
|
3501
3594
|
@property --tw-gradient-from { syntax: "<color>"; inherits: false; initial-value: #0000; }
|
|
3502
3595
|
@property --tw-gradient-via { syntax: "<color>"; inherits: false; initial-value: #0000; }
|
|
@@ -3716,6 +3809,7 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3716
3809
|
const videoRef = (0, import_react12.useRef)(null);
|
|
3717
3810
|
const containerRef = (0, import_react12.useRef)(null);
|
|
3718
3811
|
const [isScriptsLoaded, setIsScriptsLoaded] = (0, import_react12.useState)(false);
|
|
3812
|
+
const [isInitialLoading, setIsInitialLoading] = (0, import_react12.useState)(true);
|
|
3719
3813
|
(0, import_react12.useImperativeHandle)(ref, () => videoRef.current, []);
|
|
3720
3814
|
const { playerRef, initializePlayer, destroyPlayer, isRetrying } = useShakaPlayer({
|
|
3721
3815
|
src,
|
|
@@ -3868,6 +3962,7 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3868
3962
|
if (!video || !isScriptsLoaded) return;
|
|
3869
3963
|
const initialize = async () => {
|
|
3870
3964
|
try {
|
|
3965
|
+
setIsInitialLoading(true);
|
|
3871
3966
|
let system73Wrapper = null;
|
|
3872
3967
|
if (system73Config?.apiKey && window.S73ShakaPlayerWrapper) {
|
|
3873
3968
|
const playerConfig = { ...shakaConfig };
|
|
@@ -3902,6 +3997,27 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3902
3997
|
destroyPlayer();
|
|
3903
3998
|
};
|
|
3904
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
|
+
}, []);
|
|
3905
4021
|
(0, import_react12.useEffect)(() => {
|
|
3906
4022
|
const video = videoRef.current;
|
|
3907
4023
|
if (!video) return;
|
|
@@ -3949,7 +4065,7 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3949
4065
|
getMuxMonitor: () => null
|
|
3950
4066
|
}), [getAvailableQualities, setQuality, skipBack, skipForward, updateMuxData]);
|
|
3951
4067
|
const isResponsive = !width && !height;
|
|
3952
|
-
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] ");
|
|
3953
4069
|
const containerStyle = isResponsive ? {
|
|
3954
4070
|
aspectRatio: aspectRatio.toString()
|
|
3955
4071
|
} : { width, height };
|
|
@@ -3977,6 +4093,7 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3977
4093
|
...filteredVideoProps
|
|
3978
4094
|
}
|
|
3979
4095
|
),
|
|
4096
|
+
isInitialLoading && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute inset-0 flex items-center justify-center z-20", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Loading, { className: "bg-transparent" }) }),
|
|
3980
4097
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LiveBadge, { isVisible: isLiveBadgeVisible })
|
|
3981
4098
|
]
|
|
3982
4099
|
}
|