@mottosports/motto-video-player 1.0.1-rc.64 → 1.0.1-rc.65
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 +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +39 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -314,6 +314,17 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
314
314
|
*/
|
|
315
315
|
locale?: string;
|
|
316
316
|
containerClassName?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Motto public key used for authenticated requests
|
|
319
|
+
*/
|
|
320
|
+
publicKey?: string;
|
|
321
|
+
/**
|
|
322
|
+
* Authentication context for player operations
|
|
323
|
+
*/
|
|
324
|
+
auth?: {
|
|
325
|
+
mottoToken?: string;
|
|
326
|
+
userId?: string;
|
|
327
|
+
};
|
|
317
328
|
}
|
|
318
329
|
/**
|
|
319
330
|
* Mux Analytics type definitions
|
package/dist/index.d.ts
CHANGED
|
@@ -314,6 +314,17 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
314
314
|
*/
|
|
315
315
|
locale?: string;
|
|
316
316
|
containerClassName?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Motto public key used for authenticated requests
|
|
319
|
+
*/
|
|
320
|
+
publicKey?: string;
|
|
321
|
+
/**
|
|
322
|
+
* Authentication context for player operations
|
|
323
|
+
*/
|
|
324
|
+
auth?: {
|
|
325
|
+
mottoToken?: string;
|
|
326
|
+
userId?: string;
|
|
327
|
+
};
|
|
317
328
|
}
|
|
318
329
|
/**
|
|
319
330
|
* Mux Analytics type definitions
|
package/dist/index.js
CHANGED
|
@@ -1226,7 +1226,7 @@ var supportsWidevinePersistentLicenses = () => {
|
|
|
1226
1226
|
var import_mux_data_shakaplayer = __toESM(require("@mux/mux-data-shakaplayer"));
|
|
1227
1227
|
|
|
1228
1228
|
// package.json
|
|
1229
|
-
var version = "1.0.1-rc.
|
|
1229
|
+
var version = "1.0.1-rc.65";
|
|
1230
1230
|
|
|
1231
1231
|
// src/utils/licenseCache.ts
|
|
1232
1232
|
var PERSISTENT_LICENSE_PREFIX = "motto_lic_";
|
|
@@ -1387,7 +1387,9 @@ var useShakaPlayer = ({
|
|
|
1387
1387
|
onPlayerReady,
|
|
1388
1388
|
muxConfig,
|
|
1389
1389
|
onMuxReady,
|
|
1390
|
-
onMuxDataUpdate
|
|
1390
|
+
onMuxDataUpdate,
|
|
1391
|
+
publicKey,
|
|
1392
|
+
mottoToken
|
|
1391
1393
|
}) => {
|
|
1392
1394
|
const playerRef = (0, import_react.useRef)(null);
|
|
1393
1395
|
const [isRetrying, setIsRetrying] = (0, import_react.useState)(false);
|
|
@@ -1528,7 +1530,12 @@ var useShakaPlayer = ({
|
|
|
1528
1530
|
if (netEngine) {
|
|
1529
1531
|
netEngine.registerRequestFilter((type, request) => {
|
|
1530
1532
|
if (type === import_shaka_player.default.net.NetworkingEngine.RequestType.LICENSE) {
|
|
1531
|
-
|
|
1533
|
+
if (publicKey) {
|
|
1534
|
+
request.headers["authorization"] = `Bearer ${publicKey}`;
|
|
1535
|
+
}
|
|
1536
|
+
if (mottoToken) {
|
|
1537
|
+
request.headers["x-motto-token"] = mottoToken;
|
|
1538
|
+
}
|
|
1532
1539
|
}
|
|
1533
1540
|
});
|
|
1534
1541
|
netEngine.registerResponseFilter((type, response) => {
|
|
@@ -1650,7 +1657,8 @@ var useShakaPlayer = ({
|
|
|
1650
1657
|
return initializePlayerInternal(video);
|
|
1651
1658
|
}, [initializePlayerInternal]);
|
|
1652
1659
|
const destroyPlayer = (0, import_react.useCallback)(async () => {
|
|
1653
|
-
|
|
1660
|
+
const playerInstance = playerRef.current;
|
|
1661
|
+
if (playerInstance) {
|
|
1654
1662
|
try {
|
|
1655
1663
|
if (videoElementRef.current) {
|
|
1656
1664
|
try {
|
|
@@ -1671,19 +1679,21 @@ var useShakaPlayer = ({
|
|
|
1671
1679
|
waitingForKeyTimerRef.current = null;
|
|
1672
1680
|
}
|
|
1673
1681
|
try {
|
|
1674
|
-
if (drmExpirationHandlerRef.current &&
|
|
1675
|
-
|
|
1682
|
+
if (drmExpirationHandlerRef.current && playerInstance.removeEventListener) {
|
|
1683
|
+
playerInstance.removeEventListener("drmsessionupdate", drmExpirationHandlerRef.current);
|
|
1676
1684
|
}
|
|
1677
1685
|
} catch (e) {
|
|
1678
1686
|
console.warn("Error removing DRM expiration listener:", e);
|
|
1679
1687
|
} finally {
|
|
1680
1688
|
drmExpirationHandlerRef.current = null;
|
|
1681
1689
|
}
|
|
1682
|
-
await
|
|
1690
|
+
await playerInstance.destroy();
|
|
1683
1691
|
} catch (error) {
|
|
1684
1692
|
console.warn("Error destroying Shaka Player:", error);
|
|
1685
1693
|
} finally {
|
|
1686
|
-
playerRef.current
|
|
1694
|
+
if (playerRef.current === playerInstance) {
|
|
1695
|
+
playerRef.current = null;
|
|
1696
|
+
}
|
|
1687
1697
|
storedPersistentThisLoadRef.current = false;
|
|
1688
1698
|
}
|
|
1689
1699
|
}
|
|
@@ -2190,14 +2200,18 @@ var useShakaUI = (playerRef, containerRef, videoRef, controls, chromecastConfig,
|
|
|
2190
2200
|
}
|
|
2191
2201
|
return ui;
|
|
2192
2202
|
}, [controls, containerRef, playerRef, videoRef, chromecastConfig, seekbarColors, onSkipBack, onSkipForward, iconSizes, locale]);
|
|
2193
|
-
const destroyUI = (0, import_react6.useCallback)(() => {
|
|
2194
|
-
|
|
2203
|
+
const destroyUI = (0, import_react6.useCallback)(async () => {
|
|
2204
|
+
const uiInstance = uiRef.current;
|
|
2205
|
+
if (uiInstance) {
|
|
2195
2206
|
try {
|
|
2196
|
-
|
|
2207
|
+
await uiInstance.destroy();
|
|
2197
2208
|
} catch (error) {
|
|
2198
2209
|
console.error("Error destroying UI:", error);
|
|
2210
|
+
} finally {
|
|
2211
|
+
if (uiRef.current === uiInstance) {
|
|
2212
|
+
uiRef.current = null;
|
|
2213
|
+
}
|
|
2199
2214
|
}
|
|
2200
|
-
uiRef.current = null;
|
|
2201
2215
|
}
|
|
2202
2216
|
}, []);
|
|
2203
2217
|
return {
|
|
@@ -3823,6 +3837,8 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3823
3837
|
events,
|
|
3824
3838
|
locale = "en",
|
|
3825
3839
|
containerClassName,
|
|
3840
|
+
publicKey,
|
|
3841
|
+
auth,
|
|
3826
3842
|
...videoProps
|
|
3827
3843
|
}, ref) => {
|
|
3828
3844
|
const videoRef = (0, import_react12.useRef)(null);
|
|
@@ -3839,7 +3855,9 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3839
3855
|
onPlayerReady: events?.onPlayerReady,
|
|
3840
3856
|
muxConfig,
|
|
3841
3857
|
onMuxReady: events?.onMuxReady,
|
|
3842
|
-
onMuxDataUpdate: events?.onMuxDataUpdate
|
|
3858
|
+
onMuxDataUpdate: events?.onMuxDataUpdate,
|
|
3859
|
+
publicKey,
|
|
3860
|
+
mottoToken: auth?.mottoToken
|
|
3843
3861
|
});
|
|
3844
3862
|
const {
|
|
3845
3863
|
initializeMux,
|
|
@@ -4686,6 +4704,8 @@ var Video = ({
|
|
|
4686
4704
|
events,
|
|
4687
4705
|
locale,
|
|
4688
4706
|
containerClassName: "w-full h-full",
|
|
4707
|
+
publicKey,
|
|
4708
|
+
auth,
|
|
4689
4709
|
children
|
|
4690
4710
|
}
|
|
4691
4711
|
) }) });
|
|
@@ -4854,7 +4874,9 @@ var Event = ({
|
|
|
4854
4874
|
className: (0, import_tailwind_merge4.twMerge)(className, "peer aspect-video"),
|
|
4855
4875
|
events,
|
|
4856
4876
|
locale,
|
|
4857
|
-
containerClassName: "w-full h-full"
|
|
4877
|
+
containerClassName: "w-full h-full",
|
|
4878
|
+
publicKey,
|
|
4879
|
+
auth
|
|
4858
4880
|
}
|
|
4859
4881
|
) }),
|
|
4860
4882
|
!hideTitle && eventData && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
@@ -5210,7 +5232,9 @@ var CreativeWork = ({
|
|
|
5210
5232
|
},
|
|
5211
5233
|
src: activePlaylist,
|
|
5212
5234
|
locale,
|
|
5213
|
-
containerClassName: "w-full h-full"
|
|
5235
|
+
containerClassName: "w-full h-full",
|
|
5236
|
+
publicKey,
|
|
5237
|
+
auth
|
|
5214
5238
|
}
|
|
5215
5239
|
),
|
|
5216
5240
|
!hideTitle && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|