eb-player 1.54.57 → 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/README.md +2 -6
- package/dist/build/default.js +1 -1
- package/dist/build/eb-player.css +2066 -0
- package/dist/build/ebplayer-engines.bundle.js +2393 -0
- package/dist/build/ebplayer-engines.bundle.js.map +1 -0
- package/dist/build/ebplayer.bundle.js +6580 -0
- package/dist/build/ebplayer.bundle.js.map +1 -0
- package/dist/build/theme-forja.css +10 -0
- package/dist/build/theme-forja.js +1 -0
- package/dist/build/theme-modern.css +520 -0
- package/dist/build/theme-radio.css +11 -0
- package/dist/build/theme-radio.js +1 -0
- package/dist/build/theme-snrt.css +11 -0
- package/dist/build/theme-snrt.js +1 -0
- package/dist/build/theme-v2.css +661 -0
- package/dist/build/types/config.d.ts +139 -0
- package/dist/build/types/config.d.ts.map +1 -0
- package/dist/build/types/core/command-handler.d.ts +49 -0
- package/dist/build/types/core/command-handler.d.ts.map +1 -0
- package/dist/build/types/core/config.d.ts +174 -0
- package/dist/build/types/core/config.d.ts.map +1 -0
- package/dist/build/types/core/css/theme-forja.entry.d.ts +2 -0
- package/dist/build/types/core/css/theme-forja.entry.d.ts.map +1 -0
- package/dist/build/types/core/css/theme-radio.entry.d.ts +2 -0
- package/dist/build/types/core/css/theme-radio.entry.d.ts.map +1 -0
- package/dist/build/types/core/css/theme-snrt.entry.d.ts +2 -0
- package/dist/build/types/core/css/theme-snrt.entry.d.ts.map +1 -0
- package/dist/build/types/core/engine-state-sync.d.ts +38 -0
- package/dist/build/types/core/engine-state-sync.d.ts.map +1 -0
- package/dist/build/types/core/event-bus.d.ts +87 -0
- package/dist/build/types/core/event-bus.d.ts.map +1 -0
- package/dist/build/types/core/fsm.d.ts +27 -0
- package/dist/build/types/core/fsm.d.ts.map +1 -0
- package/dist/build/types/core/i18n.d.ts +51 -0
- package/dist/build/types/core/i18n.d.ts.map +1 -0
- package/dist/build/types/core/index.d.ts +23 -0
- package/dist/build/types/core/index.d.ts.map +1 -0
- package/dist/build/types/core/lifecycle.d.ts +96 -0
- package/dist/build/types/core/lifecycle.d.ts.map +1 -0
- package/dist/build/types/core/player-state.d.ts +15 -0
- package/dist/build/types/core/player-state.d.ts.map +1 -0
- package/dist/build/types/core/types.d.ts +84 -0
- package/dist/build/types/core/types.d.ts.map +1 -0
- package/dist/build/types/eb-player-standalone.d.ts +12 -0
- package/dist/build/types/eb-player-standalone.d.ts.map +1 -0
- package/dist/build/types/eb-player.d.ts +43 -0
- package/dist/build/types/eb-player.d.ts.map +1 -0
- package/dist/build/types/engine-state-sync.d.ts +38 -0
- package/dist/build/types/engine-state-sync.d.ts.map +1 -0
- package/dist/build/types/engines/abr/dash.d.ts +56 -0
- package/dist/build/types/engines/abr/dash.d.ts.map +1 -0
- package/dist/build/types/engines/abr/hls.d.ts +105 -0
- package/dist/build/types/engines/abr/hls.d.ts.map +1 -0
- package/dist/build/types/engines/base-engine.d.ts +56 -0
- package/dist/build/types/engines/base-engine.d.ts.map +1 -0
- package/dist/build/types/engines/cdn-loader.d.ts +20 -0
- package/dist/build/types/engines/cdn-loader.d.ts.map +1 -0
- package/dist/build/types/engines/cdn-token-manager.d.ts +136 -0
- package/dist/build/types/engines/cdn-token-manager.d.ts.map +1 -0
- package/dist/build/types/engines/dash.d.ts +79 -0
- package/dist/build/types/engines/dash.d.ts.map +1 -0
- package/dist/build/types/engines/drm.d.ts +54 -0
- package/dist/build/types/engines/drm.d.ts.map +1 -0
- package/dist/build/types/engines/hls-discontinuity-patch.d.ts +43 -0
- package/dist/build/types/engines/hls-discontinuity-patch.d.ts.map +1 -0
- package/dist/build/types/engines/hls.d.ts +45 -0
- package/dist/build/types/engines/hls.d.ts.map +1 -0
- package/dist/build/types/engines/index.d.ts +26 -0
- package/dist/build/types/engines/index.d.ts.map +1 -0
- package/dist/build/types/engines/ios/hls.d.ts +20 -0
- package/dist/build/types/engines/ios/hls.d.ts.map +1 -0
- package/dist/build/types/engines/poster/hls.d.ts +35 -0
- package/dist/build/types/engines/poster/hls.d.ts.map +1 -0
- package/dist/build/types/engines/retry/dash.d.ts +39 -0
- package/dist/build/types/engines/retry/dash.d.ts.map +1 -0
- package/dist/build/types/engines/retry/hls.d.ts +35 -0
- package/dist/build/types/engines/retry/hls.d.ts.map +1 -0
- package/dist/build/types/engines/snapshot/dash.d.ts +55 -0
- package/dist/build/types/engines/snapshot/dash.d.ts.map +1 -0
- package/dist/build/types/engines/snapshot/hls.d.ts +104 -0
- package/dist/build/types/engines/snapshot/hls.d.ts.map +1 -0
- package/dist/build/types/engines/stall-watchdog.d.ts +41 -0
- package/dist/build/types/engines/stall-watchdog.d.ts.map +1 -0
- package/dist/build/types/event-bus.d.ts +54 -0
- package/dist/build/types/event-bus.d.ts.map +1 -0
- package/dist/build/types/fsm.d.ts +27 -0
- package/dist/build/types/fsm.d.ts.map +1 -0
- package/dist/build/types/i18n.d.ts +51 -0
- package/dist/build/types/i18n.d.ts.map +1 -0
- package/dist/build/types/index.d.ts +21 -0
- package/dist/build/types/index.d.ts.map +1 -0
- package/dist/build/types/integrations/ads-manager.d.ts +32 -0
- package/dist/build/types/integrations/ads-manager.d.ts.map +1 -0
- package/dist/build/types/integrations/chromecast-manager.d.ts +50 -0
- package/dist/build/types/integrations/chromecast-manager.d.ts.map +1 -0
- package/dist/build/types/integrations/epg-manager.d.ts +22 -0
- package/dist/build/types/integrations/epg-manager.d.ts.map +1 -0
- package/dist/build/types/integrations/index.d.ts +6 -0
- package/dist/build/types/integrations/index.d.ts.map +1 -0
- package/dist/build/types/integrations/p2p-manager.d.ts +33 -0
- package/dist/build/types/integrations/p2p-manager.d.ts.map +1 -0
- package/dist/build/types/integrations/playlist-manager.d.ts +21 -0
- package/dist/build/types/integrations/playlist-manager.d.ts.map +1 -0
- package/dist/build/types/lifecycle.d.ts +64 -0
- package/dist/build/types/lifecycle.d.ts.map +1 -0
- package/dist/build/types/player-state.d.ts +15 -0
- package/dist/build/types/player-state.d.ts.map +1 -0
- package/dist/build/types/skin/bars/bottom-bar.d.ts +16 -0
- package/dist/build/types/skin/bars/bottom-bar.d.ts.map +1 -0
- package/dist/build/types/skin/bars/middle-bar.d.ts +16 -0
- package/dist/build/types/skin/bars/middle-bar.d.ts.map +1 -0
- package/dist/build/types/skin/bars/top-bar.d.ts +15 -0
- package/dist/build/types/skin/bars/top-bar.d.ts.map +1 -0
- package/dist/build/types/skin/base-component.d.ts +69 -0
- package/dist/build/types/skin/base-component.d.ts.map +1 -0
- package/dist/build/types/skin/brand/forja-playlist-bar.d.ts +15 -0
- package/dist/build/types/skin/brand/forja-playlist-bar.d.ts.map +1 -0
- package/dist/build/types/skin/brand/snrt-radio-carousel.d.ts +16 -0
- package/dist/build/types/skin/brand/snrt-radio-carousel.d.ts.map +1 -0
- package/dist/build/types/skin/component-registry.d.ts +16 -0
- package/dist/build/types/skin/component-registry.d.ts.map +1 -0
- package/dist/build/types/skin/controllers/auto-hide.d.ts +27 -0
- package/dist/build/types/skin/controllers/auto-hide.d.ts.map +1 -0
- package/dist/build/types/skin/controllers/keyboard.d.ts +29 -0
- package/dist/build/types/skin/controllers/keyboard.d.ts.map +1 -0
- package/dist/build/types/skin/controls/cast-button.d.ts +15 -0
- package/dist/build/types/skin/controls/cast-button.d.ts.map +1 -0
- package/dist/build/types/skin/controls/forward-button.d.ts +15 -0
- package/dist/build/types/skin/controls/forward-button.d.ts.map +1 -0
- package/dist/build/types/skin/controls/fullscreen-button.d.ts +17 -0
- package/dist/build/types/skin/controls/fullscreen-button.d.ts.map +1 -0
- package/dist/build/types/skin/controls/info-button.d.ts +10 -0
- package/dist/build/types/skin/controls/info-button.d.ts.map +1 -0
- package/dist/build/types/skin/controls/live-sync-button.d.ts +20 -0
- package/dist/build/types/skin/controls/live-sync-button.d.ts.map +1 -0
- package/dist/build/types/skin/controls/pip-button.d.ts +21 -0
- package/dist/build/types/skin/controls/pip-button.d.ts.map +1 -0
- package/dist/build/types/skin/controls/play-pause-button.d.ts +14 -0
- package/dist/build/types/skin/controls/play-pause-button.d.ts.map +1 -0
- package/dist/build/types/skin/controls/rewind-button.d.ts +15 -0
- package/dist/build/types/skin/controls/rewind-button.d.ts.map +1 -0
- package/dist/build/types/skin/controls/seekbar.d.ts +43 -0
- package/dist/build/types/skin/controls/seekbar.d.ts.map +1 -0
- package/dist/build/types/skin/controls/settings-panel.d.ts +45 -0
- package/dist/build/types/skin/controls/settings-panel.d.ts.map +1 -0
- package/dist/build/types/skin/controls/share-button.d.ts +11 -0
- package/dist/build/types/skin/controls/share-button.d.ts.map +1 -0
- package/dist/build/types/skin/controls/time-display.d.ts +19 -0
- package/dist/build/types/skin/controls/time-display.d.ts.map +1 -0
- package/dist/build/types/skin/controls/volume-control.d.ts +21 -0
- package/dist/build/types/skin/controls/volume-control.d.ts.map +1 -0
- package/dist/build/types/skin/icons/icons-modern.d.ts +10 -0
- package/dist/build/types/skin/icons/icons-modern.d.ts.map +1 -0
- package/dist/build/types/skin/icons/icons.d.ts +10 -0
- package/dist/build/types/skin/icons/icons.d.ts.map +1 -0
- package/dist/build/types/skin/icons/sprite.d.ts +39 -0
- package/dist/build/types/skin/icons/sprite.d.ts.map +1 -0
- package/dist/build/types/skin/index.d.ts +24 -0
- package/dist/build/types/skin/index.d.ts.map +1 -0
- package/dist/build/types/skin/overlays/error-message.d.ts +14 -0
- package/dist/build/types/skin/overlays/error-message.d.ts.map +1 -0
- package/dist/build/types/skin/overlays/info-overlay.d.ts +15 -0
- package/dist/build/types/skin/overlays/info-overlay.d.ts.map +1 -0
- package/dist/build/types/skin/overlays/loading-spinner.d.ts +17 -0
- package/dist/build/types/skin/overlays/loading-spinner.d.ts.map +1 -0
- package/dist/build/types/skin/overlays/socials-overlay.d.ts +17 -0
- package/dist/build/types/skin/overlays/socials-overlay.d.ts.map +1 -0
- package/dist/build/types/skin/overlays/toast-notification.d.ts +18 -0
- package/dist/build/types/skin/overlays/toast-notification.d.ts.map +1 -0
- package/dist/build/types/skin/skin-root.d.ts +80 -0
- package/dist/build/types/skin/skin-root.d.ts.map +1 -0
- package/dist/build/types/types.d.ts +41 -0
- package/dist/build/types/types.d.ts.map +1 -0
- package/dist/build/types/utils/chapters.d.ts +16 -0
- package/dist/build/types/utils/chapters.d.ts.map +1 -0
- package/dist/build/types/utils/format-duration.d.ts +9 -0
- package/dist/build/types/utils/format-duration.d.ts.map +1 -0
- package/dist/build/types/utils/format-wall-clock.d.ts +6 -0
- package/dist/build/types/utils/format-wall-clock.d.ts.map +1 -0
- package/dist/build/types/utils/settings-helpers.d.ts +41 -0
- package/dist/build/types/utils/settings-helpers.d.ts.map +1 -0
- package/dist/dev/default.js +6451 -0
- package/dist/dev/default.js.map +1 -0
- package/dist/dev/easybroadcast.js +6654 -0
- package/dist/dev/easybroadcast.js.map +1 -0
- package/dist/dev/index.html +24 -0
- package/dist/eb-player.css +2066 -0
- package/dist/players/default/default.js +400 -1
- package/dist/players/default/index.html +1 -5
- package/dist/players/forja/forja.js +310 -0
- package/dist/players/forja/index.html +1 -0
- package/dist/players/videos/equipe/EB_lequipe-preprod.js +1 -0
- package/dist/players/videos/equipe/EB_lequipe.js +1 -1
- package/dist/players/videos/equipe/equipe.js +1 -1
- package/dist/theme-forja.css +10 -0
- package/dist/theme-modern.css +520 -0
- package/dist/theme-radio.css +11 -0
- package/dist/theme-snrt.css +11 -0
- package/dist/theme-v2.css +661 -0
- package/package.json +34 -3
- package/dist/build/forja.js +0 -1
- package/dist/players/videos/equipe/EB_lequipe-preprod copy.js +0 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { TypedEventBus } from './event-bus';
|
|
2
|
+
import { I18n } from './i18n';
|
|
3
|
+
import type { PlayerState } from './types';
|
|
4
|
+
import type { PlayerConfig } from './config';
|
|
5
|
+
import type { EngineStateSync } from './engine-state-sync';
|
|
6
|
+
import type { SavedSelections } from './command-handler';
|
|
7
|
+
/**
|
|
8
|
+
* PlayerController manages the complete lifecycle of a player instance.
|
|
9
|
+
*
|
|
10
|
+
* Lifecycle:
|
|
11
|
+
* 1. Construct with config
|
|
12
|
+
* 2. mount(container) — apply CSS vars, set data-theme, create SkinRoot, initialize integrations
|
|
13
|
+
* 3. setEngineSync(sync) — attach engine bridge to state
|
|
14
|
+
* 4. dispose() — disconnect SkinRoot, abort all signals, detach engine, clear references
|
|
15
|
+
* 5. Optionally re-mount with a fresh container (dispose() creates a new AbortController)
|
|
16
|
+
*
|
|
17
|
+
* Mount order:
|
|
18
|
+
* 1. CSS vars / data-theme applied to container
|
|
19
|
+
* 2. Config-derived state (isRtl, isRadio) set
|
|
20
|
+
* 3. SkinRoot connected (needs DOM) — creates video element and ads container
|
|
21
|
+
* 4. AutoHideController + KeyboardController wired
|
|
22
|
+
* 5. Integrations initialized (need skin DOM for ads)
|
|
23
|
+
*
|
|
24
|
+
* Dispose order (reverse of mount):
|
|
25
|
+
* 1. Engine detached
|
|
26
|
+
* 2. Bus disposed
|
|
27
|
+
* 3. AbortController aborted (cleans up all signal-based listeners)
|
|
28
|
+
* 4. SkinRoot disconnected
|
|
29
|
+
* 5. References nulled
|
|
30
|
+
*/
|
|
31
|
+
export declare class PlayerController {
|
|
32
|
+
readonly state: PlayerState;
|
|
33
|
+
readonly bus: TypedEventBus;
|
|
34
|
+
readonly config: PlayerConfig;
|
|
35
|
+
readonly i18n: I18n;
|
|
36
|
+
private abortController;
|
|
37
|
+
private _container;
|
|
38
|
+
private engineSync;
|
|
39
|
+
private skinRoot;
|
|
40
|
+
private commandHandler;
|
|
41
|
+
private chromecastManager;
|
|
42
|
+
private reloadCallback;
|
|
43
|
+
get signal(): AbortSignal;
|
|
44
|
+
/**
|
|
45
|
+
* The currently mounted container element, or null if not mounted / after dispose().
|
|
46
|
+
* Available for Phase 2 engine implementations that need access to the DOM context.
|
|
47
|
+
*/
|
|
48
|
+
get container(): HTMLElement | null;
|
|
49
|
+
constructor(config: Partial<PlayerConfig>);
|
|
50
|
+
/**
|
|
51
|
+
* Attach the player to a DOM container element.
|
|
52
|
+
*
|
|
53
|
+
* Applies CSS vars and data-theme, creates the SkinRoot DOM scaffold,
|
|
54
|
+
* registers AutoHide/Keyboard controllers, and initializes integration
|
|
55
|
+
* managers based on config flags.
|
|
56
|
+
*
|
|
57
|
+
* CSS application order (later wins):
|
|
58
|
+
* 1. primaryColor → --eb-color-primary
|
|
59
|
+
* 2. skinColors.general → --eb-color-primary (overrides primaryColor)
|
|
60
|
+
* 3. skinColors.progressBar → --eb-color-progress
|
|
61
|
+
* 4. skinColors.volumeBar → --eb-color-volume
|
|
62
|
+
*/
|
|
63
|
+
mount(container: HTMLElement): void;
|
|
64
|
+
/**
|
|
65
|
+
* Store a callback to invoke when request-reload fires.
|
|
66
|
+
* Called by eb-player.ts after mount() to wire the reload orchestration path.
|
|
67
|
+
*/
|
|
68
|
+
setReloadCallback(callback: () => void): void;
|
|
69
|
+
/**
|
|
70
|
+
* Returns saved stream selections from the CommandHandler (quality, audioTrack, subtitleTrack).
|
|
71
|
+
* Returns defaults when no CommandHandler exists (e.g., noUi mode, no video element).
|
|
72
|
+
*/
|
|
73
|
+
getSavedSelections(): SavedSelections;
|
|
74
|
+
/**
|
|
75
|
+
* Attach an engine bridge implementation to the state store.
|
|
76
|
+
* If an existing engine is attached, detach() is called first.
|
|
77
|
+
* The engine receives the PlayerState and the current AbortSignal.
|
|
78
|
+
*/
|
|
79
|
+
setEngineSync(sync: EngineStateSync): void;
|
|
80
|
+
/**
|
|
81
|
+
* Dispose the player instance.
|
|
82
|
+
* - Calls engineSync.detach() if an engine is attached
|
|
83
|
+
* - Calls bus.dispose() to clear all event listeners
|
|
84
|
+
* - Aborts the AbortController (removes all signal-based listeners atomically)
|
|
85
|
+
* - Disconnects SkinRoot
|
|
86
|
+
* - Clears all references
|
|
87
|
+
* - Creates a fresh AbortController for potential re-mount
|
|
88
|
+
*/
|
|
89
|
+
dispose(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Initialize integration managers based on config flags.
|
|
92
|
+
* All integrations are async and non-critical — errors are caught and logged.
|
|
93
|
+
*/
|
|
94
|
+
private initIntegrations;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/core/lifecycle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAU7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAGxD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,gBAAgB;IAC3B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IAEnB,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,iBAAiB,CAA0B;IACnD,OAAO,CAAC,cAAc,CAAqB;IAE3C,IAAI,MAAM,IAAI,WAAW,CAExB;IAED;;;OAGG;IACH,IAAI,SAAS,IAAI,WAAW,GAAG,IAAI,CAElC;gBAEW,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC;IAczC;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI;IA4EnC;;;OAGG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAI7C;;;OAGG;IACH,kBAAkB,IAAI,eAAe;IAOrC;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAQ1C;;;;;;;;OAQG;IACH,OAAO,IAAI,IAAI;IAwBf;;;OAGG;IACH,OAAO,CAAC,gBAAgB;CAyEzB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StateMap, PlayerState } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Proxy-based reactive PlayerState instance.
|
|
4
|
+
*
|
|
5
|
+
* The Proxy set trap enforces three rules:
|
|
6
|
+
* 1. Non-plain objects (class instances) are rejected with a TypeError
|
|
7
|
+
* 2. `playbackState` assignments are validated via the FSM transition guard
|
|
8
|
+
* 3. Assigning the same value is a no-op (no subscriber notification)
|
|
9
|
+
*
|
|
10
|
+
* Subscribers are registered via `state.on('propertyName', callback, { signal })`.
|
|
11
|
+
* Pass an AbortController signal to clean up subscriptions automatically.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createPlayerState(initial?: Partial<StateMap>): PlayerState;
|
|
14
|
+
export type { PlayerState };
|
|
15
|
+
//# sourceMappingURL=player-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"player-state.d.ts","sourceRoot":"","sources":["../../../../src/core/player-state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAY,WAAW,EAAE,MAAM,SAAS,CAAA;AAoG9D;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,WAAW,CAuD1E;AAED,YAAY,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { PlaybackState } from './fsm';
|
|
2
|
+
/**
|
|
3
|
+
* A single EPG (Electronic Program Guide) entry.
|
|
4
|
+
*/
|
|
5
|
+
export interface EpgProgram {
|
|
6
|
+
title: string;
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
lang: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A chapter marker within the video timeline.
|
|
13
|
+
*/
|
|
14
|
+
export interface ChapterMark {
|
|
15
|
+
title: string;
|
|
16
|
+
startTime: number;
|
|
17
|
+
endTime: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A single item in a playlist.
|
|
21
|
+
*/
|
|
22
|
+
export interface PlaylistItem {
|
|
23
|
+
src: string;
|
|
24
|
+
title: string;
|
|
25
|
+
image: string;
|
|
26
|
+
duration: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The complete map of all reactive state properties in the player.
|
|
30
|
+
* Used by PlayerState (Proxy-based reactive store).
|
|
31
|
+
*/
|
|
32
|
+
export interface StateMap {
|
|
33
|
+
playbackState: PlaybackState;
|
|
34
|
+
volume: number;
|
|
35
|
+
currentTime: number;
|
|
36
|
+
duration: number;
|
|
37
|
+
muted: boolean;
|
|
38
|
+
bufferedEnd: number;
|
|
39
|
+
isLive: boolean;
|
|
40
|
+
qualityLevels: unknown[];
|
|
41
|
+
currentQuality: number;
|
|
42
|
+
audioTracks: unknown[];
|
|
43
|
+
currentAudioTrack: number;
|
|
44
|
+
subtitleTracks: unknown[];
|
|
45
|
+
currentSubtitleTrack: number;
|
|
46
|
+
playbackRate: number;
|
|
47
|
+
error: string | null;
|
|
48
|
+
src: string;
|
|
49
|
+
isFullscreen: boolean;
|
|
50
|
+
isPip: boolean;
|
|
51
|
+
isCasting: boolean;
|
|
52
|
+
controlsVisible: boolean;
|
|
53
|
+
settingsOpen: boolean;
|
|
54
|
+
socialsOpen: boolean;
|
|
55
|
+
infoOpen: boolean;
|
|
56
|
+
adPlaying: boolean;
|
|
57
|
+
castAvailable: boolean;
|
|
58
|
+
isRtl: boolean;
|
|
59
|
+
isRadio: boolean;
|
|
60
|
+
isIOS: boolean;
|
|
61
|
+
isSyncWithLive: boolean;
|
|
62
|
+
epgPrograms: EpgProgram[];
|
|
63
|
+
epgFetchedAt: number;
|
|
64
|
+
chapters: ChapterMark[];
|
|
65
|
+
playlist: PlaylistItem[];
|
|
66
|
+
currentEpisode: number;
|
|
67
|
+
reconnecting: boolean;
|
|
68
|
+
toast: string | null;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Per-property subscriber callback type.
|
|
72
|
+
* Receives the new value and the previous value.
|
|
73
|
+
*/
|
|
74
|
+
export type Listener<T> = (value: T, prev: T) => void;
|
|
75
|
+
/**
|
|
76
|
+
* The public interface for the player state object.
|
|
77
|
+
* Combines all state properties with the subscription method.
|
|
78
|
+
*/
|
|
79
|
+
export type PlayerState = StateMap & {
|
|
80
|
+
on: <K extends keyof StateMap>(key: K, listener: Listener<StateMap[K]>, options?: {
|
|
81
|
+
signal?: AbortSignal;
|
|
82
|
+
}) => void;
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM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ACrB;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;AAErD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG;IACnC,EAAE,EAAE,CAAC,CAAC,SAAS,MAAM,QAAQ,EAC3B,GAAG,EAAE,CAAC,EACN,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC/B,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAC/B,IAAI,CAAA;CACV,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standalone entry point — used for the generated player bundle (not the npm UMD build).
|
|
3
|
+
*
|
|
4
|
+
* This file is resolved by Rollup with @rollup/plugin-virtual injecting the brand config
|
|
5
|
+
* from 'virtual:brand-config' at build time. The merged config is passed to start()
|
|
6
|
+
* automatically if config.start is truthy (the default).
|
|
7
|
+
*
|
|
8
|
+
* Import chain:
|
|
9
|
+
* eb-player-standalone.ts → eb-player.ts (facade) + virtual:brand-config (brand config)
|
|
10
|
+
*/
|
|
11
|
+
export { start, stop, destroy } from './eb-player';
|
|
12
|
+
//# sourceMappingURL=eb-player-standalone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eb-player-standalone.d.ts","sourceRoot":"","sources":["../../../src/eb-player-standalone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EBPlayer facade — consumer-facing API layer.
|
|
3
|
+
*
|
|
4
|
+
* Provides the window.EBPlayer interface that existing consumers use:
|
|
5
|
+
* - window.EBPlayer.start(config) — synchronously returns a PlayerReference
|
|
6
|
+
* - window.EBPlayer.stop() — detaches the active engine (skin stays mounted)
|
|
7
|
+
* - window.EBPlayer.destroy() — disposes the controller (tears down everything)
|
|
8
|
+
*
|
|
9
|
+
* The facade tracks one active controller and one active engine at module level.
|
|
10
|
+
* Multiple start() calls dispose the previous instance before creating a new one.
|
|
11
|
+
*/
|
|
12
|
+
import type { PlayerState } from './core/types';
|
|
13
|
+
import type { PlayerConfig } from './core/config';
|
|
14
|
+
/**
|
|
15
|
+
* The PlayerReference returned by start().
|
|
16
|
+
* Gives consumers direct control over the active stream.
|
|
17
|
+
*/
|
|
18
|
+
export interface PlayerReference {
|
|
19
|
+
/** Open a stream URL. Detects protocol from extension (.m3u8 → HLS, .mpd → DASH). */
|
|
20
|
+
open(src: string): void;
|
|
21
|
+
/** Close the active stream (detaches engine; skin remains mounted). */
|
|
22
|
+
close(): void;
|
|
23
|
+
/** Current player state (read-only reference to the reactive state store). */
|
|
24
|
+
readonly state: PlayerState;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Start the player with the given config.
|
|
28
|
+
* If a player is already running, it is disposed before the new one is created.
|
|
29
|
+
*
|
|
30
|
+
* Returns a PlayerReference synchronously — never returns a Promise.
|
|
31
|
+
*/
|
|
32
|
+
export declare function start(runtimeConfig: Partial<PlayerConfig>): PlayerReference;
|
|
33
|
+
/**
|
|
34
|
+
* Stop the active stream.
|
|
35
|
+
* Detaches the engine without disposing the controller (skin stays mounted).
|
|
36
|
+
*/
|
|
37
|
+
export declare function stop(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Destroy the player completely.
|
|
40
|
+
* Disposes the controller (tears down skin, events, and all resources).
|
|
41
|
+
*/
|
|
42
|
+
export declare function destroy(): void;
|
|
43
|
+
//# sourceMappingURL=eb-player.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eb-player.d.ts","sourceRoot":"","sources":["../../../src/eb-player.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAGjD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,qFAAqF;IACrF,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,uEAAuE;IACvE,KAAK,IAAI,IAAI,CAAA;IACb,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;CAC5B;AA4DD;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,eAAe,CAuJ3E;AAED;;;GAGG;AACH,wBAAgB,IAAI,IAAI,IAAI,CAK3B;AAED;;;GAGG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAU9B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PlayerState } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* EngineStateSync is the abstract base class defining the contract for Phase 2
|
|
4
|
+
* engine bridge implementations (HLS, DASH).
|
|
5
|
+
*
|
|
6
|
+
* Phase 2 HLS and DASH engines extend this class to bridge DOM video events
|
|
7
|
+
* to the PlayerState store. The attach() method receives the PlayerState and
|
|
8
|
+
* an AbortSignal for automatic cleanup — engines register video element
|
|
9
|
+
* event listeners using the signal to ensure zero-leak cleanup on dispose().
|
|
10
|
+
*
|
|
11
|
+
* Usage pattern in Phase 2:
|
|
12
|
+
* class HlsEngineSync extends EngineStateSync {
|
|
13
|
+
* attach(state: PlayerState, signal: AbortSignal): void {
|
|
14
|
+
* video.addEventListener('timeupdate', () => { state.currentTime = video.currentTime }, { signal })
|
|
15
|
+
* }
|
|
16
|
+
* detach(): void {
|
|
17
|
+
* this.driver?.destroy()
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export declare abstract class EngineStateSync {
|
|
22
|
+
/**
|
|
23
|
+
* Called by PlayerController.setEngineSync() to bridge engine events to state.
|
|
24
|
+
* Implementations should register all event listeners using { signal } so they
|
|
25
|
+
* are automatically removed when the AbortController is aborted on dispose().
|
|
26
|
+
*
|
|
27
|
+
* @param state - The reactive PlayerState to write engine events into
|
|
28
|
+
* @param signal - AbortSignal tied to the PlayerController's lifecycle
|
|
29
|
+
*/
|
|
30
|
+
abstract attach(state: PlayerState, signal: AbortSignal): void;
|
|
31
|
+
/**
|
|
32
|
+
* Called by PlayerController.dispose() or when a new engine replaces this one.
|
|
33
|
+
* Implementations should clean up engine-specific resources (e.g., driver.destroy()).
|
|
34
|
+
* Signal-based event listeners are automatically removed by the AbortController.
|
|
35
|
+
*/
|
|
36
|
+
abstract detach(): void;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=engine-state-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-state-sync.d.ts","sourceRoot":"","sources":["../../../src/core/engine-state-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,8BAAsB,eAAe;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI;IAE9D;;;;OAIG;IACH,QAAQ,CAAC,MAAM,IAAI,IAAI;CACxB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DASH Custom ABR Rule
|
|
3
|
+
*
|
|
4
|
+
* Ported from component/engines/abr/dash.js
|
|
5
|
+
*
|
|
6
|
+
* Implements a buffer-and-throughput aware adaptive bitrate rule for dash.js.
|
|
7
|
+
* Applied via driver.addABRCustomRule('qualitySwitchRules', 'CustomAbrRule', factory).
|
|
8
|
+
*/
|
|
9
|
+
interface SwitchRequestInstance {
|
|
10
|
+
quality: number;
|
|
11
|
+
reason: string;
|
|
12
|
+
priority: number;
|
|
13
|
+
}
|
|
14
|
+
interface SwitchRequestFactory {
|
|
15
|
+
(context: unknown): {
|
|
16
|
+
create: () => SwitchRequestInstance;
|
|
17
|
+
};
|
|
18
|
+
PRIORITY: {
|
|
19
|
+
STRONG: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
interface SingletonFactory<T> {
|
|
23
|
+
(context: unknown): {
|
|
24
|
+
getInstance: () => T;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
interface AbrControllerInstance {
|
|
28
|
+
getQualityFor: (mediaType: string, streamInfo: unknown) => number;
|
|
29
|
+
}
|
|
30
|
+
interface RulesContextInstance {
|
|
31
|
+
getMediaInfo: () => {
|
|
32
|
+
type: string;
|
|
33
|
+
bitrateList: Array<{
|
|
34
|
+
bandwidth: number;
|
|
35
|
+
}>;
|
|
36
|
+
representationCount: number;
|
|
37
|
+
};
|
|
38
|
+
getAbrController: () => AbrControllerInstance;
|
|
39
|
+
}
|
|
40
|
+
interface FactoryMakerLike {
|
|
41
|
+
getClassFactoryByName: (name: string) => SwitchRequestFactory;
|
|
42
|
+
getSingletonFactoryByName: (name: string) => SingletonFactory<unknown>;
|
|
43
|
+
getClassFactory: (fn: AbrRuleFunction) => unknown;
|
|
44
|
+
}
|
|
45
|
+
interface AbrRuleFunction {
|
|
46
|
+
(): {
|
|
47
|
+
getMaxIndex: (rulesContext: RulesContextInstance) => SwitchRequestInstance;
|
|
48
|
+
};
|
|
49
|
+
__dashjs_factory_name: string;
|
|
50
|
+
}
|
|
51
|
+
export interface DashjsForAbr {
|
|
52
|
+
FactoryMaker: FactoryMakerLike;
|
|
53
|
+
}
|
|
54
|
+
export declare function createDashAbrRule(dashjs: DashjsForAbr): unknown;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=dash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dash.d.ts","sourceRoot":"","sources":["../../../../../src/engines/abr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Y,EAAE,gBAAgB,CAAA;CAC/B;AAyCD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAwJ/D"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom HLS ABR controller.
|
|
3
|
+
*
|
|
4
|
+
* Ported from component/engines/abr/hls.js (509 LOC).
|
|
5
|
+
*
|
|
6
|
+
* Creates a class that extends hls.js's built-in ABR controller and overrides
|
|
7
|
+
* nextAutoLevel with bandwidth-aware and buffer-level-based quality selection.
|
|
8
|
+
*
|
|
9
|
+
* Usage: pass the result as `abrController` in the Hls constructor config.
|
|
10
|
+
*
|
|
11
|
+
* Note: hls.js internals are accessed via type assertions because the library
|
|
12
|
+
* does not export its internal controller types (Open Question 3 in RESEARCH.md).
|
|
13
|
+
*/
|
|
14
|
+
interface AbrHlsLevel {
|
|
15
|
+
bitrate: number;
|
|
16
|
+
loaded?: {
|
|
17
|
+
bytes: number;
|
|
18
|
+
duration: number;
|
|
19
|
+
};
|
|
20
|
+
realBitrate?: number;
|
|
21
|
+
}
|
|
22
|
+
interface AbrHlsMedia {
|
|
23
|
+
currentTime: number;
|
|
24
|
+
playbackRate: number;
|
|
25
|
+
paused: boolean;
|
|
26
|
+
readyState: number;
|
|
27
|
+
}
|
|
28
|
+
interface AbrHlsConfig {
|
|
29
|
+
maxBufferLength: number;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
interface AbrHlsInstance {
|
|
33
|
+
on: (event: string, handler: (event: string, data: unknown) => void, context?: unknown) => void;
|
|
34
|
+
off: (event: string, handler: (event: string, data: unknown) => void, context?: unknown) => void;
|
|
35
|
+
levels: AbrHlsLevel[];
|
|
36
|
+
currentLevel: number;
|
|
37
|
+
media: AbrHlsMedia | null;
|
|
38
|
+
config: AbrHlsConfig;
|
|
39
|
+
autoLevelEnabled?: boolean;
|
|
40
|
+
}
|
|
41
|
+
interface AbrHlsEvents {
|
|
42
|
+
FRAG_LOADING: string;
|
|
43
|
+
FRAG_LOADED: string;
|
|
44
|
+
FRAG_BUFFERED: string;
|
|
45
|
+
LEVEL_LOADED: string;
|
|
46
|
+
ERROR: string;
|
|
47
|
+
}
|
|
48
|
+
interface AbrHlsConstructorLike {
|
|
49
|
+
Events: AbrHlsEvents;
|
|
50
|
+
DefaultConfig: {
|
|
51
|
+
abrController?: AbrControllerConstructor;
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
};
|
|
54
|
+
[key: string]: unknown;
|
|
55
|
+
}
|
|
56
|
+
interface AbrControllerConstructor {
|
|
57
|
+
new (hlsInstance: AbrHlsInstance, ...args: unknown[]): AbrControllerInstance;
|
|
58
|
+
prototype: AbrControllerInstance;
|
|
59
|
+
}
|
|
60
|
+
interface AbrControllerInstance {
|
|
61
|
+
hls: AbrHlsInstance;
|
|
62
|
+
destroy(): void;
|
|
63
|
+
registerListeners?: () => void;
|
|
64
|
+
unregisterListeners?: () => void;
|
|
65
|
+
clearTimer?: () => void;
|
|
66
|
+
fragCurrent?: HlsFragment | null;
|
|
67
|
+
partCurrent?: HlsFragPart | null;
|
|
68
|
+
timer?: ReturnType<typeof setInterval> | undefined;
|
|
69
|
+
onCheck?: () => void;
|
|
70
|
+
[key: string]: unknown;
|
|
71
|
+
}
|
|
72
|
+
interface HlsFragment {
|
|
73
|
+
type: string;
|
|
74
|
+
sn: number | 'initSegment';
|
|
75
|
+
level: number;
|
|
76
|
+
duration: number;
|
|
77
|
+
stats: HlsFragStats;
|
|
78
|
+
[key: string]: unknown;
|
|
79
|
+
}
|
|
80
|
+
interface HlsFragPart {
|
|
81
|
+
duration: number;
|
|
82
|
+
stats: HlsFragStats;
|
|
83
|
+
}
|
|
84
|
+
interface HlsFragStats {
|
|
85
|
+
loading: {
|
|
86
|
+
start: number;
|
|
87
|
+
};
|
|
88
|
+
parsing: {
|
|
89
|
+
end: number;
|
|
90
|
+
};
|
|
91
|
+
loaded: number;
|
|
92
|
+
tload?: number;
|
|
93
|
+
tfirst?: number;
|
|
94
|
+
trequest?: number;
|
|
95
|
+
aborted?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Factory that creates a custom ABR controller class extending hls.js's built-in
|
|
99
|
+
* ABR controller. Takes the Hls constructor so it can access Events and DefaultConfig.
|
|
100
|
+
*
|
|
101
|
+
* The returned class can be passed as `abrController` in the Hls constructor config.
|
|
102
|
+
*/
|
|
103
|
+
export declare function createHlsAbrController(HlsConstructor: AbrHlsConstructorLike): AbrControllerConstructor;
|
|
104
|
+
export {};
|
|
105
|
+
//# sourceMappingURL=hls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hls.d.ts","sourceRoot":"","sources":["../../../../../src/engines/abr/hls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAqBH,UAAU,WAAW;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,UAAU,WAAW;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,OAAO,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,YAAY;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,UAAU,cAAc;IACtB,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IAC/F,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAA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AG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,GAAG,aAAa,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,YAAY,CAAA;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,UAAU,WAAW;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,YAAY,CAAA;CACpB;AAED,UAAU,YAAY;IACpB,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1B,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAiDD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,qBAAqB,GAAG,wBAAwB,CAgatG"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BaseEngine — abstract base class for HLS and DASH engine implementations.
|
|
3
|
+
*
|
|
4
|
+
* Extends EngineStateSync with concrete lifecycle management:
|
|
5
|
+
* - stores video, state, signal, bus, config
|
|
6
|
+
* - binds native video element events to PlayerState
|
|
7
|
+
* - delegates engine-specific startup / teardown to onAttach / onDetach
|
|
8
|
+
* - delegates stall recovery to recoverFromStall (engine-specific)
|
|
9
|
+
*/
|
|
10
|
+
import { EngineStateSync } from '../core/engine-state-sync';
|
|
11
|
+
import type { PlayerState } from '../core/types';
|
|
12
|
+
import type { TypedEventBus } from '../core/event-bus';
|
|
13
|
+
import type { PlayerConfig } from '../core/config';
|
|
14
|
+
export declare abstract class BaseEngine extends EngineStateSync {
|
|
15
|
+
protected video: HTMLVideoElement | null;
|
|
16
|
+
protected state: PlayerState | null;
|
|
17
|
+
protected signal: AbortSignal | null;
|
|
18
|
+
protected bus: TypedEventBus | null;
|
|
19
|
+
protected config: PlayerConfig | null;
|
|
20
|
+
private watchdog;
|
|
21
|
+
/**
|
|
22
|
+
* Promise that resolves when the engine driver (hls.js/dash.js) is created
|
|
23
|
+
* and ready for integration (e.g., P2P SDK). Resolved inside onAttach().
|
|
24
|
+
*/
|
|
25
|
+
readonly driverReady: Promise<void>;
|
|
26
|
+
protected resolveDriverReady: () => void;
|
|
27
|
+
constructor();
|
|
28
|
+
attach(state: PlayerState, signal: AbortSignal): void;
|
|
29
|
+
detach(): void;
|
|
30
|
+
protected startWatchdog(): void;
|
|
31
|
+
protected stopWatchdog(): void;
|
|
32
|
+
setConfig(config: PlayerConfig): void;
|
|
33
|
+
setBus(bus: TypedEventBus): void;
|
|
34
|
+
setVideo(video: HTMLVideoElement): void;
|
|
35
|
+
protected bindVideoEvents(video: HTMLVideoElement, state: PlayerState, signal: AbortSignal): void;
|
|
36
|
+
protected abstract recoverFromStall(attempt: number): void;
|
|
37
|
+
protected abstract onAttach(): Promise<void> | void;
|
|
38
|
+
protected abstract onDetach(): void;
|
|
39
|
+
abstract setQuality(index: number): void;
|
|
40
|
+
abstract setAudioTrack(index: number): void;
|
|
41
|
+
abstract setSubtitle(index: number): void;
|
|
42
|
+
abstract setPlaybackRate(rate: number): void;
|
|
43
|
+
abstract seekToLive(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Seek to a specific time. Default implementation sets video.currentTime.
|
|
46
|
+
* HLS engine overrides this for live streams to reset hls.js stream controller.
|
|
47
|
+
*/
|
|
48
|
+
seek(time: number): void;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the underlying driver instance (hls.js or dash.js player).
|
|
51
|
+
* Used by P2PManager to integrate with the streaming library.
|
|
52
|
+
* Returns null before engine initialization completes.
|
|
53
|
+
*/
|
|
54
|
+
abstract getDriver(): unknown | null;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=base-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-engine.d.ts","sourceRoot":"","sources":["../../../../src/engines/base-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,8BAAsB,UAAW,SAAQ,eAAe;IACtD,SAAS,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAO;IAC/C,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAO;IAC1C,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAO;IAC3C,SAAS,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAAO;IAC1C,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAO;IAE5C,OAAO,CAAC,QAAQ,CAA6B;IAE7C;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,SAAS,CAAC,kBAAkB,EAAG,MAAM,IAAI,CAAA;;IAazC,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI;IAMrD,MAAM,IAAI,IAAI;IAed,SAAS,CAAC,aAAa,IAAI,IAAI;IAmB/B,SAAS,CAAC,YAAY,IAAI,IAAI;IAa9B,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAIrC,MAAM,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI;IAIhC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAQvC,SAAS,CAAC,eAAe,CACvB,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,WAAW,GAClB,IAAI;IA0FP,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAC1D,SAAS,CAAC,QAAQ,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IACnD,SAAS,CAAC,QAAQ,CAAC,QAAQ,IAAI,IAAI;IAMnC,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IACxC,QAAQ,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAC3C,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IACzC,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAC5C,QAAQ,CAAC,UAAU,IAAI,IAAI;IAE3B;;;OAGG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,IAAI,OAAO,GAAG,IAAI;CACrC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDN Script Loader
|
|
3
|
+
*
|
|
4
|
+
* Replaces the scriptjs-based component/utils/load.js with direct <script> tag injection.
|
|
5
|
+
* Resolves with window[globalName] when the script loads, or rejects with a clear error.
|
|
6
|
+
*/
|
|
7
|
+
export interface LoadScriptOptions {
|
|
8
|
+
timeout?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Loads a CDN script by injecting a <script> tag into document.head and resolves
|
|
12
|
+
* with window[globalName] once the script has loaded.
|
|
13
|
+
*
|
|
14
|
+
* - If window[globalName] already exists, resolves immediately (no re-injection).
|
|
15
|
+
* - If the script loads but the global is not on window, rejects with a descriptive error.
|
|
16
|
+
* - If script.onerror fires, rejects with a descriptive error.
|
|
17
|
+
* - If neither onload nor onerror fires within `options.timeout` ms (default 10000), rejects.
|
|
18
|
+
*/
|
|
19
|
+
export declare function loadScript<T>(url: string, globalName: string, options?: LoadScriptOptions): Promise<T>;
|
|
20
|
+
//# sourceMappingURL=cdn-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdn-loader.d.ts","sourceRoot":"","sources":["../../../../src/engines/cdn-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AA4BD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,CAAC,CAAC,CAyCZ"}
|