@mottosports/motto-video-player 1.0.0 → 1.0.1-rc.1
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/README.md +64 -0
- package/dist/index.js +38 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -269,6 +269,10 @@ var SkipBackButton = class {
|
|
|
269
269
|
this.eventManager = { listen: (element, event, handler) => {
|
|
270
270
|
element.addEventListener(event, handler);
|
|
271
271
|
} };
|
|
272
|
+
if (typeof document === "undefined") {
|
|
273
|
+
console.warn("SkipBackButton: document is not available (SSR environment)");
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
272
276
|
this.button_ = document.createElement("button");
|
|
273
277
|
this.button_.className = "shaka-button motto-native-skip-button";
|
|
274
278
|
this.button_.innerHTML = `
|
|
@@ -299,6 +303,10 @@ var SkipForwardButton = class {
|
|
|
299
303
|
this.eventManager = { listen: (element, event, handler) => {
|
|
300
304
|
element.addEventListener(event, handler);
|
|
301
305
|
} };
|
|
306
|
+
if (typeof document === "undefined") {
|
|
307
|
+
console.warn("SkipForwardButton: document is not available (SSR environment)");
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
302
310
|
this.button_ = document.createElement("button");
|
|
303
311
|
this.button_.className = "shaka-button motto-native-skip-button";
|
|
304
312
|
this.button_.innerHTML = `
|
|
@@ -342,6 +350,10 @@ var MobilePlayButton = class {
|
|
|
342
350
|
constructor(parent, controls) {
|
|
343
351
|
this.parent = parent;
|
|
344
352
|
this.controls = controls;
|
|
353
|
+
if (typeof document === "undefined") {
|
|
354
|
+
console.warn("MobilePlayButton: document is not available (SSR environment)");
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
345
357
|
this.video = controls?.getVideo?.() || parent.querySelector("video") || document.querySelector("video");
|
|
346
358
|
if (!this.video) {
|
|
347
359
|
console.error("MobilePlayButton: No video element found");
|
|
@@ -386,6 +398,10 @@ var MobileSkipBackButton = class {
|
|
|
386
398
|
constructor(parent, controls, onSkipBack) {
|
|
387
399
|
this.parent = parent;
|
|
388
400
|
this.controls = controls;
|
|
401
|
+
if (typeof document === "undefined") {
|
|
402
|
+
console.warn("MobileSkipBackButton: document is not available (SSR environment)");
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
389
405
|
this.video = controls?.getVideo?.() || parent.querySelector("video") || document.querySelector("video");
|
|
390
406
|
if (!this.video) {
|
|
391
407
|
console.error("MobileSkipBackButton: No video element found");
|
|
@@ -417,6 +433,10 @@ var MobileSkipForwardButton = class {
|
|
|
417
433
|
constructor(parent, controls, onSkipForward) {
|
|
418
434
|
this.parent = parent;
|
|
419
435
|
this.controls = controls;
|
|
436
|
+
if (typeof document === "undefined") {
|
|
437
|
+
console.warn("MobileSkipForwardButton: document is not available (SSR environment)");
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
420
440
|
this.video = controls?.getVideo?.() || parent.querySelector("video") || document.querySelector("video");
|
|
421
441
|
if (!this.video) {
|
|
422
442
|
console.error("MobileSkipForwardButton: No video element found");
|
|
@@ -448,6 +468,10 @@ var MobileControlsContainer = class {
|
|
|
448
468
|
constructor(parent, controls, onSkipBack, onSkipForward) {
|
|
449
469
|
this.parent = parent;
|
|
450
470
|
this.controls = controls;
|
|
471
|
+
if (typeof document === "undefined") {
|
|
472
|
+
console.warn("MobileControlsContainer: document is not available (SSR environment)");
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
451
475
|
if (!parent) {
|
|
452
476
|
console.error("MobileControlsContainer: No parent element provided");
|
|
453
477
|
return;
|
|
@@ -505,6 +529,9 @@ var MobileControlsContainer = class {
|
|
|
505
529
|
}
|
|
506
530
|
}
|
|
507
531
|
isElementVisible(element) {
|
|
532
|
+
if (typeof window === "undefined") {
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
508
535
|
const style = window.getComputedStyle(element);
|
|
509
536
|
const hasHiddenClass = element.classList.contains("shaka-hidden") || element.classList.contains("hidden") || element.classList.contains("shaka-fade-out");
|
|
510
537
|
return style.display !== "none" && style.visibility !== "hidden" && style.opacity !== "0" && !element.hidden && !hasHiddenClass;
|
|
@@ -523,10 +550,14 @@ var useShakaUI = (playerRef, containerRef, videoRef, controls, chromecastConfig,
|
|
|
523
550
|
const uiRef = useRef4(null);
|
|
524
551
|
const registeredElements = useRef4(/* @__PURE__ */ new Set());
|
|
525
552
|
const initializeUI = useCallback5(async () => {
|
|
553
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
554
|
+
console.warn("useShakaUI: Cannot initialize UI in SSR environment");
|
|
555
|
+
return null;
|
|
556
|
+
}
|
|
526
557
|
if (!controls || !containerRef.current || !playerRef.current || !videoRef.current) {
|
|
527
558
|
return null;
|
|
528
559
|
}
|
|
529
|
-
const isMobile = window.innerWidth <= 767 || /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
560
|
+
const isMobile = typeof window !== "undefined" && typeof navigator !== "undefined" && (window.innerWidth <= 767 || /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
|
|
530
561
|
if (!registeredElements.current.has("skip_back_button")) {
|
|
531
562
|
ShakaUI.Controls.registerElement("skip_back_button", new SkipBackButtonFactory(onSkipBack));
|
|
532
563
|
registeredElements.current.add("skip_back_button");
|
|
@@ -720,6 +751,9 @@ var useLiveIndicator = (containerRef, options = {}) => {
|
|
|
720
751
|
showPulseAnimation = true
|
|
721
752
|
} = options;
|
|
722
753
|
useEffect3(() => {
|
|
754
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
723
757
|
if (!containerRef.current || !enabled) {
|
|
724
758
|
return;
|
|
725
759
|
}
|
|
@@ -1782,6 +1816,9 @@ var availableLanguages = {
|
|
|
1782
1816
|
fa: fa_default
|
|
1783
1817
|
};
|
|
1784
1818
|
var getBrowserLanguage = () => {
|
|
1819
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") {
|
|
1820
|
+
return "en";
|
|
1821
|
+
}
|
|
1785
1822
|
const language = navigator.language.split("-")[0];
|
|
1786
1823
|
return availableLanguages[language] ? language : "en";
|
|
1787
1824
|
};
|