@ngxsp/core 0.2.0 → 0.2.1
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/commands.d.ts +40 -0
- package/config/default-config.d.ts +34 -0
- package/domain/audio-identification-routine.d.ts +47 -0
- package/domain/audio-identification.d.ts +78 -0
- package/domain/audio-library.d.ts +59 -0
- package/domain/audio-metadata-harmony.d.ts +29 -0
- package/domain/device-playback.d.ts +40 -0
- package/domain/media-item.d.ts +22 -0
- package/domain/media-library-model.d.ts +75 -0
- package/domain/media-source.d.ts +115 -0
- package/domain/queue.d.ts +12 -0
- package/domain/remote-playback.d.ts +82 -0
- package/domain/ringtone.d.ts +46 -0
- package/domain/shake.d.ts +55 -0
- package/domain/vault.d.ts +55 -0
- package/engine/capability-report.d.ts +35 -0
- package/engine/engine-factory.d.ts +19 -0
- package/engine/engine-profile.d.ts +27 -0
- package/engine/native.engine.d.ts +23 -0
- package/engine/native.factory.d.ts +2 -0
- package/engine/playback-capabilities.d.ts +29 -0
- package/engine/playback-engine.d.ts +44 -0
- package/engine/remote-playback.engine.d.ts +77 -0
- package/engine/types.d.ts +15 -0
- package/events/event-bus.d.ts +15 -0
- package/facade/player-facade.d.ts +125 -0
- package/index.d.ts +60 -2491
- package/online/acoustid.d.ts +29 -0
- package/online/cast-v2.d.ts +62 -0
- package/online/dlna-renderer.d.ts +19 -0
- package/online/dlna.d.ts +48 -0
- package/online/internet-archive.d.ts +105 -0
- package/online/jellyfin.d.ts +24 -0
- package/online/lyrics.d.ts +69 -0
- package/online/md5.d.ts +5 -0
- package/online/mdns.d.ts +61 -0
- package/online/media-cache.d.ts +61 -0
- package/online/musicbrainz.d.ts +41 -0
- package/online/online-http.d.ts +10 -0
- package/online/playback-transfer.d.ts +106 -0
- package/online/radio-browser.d.ts +42 -0
- package/online/subsonic.d.ts +16 -0
- package/online/upnp.d.ts +30 -0
- package/online/webdav.d.ts +21 -0
- package/online/xml-text.d.ts +19 -0
- package/package.json +1 -1
- package/plugins/ads/ssai.plugin.d.ts +14 -0
- package/plugins/metadata/metadata.types.d.ts +28 -0
- package/plugins/metadata/providers/local-metadata.provider.d.ts +11 -0
- package/plugins/plugin.d.ts +20 -0
- package/plugins/progress/progress.plugin.d.ts +10 -0
- package/plugins/resilience/resilience.plugin.d.ts +12 -0
- package/plugins/subtitles/providers/local-subtitle.provider.d.ts +9 -0
- package/plugins/subtitles/subtitle-file.d.ts +14 -0
- package/plugins/subtitles/subtitles.types.d.ts +22 -0
- package/ports/http.port.d.ts +3 -0
- package/ports/log.port.d.ts +12 -0
- package/ports/ports.d.ts +14 -0
- package/ports/storage.port.d.ts +11 -0
- package/ports/telemetry.port.d.ts +7 -0
- package/remote-config/remote-config.d.ts +8 -0
- package/telemetry/telemetry.types.d.ts +11 -0
- package/types.d.ts +345 -0
- package/utils/cache-store.d.ts +12 -0
- package/index.d.cts +0 -2491
package/types.d.ts
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
export type SourceType = 'local-file' | 'url' | 'hls' | 'dash';
|
|
2
|
+
/**
|
|
3
|
+
* High-level playback profiles (v2.0).
|
|
4
|
+
*
|
|
5
|
+
* Used to apply sensible defaults (ABR / buffering) with minimal configuration.
|
|
6
|
+
*/
|
|
7
|
+
export type EngineProfileId = 'default' | 'tv' | 'mobile' | 'low-latency';
|
|
8
|
+
export type AspectRatioMode = 'contain' | 'cover' | '1:1' | '4:3' | '16:9' | '21:9';
|
|
9
|
+
export type ProgressMode = 'local' | 'server' | 'hybrid';
|
|
10
|
+
export type AdsMode = 'csai' | 'ssai' | 'mixed';
|
|
11
|
+
export interface DrmConfig {
|
|
12
|
+
/**
|
|
13
|
+
* Key system configuration, usually driven by your backend.
|
|
14
|
+
* Examples: 'com.widevine.alpha', 'com.microsoft.playready'
|
|
15
|
+
*/
|
|
16
|
+
keySystems: Record<string, {
|
|
17
|
+
licenseServerUrl: string;
|
|
18
|
+
/**
|
|
19
|
+
* Additional request headers sent to the license server.
|
|
20
|
+
*/
|
|
21
|
+
headers?: Record<string, string>;
|
|
22
|
+
/** Optional robustness constraints (e.g. 'SW_SECURE_DECODE', 'HW_SECURE_ALL'). */
|
|
23
|
+
videoRobustness?: string;
|
|
24
|
+
audioRobustness?: string;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Whether offline/persistent licenses are intended for this content.
|
|
28
|
+
* Actual capability depends on device + license policy.
|
|
29
|
+
*/
|
|
30
|
+
persistentLicense?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* License request retry policy.
|
|
33
|
+
*
|
|
34
|
+
* If unset, engines should apply conservative defaults (3 attempts, exponential backoff).
|
|
35
|
+
*/
|
|
36
|
+
licenseRetry?: {
|
|
37
|
+
maxAttempts?: number;
|
|
38
|
+
baseDelayMs?: number;
|
|
39
|
+
backoffFactor?: number;
|
|
40
|
+
fuzzFactor?: number;
|
|
41
|
+
timeoutMs?: number;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface PlayerSource {
|
|
45
|
+
type: SourceType;
|
|
46
|
+
url?: string;
|
|
47
|
+
file?: File;
|
|
48
|
+
live?: boolean;
|
|
49
|
+
drm?: DrmConfig;
|
|
50
|
+
/** Optional engine profile for default tuning (can be set at `PlayerConfig.profile`). */
|
|
51
|
+
profile?: EngineProfileId;
|
|
52
|
+
/**
|
|
53
|
+
* Optional ABR hints for adaptive engines (e.g. Shaka).
|
|
54
|
+
*
|
|
55
|
+
* These are *hints* only: engines may ignore them if unsupported.
|
|
56
|
+
*/
|
|
57
|
+
abr?: {
|
|
58
|
+
/** Hard cap for rendition height (e.g. 720). */
|
|
59
|
+
maxHeight?: number;
|
|
60
|
+
/** Hard cap for bitrate (bits/s). */
|
|
61
|
+
maxBandwidth?: number;
|
|
62
|
+
};
|
|
63
|
+
/** Internal engine hints (best-effort). */
|
|
64
|
+
_shakaStreaming?: {
|
|
65
|
+
lowLatencyMode?: boolean;
|
|
66
|
+
bufferingGoalSec?: number;
|
|
67
|
+
rebufferingGoalSec?: number;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Whether this source is allowed to be downloaded/offlined.
|
|
71
|
+
*/
|
|
72
|
+
offlineEligible?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Optional identifier for progress/metadata/subtitles lookup.
|
|
75
|
+
*/
|
|
76
|
+
contentId?: string;
|
|
77
|
+
/** Optional display metadata, used by UI skins (especially audio mode). */
|
|
78
|
+
title?: string;
|
|
79
|
+
subtitle?: string;
|
|
80
|
+
artist?: string;
|
|
81
|
+
album?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Optional sidecar URL for local metadata (json/txt) or subtitles.
|
|
84
|
+
*/
|
|
85
|
+
sidecar?: {
|
|
86
|
+
metadataUrl?: string;
|
|
87
|
+
subtitles?: Array<{
|
|
88
|
+
lang: string;
|
|
89
|
+
url: string;
|
|
90
|
+
format?: string;
|
|
91
|
+
}>;
|
|
92
|
+
chaptersUrl?: string;
|
|
93
|
+
thumbnailVttUrl?: string;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export interface ProgressConfig {
|
|
97
|
+
mode: ProgressMode;
|
|
98
|
+
endpoint?: string;
|
|
99
|
+
intervalSec: number;
|
|
100
|
+
}
|
|
101
|
+
export interface SkipSegment {
|
|
102
|
+
kind: 'intro' | 'recap';
|
|
103
|
+
startSec: number;
|
|
104
|
+
endSec: number;
|
|
105
|
+
}
|
|
106
|
+
export interface NextEpisodeHint {
|
|
107
|
+
label: string;
|
|
108
|
+
onNext: () => void | Promise<void>;
|
|
109
|
+
}
|
|
110
|
+
export interface UiConfig {
|
|
111
|
+
/** Optional UI skin preset (default: classic) */
|
|
112
|
+
skin?: 'classic' | 'vod' | 'edition';
|
|
113
|
+
/** Optional display title used by some skins */
|
|
114
|
+
title?: string;
|
|
115
|
+
/** Optional alternate display title (falls back from `title`). */
|
|
116
|
+
displayTitle?: string;
|
|
117
|
+
/** Optional subtitle shown under the title (e.g. audio "now playing"). */
|
|
118
|
+
subtitle?: string;
|
|
119
|
+
/** Optional longer description shown by some skins. */
|
|
120
|
+
description?: string;
|
|
121
|
+
ratios: AspectRatioMode[];
|
|
122
|
+
defaultRatio: AspectRatioMode;
|
|
123
|
+
keyboardShortcuts: boolean;
|
|
124
|
+
skipSegments?: SkipSegment[];
|
|
125
|
+
nextEpisode?: NextEpisodeHint;
|
|
126
|
+
chaptersVttUrl?: string;
|
|
127
|
+
thumbnailsVttUrl?: string;
|
|
128
|
+
/** Preview strategy for timeline hover (default: thumbnails) */
|
|
129
|
+
previewMode?: 'thumbnails' | 'frame' | 'off';
|
|
130
|
+
}
|
|
131
|
+
export interface ResilienceConfig {
|
|
132
|
+
retries: number;
|
|
133
|
+
backoffMs: {
|
|
134
|
+
min: number;
|
|
135
|
+
max: number;
|
|
136
|
+
};
|
|
137
|
+
healthEndpoint?: string;
|
|
138
|
+
}
|
|
139
|
+
export interface SubtitleHint {
|
|
140
|
+
contentId?: string;
|
|
141
|
+
title?: string;
|
|
142
|
+
season?: number;
|
|
143
|
+
episode?: number;
|
|
144
|
+
language?: string;
|
|
145
|
+
/** Année (films) */
|
|
146
|
+
year?: number;
|
|
147
|
+
/** Identifiants externes (optionnels) */
|
|
148
|
+
imdbId?: string;
|
|
149
|
+
tmdbId?: number;
|
|
150
|
+
/** Pour rester extensible sans casser le typage */
|
|
151
|
+
extra?: Record<string, unknown>;
|
|
152
|
+
}
|
|
153
|
+
export interface SubtitlesConfig {
|
|
154
|
+
enabled: boolean;
|
|
155
|
+
providers: string[];
|
|
156
|
+
preferredLang?: string;
|
|
157
|
+
/** Optional hint for internet providers */
|
|
158
|
+
hint?: SubtitleHint;
|
|
159
|
+
}
|
|
160
|
+
export interface MetadataConfig {
|
|
161
|
+
enabled: boolean;
|
|
162
|
+
providers: string[];
|
|
163
|
+
localSidecar: boolean;
|
|
164
|
+
/** Optional hint for internet providers */
|
|
165
|
+
hint?: import('./plugins/metadata/metadata.types').MetadataHint;
|
|
166
|
+
}
|
|
167
|
+
export interface AdsConfig {
|
|
168
|
+
enabled: boolean;
|
|
169
|
+
mode: AdsMode;
|
|
170
|
+
providerConfig?: unknown;
|
|
171
|
+
}
|
|
172
|
+
export interface EpisodeItem {
|
|
173
|
+
/** Unique id for progress/offline/metadata/subtitles. */
|
|
174
|
+
contentId: string;
|
|
175
|
+
season?: number;
|
|
176
|
+
episode?: number;
|
|
177
|
+
title?: string;
|
|
178
|
+
source: PlayerSource;
|
|
179
|
+
/** Optional per-episode UI overrides (skip segments, thumbnails, etc.) */
|
|
180
|
+
ui?: Partial<UiConfig>;
|
|
181
|
+
/** Optional metadata hint for internet providers. */
|
|
182
|
+
metadataHint?: {
|
|
183
|
+
title?: string;
|
|
184
|
+
year?: number;
|
|
185
|
+
imdbId?: string;
|
|
186
|
+
tmdbId?: string;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
export interface SeriesConfig {
|
|
190
|
+
title?: string;
|
|
191
|
+
/** 0-based index of current episode in episodes[] */
|
|
192
|
+
currentIndex: number;
|
|
193
|
+
episodes: EpisodeItem[];
|
|
194
|
+
/** Auto-play next episode when ended. Default true. */
|
|
195
|
+
autoNext?: boolean;
|
|
196
|
+
/** Warm-up next episode manifest when within N seconds of end. Default 30. */
|
|
197
|
+
preloadNextSeconds?: number;
|
|
198
|
+
}
|
|
199
|
+
export interface PlayerConfig {
|
|
200
|
+
source: PlayerSource;
|
|
201
|
+
/** High-level playback profile (v2.0). */
|
|
202
|
+
profile?: EngineProfileId;
|
|
203
|
+
/** Optional DRM config. When set, it overrides/augments source.drm. */
|
|
204
|
+
drm?: DrmConfig;
|
|
205
|
+
/** Optional series mode */
|
|
206
|
+
series?: SeriesConfig;
|
|
207
|
+
/** Optional playlist mode (overrides source at runtime) */
|
|
208
|
+
playlist?: PlayerSource[];
|
|
209
|
+
/** Starting index in playlist (default 0) */
|
|
210
|
+
playlistStartIndex?: number;
|
|
211
|
+
/** Auto-play next item on ended (default true when playlist provided) */
|
|
212
|
+
autoNext?: boolean;
|
|
213
|
+
progress: ProgressConfig;
|
|
214
|
+
ui: UiConfig;
|
|
215
|
+
resilience: ResilienceConfig;
|
|
216
|
+
subtitles: SubtitlesConfig;
|
|
217
|
+
metadata: MetadataConfig;
|
|
218
|
+
ads: AdsConfig;
|
|
219
|
+
/** Optional: enable offline materialization via @ngxsp/plugin-offline. */
|
|
220
|
+
offline?: {
|
|
221
|
+
enabled?: boolean;
|
|
222
|
+
/** Storage key override; default = `offline:${contentId || url}` */
|
|
223
|
+
key?: string;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Remote control-plane: fetch JSON overrides at runtime (optionally cached), then merge into this config.
|
|
227
|
+
* Designed to keep the engine decoupled from Angular and allow feature flags / tuning without rebuild.
|
|
228
|
+
*/
|
|
229
|
+
remoteConfig?: RemoteConfigConfig;
|
|
230
|
+
}
|
|
231
|
+
export interface RemoteConfigConfig {
|
|
232
|
+
enabled: boolean;
|
|
233
|
+
/** Absolute URL returning a JSON payload (object). */
|
|
234
|
+
url: string;
|
|
235
|
+
/** Cache TTL (seconds). Default: 300s. */
|
|
236
|
+
ttlSec?: number;
|
|
237
|
+
/** Merge mode. Default: 'deep'. */
|
|
238
|
+
mode?: 'shallow' | 'deep';
|
|
239
|
+
/** Allow-list of top-level keys that can be overridden remotely. */
|
|
240
|
+
allow?: string[];
|
|
241
|
+
}
|
|
242
|
+
export type RemoteConfigPayload = Record<string, unknown>;
|
|
243
|
+
export type PlayerState = {
|
|
244
|
+
kind: 'idle';
|
|
245
|
+
} | {
|
|
246
|
+
kind: 'loading';
|
|
247
|
+
} | {
|
|
248
|
+
kind: 'buffering';
|
|
249
|
+
} | {
|
|
250
|
+
kind: 'playing';
|
|
251
|
+
} | {
|
|
252
|
+
kind: 'paused';
|
|
253
|
+
} | {
|
|
254
|
+
kind: 'ended';
|
|
255
|
+
} | {
|
|
256
|
+
kind: 'error';
|
|
257
|
+
error: PlayerError;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Minimal time model exposed by the public API.
|
|
261
|
+
* Kept as a stable alias for wrappers (Angular/Electron) and adapters.
|
|
262
|
+
*/
|
|
263
|
+
export interface PlayerTime {
|
|
264
|
+
currentTime: number;
|
|
265
|
+
duration: number;
|
|
266
|
+
/** Best-effort buffered end (seconds) for native playback. */
|
|
267
|
+
bufferedEnd?: number;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Diagnostics snapshot exposed by the public API.
|
|
271
|
+
* Intentionally decoupled from internal facade implementation details.
|
|
272
|
+
*/
|
|
273
|
+
import type { CapabilityReport } from './engine/capability-report';
|
|
274
|
+
export interface DiagnosticsEngineInfo {
|
|
275
|
+
/** Selected engine id (ex: 'native', 'shaka') */
|
|
276
|
+
id: string;
|
|
277
|
+
/** How the engine was selected */
|
|
278
|
+
selectedBy: 'supports' | 'caps' | 'fallback' | 'explicit' | 'none';
|
|
279
|
+
/** Optional selection reasons (debuggable, non-normative) */
|
|
280
|
+
reasons: string[];
|
|
281
|
+
}
|
|
282
|
+
export interface DiagnosticsSnapshot {
|
|
283
|
+
/** Epoch milliseconds when the snapshot was produced. */
|
|
284
|
+
ts: number;
|
|
285
|
+
engine: DiagnosticsEngineInfo;
|
|
286
|
+
capabilities: CapabilityReport;
|
|
287
|
+
source?: PlayerSource;
|
|
288
|
+
state: PlayerState;
|
|
289
|
+
time: PlayerTime;
|
|
290
|
+
lastNonFatal: PlayerError | null;
|
|
291
|
+
/** @deprecated use `engine.id` */
|
|
292
|
+
selectedEngineId?: string;
|
|
293
|
+
/** @deprecated use `state` + `time` */
|
|
294
|
+
snapshot?: {
|
|
295
|
+
currentTime: number;
|
|
296
|
+
duration: number;
|
|
297
|
+
state: PlayerState;
|
|
298
|
+
bufferedAheadSec: number;
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
export type PlayerErrorCode = 'AUTOPLAY_BLOCKED' | 'SRC_NOT_SUPPORTED' | 'NETWORK_TIMEOUT' | 'NETWORK_HTTP' | 'DECODE_ERROR' | 'ENGINE_MISSING' | 'ENGINE_CRASH' | 'DRM_ERROR' | 'UNKNOWN';
|
|
302
|
+
export interface PlayerError {
|
|
303
|
+
code: PlayerErrorCode | string;
|
|
304
|
+
message: string;
|
|
305
|
+
fatal?: boolean;
|
|
306
|
+
details?: unknown;
|
|
307
|
+
}
|
|
308
|
+
export interface MediaTrack {
|
|
309
|
+
id: string;
|
|
310
|
+
kind: 'audio' | 'text' | 'video';
|
|
311
|
+
language?: string;
|
|
312
|
+
label?: string;
|
|
313
|
+
active: boolean;
|
|
314
|
+
width?: number;
|
|
315
|
+
height?: number;
|
|
316
|
+
bandwidth?: number;
|
|
317
|
+
}
|
|
318
|
+
export type PlayerEvent = {
|
|
319
|
+
type: 'play';
|
|
320
|
+
} | {
|
|
321
|
+
type: 'pause';
|
|
322
|
+
} | {
|
|
323
|
+
type: 'timeupdate';
|
|
324
|
+
currentTime: number;
|
|
325
|
+
duration: number;
|
|
326
|
+
} | {
|
|
327
|
+
type: 'ended';
|
|
328
|
+
} | {
|
|
329
|
+
type: 'error';
|
|
330
|
+
code: PlayerErrorCode | string;
|
|
331
|
+
message: string;
|
|
332
|
+
detail?: unknown;
|
|
333
|
+
} | {
|
|
334
|
+
type: 'adbreak-start';
|
|
335
|
+
id?: string;
|
|
336
|
+
} | {
|
|
337
|
+
type: 'adbreak-end';
|
|
338
|
+
id?: string;
|
|
339
|
+
} | {
|
|
340
|
+
type: 'ad-start';
|
|
341
|
+
id?: string;
|
|
342
|
+
} | {
|
|
343
|
+
type: 'ad-end';
|
|
344
|
+
id?: string;
|
|
345
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface CacheStore {
|
|
2
|
+
get<T>(key: string): Promise<T | null>;
|
|
3
|
+
set<T>(key: string, value: T, ttlMs: number): Promise<void>;
|
|
4
|
+
del(key: string): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare class DefaultCacheStore implements CacheStore {
|
|
7
|
+
private dbp;
|
|
8
|
+
get<T>(key: string): Promise<T | null>;
|
|
9
|
+
set<T>(key: string, value: T, ttlMs: number): Promise<void>;
|
|
10
|
+
del(key: string): Promise<void>;
|
|
11
|
+
private db;
|
|
12
|
+
}
|