@codenkay/video-nsgplayer-core 5.0.0 → 5.1.0

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.cts CHANGED
@@ -136,6 +136,16 @@ type StreamingConfig = {
136
136
  backBufferLength?: number;
137
137
  fatalRecoveryLimit?: number;
138
138
  };
139
+ /**
140
+ * Same-origin BFF proxy for playlists, segments, and keys.
141
+ * The playback API rejects the browser Origin and does not send CORS
142
+ * headers, so cross-origin media URLs must be rewritten before fetch.
143
+ * The builder is not called for URLs that are already on the page origin.
144
+ */
145
+ mediaProxyUrlBuilder?: (ctx: {
146
+ url: string;
147
+ videoId?: string;
148
+ }) => string;
139
149
  /**
140
150
  * Same-origin BFF proxy for `enc.key` (preferred in production when the
141
151
  * server IP is allowlisted by the CDN / Cloudflare).
@@ -205,6 +215,7 @@ type PlayerConfig = Required<{
205
215
  streaming: {
206
216
  engine: "hls";
207
217
  hls: Required<NonNullable<StreamingConfig["hls"]>>;
218
+ mediaProxyUrlBuilder?: StreamingConfig["mediaProxyUrlBuilder"];
208
219
  keyProxyUrlBuilder?: StreamingConfig["keyProxyUrlBuilder"];
209
220
  getKeyAccessToken?: StreamingConfig["getKeyAccessToken"];
210
221
  keyProxyMaxFailures?: StreamingConfig["keyProxyMaxFailures"];
@@ -320,6 +331,7 @@ type PlayerConfigPartial = Partial<{
320
331
  streaming: {
321
332
  engine?: "hls";
322
333
  hls?: Partial<PlayerConfig["streaming"]["hls"]>;
334
+ mediaProxyUrlBuilder?: PlayerConfig["streaming"]["mediaProxyUrlBuilder"];
323
335
  keyProxyUrlBuilder?: PlayerConfig["streaming"]["keyProxyUrlBuilder"];
324
336
  getKeyAccessToken?: PlayerConfig["streaming"]["getKeyAccessToken"];
325
337
  keyProxyMaxFailures?: PlayerConfig["streaming"]["keyProxyMaxFailures"];
@@ -440,6 +452,7 @@ type HlsEngineOptions = {
440
452
  startPosition?: number;
441
453
  volume?: number;
442
454
  videoId?: string;
455
+ mediaProxyUrlBuilder?: StreamingConfig["mediaProxyUrlBuilder"];
443
456
  keyProxyUrlBuilder?: StreamingConfig["keyProxyUrlBuilder"];
444
457
  getKeyAccessToken?: StreamingConfig["getKeyAccessToken"];
445
458
  keyProxyMaxFailures?: StreamingConfig["keyProxyMaxFailures"];
@@ -480,6 +493,7 @@ declare class HlsEngine {
480
493
  private applyStartPositionAndAutoplay;
481
494
  private bindMediaEvents;
482
495
  updateAuthParams(): void;
496
+ private playbackRequestUrl;
483
497
  resumeAfterAuthRenew(): void;
484
498
  setQuality(selection: QualitySelection): void;
485
499
  getQuality(): QualitySelection;
@@ -716,6 +730,7 @@ type HlsModuleLike = object;
716
730
  declare const KEY_PROXY_MAX_FAILURES = 2;
717
731
  type AuthParamsLoaderOptions = {
718
732
  videoId?: string;
733
+ mediaProxyUrlBuilder?: StreamingConfig["mediaProxyUrlBuilder"];
719
734
  keyProxyUrlBuilder?: StreamingConfig["keyProxyUrlBuilder"];
720
735
  getKeyAccessToken?: StreamingConfig["getKeyAccessToken"];
721
736
  /** Override max BFF key failures before permanent browser fallback (default 2). */
@@ -737,6 +752,13 @@ declare function rewriteHlsRequestUrl(rawUrl: string, store: AuthParamsStore, op
737
752
  */
738
753
  declare function createAuthParamsLoader(HlsModule: HlsModuleLike, store: AuthParamsStore, options?: AuthParamsLoaderOptions): HlsLoaderConstructor;
739
754
 
755
+ /**
756
+ * True for legacy `/hls-web-live/` playlists and current `/live/` playlists.
757
+ * A same-origin proxy URL is live when its `url` query points at one of those paths.
758
+ */
759
+ declare function isLivePlaylistUrl(value: string): boolean;
760
+ declare function isSameOriginHttpUrl(value: string, baseOrigin: string): boolean;
761
+
740
762
  declare function redactValue(key: string, value: unknown, seen?: WeakSet<object>, depth?: number): unknown;
741
763
  /**
742
764
  * Redacts sensitive fields. Cycle-safe and depth-capped.
@@ -744,4 +766,4 @@ declare function redactValue(key: string, value: unknown, seen?: WeakSet<object>
744
766
  */
745
767
  declare function redactObject(obj: Record<string, unknown>, seen?: WeakSet<object>, depth?: number): Record<string, unknown>;
746
768
 
747
- export { type AccessibilityConfig, type AnalyticsConfig, type AuthConfig, AuthManager, AuthParamsStore, type AuthToken, type AuthTokenProviderContext, type BufferedRange, type ControlsConfig, type CreateVideoPlayerOptions, DEFAULT_CONTROLS, DEFAULT_LIVE_EDGE_TOLERANCE_SECONDS, DEFAULT_PLAYER_BEHAVIOR, DEFAULT_PLAYER_CONFIG, DEFAULT_THEME, DEFAULT_WATERMARK, type DebugConfig, EventEmitter, type HlsLoaderConstructor, type HlsModuleLike, type HlsQualityLevel, type HlsSupportMode, KEY_PROXY_MAX_FAILURES, type LiveMediaSnapshot, type LoggingConfig, PACKAGE_VERSION, PLAYBACK_RATES, type PlayIconPreset, type PlaybackCredentialConfig, type PlaybackRate, type PlaybackSource, type PlaybackSourceContext, PlaybackSourceManager, type PlayerAudioTrack, type PlayerBehaviorConfig, type PlayerConfig, type PlayerDiagnostics, type PlayerError, PlayerErrorCode, type PlayerEventMap, type PlayerSkipSeconds, type PlayerState, type PlayerTextTrack, type PlayerZoomLevel, type QualitySelection, RefreshManager, SECRET_SCAN_MAX_DEPTH, type SeekToLiveResult, type StreamingConfig, type TextTrackSelection, type ThemeConfig, type VideoPlayer, type WatermarkConfig, assertNoSecretsInConfig, createAuthParamsLoader, createPlayerError, createVideoPlayer, getLiveEdgeTime, isAtLiveEdge, isEncryptionKeyUrl, isPlainObject, mergePlayerConfig, redactObject, redactSensitive, redactValue, resolveBuiltinHlsLoader, rewriteHlsRequestUrl, seekToLiveEdge, themeToCssVars };
769
+ export { type AccessibilityConfig, type AnalyticsConfig, type AuthConfig, AuthManager, AuthParamsStore, type AuthToken, type AuthTokenProviderContext, type BufferedRange, type ControlsConfig, type CreateVideoPlayerOptions, DEFAULT_CONTROLS, DEFAULT_LIVE_EDGE_TOLERANCE_SECONDS, DEFAULT_PLAYER_BEHAVIOR, DEFAULT_PLAYER_CONFIG, DEFAULT_THEME, DEFAULT_WATERMARK, type DebugConfig, EventEmitter, type HlsLoaderConstructor, type HlsModuleLike, type HlsQualityLevel, type HlsSupportMode, KEY_PROXY_MAX_FAILURES, type LiveMediaSnapshot, type LoggingConfig, PACKAGE_VERSION, PLAYBACK_RATES, type PlayIconPreset, type PlaybackCredentialConfig, type PlaybackRate, type PlaybackSource, type PlaybackSourceContext, PlaybackSourceManager, type PlayerAudioTrack, type PlayerBehaviorConfig, type PlayerConfig, type PlayerDiagnostics, type PlayerError, PlayerErrorCode, type PlayerEventMap, type PlayerSkipSeconds, type PlayerState, type PlayerTextTrack, type PlayerZoomLevel, type QualitySelection, RefreshManager, SECRET_SCAN_MAX_DEPTH, type SeekToLiveResult, type StreamingConfig, type TextTrackSelection, type ThemeConfig, type VideoPlayer, type WatermarkConfig, assertNoSecretsInConfig, createAuthParamsLoader, createPlayerError, createVideoPlayer, getLiveEdgeTime, isAtLiveEdge, isEncryptionKeyUrl, isLivePlaylistUrl, isPlainObject, isSameOriginHttpUrl, mergePlayerConfig, redactObject, redactSensitive, redactValue, resolveBuiltinHlsLoader, rewriteHlsRequestUrl, seekToLiveEdge, themeToCssVars };
package/dist/index.d.ts CHANGED
@@ -136,6 +136,16 @@ type StreamingConfig = {
136
136
  backBufferLength?: number;
137
137
  fatalRecoveryLimit?: number;
138
138
  };
139
+ /**
140
+ * Same-origin BFF proxy for playlists, segments, and keys.
141
+ * The playback API rejects the browser Origin and does not send CORS
142
+ * headers, so cross-origin media URLs must be rewritten before fetch.
143
+ * The builder is not called for URLs that are already on the page origin.
144
+ */
145
+ mediaProxyUrlBuilder?: (ctx: {
146
+ url: string;
147
+ videoId?: string;
148
+ }) => string;
139
149
  /**
140
150
  * Same-origin BFF proxy for `enc.key` (preferred in production when the
141
151
  * server IP is allowlisted by the CDN / Cloudflare).
@@ -205,6 +215,7 @@ type PlayerConfig = Required<{
205
215
  streaming: {
206
216
  engine: "hls";
207
217
  hls: Required<NonNullable<StreamingConfig["hls"]>>;
218
+ mediaProxyUrlBuilder?: StreamingConfig["mediaProxyUrlBuilder"];
208
219
  keyProxyUrlBuilder?: StreamingConfig["keyProxyUrlBuilder"];
209
220
  getKeyAccessToken?: StreamingConfig["getKeyAccessToken"];
210
221
  keyProxyMaxFailures?: StreamingConfig["keyProxyMaxFailures"];
@@ -320,6 +331,7 @@ type PlayerConfigPartial = Partial<{
320
331
  streaming: {
321
332
  engine?: "hls";
322
333
  hls?: Partial<PlayerConfig["streaming"]["hls"]>;
334
+ mediaProxyUrlBuilder?: PlayerConfig["streaming"]["mediaProxyUrlBuilder"];
323
335
  keyProxyUrlBuilder?: PlayerConfig["streaming"]["keyProxyUrlBuilder"];
324
336
  getKeyAccessToken?: PlayerConfig["streaming"]["getKeyAccessToken"];
325
337
  keyProxyMaxFailures?: PlayerConfig["streaming"]["keyProxyMaxFailures"];
@@ -440,6 +452,7 @@ type HlsEngineOptions = {
440
452
  startPosition?: number;
441
453
  volume?: number;
442
454
  videoId?: string;
455
+ mediaProxyUrlBuilder?: StreamingConfig["mediaProxyUrlBuilder"];
443
456
  keyProxyUrlBuilder?: StreamingConfig["keyProxyUrlBuilder"];
444
457
  getKeyAccessToken?: StreamingConfig["getKeyAccessToken"];
445
458
  keyProxyMaxFailures?: StreamingConfig["keyProxyMaxFailures"];
@@ -480,6 +493,7 @@ declare class HlsEngine {
480
493
  private applyStartPositionAndAutoplay;
481
494
  private bindMediaEvents;
482
495
  updateAuthParams(): void;
496
+ private playbackRequestUrl;
483
497
  resumeAfterAuthRenew(): void;
484
498
  setQuality(selection: QualitySelection): void;
485
499
  getQuality(): QualitySelection;
@@ -716,6 +730,7 @@ type HlsModuleLike = object;
716
730
  declare const KEY_PROXY_MAX_FAILURES = 2;
717
731
  type AuthParamsLoaderOptions = {
718
732
  videoId?: string;
733
+ mediaProxyUrlBuilder?: StreamingConfig["mediaProxyUrlBuilder"];
719
734
  keyProxyUrlBuilder?: StreamingConfig["keyProxyUrlBuilder"];
720
735
  getKeyAccessToken?: StreamingConfig["getKeyAccessToken"];
721
736
  /** Override max BFF key failures before permanent browser fallback (default 2). */
@@ -737,6 +752,13 @@ declare function rewriteHlsRequestUrl(rawUrl: string, store: AuthParamsStore, op
737
752
  */
738
753
  declare function createAuthParamsLoader(HlsModule: HlsModuleLike, store: AuthParamsStore, options?: AuthParamsLoaderOptions): HlsLoaderConstructor;
739
754
 
755
+ /**
756
+ * True for legacy `/hls-web-live/` playlists and current `/live/` playlists.
757
+ * A same-origin proxy URL is live when its `url` query points at one of those paths.
758
+ */
759
+ declare function isLivePlaylistUrl(value: string): boolean;
760
+ declare function isSameOriginHttpUrl(value: string, baseOrigin: string): boolean;
761
+
740
762
  declare function redactValue(key: string, value: unknown, seen?: WeakSet<object>, depth?: number): unknown;
741
763
  /**
742
764
  * Redacts sensitive fields. Cycle-safe and depth-capped.
@@ -744,4 +766,4 @@ declare function redactValue(key: string, value: unknown, seen?: WeakSet<object>
744
766
  */
745
767
  declare function redactObject(obj: Record<string, unknown>, seen?: WeakSet<object>, depth?: number): Record<string, unknown>;
746
768
 
747
- export { type AccessibilityConfig, type AnalyticsConfig, type AuthConfig, AuthManager, AuthParamsStore, type AuthToken, type AuthTokenProviderContext, type BufferedRange, type ControlsConfig, type CreateVideoPlayerOptions, DEFAULT_CONTROLS, DEFAULT_LIVE_EDGE_TOLERANCE_SECONDS, DEFAULT_PLAYER_BEHAVIOR, DEFAULT_PLAYER_CONFIG, DEFAULT_THEME, DEFAULT_WATERMARK, type DebugConfig, EventEmitter, type HlsLoaderConstructor, type HlsModuleLike, type HlsQualityLevel, type HlsSupportMode, KEY_PROXY_MAX_FAILURES, type LiveMediaSnapshot, type LoggingConfig, PACKAGE_VERSION, PLAYBACK_RATES, type PlayIconPreset, type PlaybackCredentialConfig, type PlaybackRate, type PlaybackSource, type PlaybackSourceContext, PlaybackSourceManager, type PlayerAudioTrack, type PlayerBehaviorConfig, type PlayerConfig, type PlayerDiagnostics, type PlayerError, PlayerErrorCode, type PlayerEventMap, type PlayerSkipSeconds, type PlayerState, type PlayerTextTrack, type PlayerZoomLevel, type QualitySelection, RefreshManager, SECRET_SCAN_MAX_DEPTH, type SeekToLiveResult, type StreamingConfig, type TextTrackSelection, type ThemeConfig, type VideoPlayer, type WatermarkConfig, assertNoSecretsInConfig, createAuthParamsLoader, createPlayerError, createVideoPlayer, getLiveEdgeTime, isAtLiveEdge, isEncryptionKeyUrl, isPlainObject, mergePlayerConfig, redactObject, redactSensitive, redactValue, resolveBuiltinHlsLoader, rewriteHlsRequestUrl, seekToLiveEdge, themeToCssVars };
769
+ export { type AccessibilityConfig, type AnalyticsConfig, type AuthConfig, AuthManager, AuthParamsStore, type AuthToken, type AuthTokenProviderContext, type BufferedRange, type ControlsConfig, type CreateVideoPlayerOptions, DEFAULT_CONTROLS, DEFAULT_LIVE_EDGE_TOLERANCE_SECONDS, DEFAULT_PLAYER_BEHAVIOR, DEFAULT_PLAYER_CONFIG, DEFAULT_THEME, DEFAULT_WATERMARK, type DebugConfig, EventEmitter, type HlsLoaderConstructor, type HlsModuleLike, type HlsQualityLevel, type HlsSupportMode, KEY_PROXY_MAX_FAILURES, type LiveMediaSnapshot, type LoggingConfig, PACKAGE_VERSION, PLAYBACK_RATES, type PlayIconPreset, type PlaybackCredentialConfig, type PlaybackRate, type PlaybackSource, type PlaybackSourceContext, PlaybackSourceManager, type PlayerAudioTrack, type PlayerBehaviorConfig, type PlayerConfig, type PlayerDiagnostics, type PlayerError, PlayerErrorCode, type PlayerEventMap, type PlayerSkipSeconds, type PlayerState, type PlayerTextTrack, type PlayerZoomLevel, type QualitySelection, RefreshManager, SECRET_SCAN_MAX_DEPTH, type SeekToLiveResult, type StreamingConfig, type TextTrackSelection, type ThemeConfig, type VideoPlayer, type WatermarkConfig, assertNoSecretsInConfig, createAuthParamsLoader, createPlayerError, createVideoPlayer, getLiveEdgeTime, isAtLiveEdge, isEncryptionKeyUrl, isLivePlaylistUrl, isPlainObject, isSameOriginHttpUrl, mergePlayerConfig, redactObject, redactSensitive, redactValue, resolveBuiltinHlsLoader, rewriteHlsRequestUrl, seekToLiveEdge, themeToCssVars };
package/dist/index.js CHANGED
@@ -242,6 +242,7 @@ var SKIP_DEEP_SCAN_KEYS = /* @__PURE__ */ new Set([
242
242
  "getsource",
243
243
  "refreshsource",
244
244
  "keyproxyurlbuilder",
245
+ "mediaproxyurlbuilder",
245
246
  "getkeyaccesstoken"
246
247
  ]);
247
248
  var SECRET_SCAN_MAX_DEPTH = 32;
@@ -326,6 +327,7 @@ function mergePlayerConfig(partial) {
326
327
  ...DEFAULT_PLAYER_CONFIG.streaming.hls,
327
328
  ...partial?.streaming?.hls
328
329
  },
330
+ mediaProxyUrlBuilder: partial?.streaming?.mediaProxyUrlBuilder,
329
331
  keyProxyUrlBuilder: partial?.streaming?.keyProxyUrlBuilder,
330
332
  getKeyAccessToken: partial?.streaming?.getKeyAccessToken,
331
333
  keyProxyMaxFailures: partial?.streaming?.keyProxyMaxFailures
@@ -767,6 +769,26 @@ function seekToLiveEdge(media, options) {
767
769
  return { moved: true, edge };
768
770
  }
769
771
 
772
+ // src/streaming/mediaUrl.ts
773
+ var LIVE_PLAYLIST_PATH = /\/(?:hls-web-live|live)\//i;
774
+ function isLivePlaylistUrl(value) {
775
+ if (LIVE_PLAYLIST_PATH.test(value)) return true;
776
+ try {
777
+ const parsed = new URL(value, "http://localhost");
778
+ const inner = parsed.searchParams.get("url");
779
+ return Boolean(inner && LIVE_PLAYLIST_PATH.test(inner));
780
+ } catch {
781
+ return false;
782
+ }
783
+ }
784
+ function isSameOriginHttpUrl(value, baseOrigin) {
785
+ try {
786
+ return new URL(value, baseOrigin).origin === new URL(baseOrigin).origin;
787
+ } catch {
788
+ return false;
789
+ }
790
+ }
791
+
770
792
  // src/streaming/authParamsLoader.ts
771
793
  var ENC_KEY_PATH_RE = /enc\.key$/i;
772
794
  var BUILTIN_LOADER_NAMES = /* @__PURE__ */ new Set(["XhrLoader", "FetchLoader"]);
@@ -836,8 +858,16 @@ function rewriteHlsRequestUrl(rawUrl, store, options = {}, baseOrigin = typeof l
836
858
  mobile: snapshot.mobile
837
859
  });
838
860
  }
839
- if (!store.hasParams()) return parsed.toString();
840
- return store.applyToUrl(rawUrl, baseOrigin);
861
+ const withAuth = store.hasParams() ? store.applyToUrl(rawUrl, baseOrigin) : parsed.toString();
862
+ return applyMediaProxy(withAuth, options, baseOrigin);
863
+ }
864
+ function applyMediaProxy(url, options, baseOrigin) {
865
+ if (!options.mediaProxyUrlBuilder) return url;
866
+ if (isSameOriginHttpUrl(url, baseOrigin)) return url;
867
+ return options.mediaProxyUrlBuilder({
868
+ url,
869
+ videoId: options.videoId
870
+ });
841
871
  }
842
872
  function createLoaderStats() {
843
873
  const now = performance.now();
@@ -868,12 +898,14 @@ function isProxyUpstreamBlocked(status, contentType, bodyHead, errorText) {
868
898
  return false;
869
899
  }
870
900
  async function fetchEncryptionKeyBytes(url, accessToken, signal) {
871
- const headers = accessToken ? { Authorization: `Bearer ${accessToken}`, Accept: "*/*" } : void 0;
901
+ const pageOrigin = typeof location !== "undefined" ? location.origin : "http://localhost";
902
+ const sameOrigin = isSameOriginHttpUrl(url, pageOrigin);
903
+ const headers = !sameOrigin && accessToken ? { Authorization: `Bearer ${accessToken}`, Accept: "*/*" } : void 0;
872
904
  try {
873
905
  const response = await fetch(url, {
874
906
  method: "GET",
875
907
  ...headers ? { headers } : {},
876
- credentials: "omit",
908
+ credentials: sameOrigin ? "same-origin" : "omit",
877
909
  cache: "no-store",
878
910
  signal
879
911
  });
@@ -1164,7 +1196,7 @@ function createAuthParamsLoader(HlsModule, store, options = {}) {
1164
1196
  const originalUrl = context.url;
1165
1197
  const isKey = isEncryptionKeyUrl(originalUrl);
1166
1198
  if (!isKey) {
1167
- if (store.hasParams()) {
1199
+ if (store.hasParams() || options.mediaProxyUrlBuilder) {
1168
1200
  context.url = rewriteHlsRequestUrl(originalUrl, store, {
1169
1201
  ...options,
1170
1202
  keyProxyUrlBuilder: void 0
@@ -1289,7 +1321,7 @@ var HlsEngine = class {
1289
1321
  if (videoEl.canPlayType("application/vnd.apple.mpegurl")) {
1290
1322
  this.supportMode = "native";
1291
1323
  this.options.callbacks.onSupportMode?.("native");
1292
- videoEl.src = this.options.authParams.applyToUrl(playbackUrl);
1324
+ videoEl.src = this.playbackRequestUrl(playbackUrl);
1293
1325
  this.bindMediaEvents();
1294
1326
  this.bindNativeTextTracks();
1295
1327
  this.options.callbacks.onStateChange?.("ready");
@@ -1314,6 +1346,7 @@ var HlsEngine = class {
1314
1346
  } = this.options;
1315
1347
  const loader = createAuthParamsLoader(Hls, authParams, {
1316
1348
  videoId,
1349
+ mediaProxyUrlBuilder: this.options.mediaProxyUrlBuilder,
1317
1350
  keyProxyUrlBuilder,
1318
1351
  getKeyAccessToken,
1319
1352
  keyProxyMaxFailures: this.options.keyProxyMaxFailures
@@ -1342,7 +1375,7 @@ var HlsEngine = class {
1342
1375
  loader
1343
1376
  });
1344
1377
  this.hls.attachMedia(videoEl);
1345
- this.hls.loadSource(authParams.applyToUrl(playbackUrl));
1378
+ this.hls.loadSource(this.playbackRequestUrl(playbackUrl));
1346
1379
  this.hls.on(Hls.Events.MANIFEST_PARSED, (_event, data) => {
1347
1380
  if (this.destroyed) return;
1348
1381
  this.qualities = (data.levels ?? []).map((level, index) => ({
@@ -1520,13 +1553,20 @@ var HlsEngine = class {
1520
1553
  if (this.supportMode === "native" && this.options.videoEl) {
1521
1554
  const time = this.options.videoEl.currentTime;
1522
1555
  const wasPaused = this.options.videoEl.paused;
1523
- this.options.videoEl.src = this.options.authParams.applyToUrl(
1524
- this.options.playbackUrl
1525
- );
1556
+ this.options.videoEl.src = this.playbackRequestUrl(this.options.playbackUrl);
1526
1557
  this.options.videoEl.currentTime = time;
1527
1558
  if (!wasPaused) void this.options.videoEl.play();
1528
1559
  }
1529
1560
  }
1561
+ playbackRequestUrl(playbackUrl) {
1562
+ return rewriteHlsRequestUrl(playbackUrl, this.options.authParams, {
1563
+ videoId: this.options.videoId,
1564
+ mediaProxyUrlBuilder: this.options.mediaProxyUrlBuilder,
1565
+ keyProxyUrlBuilder: this.options.keyProxyUrlBuilder,
1566
+ getKeyAccessToken: this.options.getKeyAccessToken,
1567
+ keyProxyMaxFailures: this.options.keyProxyMaxFailures
1568
+ });
1569
+ }
1530
1570
  resumeAfterAuthRenew() {
1531
1571
  this.networkRecoveryCount = 0;
1532
1572
  this.hls?.startLoad();
@@ -1791,7 +1831,7 @@ function createVideoPlayer(options) {
1791
1831
  const source = {
1792
1832
  url: options.sourceUrl,
1793
1833
  expiresAt: Date.now() + 24 * 60 * 60 * 1e3,
1794
- live: /\/hls-web-live\//i.test(options.sourceUrl)
1834
+ live: isLivePlaylistUrl(options.sourceUrl)
1795
1835
  };
1796
1836
  sourceManager.applyDirectSource(source);
1797
1837
  playbackUrl = source.url;
@@ -1821,6 +1861,7 @@ function createVideoPlayer(options) {
1821
1861
  startPosition: config.player.startPosition,
1822
1862
  volume: config.player.volume,
1823
1863
  videoId: options.videoId,
1864
+ mediaProxyUrlBuilder: config.streaming.mediaProxyUrlBuilder,
1824
1865
  keyProxyUrlBuilder: config.streaming.keyProxyUrlBuilder,
1825
1866
  // Enterprise AES key auth (see authParamsLoader):
1826
1867
  // 1) keyProxyUrlBuilder BFF — max 2 failures then circuit
@@ -2152,6 +2193,7 @@ function createVideoPlayer(options) {
2152
2193
  streaming: {
2153
2194
  engine: "hls",
2154
2195
  hls: { ...config.streaming.hls, ...partial?.streaming?.hls },
2196
+ mediaProxyUrlBuilder: partial?.streaming?.mediaProxyUrlBuilder ?? config.streaming.mediaProxyUrlBuilder,
2155
2197
  keyProxyUrlBuilder: partial?.streaming?.keyProxyUrlBuilder ?? config.streaming.keyProxyUrlBuilder,
2156
2198
  getKeyAccessToken: partial?.streaming?.getKeyAccessToken ?? config.streaming.getKeyAccessToken ?? (() => authManager.getAccessToken()),
2157
2199
  keyProxyMaxFailures: partial?.streaming?.keyProxyMaxFailures ?? config.streaming.keyProxyMaxFailures
@@ -2199,7 +2241,9 @@ export {
2199
2241
  getLiveEdgeTime,
2200
2242
  isAtLiveEdge,
2201
2243
  isEncryptionKeyUrl,
2244
+ isLivePlaylistUrl,
2202
2245
  isPlainObject,
2246
+ isSameOriginHttpUrl,
2203
2247
  mergePlayerConfig,
2204
2248
  redactObject,
2205
2249
  redactSensitive,