@mottosports/motto-video-player 1.0.1-rc.78 → 1.0.1-rc.79

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 CHANGED
@@ -353,6 +353,7 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
353
353
  auth?: {
354
354
  mottoToken?: string;
355
355
  userId?: string;
356
+ apiToken?: string;
356
357
  };
357
358
  }
358
359
  /**
package/dist/index.d.ts CHANGED
@@ -353,6 +353,7 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
353
353
  auth?: {
354
354
  mottoToken?: string;
355
355
  userId?: string;
356
+ apiToken?: string;
356
357
  };
357
358
  }
358
359
  /**
package/dist/index.js CHANGED
@@ -490,7 +490,7 @@ var supportsWidevinePersistentLicenses = () => {
490
490
  var import_mux_data_shakaplayer = __toESM(require("@mux/mux-data-shakaplayer"));
491
491
 
492
492
  // package.json
493
- var version = "1.0.1-rc.78";
493
+ var version = "1.0.1-rc.79";
494
494
 
495
495
  // src/utils/licenseCache.ts
496
496
  var PERSISTENT_LICENSE_PREFIX = "motto_lic_";
@@ -666,7 +666,8 @@ var useShakaPlayer = ({
666
666
  publicKey,
667
667
  mottoToken,
668
668
  hasAds = false,
669
- hasSystem73 = false
669
+ hasSystem73 = false,
670
+ apiToken
670
671
  }) => {
671
672
  const playerRef = (0, import_react.useRef)(null);
672
673
  const [isRetrying, setIsRetrying] = (0, import_react.useState)(false);
@@ -873,6 +874,16 @@ var useShakaPlayer = ({
873
874
  });
874
875
  }
875
876
  }
877
+ if (apiToken) {
878
+ const netEngine = player.getNetworkingEngine();
879
+ if (netEngine) {
880
+ netEngine.registerRequestFilter((type, request) => {
881
+ if (type === import_shaka_player.default.net.NetworkingEngine.RequestType.MANIFEST) {
882
+ request.headers["authorization"] = `Bearer ${apiToken}`;
883
+ }
884
+ });
885
+ }
886
+ }
876
887
  if (isDRM && playlistId) {
877
888
  const onDRMSessionUpdate = () => {
878
889
  try {
@@ -990,7 +1001,7 @@ var useShakaPlayer = ({
990
1001
  onError?.(error);
991
1002
  throw error;
992
1003
  }
993
- }, [shakaConfig, drmConfig, src, onError, onPlayerReady, muxConfig, onMuxReady, isRetrying, getManifestUrl]);
1004
+ }, [shakaConfig, drmConfig, src, onError, onPlayerReady, muxConfig, onMuxReady, isRetrying, getManifestUrl, apiToken]);
994
1005
  const initializePlayer = (0, import_react.useCallback)(async (video) => {
995
1006
  return initializePlayerInternal(video);
996
1007
  }, [initializePlayerInternal]);
@@ -2275,7 +2286,8 @@ var Player = (0, import_react13.forwardRef)(
2275
2286
  publicKey,
2276
2287
  mottoToken: auth?.mottoToken,
2277
2288
  hasAds: !!imaConfig?.adTagUrl,
2278
- hasSystem73: !!system73Config?.apiKey
2289
+ hasSystem73: !!system73Config?.apiKey,
2290
+ apiToken: auth?.apiToken
2279
2291
  });
2280
2292
  const {
2281
2293
  initializeMux,