@mottosports/motto-video-player 1.0.1-rc.53 → 1.0.1-rc.55
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 +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +25 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -308,6 +308,11 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
308
308
|
* Event callbacks
|
|
309
309
|
*/
|
|
310
310
|
events?: PlayerEvents;
|
|
311
|
+
/**
|
|
312
|
+
* Locale for Shaka Player UI localization (e.g., 'en', 'ar', 'es')
|
|
313
|
+
* Defaults to 'en' if not provided
|
|
314
|
+
*/
|
|
315
|
+
locale?: string;
|
|
311
316
|
containerClassName?: string;
|
|
312
317
|
}
|
|
313
318
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -308,6 +308,11 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
308
308
|
* Event callbacks
|
|
309
309
|
*/
|
|
310
310
|
events?: PlayerEvents;
|
|
311
|
+
/**
|
|
312
|
+
* Locale for Shaka Player UI localization (e.g., 'en', 'ar', 'es')
|
|
313
|
+
* Defaults to 'en' if not provided
|
|
314
|
+
*/
|
|
315
|
+
locale?: string;
|
|
311
316
|
containerClassName?: string;
|
|
312
317
|
}
|
|
313
318
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1211,7 +1211,7 @@ var supportsWidevinePersistentLicenses = () => {
|
|
|
1211
1211
|
var import_mux_data_shakaplayer = __toESM(require("@mux/mux-data-shakaplayer"));
|
|
1212
1212
|
|
|
1213
1213
|
// package.json
|
|
1214
|
-
var version = "1.0.1-rc.
|
|
1214
|
+
var version = "1.0.1-rc.55";
|
|
1215
1215
|
|
|
1216
1216
|
// src/utils/licenseCache.ts
|
|
1217
1217
|
var PERSISTENT_LICENSE_PREFIX = "motto_lic_";
|
|
@@ -2000,7 +2000,7 @@ var SkipForwardButtonFactory = class {
|
|
|
2000
2000
|
return new SkipForwardButton(rootElement, controls, this.onSkipForward, this.iconSize);
|
|
2001
2001
|
}
|
|
2002
2002
|
};
|
|
2003
|
-
var useShakaUI = (playerRef, containerRef, videoRef, controls, chromecastConfig, seekbarColors, onSkipBack, onSkipForward, iconSizes) => {
|
|
2003
|
+
var useShakaUI = (playerRef, containerRef, videoRef, controls, chromecastConfig, seekbarColors, onSkipBack, onSkipForward, iconSizes, locale = "en") => {
|
|
2004
2004
|
const uiRef = (0, import_react6.useRef)(null);
|
|
2005
2005
|
const registeredElements = (0, import_react6.useRef)(/* @__PURE__ */ new Set());
|
|
2006
2006
|
const initializeUI = (0, import_react6.useCallback)(async () => {
|
|
@@ -2017,6 +2017,14 @@ var useShakaUI = (playerRef, containerRef, videoRef, controls, chromecastConfig,
|
|
|
2017
2017
|
}
|
|
2018
2018
|
const ui = new import_shaka_player3.ui.Overlay(playerRef.current, containerRef.current, videoRef.current);
|
|
2019
2019
|
uiRef.current = ui;
|
|
2020
|
+
if (locale !== "en") {
|
|
2021
|
+
try {
|
|
2022
|
+
ui.getControls().getLocalization().changeLocale([locale]);
|
|
2023
|
+
console.log(`Set locale to '${locale}'`);
|
|
2024
|
+
} catch (error) {
|
|
2025
|
+
console.warn(`Failed to set locale to '${locale}', falling back to 'en':`, error);
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2020
2028
|
const isMobile = window.innerWidth <= 767;
|
|
2021
2029
|
const controlPanelElements = [
|
|
2022
2030
|
...isMobile ? [] : ["skip_back_button"],
|
|
@@ -2081,7 +2089,7 @@ var useShakaUI = (playerRef, containerRef, videoRef, controls, chromecastConfig,
|
|
|
2081
2089
|
}
|
|
2082
2090
|
}
|
|
2083
2091
|
return ui;
|
|
2084
|
-
}, [controls, containerRef, playerRef, videoRef, chromecastConfig, seekbarColors, onSkipBack, onSkipForward, iconSizes]);
|
|
2092
|
+
}, [controls, containerRef, playerRef, videoRef, chromecastConfig, seekbarColors, onSkipBack, onSkipForward, iconSizes, locale]);
|
|
2085
2093
|
const destroyUI = (0, import_react6.useCallback)(() => {
|
|
2086
2094
|
if (uiRef.current) {
|
|
2087
2095
|
try {
|
|
@@ -3695,6 +3703,7 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3695
3703
|
seekbarConfig,
|
|
3696
3704
|
iconSizes,
|
|
3697
3705
|
events,
|
|
3706
|
+
locale = "en",
|
|
3698
3707
|
containerClassName,
|
|
3699
3708
|
...videoProps
|
|
3700
3709
|
}, ref) => {
|
|
@@ -3751,7 +3760,8 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3751
3760
|
seekbarConfig,
|
|
3752
3761
|
events?.onSkipBack,
|
|
3753
3762
|
events?.onSkipForward,
|
|
3754
|
-
iconSizes
|
|
3763
|
+
iconSizes,
|
|
3764
|
+
locale
|
|
3755
3765
|
);
|
|
3756
3766
|
const { isLive, isVisible: isLiveBadgeVisible } = useLiveBadge(playerRef, {
|
|
3757
3767
|
enabled: true,
|
|
@@ -3933,7 +3943,7 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3933
3943
|
getMuxMonitor: () => null
|
|
3934
3944
|
}), [getAvailableQualities, setQuality, skipBack, skipForward, updateMuxData]);
|
|
3935
3945
|
const isResponsive = !width && !height;
|
|
3936
|
-
const containerClasses = (0, import_tailwind_merge2.twMerge)(containerClassName, "motto-video-container bg-black
|
|
3946
|
+
const containerClasses = (0, import_tailwind_merge2.twMerge)(containerClassName, "motto-video-container bg-black ");
|
|
3937
3947
|
const containerStyle = isResponsive ? {
|
|
3938
3948
|
aspectRatio: aspectRatio.toString()
|
|
3939
3949
|
} : { width, height };
|
|
@@ -4522,6 +4532,7 @@ var Video = ({
|
|
|
4522
4532
|
src: activePlaylist,
|
|
4523
4533
|
className: (0, import_tailwind_merge3.twMerge)("video-player-container", className),
|
|
4524
4534
|
events,
|
|
4535
|
+
locale,
|
|
4525
4536
|
containerClassName: "w-full h-full",
|
|
4526
4537
|
children
|
|
4527
4538
|
}
|
|
@@ -4678,18 +4689,19 @@ var Event = ({
|
|
|
4678
4689
|
events.onEmptyPlaylists();
|
|
4679
4690
|
}
|
|
4680
4691
|
if (loadingPlaylist) {
|
|
4681
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_tailwind_merge4.twMerge)("
|
|
4692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_tailwind_merge4.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative w-full h-full bg-[#151515]", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Loading, {}) }) });
|
|
4682
4693
|
}
|
|
4683
4694
|
if (activePlaylist && activeVideoId && videosData) {
|
|
4684
4695
|
const activeVideo = videosData.find((video) => video.id === activeVideoId);
|
|
4685
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: (0, import_tailwind_merge4.twMerge)("
|
|
4696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: (0, import_tailwind_merge4.twMerge)("", className), children: [
|
|
4686
4697
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4687
4698
|
Player,
|
|
4688
4699
|
{
|
|
4689
4700
|
...props,
|
|
4690
4701
|
src: activePlaylist,
|
|
4691
|
-
className: (0, import_tailwind_merge4.twMerge)(className, "peer"),
|
|
4702
|
+
className: (0, import_tailwind_merge4.twMerge)(className, "peer aspect-video"),
|
|
4692
4703
|
events,
|
|
4704
|
+
locale,
|
|
4693
4705
|
containerClassName: "w-full h-full"
|
|
4694
4706
|
}
|
|
4695
4707
|
) }),
|
|
@@ -4705,7 +4717,7 @@ var Event = ({
|
|
|
4705
4717
|
] });
|
|
4706
4718
|
}
|
|
4707
4719
|
if (eventData) {
|
|
4708
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_tailwind_merge4.twMerge)("
|
|
4720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_tailwind_merge4.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4709
4721
|
PreEvent,
|
|
4710
4722
|
{
|
|
4711
4723
|
event: eventData,
|
|
@@ -4989,7 +5001,7 @@ var CreativeWork = ({
|
|
|
4989
5001
|
if (error) {
|
|
4990
5002
|
const title = t(error.message)?.length ? t(error.message) : t("DEFAULT_ERROR");
|
|
4991
5003
|
const description = t(`${error.message}_DESCRIPTION`)?.length ? t(`${error.message}_DESCRIPTION`) : t("DEFAULT_ERROR_DESCRIPTION");
|
|
4992
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("
|
|
5004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
4993
5005
|
ErrorScreen,
|
|
4994
5006
|
{
|
|
4995
5007
|
title,
|
|
@@ -5019,10 +5031,10 @@ var CreativeWork = ({
|
|
|
5019
5031
|
events
|
|
5020
5032
|
]);
|
|
5021
5033
|
if (isCreativeWorkLoading || videosIsLoading || loadingApisState) {
|
|
5022
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("
|
|
5034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "relative w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Loading, {}) }) });
|
|
5023
5035
|
}
|
|
5024
5036
|
if (showCountDown && creativeWorkData) {
|
|
5025
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("
|
|
5037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: (0, import_tailwind_merge5.twMerge)("", className), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "relative w-full h-full bg-base-200 text-base-content flex justify-center items-center flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5026
5038
|
PreCreativeWork,
|
|
5027
5039
|
{
|
|
5028
5040
|
creativeWork: creativeWorkData,
|
|
@@ -5045,6 +5057,7 @@ var CreativeWork = ({
|
|
|
5045
5057
|
...events
|
|
5046
5058
|
},
|
|
5047
5059
|
src: activePlaylist,
|
|
5060
|
+
locale,
|
|
5048
5061
|
containerClassName: "w-full h-full"
|
|
5049
5062
|
}
|
|
5050
5063
|
),
|