@codenkay/video-nsgplayer-core 0.1.5 → 2.0.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/CHANGELOG.md +51 -11
- package/dist/index.cjs +408 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -14
- package/dist/index.d.ts +87 -14
- package/dist/index.js +406 -43
- package/dist/index.js.map +1 -1
- package/package.json +14 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
import Hls, { LoaderContext, LoaderConfiguration, LoaderCallbacks } from 'hls.js';
|
|
1
|
+
import Hls, { LoaderStats, LoaderContext, LoaderConfiguration, LoaderCallbacks } from 'hls.js';
|
|
2
2
|
|
|
3
3
|
/** Player lifecycle states. */
|
|
4
4
|
type PlayerState = "idle" | "loading" | "ready" | "playing" | "paused" | "buffering" | "renewing" | "ended" | "error" | "destroyed";
|
|
5
5
|
type HlsSupportMode = "hls.js" | "native" | "unsupported";
|
|
6
6
|
type QualitySelection = "auto" | number;
|
|
7
7
|
type PlaybackRate = 0.5 | 0.75 | 1 | 1.25 | 1.5 | 2;
|
|
8
|
+
type PlayerTextTrack = {
|
|
9
|
+
index: number;
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
language?: string;
|
|
13
|
+
uri?: string;
|
|
14
|
+
};
|
|
15
|
+
type PlayerAudioTrack = {
|
|
16
|
+
index: number;
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
language?: string;
|
|
20
|
+
uri?: string;
|
|
21
|
+
};
|
|
22
|
+
/** Runtime caption selection: off or a concrete subtitle track index. */
|
|
23
|
+
type TextTrackSelection = "off" | number;
|
|
8
24
|
type HlsQualityLevel = {
|
|
9
25
|
index: number;
|
|
10
26
|
height: number;
|
|
@@ -222,6 +238,14 @@ type PlayerEventMap = {
|
|
|
222
238
|
selection: QualitySelection;
|
|
223
239
|
label?: string;
|
|
224
240
|
};
|
|
241
|
+
texttrackchange: {
|
|
242
|
+
tracks: PlayerTextTrack[];
|
|
243
|
+
selection: TextTrackSelection;
|
|
244
|
+
};
|
|
245
|
+
audiotrackchange: {
|
|
246
|
+
tracks: PlayerAudioTrack[];
|
|
247
|
+
selection: number;
|
|
248
|
+
};
|
|
225
249
|
volumechange: {
|
|
226
250
|
volume: number;
|
|
227
251
|
muted: boolean;
|
|
@@ -255,7 +279,7 @@ type PlayerEventMap = {
|
|
|
255
279
|
};
|
|
256
280
|
|
|
257
281
|
declare const PLAYBACK_RATES: readonly [0.5, 0.75, 1, 1.25, 1.5, 2];
|
|
258
|
-
declare const PACKAGE_VERSION = "0.1.
|
|
282
|
+
declare const PACKAGE_VERSION = "0.1.8";
|
|
259
283
|
declare const DEFAULT_PLAYER_BEHAVIOR: Required<PlayerBehaviorConfig>;
|
|
260
284
|
declare const DEFAULT_CONTROLS: Required<ControlsConfig>;
|
|
261
285
|
declare const DEFAULT_THEME: Required<ThemeConfig>;
|
|
@@ -390,6 +414,10 @@ type HlsEngineCallbacks = {
|
|
|
390
414
|
onAuthRecoveryNeeded?: (reason: string) => void;
|
|
391
415
|
onQualitiesChange?: (levels: HlsQualityLevel[]) => void;
|
|
392
416
|
onQualitySelectionChange?: (selection: QualitySelection) => void;
|
|
417
|
+
onTextTracksChange?: (tracks: PlayerTextTrack[]) => void;
|
|
418
|
+
onTextTrackSelectionChange?: (selection: TextTrackSelection) => void;
|
|
419
|
+
onAudioTracksChange?: (tracks: PlayerAudioTrack[]) => void;
|
|
420
|
+
onAudioTrackSelectionChange?: (selection: number) => void;
|
|
393
421
|
onEnded?: () => void;
|
|
394
422
|
};
|
|
395
423
|
type HlsEngineOptions = {
|
|
@@ -415,9 +443,12 @@ type HlsEngineOptions = {
|
|
|
415
443
|
/**
|
|
416
444
|
* Dual-path HLS engine: hls.js when supported, otherwise native Safari HLS.
|
|
417
445
|
*
|
|
418
|
-
* Signed CDN playback requires auth query params on every HLS request
|
|
419
|
-
*
|
|
420
|
-
*
|
|
446
|
+
* Signed CDN playback requires auth query params on every HLS request
|
|
447
|
+
* (playlists, segments, and AES `enc.key` on CDN hosts).
|
|
448
|
+
*
|
|
449
|
+
* Optional `streaming.keyProxyUrlBuilder` (same-origin BFF) or
|
|
450
|
+
* `streaming.getKeyAccessToken` (browser Bearer) for Video API–origin keys
|
|
451
|
+
* when query-signed CDN access is insufficient.
|
|
421
452
|
*/
|
|
422
453
|
declare class HlsEngine {
|
|
423
454
|
private readonly options;
|
|
@@ -428,6 +459,11 @@ declare class HlsEngine {
|
|
|
428
459
|
private mediaRecoveryCount;
|
|
429
460
|
private qualities;
|
|
430
461
|
private qualitySelection;
|
|
462
|
+
private textTracks;
|
|
463
|
+
private textTrackSelection;
|
|
464
|
+
private audioTracks;
|
|
465
|
+
private audioTrackSelection;
|
|
466
|
+
private nativeTextTrackCleanup;
|
|
431
467
|
constructor(options: HlsEngineOptions);
|
|
432
468
|
start(): Promise<void>;
|
|
433
469
|
private startWithHlsJs;
|
|
@@ -439,7 +475,16 @@ declare class HlsEngine {
|
|
|
439
475
|
setQuality(selection: QualitySelection): void;
|
|
440
476
|
getQuality(): QualitySelection;
|
|
441
477
|
getQualities(): HlsQualityLevel[];
|
|
478
|
+
getTextTracks(): PlayerTextTrack[];
|
|
479
|
+
getTextTrackSelection(): TextTrackSelection;
|
|
480
|
+
setTextTrack(selection: TextTrackSelection): void;
|
|
481
|
+
getAudioTracks(): PlayerAudioTrack[];
|
|
482
|
+
getAudioTrackSelection(): number;
|
|
483
|
+
setAudioTrack(index: number): void;
|
|
442
484
|
getSupportMode(): HlsSupportMode;
|
|
485
|
+
private syncHlsSubtitleTracks;
|
|
486
|
+
private syncHlsAudioTracks;
|
|
487
|
+
private bindNativeTextTracks;
|
|
443
488
|
destroy(): void;
|
|
444
489
|
}
|
|
445
490
|
|
|
@@ -465,9 +510,17 @@ type VideoPlayer = {
|
|
|
465
510
|
getQuality: () => QualitySelection;
|
|
466
511
|
setQuality: (selection: QualitySelection | string) => void;
|
|
467
512
|
getAvailableQualities: () => ReturnType<HlsEngine["getQualities"]>;
|
|
513
|
+
getTextTracks: () => PlayerTextTrack[];
|
|
514
|
+
getSelectedTextTrack: () => TextTrackSelection;
|
|
515
|
+
setTextTrack: (selection: TextTrackSelection) => void;
|
|
516
|
+
getAudioTracks: () => PlayerAudioTrack[];
|
|
517
|
+
getSelectedAudioTrack: () => number;
|
|
518
|
+
setAudioTrack: (index: number) => void;
|
|
468
519
|
enterFullscreen: () => Promise<void>;
|
|
469
520
|
exitFullscreen: () => Promise<void>;
|
|
470
521
|
isFullscreen: () => boolean;
|
|
522
|
+
/** Attach fullscreen target container (host UI chrome). Zoom stays UI-only. */
|
|
523
|
+
setFullscreenElement: (el: HTMLElement | null) => void;
|
|
471
524
|
reload: () => Promise<void>;
|
|
472
525
|
destroy: () => void;
|
|
473
526
|
getDiagnostics: () => PlayerDiagnostics;
|
|
@@ -591,32 +644,52 @@ declare class RefreshManager {
|
|
|
591
644
|
private renew;
|
|
592
645
|
}
|
|
593
646
|
|
|
594
|
-
type
|
|
647
|
+
type HlsLoaderInstance = {
|
|
648
|
+
stats: LoaderStats;
|
|
595
649
|
load(context: LoaderContext, config: LoaderConfiguration, callbacks: LoaderCallbacks<LoaderContext>): void;
|
|
596
650
|
destroy(): void;
|
|
651
|
+
abort?: () => void;
|
|
597
652
|
};
|
|
653
|
+
type HlsLoader = new (config: object) => HlsLoaderInstance;
|
|
598
654
|
type AuthParamsLoaderOptions = {
|
|
599
655
|
videoId?: string;
|
|
600
656
|
keyProxyUrlBuilder?: StreamingConfig["keyProxyUrlBuilder"];
|
|
601
657
|
getKeyAccessToken?: StreamingConfig["getKeyAccessToken"];
|
|
602
658
|
};
|
|
659
|
+
declare function isEncryptionKeyUrl(rawUrl: string, baseOrigin?: string): boolean;
|
|
660
|
+
/**
|
|
661
|
+
* Always resolve a builtin hls.js loader (XhrLoader).
|
|
662
|
+
*
|
|
663
|
+
* Never trust `Hls.DefaultConfig.loader` alone — if it was reassigned to a
|
|
664
|
+
* custom wrapper, `extends` / nested `inner.load()` chains blow Firefox's
|
|
665
|
+
* stack (`InternalError: too much recursion`).
|
|
666
|
+
*/
|
|
667
|
+
declare function resolveBuiltinHlsLoader(HlsClass: typeof Hls): HlsLoader;
|
|
603
668
|
/**
|
|
604
669
|
* Rewrites an HLS request URL so signed auth query params are present.
|
|
605
|
-
* Master playlists are signed on loadSource; child playlists / segments / keys
|
|
606
|
-
* are relative and would otherwise be fetched unsigned → CDN 403.
|
|
607
670
|
*
|
|
608
|
-
* AES `enc.key` handling (
|
|
609
|
-
* 1. `keyProxyUrlBuilder` — same-origin BFF (
|
|
610
|
-
* 2.
|
|
671
|
+
* AES `enc.key` handling (enterprise priority order):
|
|
672
|
+
* 1. `keyProxyUrlBuilder` — same-origin BFF (production; server IP must pass CDN/WAF)
|
|
673
|
+
* 2. Otherwise keep CDN/API URL and apply signed `token`/`expires` (and related) query
|
|
674
|
+
* params — same auth model as segments on Appextech CDN hosts
|
|
675
|
+
* 3. Optional `getKeyAccessToken` is applied at load-time (Bearer), not in this rewrite
|
|
611
676
|
*/
|
|
612
677
|
declare function rewriteHlsRequestUrl(rawUrl: string, store: AuthParamsStore, options?: AuthParamsLoaderOptions, baseOrigin?: string): string;
|
|
613
678
|
/**
|
|
614
|
-
* hls.js loader that
|
|
615
|
-
*
|
|
679
|
+
* hls.js loader that:
|
|
680
|
+
* - Re-applies signed auth query params on every media request
|
|
681
|
+
* - Loads AES `enc.key` via BFF / optional Bearer fetch / signed-query XHR
|
|
682
|
+
*
|
|
683
|
+
* Uses composition (not `extends DefaultConfig.loader`) so repeated mounts,
|
|
684
|
+
* HMR, or a polluted DefaultConfig cannot nest `super.load()` into recursion.
|
|
616
685
|
*/
|
|
617
686
|
declare function createAuthParamsLoader(HlsClass: typeof Hls, store: AuthParamsStore, options?: AuthParamsLoaderOptions): HlsLoader;
|
|
618
687
|
|
|
619
688
|
declare function redactValue(key: string, value: unknown, seen?: WeakSet<object>, depth?: number): unknown;
|
|
689
|
+
/**
|
|
690
|
+
* Redacts sensitive fields. Cycle-safe and depth-capped.
|
|
691
|
+
* Only walks plain objects/arrays — never DOM / host graphs.
|
|
692
|
+
*/
|
|
620
693
|
declare function redactObject(obj: Record<string, unknown>, seen?: WeakSet<object>, depth?: number): Record<string, unknown>;
|
|
621
694
|
|
|
622
|
-
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 HlsQualityLevel, type HlsSupportMode, type LiveMediaSnapshot, type LoggingConfig, PACKAGE_VERSION, PLAYBACK_RATES, type PlayIconPreset, type PlaybackCredentialConfig, type PlaybackRate, type PlaybackSource, type PlaybackSourceContext, PlaybackSourceManager, type PlayerBehaviorConfig, type PlayerConfig, type PlayerDiagnostics, type PlayerError, PlayerErrorCode, type PlayerEventMap, type PlayerSkipSeconds, type PlayerState, type PlayerZoomLevel, type QualitySelection, RefreshManager, SECRET_SCAN_MAX_DEPTH, type SeekToLiveResult, type StreamingConfig, type ThemeConfig, type VideoPlayer, type WatermarkConfig, assertNoSecretsInConfig, createAuthParamsLoader, createPlayerError, createVideoPlayer, getLiveEdgeTime, isAtLiveEdge, isPlainObject, mergePlayerConfig, redactObject, redactSensitive, redactValue, rewriteHlsRequestUrl, seekToLiveEdge, themeToCssVars };
|
|
695
|
+
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 HlsQualityLevel, type HlsSupportMode, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
import Hls, { LoaderContext, LoaderConfiguration, LoaderCallbacks } from 'hls.js';
|
|
1
|
+
import Hls, { LoaderStats, LoaderContext, LoaderConfiguration, LoaderCallbacks } from 'hls.js';
|
|
2
2
|
|
|
3
3
|
/** Player lifecycle states. */
|
|
4
4
|
type PlayerState = "idle" | "loading" | "ready" | "playing" | "paused" | "buffering" | "renewing" | "ended" | "error" | "destroyed";
|
|
5
5
|
type HlsSupportMode = "hls.js" | "native" | "unsupported";
|
|
6
6
|
type QualitySelection = "auto" | number;
|
|
7
7
|
type PlaybackRate = 0.5 | 0.75 | 1 | 1.25 | 1.5 | 2;
|
|
8
|
+
type PlayerTextTrack = {
|
|
9
|
+
index: number;
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
language?: string;
|
|
13
|
+
uri?: string;
|
|
14
|
+
};
|
|
15
|
+
type PlayerAudioTrack = {
|
|
16
|
+
index: number;
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
language?: string;
|
|
20
|
+
uri?: string;
|
|
21
|
+
};
|
|
22
|
+
/** Runtime caption selection: off or a concrete subtitle track index. */
|
|
23
|
+
type TextTrackSelection = "off" | number;
|
|
8
24
|
type HlsQualityLevel = {
|
|
9
25
|
index: number;
|
|
10
26
|
height: number;
|
|
@@ -222,6 +238,14 @@ type PlayerEventMap = {
|
|
|
222
238
|
selection: QualitySelection;
|
|
223
239
|
label?: string;
|
|
224
240
|
};
|
|
241
|
+
texttrackchange: {
|
|
242
|
+
tracks: PlayerTextTrack[];
|
|
243
|
+
selection: TextTrackSelection;
|
|
244
|
+
};
|
|
245
|
+
audiotrackchange: {
|
|
246
|
+
tracks: PlayerAudioTrack[];
|
|
247
|
+
selection: number;
|
|
248
|
+
};
|
|
225
249
|
volumechange: {
|
|
226
250
|
volume: number;
|
|
227
251
|
muted: boolean;
|
|
@@ -255,7 +279,7 @@ type PlayerEventMap = {
|
|
|
255
279
|
};
|
|
256
280
|
|
|
257
281
|
declare const PLAYBACK_RATES: readonly [0.5, 0.75, 1, 1.25, 1.5, 2];
|
|
258
|
-
declare const PACKAGE_VERSION = "0.1.
|
|
282
|
+
declare const PACKAGE_VERSION = "0.1.8";
|
|
259
283
|
declare const DEFAULT_PLAYER_BEHAVIOR: Required<PlayerBehaviorConfig>;
|
|
260
284
|
declare const DEFAULT_CONTROLS: Required<ControlsConfig>;
|
|
261
285
|
declare const DEFAULT_THEME: Required<ThemeConfig>;
|
|
@@ -390,6 +414,10 @@ type HlsEngineCallbacks = {
|
|
|
390
414
|
onAuthRecoveryNeeded?: (reason: string) => void;
|
|
391
415
|
onQualitiesChange?: (levels: HlsQualityLevel[]) => void;
|
|
392
416
|
onQualitySelectionChange?: (selection: QualitySelection) => void;
|
|
417
|
+
onTextTracksChange?: (tracks: PlayerTextTrack[]) => void;
|
|
418
|
+
onTextTrackSelectionChange?: (selection: TextTrackSelection) => void;
|
|
419
|
+
onAudioTracksChange?: (tracks: PlayerAudioTrack[]) => void;
|
|
420
|
+
onAudioTrackSelectionChange?: (selection: number) => void;
|
|
393
421
|
onEnded?: () => void;
|
|
394
422
|
};
|
|
395
423
|
type HlsEngineOptions = {
|
|
@@ -415,9 +443,12 @@ type HlsEngineOptions = {
|
|
|
415
443
|
/**
|
|
416
444
|
* Dual-path HLS engine: hls.js when supported, otherwise native Safari HLS.
|
|
417
445
|
*
|
|
418
|
-
* Signed CDN playback requires auth query params on every HLS request
|
|
419
|
-
*
|
|
420
|
-
*
|
|
446
|
+
* Signed CDN playback requires auth query params on every HLS request
|
|
447
|
+
* (playlists, segments, and AES `enc.key` on CDN hosts).
|
|
448
|
+
*
|
|
449
|
+
* Optional `streaming.keyProxyUrlBuilder` (same-origin BFF) or
|
|
450
|
+
* `streaming.getKeyAccessToken` (browser Bearer) for Video API–origin keys
|
|
451
|
+
* when query-signed CDN access is insufficient.
|
|
421
452
|
*/
|
|
422
453
|
declare class HlsEngine {
|
|
423
454
|
private readonly options;
|
|
@@ -428,6 +459,11 @@ declare class HlsEngine {
|
|
|
428
459
|
private mediaRecoveryCount;
|
|
429
460
|
private qualities;
|
|
430
461
|
private qualitySelection;
|
|
462
|
+
private textTracks;
|
|
463
|
+
private textTrackSelection;
|
|
464
|
+
private audioTracks;
|
|
465
|
+
private audioTrackSelection;
|
|
466
|
+
private nativeTextTrackCleanup;
|
|
431
467
|
constructor(options: HlsEngineOptions);
|
|
432
468
|
start(): Promise<void>;
|
|
433
469
|
private startWithHlsJs;
|
|
@@ -439,7 +475,16 @@ declare class HlsEngine {
|
|
|
439
475
|
setQuality(selection: QualitySelection): void;
|
|
440
476
|
getQuality(): QualitySelection;
|
|
441
477
|
getQualities(): HlsQualityLevel[];
|
|
478
|
+
getTextTracks(): PlayerTextTrack[];
|
|
479
|
+
getTextTrackSelection(): TextTrackSelection;
|
|
480
|
+
setTextTrack(selection: TextTrackSelection): void;
|
|
481
|
+
getAudioTracks(): PlayerAudioTrack[];
|
|
482
|
+
getAudioTrackSelection(): number;
|
|
483
|
+
setAudioTrack(index: number): void;
|
|
442
484
|
getSupportMode(): HlsSupportMode;
|
|
485
|
+
private syncHlsSubtitleTracks;
|
|
486
|
+
private syncHlsAudioTracks;
|
|
487
|
+
private bindNativeTextTracks;
|
|
443
488
|
destroy(): void;
|
|
444
489
|
}
|
|
445
490
|
|
|
@@ -465,9 +510,17 @@ type VideoPlayer = {
|
|
|
465
510
|
getQuality: () => QualitySelection;
|
|
466
511
|
setQuality: (selection: QualitySelection | string) => void;
|
|
467
512
|
getAvailableQualities: () => ReturnType<HlsEngine["getQualities"]>;
|
|
513
|
+
getTextTracks: () => PlayerTextTrack[];
|
|
514
|
+
getSelectedTextTrack: () => TextTrackSelection;
|
|
515
|
+
setTextTrack: (selection: TextTrackSelection) => void;
|
|
516
|
+
getAudioTracks: () => PlayerAudioTrack[];
|
|
517
|
+
getSelectedAudioTrack: () => number;
|
|
518
|
+
setAudioTrack: (index: number) => void;
|
|
468
519
|
enterFullscreen: () => Promise<void>;
|
|
469
520
|
exitFullscreen: () => Promise<void>;
|
|
470
521
|
isFullscreen: () => boolean;
|
|
522
|
+
/** Attach fullscreen target container (host UI chrome). Zoom stays UI-only. */
|
|
523
|
+
setFullscreenElement: (el: HTMLElement | null) => void;
|
|
471
524
|
reload: () => Promise<void>;
|
|
472
525
|
destroy: () => void;
|
|
473
526
|
getDiagnostics: () => PlayerDiagnostics;
|
|
@@ -591,32 +644,52 @@ declare class RefreshManager {
|
|
|
591
644
|
private renew;
|
|
592
645
|
}
|
|
593
646
|
|
|
594
|
-
type
|
|
647
|
+
type HlsLoaderInstance = {
|
|
648
|
+
stats: LoaderStats;
|
|
595
649
|
load(context: LoaderContext, config: LoaderConfiguration, callbacks: LoaderCallbacks<LoaderContext>): void;
|
|
596
650
|
destroy(): void;
|
|
651
|
+
abort?: () => void;
|
|
597
652
|
};
|
|
653
|
+
type HlsLoader = new (config: object) => HlsLoaderInstance;
|
|
598
654
|
type AuthParamsLoaderOptions = {
|
|
599
655
|
videoId?: string;
|
|
600
656
|
keyProxyUrlBuilder?: StreamingConfig["keyProxyUrlBuilder"];
|
|
601
657
|
getKeyAccessToken?: StreamingConfig["getKeyAccessToken"];
|
|
602
658
|
};
|
|
659
|
+
declare function isEncryptionKeyUrl(rawUrl: string, baseOrigin?: string): boolean;
|
|
660
|
+
/**
|
|
661
|
+
* Always resolve a builtin hls.js loader (XhrLoader).
|
|
662
|
+
*
|
|
663
|
+
* Never trust `Hls.DefaultConfig.loader` alone — if it was reassigned to a
|
|
664
|
+
* custom wrapper, `extends` / nested `inner.load()` chains blow Firefox's
|
|
665
|
+
* stack (`InternalError: too much recursion`).
|
|
666
|
+
*/
|
|
667
|
+
declare function resolveBuiltinHlsLoader(HlsClass: typeof Hls): HlsLoader;
|
|
603
668
|
/**
|
|
604
669
|
* Rewrites an HLS request URL so signed auth query params are present.
|
|
605
|
-
* Master playlists are signed on loadSource; child playlists / segments / keys
|
|
606
|
-
* are relative and would otherwise be fetched unsigned → CDN 403.
|
|
607
670
|
*
|
|
608
|
-
* AES `enc.key` handling (
|
|
609
|
-
* 1. `keyProxyUrlBuilder` — same-origin BFF (
|
|
610
|
-
* 2.
|
|
671
|
+
* AES `enc.key` handling (enterprise priority order):
|
|
672
|
+
* 1. `keyProxyUrlBuilder` — same-origin BFF (production; server IP must pass CDN/WAF)
|
|
673
|
+
* 2. Otherwise keep CDN/API URL and apply signed `token`/`expires` (and related) query
|
|
674
|
+
* params — same auth model as segments on Appextech CDN hosts
|
|
675
|
+
* 3. Optional `getKeyAccessToken` is applied at load-time (Bearer), not in this rewrite
|
|
611
676
|
*/
|
|
612
677
|
declare function rewriteHlsRequestUrl(rawUrl: string, store: AuthParamsStore, options?: AuthParamsLoaderOptions, baseOrigin?: string): string;
|
|
613
678
|
/**
|
|
614
|
-
* hls.js loader that
|
|
615
|
-
*
|
|
679
|
+
* hls.js loader that:
|
|
680
|
+
* - Re-applies signed auth query params on every media request
|
|
681
|
+
* - Loads AES `enc.key` via BFF / optional Bearer fetch / signed-query XHR
|
|
682
|
+
*
|
|
683
|
+
* Uses composition (not `extends DefaultConfig.loader`) so repeated mounts,
|
|
684
|
+
* HMR, or a polluted DefaultConfig cannot nest `super.load()` into recursion.
|
|
616
685
|
*/
|
|
617
686
|
declare function createAuthParamsLoader(HlsClass: typeof Hls, store: AuthParamsStore, options?: AuthParamsLoaderOptions): HlsLoader;
|
|
618
687
|
|
|
619
688
|
declare function redactValue(key: string, value: unknown, seen?: WeakSet<object>, depth?: number): unknown;
|
|
689
|
+
/**
|
|
690
|
+
* Redacts sensitive fields. Cycle-safe and depth-capped.
|
|
691
|
+
* Only walks plain objects/arrays — never DOM / host graphs.
|
|
692
|
+
*/
|
|
620
693
|
declare function redactObject(obj: Record<string, unknown>, seen?: WeakSet<object>, depth?: number): Record<string, unknown>;
|
|
621
694
|
|
|
622
|
-
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 HlsQualityLevel, type HlsSupportMode, type LiveMediaSnapshot, type LoggingConfig, PACKAGE_VERSION, PLAYBACK_RATES, type PlayIconPreset, type PlaybackCredentialConfig, type PlaybackRate, type PlaybackSource, type PlaybackSourceContext, PlaybackSourceManager, type PlayerBehaviorConfig, type PlayerConfig, type PlayerDiagnostics, type PlayerError, PlayerErrorCode, type PlayerEventMap, type PlayerSkipSeconds, type PlayerState, type PlayerZoomLevel, type QualitySelection, RefreshManager, SECRET_SCAN_MAX_DEPTH, type SeekToLiveResult, type StreamingConfig, type ThemeConfig, type VideoPlayer, type WatermarkConfig, assertNoSecretsInConfig, createAuthParamsLoader, createPlayerError, createVideoPlayer, getLiveEdgeTime, isAtLiveEdge, isPlainObject, mergePlayerConfig, redactObject, redactSensitive, redactValue, rewriteHlsRequestUrl, seekToLiveEdge, themeToCssVars };
|
|
695
|
+
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 HlsQualityLevel, type HlsSupportMode, 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 };
|