@mottosports/motto-video-player 1.0.1-rc.30 → 1.0.1-rc.32

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.mjs CHANGED
@@ -1127,18 +1127,17 @@ var isPlayReadySupported = () => {
1127
1127
  return false;
1128
1128
  }
1129
1129
  const userAgent = navigator.userAgent || "";
1130
- const isWindows = /Windows/.test(userAgent);
1131
1130
  const isXbox = /Xbox/.test(userAgent);
1132
1131
  const isEdge = /Edg/.test(userAgent);
1133
1132
  const isIE = /Trident|MSIE/.test(userAgent);
1134
- return isWindows || isXbox || isEdge || isIE;
1133
+ return isXbox || isEdge || isIE;
1135
1134
  };
1136
1135
 
1137
1136
  // src/hooks/useShakePlayer.ts
1138
1137
  import initShakaPlayerMux from "@mux/mux-data-shakaplayer";
1139
1138
 
1140
1139
  // package.json
1141
- var version = "1.0.1-rc.30";
1140
+ var version = "1.0.1-rc.32";
1142
1141
 
1143
1142
  // src/hooks/useShakePlayer.ts
1144
1143
  var useShakePlayer = ({
@@ -1169,7 +1168,6 @@ var useShakePlayer = ({
1169
1168
  let cert = null;
1170
1169
  if (isDRM) {
1171
1170
  const isPlayReady = isPlayReadySupported();
1172
- const isFairPlay = isAppleDevice();
1173
1171
  if (isAppleDevice() && src.drm.fairplay?.certificate_url) {
1174
1172
  const req = await fetch(src.drm.fairplay.certificate_url);
1175
1173
  cert = await req.arrayBuffer();
@@ -1711,6 +1709,7 @@ var useShakaUI = (playerRef, containerRef, videoRef, controls, chromecastConfig,
1711
1709
  "spacer",
1712
1710
  "fullscreen",
1713
1711
  "cast",
1712
+ // Always show cast button
1714
1713
  "overflow_menu"
1715
1714
  ];
1716
1715
  const uiConfig = {
@@ -1724,20 +1723,17 @@ var useShakaUI = (playerRef, containerRef, videoRef, controls, chromecastConfig,
1724
1723
  },
1725
1724
  controlPanelElements,
1726
1725
  addBigPlayButton: isMobile,
1727
- ...chromecastConfig?.receiverApplicationId && {
1728
- "castReceiverAppId": chromecastConfig.receiverApplicationId,
1729
- "castAndroidReceiverCompatible": false
1730
- },
1726
+ // Always configure chromecast with defaults or provided config
1727
+ castReceiverAppId: chromecastConfig?.receiverApplicationId || "CC1AD845",
1728
+ // Default Media Receiver
1729
+ castAndroidReceiverCompatible: true,
1730
+ // Enable Android TV compatibility
1731
1731
  overflowMenuButtons: [
1732
1732
  "quality",
1733
1733
  "picture_in_picture",
1734
1734
  "playback_rate"
1735
1735
  ]
1736
1736
  };
1737
- if (chromecastConfig?.receiverApplicationId) {
1738
- uiConfig.castReceiverAppId = chromecastConfig.receiverApplicationId;
1739
- uiConfig.castAndroidReceiverCompatible = false;
1740
- }
1741
1737
  ui.configure(uiConfig);
1742
1738
  if (isMobile) {
1743
1739
  const customizeBigPlayButton = () => {
@@ -3392,15 +3388,29 @@ var Player = forwardRef(
3392
3388
  }
3393
3389
  };
3394
3390
  const initializeChromecast = () => {
3395
- if (!chromecastConfig?.enabled) {
3396
- return;
3397
- }
3398
3391
  try {
3399
- if (events?.onCastStateChange) {
3400
- setTimeout(() => events.onCastStateChange(false), 100);
3392
+ if (typeof window !== "undefined" && window.chrome?.cast) {
3393
+ const castContext = window.chrome.cast.CastContext.getInstance();
3394
+ if (castContext) {
3395
+ castContext.setOptions({
3396
+ receiverApplicationId: chromecastConfig?.receiverApplicationId || "CC1AD845"
3397
+ // Default Media Receiver
3398
+ });
3399
+ castContext.addEventListener("caststatechanged", (event) => {
3400
+ const isCasting = event.castState === "CONNECTED";
3401
+ events?.onCastStateChange?.(isCasting);
3402
+ });
3403
+ }
3404
+ } else {
3405
+ if (events?.onCastStateChange) {
3406
+ setTimeout(() => events.onCastStateChange(false), 100);
3407
+ }
3401
3408
  }
3402
3409
  } catch (error) {
3403
3410
  console.warn("Chromecast initialization failed:", error);
3411
+ if (events?.onCastStateChange) {
3412
+ setTimeout(() => events.onCastStateChange(false), 100);
3413
+ }
3404
3414
  }
3405
3415
  };
3406
3416
  useEffect5(() => {