@scarlett-player/core 0.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.
Files changed (59) hide show
  1. package/dist/error-handler.d.ts.map +1 -0
  2. package/dist/error-handler.js +300 -0
  3. package/dist/error-handler.js.map +1 -0
  4. package/dist/events/event-bus.d.ts.map +1 -0
  5. package/dist/events/event-bus.js +407 -0
  6. package/dist/events/event-bus.js.map +1 -0
  7. package/dist/index.cjs +2 -0
  8. package/dist/index.cjs.map +1 -0
  9. package/dist/index.d.ts +16 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +2271 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/logger.d.ts.map +1 -0
  14. package/dist/logger.js +272 -0
  15. package/dist/logger.js.map +1 -0
  16. package/dist/plugin-api.d.ts +147 -0
  17. package/dist/plugin-api.d.ts.map +1 -0
  18. package/dist/plugin-api.js +160 -0
  19. package/dist/plugin-api.js.map +1 -0
  20. package/dist/plugin-manager.d.ts +52 -0
  21. package/dist/plugin-manager.d.ts.map +1 -0
  22. package/dist/plugin-manager.js +224 -0
  23. package/dist/plugin-manager.js.map +1 -0
  24. package/dist/scarlett-player.d.ts +404 -0
  25. package/dist/scarlett-player.d.ts.map +1 -0
  26. package/dist/scarlett-player.js +769 -0
  27. package/dist/scarlett-player.js.map +1 -0
  28. package/dist/state/computed.d.ts.map +1 -0
  29. package/dist/state/computed.js +134 -0
  30. package/dist/state/computed.js.map +1 -0
  31. package/dist/state/effect.d.ts.map +1 -0
  32. package/dist/state/effect.js +77 -0
  33. package/dist/state/effect.js.map +1 -0
  34. package/dist/state/index.d.ts.map +1 -0
  35. package/dist/state/index.js +9 -0
  36. package/dist/state/index.js.map +1 -0
  37. package/dist/state/signal.d.ts.map +1 -0
  38. package/dist/state/signal.js +126 -0
  39. package/dist/state/signal.js.map +1 -0
  40. package/dist/state/state-manager.d.ts.map +1 -0
  41. package/dist/state/state-manager.js +334 -0
  42. package/dist/state/state-manager.js.map +1 -0
  43. package/dist/types/events.d.ts +323 -0
  44. package/dist/types/events.d.ts.map +1 -0
  45. package/dist/types/events.js +7 -0
  46. package/dist/types/events.js.map +1 -0
  47. package/dist/types/index.d.ts +9 -0
  48. package/dist/types/index.d.ts.map +1 -0
  49. package/dist/types/index.js +7 -0
  50. package/dist/types/index.js.map +1 -0
  51. package/dist/types/plugin.d.ts +141 -0
  52. package/dist/types/plugin.d.ts.map +1 -0
  53. package/dist/types/plugin.js +8 -0
  54. package/dist/types/plugin.js.map +1 -0
  55. package/dist/types/state.d.ts +232 -0
  56. package/dist/types/state.d.ts.map +1 -0
  57. package/dist/types/state.js +8 -0
  58. package/dist/types/state.js.map +1 -0
  59. package/package.json +64 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,MAAM,EACN,UAAU,EACV,WAAW,EACX,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,UAAU,GACX,MAAM,UAAU,CAAC;AAGlB,YAAY,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,SAAS,EACT,WAAW,EACX,OAAO,EACP,SAAS,EACT,UAAU,EACV,YAAY,EACZ,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,cAAc,EACd,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,mBAAmB,GACpB,MAAM,UAAU,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Scarlett Player Type Definitions
3
+ *
4
+ * Central export for all TypeScript types and interfaces.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Plugin system type definitions for Scarlett Player.
3
+ *
4
+ * Plugins are the core extension mechanism for adding functionality
5
+ * to the player (providers, UI, features, analytics, etc.).
6
+ */
7
+ import type { StateKey, StateValue, StateChangeEvent } from './state';
8
+ import type { EventName, EventPayload, EventHandler } from './events';
9
+ /**
10
+ * Plugin types define the category and lifecycle of a plugin.
11
+ */
12
+ export type PluginType = 'provider' | 'ui' | 'feature' | 'analytics' | 'utility';
13
+ /**
14
+ * Plugin lifecycle states.
15
+ */
16
+ export type PluginState = 'registered' | 'initializing' | 'ready' | 'error' | 'destroyed';
17
+ /**
18
+ * Plugin configuration options (plugin-specific).
19
+ */
20
+ export type PluginConfig = Record<string, unknown>;
21
+ /**
22
+ * Plugin API surface exposed to plugins for interacting with the player.
23
+ * Plugins should use this API instead of accessing StateManager/EventBus directly.
24
+ */
25
+ export interface IPluginAPI {
26
+ /** Unique plugin ID */
27
+ readonly pluginId: string;
28
+ /** Player container element */
29
+ readonly container: HTMLElement;
30
+ /** Logger instance for this plugin */
31
+ readonly logger: {
32
+ debug(message: string, ...args: unknown[]): void;
33
+ info(message: string, ...args: unknown[]): void;
34
+ warn(message: string, ...args: unknown[]): void;
35
+ error(message: string, ...args: unknown[]): void;
36
+ };
37
+ /**
38
+ * Get a state value.
39
+ * @param key - State property key
40
+ * @returns Current state value
41
+ */
42
+ getState<K extends StateKey>(key: K): StateValue<K>;
43
+ /**
44
+ * Set a state value.
45
+ * @param key - State property key
46
+ * @param value - New state value
47
+ */
48
+ setState<K extends StateKey>(key: K, value: StateValue<K>): void;
49
+ /**
50
+ * Subscribe to an event.
51
+ * @param event - Event name
52
+ * @param handler - Event handler
53
+ * @returns Unsubscribe function
54
+ */
55
+ on<T extends EventName>(event: T, handler: EventHandler<T>): () => void;
56
+ /**
57
+ * Unsubscribe from an event.
58
+ * @param event - Event name
59
+ * @param handler - Event handler to remove
60
+ */
61
+ off<T extends EventName>(event: T, handler: EventHandler<T>): void;
62
+ /**
63
+ * Emit an event.
64
+ * @param event - Event name
65
+ * @param payload - Event payload
66
+ */
67
+ emit<T extends EventName>(event: T, payload: EventPayload<T>): void;
68
+ /**
69
+ * Get another plugin by name (if ready).
70
+ * @param name - Plugin name
71
+ * @returns Plugin instance or null if not found/ready
72
+ */
73
+ getPlugin<T = unknown>(name: string): T | null;
74
+ /**
75
+ * Register a cleanup function to run when plugin is destroyed.
76
+ * @param cleanup - Cleanup function
77
+ */
78
+ onDestroy(cleanup: () => void): void;
79
+ /**
80
+ * Subscribe to state changes.
81
+ * @param callback - Callback function called on any state change
82
+ * @returns Unsubscribe function
83
+ */
84
+ subscribeToState(callback: (event: StateChangeEvent) => void): () => void;
85
+ }
86
+ /**
87
+ * Core plugin interface that all plugins must implement.
88
+ */
89
+ export interface Plugin<TConfig extends PluginConfig = PluginConfig> {
90
+ /** Unique plugin identifier (e.g., 'hls-provider', 'native-controls') */
91
+ readonly id: string;
92
+ /** Human-readable plugin name */
93
+ readonly name: string;
94
+ /** Semantic version (e.g., '1.0.0') */
95
+ readonly version: string;
96
+ /** Plugin type/category */
97
+ readonly type: PluginType;
98
+ /** Optional human-readable description */
99
+ readonly description?: string;
100
+ /** Dependencies - other plugin IDs that must be initialized first */
101
+ readonly dependencies?: string[];
102
+ /**
103
+ * Initialize the plugin.
104
+ * Called when dependencies are ready.
105
+ *
106
+ * @param api - Plugin API surface
107
+ * @param config - Plugin-specific configuration
108
+ */
109
+ init(api: IPluginAPI, config?: TConfig): void | Promise<void>;
110
+ /**
111
+ * Cleanup when plugin is destroyed.
112
+ * Called when the plugin is deactivated or player is destroyed.
113
+ */
114
+ destroy(): void | Promise<void>;
115
+ /**
116
+ * Optional: Called when any state changes.
117
+ * @param event - State change event
118
+ */
119
+ onStateChange?(event: StateChangeEvent): void;
120
+ /**
121
+ * Optional: Called when an error occurs.
122
+ * @param error - Error that occurred
123
+ */
124
+ onError?(error: Error): void;
125
+ }
126
+ /**
127
+ * Plugin factory function signature.
128
+ */
129
+ export type PluginFactory<TConfig extends PluginConfig = PluginConfig> = (config?: TConfig) => Plugin<TConfig>;
130
+ /**
131
+ * Internal plugin descriptor used by PluginManager.
132
+ * @internal
133
+ */
134
+ export interface PluginDescriptor {
135
+ plugin: Plugin;
136
+ state: PluginState;
137
+ config?: PluginConfig;
138
+ error?: Error;
139
+ cleanupFns: Array<() => void>;
140
+ }
141
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,IAAI,GACJ,SAAS,GACT,WAAW,GACX,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,YAAY,GACZ,cAAc,GACd,OAAO,GACP,OAAO,GACP,WAAW,CAAC;AAEhB;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,uBAAuB;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,+BAA+B;IAC/B,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAEhC,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE;QACf,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QACjD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAChD,IAAI,C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E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,iCAAiC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,uCAAuC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAE1B,0CAA0C;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B,qEAAqE;IACrE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAEjC;;;;;;OAMG;IACH,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9D;;;OAGG;IACH,OAAO,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhC;;;OAGG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAE9C;;;OAGG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,OAAO,SAAS,YAAY,GAAG,YAAY,IAAI,CACvE,MAAM,CAAC,EAAE,OAAO,KACb,MAAM,CAAC,OAAO,CAAC,CAAC;AAErB;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,UAAU,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;CAC/B"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Plugin system type definitions for Scarlett Player.
3
+ *
4
+ * Plugins are the core extension mechanism for adding functionality
5
+ * to the player (providers, UI, features, analytics, etc.).
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,232 @@
1
+ /**
2
+ * State management type definitions for Scarlett Player.
3
+ *
4
+ * All player state is managed through reactive signals.
5
+ * Each property in StateStore will be a Signal<T> in the actual implementation.
6
+ */
7
+ import type { Signal } from '../state/signal';
8
+ /**
9
+ * Playback state enumeration.
10
+ */
11
+ export type PlaybackState = 'idle' | 'loading' | 'ready' | 'playing' | 'paused' | 'ended' | 'error';
12
+ /**
13
+ * Media type enumeration.
14
+ */
15
+ export type MediaType = 'video' | 'audio' | 'unknown';
16
+ /**
17
+ * Media source information.
18
+ */
19
+ export interface MediaSource {
20
+ /** Source URL */
21
+ src: string;
22
+ /** MIME type (e.g., 'application/x-mpegURL', 'application/dash+xml') */
23
+ type?: string;
24
+ /** Quality label (e.g., '1080p', '720p') */
25
+ quality?: string;
26
+ /** Bitrate in bits per second */
27
+ bitrate?: number;
28
+ }
29
+ /**
30
+ * Chapter/marker for VOD or live content.
31
+ */
32
+ export interface Chapter {
33
+ /** Chapter start time in seconds */
34
+ time: number;
35
+ /** Chapter label/title */
36
+ label: string;
37
+ /** Optional thumbnail URL */
38
+ thumbnail?: string;
39
+ /** Optional chapter metadata */
40
+ metadata?: Record<string, unknown>;
41
+ }
42
+ /**
43
+ * Text track (subtitles/captions) information.
44
+ */
45
+ export interface TextTrack {
46
+ /** Track ID */
47
+ id: string;
48
+ /** Track label (e.g., 'English', 'Spanish') */
49
+ label: string;
50
+ /** Language code (e.g., 'en', 'es') */
51
+ language: string;
52
+ /** Track kind */
53
+ kind: 'subtitles' | 'captions' | 'descriptions' | 'chapters' | 'metadata';
54
+ /** Whether track is currently active */
55
+ active: boolean;
56
+ }
57
+ /**
58
+ * Audio track information.
59
+ */
60
+ export interface AudioTrack {
61
+ /** Track ID */
62
+ id: string;
63
+ /** Track label (e.g., 'English', 'Director Commentary') */
64
+ label: string;
65
+ /** Language code (e.g., 'en', 'es') */
66
+ language?: string;
67
+ /** Whether track is currently active */
68
+ active: boolean;
69
+ }
70
+ /**
71
+ * Quality level information.
72
+ */
73
+ export interface QualityLevel {
74
+ /** Quality ID */
75
+ id: string;
76
+ /** Quality label (e.g., '1080p', '720p', 'auto') */
77
+ label: string;
78
+ /** Width in pixels */
79
+ width: number;
80
+ /** Height in pixels */
81
+ height: number;
82
+ /** Bitrate in bits per second */
83
+ bitrate: number;
84
+ /** Whether this is the currently active quality */
85
+ active: boolean;
86
+ }
87
+ /**
88
+ * Seekable time range for live/DVR content.
89
+ */
90
+ export interface SeekableRange {
91
+ /** Start time in seconds */
92
+ start: number;
93
+ /** End time in seconds */
94
+ end: number;
95
+ }
96
+ /**
97
+ * Complete player state store.
98
+ * In StateManager, each property will be wrapped in a Signal<T>.
99
+ */
100
+ export interface StateStore {
101
+ /** Current playback state */
102
+ playbackState: PlaybackState;
103
+ /** Whether media is currently playing */
104
+ playing: boolean;
105
+ /** Whether media is paused */
106
+ paused: boolean;
107
+ /** Whether playback has ended */
108
+ ended: boolean;
109
+ /** Whether media is buffering/loading */
110
+ buffering: boolean;
111
+ /** Whether media is waiting for data */
112
+ waiting: boolean;
113
+ /** Whether media is currently seeking */
114
+ seeking: boolean;
115
+ /** Current playback time in seconds */
116
+ currentTime: number;
117
+ /** Total duration in seconds (NaN if unknown) */
118
+ duration: number;
119
+ /** Buffered time ranges */
120
+ buffered: TimeRanges | null;
121
+ /** Amount of media buffered ahead of current time (seconds) */
122
+ bufferedAmount: number;
123
+ /** Media type (video/audio) */
124
+ mediaType: MediaType;
125
+ /** Current media source */
126
+ source: MediaSource | null;
127
+ /** Media title */
128
+ title: string;
129
+ /** Media poster/thumbnail URL */
130
+ poster: string;
131
+ /** Volume level (0-1) */
132
+ volume: number;
133
+ /** Whether audio is muted */
134
+ muted: boolean;
135
+ /** Playback rate/speed (1.0 = normal) */
136
+ playbackRate: number;
137
+ /** Whether player is in fullscreen */
138
+ fullscreen: boolean;
139
+ /** Whether player is in picture-in-picture */
140
+ pip: boolean;
141
+ /** Whether controls are visible */
142
+ controlsVisible: boolean;
143
+ /** Available quality levels */
144
+ qualities: QualityLevel[];
145
+ /** Currently active quality level */
146
+ currentQuality: QualityLevel | null;
147
+ /** Available audio tracks */
148
+ audioTracks: AudioTrack[];
149
+ /** Currently active audio track */
150
+ currentAudioTrack: AudioTrack | null;
151
+ /** Available text tracks (subtitles/captions) */
152
+ textTracks: TextTrack[];
153
+ /** Currently active text track */
154
+ currentTextTrack: TextTrack | null;
155
+ /** Whether this is live content */
156
+ live: boolean;
157
+ /** Whether playback is at the live edge */
158
+ liveEdge: boolean;
159
+ /** Seekable range for DVR (null if not DVR/live) */
160
+ seekableRange: SeekableRange | null;
161
+ /** Current latency from live edge in seconds */
162
+ liveLatency: number;
163
+ /** Whether low-latency mode is enabled */
164
+ lowLatencyMode: boolean;
165
+ /** All available chapters */
166
+ chapters: Chapter[];
167
+ /** Currently active chapter (based on currentTime) */
168
+ currentChapter: Chapter | null;
169
+ /** Current error (null if no error) */
170
+ error: Error | null;
171
+ /** Estimated network bandwidth in bits per second */
172
+ bandwidth: number;
173
+ /** Whether autoplay is enabled */
174
+ autoplay: boolean;
175
+ /** Whether loop is enabled */
176
+ loop: boolean;
177
+ /** Whether AirPlay devices are available */
178
+ airplayAvailable: boolean;
179
+ /** Whether currently casting via AirPlay */
180
+ airplayActive: boolean;
181
+ /** Whether Chromecast is available */
182
+ chromecastAvailable: boolean;
183
+ /** Whether currently casting via Chromecast */
184
+ chromecastActive: boolean;
185
+ /** Whether user is currently interacting with player */
186
+ interacting: boolean;
187
+ /** Whether user is hovering over player */
188
+ hovering: boolean;
189
+ /** Whether player is in focus */
190
+ focused: boolean;
191
+ }
192
+ /**
193
+ * Type-safe state keys.
194
+ */
195
+ export type StateKey = keyof StateStore;
196
+ /**
197
+ * Type-safe state value for a given key.
198
+ */
199
+ export type StateValue<K extends StateKey> = StateStore[K];
200
+ /**
201
+ * State update payload for batch updates.
202
+ */
203
+ export type StateUpdate = Partial<StateStore>;
204
+ /**
205
+ * State change event payload.
206
+ */
207
+ export interface StateChangeEvent<K extends StateKey = StateKey> {
208
+ /** State key that changed */
209
+ key: K;
210
+ /** New value */
211
+ value: StateValue<K>;
212
+ /** Previous value */
213
+ previousValue: StateValue<K>;
214
+ }
215
+ /**
216
+ * State manager interface (to be implemented).
217
+ */
218
+ export interface IStateManager {
219
+ /** Get a state signal by key */
220
+ get<K extends StateKey>(key: K): Signal<StateValue<K>>;
221
+ /** Set a state value */
222
+ set<K extends StateKey>(key: K, value: StateValue<K>): void;
223
+ /** Update multiple state values at once */
224
+ update(updates: StateUpdate): void;
225
+ /** Reset all state to initial values */
226
+ reset(): void;
227
+ /** Subscribe to any state change */
228
+ subscribe(callback: (event: StateChangeEvent) => void): () => void;
229
+ /** Destroy state manager and cleanup */
230
+ destroy(): void;
231
+ }
232
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/types/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,SAAS,GACT,OAAO,GACP,SAAS,GACT,QAAQ,GACR,OAAO,GACP,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,OAAO,GACP,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iBAAiB;IACjB,GAAG,EAAE,MAAM,CAAC;IAEZ,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAA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AAO,CAAC,UAAU,CAAC,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ;IAC7D,6BAA6B;IAC7B,GAAG,EAAE,CAAC,CAAC;IAEP,gBAAgB;IAChB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAErB,qBAAqB;IACrB,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,GAAG,CAAC,CAAC,SAAS,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAEvD,wBAAwB;IACxB,GAAG,CAAC,CAAC,SAAS,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAE5D,2CAA2C;IAC3C,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAEnC,wCAAwC;IACxC,KAAK,IAAI,IAAI,CAAC;IAEd,oCAAoC;IACpC,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAEnE,wCAAwC;IACxC,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * State management type definitions for Scarlett Player.
3
+ *
4
+ * All player state is managed through reactive signals.
5
+ * Each property in StateStore will be a Signal<T> in the actual implementation.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/types/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@scarlett-player/core",
3
+ "version": "0.1.0",
4
+ "description": "Core player with plugin system for Scarlett Player",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "dev": "vite",
21
+ "demo": "vite",
22
+ "build": "tsc && vite build",
23
+ "test": "vitest --run",
24
+ "test:watch": "vitest",
25
+ "test:coverage": "vitest --coverage",
26
+ "typecheck": "tsc --noEmit",
27
+ "clean": "rimraf dist"
28
+ },
29
+ "keywords": [
30
+ "video",
31
+ "player",
32
+ "plugin",
33
+ "hls",
34
+ "dash",
35
+ "streaming",
36
+ "live",
37
+ "dvr",
38
+ "chapters"
39
+ ],
40
+ "author": "The Stream Platform",
41
+ "license": "MIT",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/Hackney-Enterprises-Inc/scarlett-player.git",
45
+ "directory": "packages/core"
46
+ },
47
+ "bugs": {
48
+ "url": "https://github.com/Hackney-Enterprises-Inc/scarlett-player/issues"
49
+ },
50
+ "homepage": "https://github.com/Hackney-Enterprises-Inc/scarlett-player#readme",
51
+ "devDependencies": {
52
+ "@types/node": "^20.0.0",
53
+ "@vitest/coverage-v8": "^1.1.0",
54
+ "jsdom": "^23.0.0",
55
+ "rimraf": "^5.0.5",
56
+ "terser": "^5.44.0",
57
+ "typescript": "^5.3.3",
58
+ "vite": "^5.0.11",
59
+ "vitest": "^1.1.0"
60
+ },
61
+ "dependencies": {
62
+ "hls.js": "^1.6.13"
63
+ }
64
+ }