@gyeonghokim/vega 0.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/LICENSE +21 -0
- package/README.md +301 -0
- package/dist/assets/media-worker-DqCztg6H.js +3363 -0
- package/dist/assets/media-worker-DqCztg6H.js.map +1 -0
- package/dist/audio/audio-renderer.d.ts +76 -0
- package/dist/audio/audio-renderer.d.ts.map +1 -0
- package/dist/audio/audio-worklet-processor.d.ts +14 -0
- package/dist/audio/audio-worklet-processor.d.ts.map +1 -0
- package/dist/audio/ring-buffer.d.ts +71 -0
- package/dist/audio/ring-buffer.d.ts.map +1 -0
- package/dist/convert.d.ts +27 -0
- package/dist/convert.d.ts.map +1 -0
- package/dist/demuxer/mp4-demuxer.d.ts +133 -0
- package/dist/demuxer/mp4-demuxer.d.ts.map +1 -0
- package/dist/demuxer/mp4box-types.d.ts +149 -0
- package/dist/demuxer/mp4box-types.d.ts.map +1 -0
- package/dist/factory.d.ts +16 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/renderers/renderer-2d.d.ts +12 -0
- package/dist/renderers/renderer-2d.d.ts.map +1 -0
- package/dist/renderers/renderer-webgl.d.ts +11 -0
- package/dist/renderers/renderer-webgl.d.ts.map +1 -0
- package/dist/renderers/renderer-webgpu.d.ts +11 -0
- package/dist/renderers/renderer-webgpu.d.ts.map +1 -0
- package/dist/types/index.d.ts +24 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/vega.d.ts +189 -0
- package/dist/types/vega.d.ts.map +1 -0
- package/dist/types/worker-messages.d.ts +179 -0
- package/dist/types/worker-messages.d.ts.map +1 -0
- package/dist/vega.d.ts +13 -0
- package/dist/vega.d.ts.map +1 -0
- package/dist/vega.js +488 -0
- package/dist/vega.js.map +1 -0
- package/dist/vega.umd.cjs +42 -0
- package/dist/vega.umd.cjs.map +1 -0
- package/dist/worker/media-worker.d.ts +6 -0
- package/dist/worker/media-worker.d.ts.map +1 -0
- package/dist/worker/video-renderer.d.ts +63 -0
- package/dist/worker/video-renderer.d.ts.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vega Video Player - Public API Types
|
|
3
|
+
* These types are exposed to library consumers.
|
|
4
|
+
*/
|
|
5
|
+
import type { RendererType } from "./index.js";
|
|
6
|
+
/**
|
|
7
|
+
* Adapter interface for custom VideoFrame processing.
|
|
8
|
+
* Users can implement this to apply effects like fisheye undistortion,
|
|
9
|
+
* super resolution, color grading, etc.
|
|
10
|
+
*/
|
|
11
|
+
export interface VideoFrameAdapter {
|
|
12
|
+
/**
|
|
13
|
+
* Process a VideoFrame before rendering.
|
|
14
|
+
* The returned frame will be rendered to the canvas.
|
|
15
|
+
* If a new frame is returned, the original frame should be closed by the adapter
|
|
16
|
+
* or the caller will close it.
|
|
17
|
+
*
|
|
18
|
+
* @param frame - The decoded VideoFrame to process
|
|
19
|
+
* @returns The processed VideoFrame (can be the same or a new one)
|
|
20
|
+
*/
|
|
21
|
+
process(frame: VideoFrame): VideoFrame | Promise<VideoFrame>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Options for creating a Vega player instance.
|
|
25
|
+
*/
|
|
26
|
+
export interface VegaOptions {
|
|
27
|
+
/** Target canvas element for video rendering */
|
|
28
|
+
canvas: HTMLCanvasElement | OffscreenCanvas;
|
|
29
|
+
/** Renderer backend type. Defaults to "2d" */
|
|
30
|
+
rendererType?: RendererType;
|
|
31
|
+
/** Optional VideoFrame adapter for custom frame processing */
|
|
32
|
+
adapter?: VideoFrameAdapter;
|
|
33
|
+
/** Initial volume (0.0 to 1.0). Defaults to 1.0 */
|
|
34
|
+
volume?: number;
|
|
35
|
+
/** Whether to loop playback. Defaults to false */
|
|
36
|
+
loop?: boolean;
|
|
37
|
+
/** Whether to automatically start playback after loading. Defaults to false */
|
|
38
|
+
autoplay?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Information about a video track.
|
|
42
|
+
*/
|
|
43
|
+
export interface VideoTrackInfo {
|
|
44
|
+
/** Video codec string (e.g., "avc1.42E01E") */
|
|
45
|
+
codec: string;
|
|
46
|
+
/** Video width in pixels */
|
|
47
|
+
width: number;
|
|
48
|
+
/** Video height in pixels */
|
|
49
|
+
height: number;
|
|
50
|
+
/** Frame rate (frames per second) */
|
|
51
|
+
frameRate: number;
|
|
52
|
+
/** Bitrate in bits per second */
|
|
53
|
+
bitrate?: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Information about an audio track.
|
|
57
|
+
*/
|
|
58
|
+
export interface AudioTrackInfo {
|
|
59
|
+
/** Audio codec string (e.g., "mp4a.40.2") */
|
|
60
|
+
codec: string;
|
|
61
|
+
/** Sample rate in Hz */
|
|
62
|
+
sampleRate: number;
|
|
63
|
+
/** Number of audio channels */
|
|
64
|
+
channelCount: number;
|
|
65
|
+
/** Bitrate in bits per second */
|
|
66
|
+
bitrate?: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Media file information returned after loading.
|
|
70
|
+
*/
|
|
71
|
+
export interface MediaInfo {
|
|
72
|
+
/** Total duration in seconds */
|
|
73
|
+
duration: number;
|
|
74
|
+
/** Video track information (undefined if no video track) */
|
|
75
|
+
videoTrack?: VideoTrackInfo;
|
|
76
|
+
/** Audio track information (undefined if no audio track) */
|
|
77
|
+
audioTrack?: AudioTrackInfo;
|
|
78
|
+
/** Whether the file is fragmented */
|
|
79
|
+
isFragmented?: boolean;
|
|
80
|
+
/** Container brands (e.g., ["isom", "mp42"]) */
|
|
81
|
+
brands?: string[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Event types emitted by the Vega player.
|
|
85
|
+
*/
|
|
86
|
+
export type VegaEvent = "play" | "pause" | "ended" | "seeking" | "seeked" | "timeupdate" | "error" | "loadedmetadata" | "canplay" | "waiting" | "volumechange";
|
|
87
|
+
/**
|
|
88
|
+
* Event callback function type.
|
|
89
|
+
*/
|
|
90
|
+
export type VegaEventCallback<T = unknown> = (data?: T) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Error event data.
|
|
93
|
+
*/
|
|
94
|
+
export interface VegaErrorEvent {
|
|
95
|
+
/** Error message */
|
|
96
|
+
message: string;
|
|
97
|
+
/** Original error object */
|
|
98
|
+
error?: Error;
|
|
99
|
+
/** Error code for categorization */
|
|
100
|
+
code?: VegaErrorCode;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Error codes for categorizing errors.
|
|
104
|
+
*/
|
|
105
|
+
export type VegaErrorCode = "LOAD_ERROR" | "DECODE_ERROR" | "DEMUX_ERROR" | "RENDER_ERROR" | "ADAPTER_ERROR" | "UNSUPPORTED_FORMAT" | "NETWORK_ERROR";
|
|
106
|
+
/**
|
|
107
|
+
* Playback state of the player.
|
|
108
|
+
*/
|
|
109
|
+
export type PlaybackState = "idle" | "loading" | "ready" | "playing" | "paused" | "seeking" | "ended" | "error";
|
|
110
|
+
/**
|
|
111
|
+
* Main Vega player interface.
|
|
112
|
+
*/
|
|
113
|
+
export interface Vega {
|
|
114
|
+
/**
|
|
115
|
+
* Load a media source for playback.
|
|
116
|
+
* @param source - URL string, File, or Blob containing the media
|
|
117
|
+
* @returns Promise resolving to media information
|
|
118
|
+
*/
|
|
119
|
+
load(source: string | File | Blob): Promise<MediaInfo>;
|
|
120
|
+
/**
|
|
121
|
+
* Start or resume playback.
|
|
122
|
+
*/
|
|
123
|
+
play(): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Pause playback.
|
|
126
|
+
*/
|
|
127
|
+
pause(): void;
|
|
128
|
+
/**
|
|
129
|
+
* Seek to a specific time.
|
|
130
|
+
* @param time - Target time in seconds
|
|
131
|
+
*/
|
|
132
|
+
seek(time: number): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Stop playback and reset to the beginning.
|
|
135
|
+
*/
|
|
136
|
+
stop(): void;
|
|
137
|
+
/** Current playback time in seconds */
|
|
138
|
+
readonly currentTime: number;
|
|
139
|
+
/** Total duration in seconds */
|
|
140
|
+
readonly duration: number;
|
|
141
|
+
/** Whether playback is paused */
|
|
142
|
+
readonly paused: boolean;
|
|
143
|
+
/** Whether playback has ended */
|
|
144
|
+
readonly ended: boolean;
|
|
145
|
+
/** Current volume (0.0 to 1.0) */
|
|
146
|
+
readonly volume: number;
|
|
147
|
+
/** Whether audio is muted */
|
|
148
|
+
readonly muted: boolean;
|
|
149
|
+
/** Current playback state */
|
|
150
|
+
readonly state: PlaybackState;
|
|
151
|
+
/** Loaded media information */
|
|
152
|
+
readonly mediaInfo: MediaInfo | null;
|
|
153
|
+
/**
|
|
154
|
+
* Set the playback volume.
|
|
155
|
+
* @param volume - Volume level (0.0 to 1.0)
|
|
156
|
+
*/
|
|
157
|
+
setVolume(volume: number): void;
|
|
158
|
+
/**
|
|
159
|
+
* Set muted state.
|
|
160
|
+
* @param muted - Whether to mute audio
|
|
161
|
+
*/
|
|
162
|
+
setMuted(muted: boolean): void;
|
|
163
|
+
/**
|
|
164
|
+
* Set or replace the VideoFrame adapter.
|
|
165
|
+
* @param adapter - New adapter or null to remove
|
|
166
|
+
*/
|
|
167
|
+
setAdapter(adapter: VideoFrameAdapter | null): void;
|
|
168
|
+
/**
|
|
169
|
+
* Get the current VideoFrame adapter.
|
|
170
|
+
*/
|
|
171
|
+
getAdapter(): VideoFrameAdapter | null;
|
|
172
|
+
/**
|
|
173
|
+
* Register an event listener.
|
|
174
|
+
* @param event - Event type
|
|
175
|
+
* @param callback - Callback function
|
|
176
|
+
*/
|
|
177
|
+
on<E extends VegaEvent>(event: E, callback: VegaEventCallback): void;
|
|
178
|
+
/**
|
|
179
|
+
* Remove an event listener.
|
|
180
|
+
* @param event - Event type
|
|
181
|
+
* @param callback - Callback function to remove
|
|
182
|
+
*/
|
|
183
|
+
off<E extends VegaEvent>(event: E, callback: VegaEventCallback): void;
|
|
184
|
+
/**
|
|
185
|
+
* Destroy the player and release all resources.
|
|
186
|
+
*/
|
|
187
|
+
destroy(): void;
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=vega.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vega.d.ts","sourceRoot":"","sources":["../../src/types/vega.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;OAQG;IACH,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAC9D;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,gDAAgD;IAChD,MAAM,EAAE,iBAAiB,GAAG,eAAe,CAAC;IAE5C,8CAA8C;IAC9C,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B,8DAA8D;IAC9D,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAE5B,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,kDAAkD;IAClD,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;I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Q,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAEtE;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker Message Types
|
|
3
|
+
* Defines the communication protocol between main thread and media worker.
|
|
4
|
+
*/
|
|
5
|
+
import type { MediaInfo } from "./vega.js";
|
|
6
|
+
/**
|
|
7
|
+
* Commands sent from main thread to worker.
|
|
8
|
+
*/
|
|
9
|
+
export type WorkerCommand = InitializeCommand | PlayCommand | PauseCommand | SeekCommand | StopCommand | UpdateMediaTimeCommand | DestroyCommand;
|
|
10
|
+
/**
|
|
11
|
+
* Initialize the worker with a media source.
|
|
12
|
+
*/
|
|
13
|
+
export interface InitializeCommand {
|
|
14
|
+
command: "initialize";
|
|
15
|
+
/** Media source URL or data */
|
|
16
|
+
source: string | ArrayBuffer;
|
|
17
|
+
/** OffscreenCanvas for rendering (optional, for worker-side rendering) */
|
|
18
|
+
canvas?: OffscreenCanvas;
|
|
19
|
+
/** Renderer type to use */
|
|
20
|
+
rendererType?: "2d" | "webgl" | "webgpu";
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Start playback.
|
|
24
|
+
*/
|
|
25
|
+
export interface PlayCommand {
|
|
26
|
+
command: "play";
|
|
27
|
+
/** Current media time when play was requested */
|
|
28
|
+
mediaTimeSecs: number;
|
|
29
|
+
/** High-resolution timestamp when media time was captured */
|
|
30
|
+
mediaTimeCapturedAtHighResTimestamp: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Pause playback.
|
|
34
|
+
*/
|
|
35
|
+
export interface PauseCommand {
|
|
36
|
+
command: "pause";
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Seek to a specific time.
|
|
40
|
+
*/
|
|
41
|
+
export interface SeekCommand {
|
|
42
|
+
command: "seek";
|
|
43
|
+
/** Target time in seconds */
|
|
44
|
+
time: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Stop playback and reset.
|
|
48
|
+
*/
|
|
49
|
+
export interface StopCommand {
|
|
50
|
+
command: "stop";
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Update the current media time reference.
|
|
54
|
+
*/
|
|
55
|
+
export interface UpdateMediaTimeCommand {
|
|
56
|
+
command: "update-media-time";
|
|
57
|
+
/** Current media time in seconds */
|
|
58
|
+
mediaTimeSecs: number;
|
|
59
|
+
/** High-resolution timestamp when media time was captured */
|
|
60
|
+
mediaTimeCapturedAtHighResTimestamp: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Destroy the worker and release resources.
|
|
64
|
+
*/
|
|
65
|
+
export interface DestroyCommand {
|
|
66
|
+
command: "destroy";
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Responses sent from worker to main thread.
|
|
70
|
+
*/
|
|
71
|
+
export type WorkerResponse = InitializeDoneResponse | FrameReadyResponse | AudioDataResponse | SeekDoneResponse | EndedResponse | ErrorResponse | StatusResponse;
|
|
72
|
+
/**
|
|
73
|
+
* Initialization complete response.
|
|
74
|
+
*/
|
|
75
|
+
export interface InitializeDoneResponse {
|
|
76
|
+
type: "initialize-done";
|
|
77
|
+
/** Parsed media information */
|
|
78
|
+
mediaInfo: MediaInfo;
|
|
79
|
+
/** Audio sample rate */
|
|
80
|
+
sampleRate?: number;
|
|
81
|
+
/** Audio channel count */
|
|
82
|
+
channelCount?: number;
|
|
83
|
+
/** SharedArrayBuffer for audio ring buffer (if using AudioWorklet) */
|
|
84
|
+
sharedArrayBuffer?: SharedArrayBuffer;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A decoded video frame is ready.
|
|
88
|
+
* The frame is transferred via postMessage.
|
|
89
|
+
*/
|
|
90
|
+
export interface FrameReadyResponse {
|
|
91
|
+
type: "frame-ready";
|
|
92
|
+
/** The decoded VideoFrame (transferred) */
|
|
93
|
+
frame: VideoFrame;
|
|
94
|
+
/** Presentation timestamp in microseconds */
|
|
95
|
+
timestamp: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Decoded audio data is ready.
|
|
99
|
+
*/
|
|
100
|
+
export interface AudioDataResponse {
|
|
101
|
+
type: "audio-data";
|
|
102
|
+
/** The decoded AudioData (transferred) */
|
|
103
|
+
audioData: AudioData;
|
|
104
|
+
/** Timestamp in microseconds */
|
|
105
|
+
timestamp: number;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Seek operation completed.
|
|
109
|
+
*/
|
|
110
|
+
export interface SeekDoneResponse {
|
|
111
|
+
type: "seek-done";
|
|
112
|
+
/** Actual time seeked to in seconds */
|
|
113
|
+
time: number;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Playback has ended.
|
|
117
|
+
*/
|
|
118
|
+
export interface EndedResponse {
|
|
119
|
+
type: "ended";
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* An error occurred in the worker.
|
|
123
|
+
*/
|
|
124
|
+
export interface ErrorResponse {
|
|
125
|
+
type: "error";
|
|
126
|
+
/** Error message */
|
|
127
|
+
message: string;
|
|
128
|
+
/** Error code */
|
|
129
|
+
code?: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Status update from the worker.
|
|
133
|
+
*/
|
|
134
|
+
export interface StatusResponse {
|
|
135
|
+
type: "status";
|
|
136
|
+
/** Status category */
|
|
137
|
+
category: "demux" | "decode" | "render" | "buffer";
|
|
138
|
+
/** Status message */
|
|
139
|
+
message: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Configuration for video decoder.
|
|
143
|
+
*/
|
|
144
|
+
export interface VideoDecoderConfigMessage {
|
|
145
|
+
codec: string;
|
|
146
|
+
codedWidth: number;
|
|
147
|
+
codedHeight: number;
|
|
148
|
+
displayWidth?: number;
|
|
149
|
+
displayHeight?: number;
|
|
150
|
+
description?: ArrayBuffer;
|
|
151
|
+
hardwareAcceleration?: "no-preference" | "prefer-hardware" | "prefer-software";
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Configuration for audio decoder.
|
|
155
|
+
*/
|
|
156
|
+
export interface AudioDecoderConfigMessage {
|
|
157
|
+
codec: string;
|
|
158
|
+
sampleRate: number;
|
|
159
|
+
numberOfChannels: number;
|
|
160
|
+
description?: ArrayBuffer;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Sample/chunk information from demuxer.
|
|
164
|
+
*/
|
|
165
|
+
export interface SampleInfo {
|
|
166
|
+
/** Whether this is a keyframe */
|
|
167
|
+
isSync: boolean;
|
|
168
|
+
/** Composition timestamp in timescale units */
|
|
169
|
+
cts: number;
|
|
170
|
+
/** Decode timestamp in timescale units */
|
|
171
|
+
dts: number;
|
|
172
|
+
/** Duration in timescale units */
|
|
173
|
+
duration: number;
|
|
174
|
+
/** Timescale (ticks per second) */
|
|
175
|
+
timescale: number;
|
|
176
|
+
/** Sample data */
|
|
177
|
+
data: ArrayBuffer;
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=worker-messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-messages.d.ts","sourceRoot":"","sources":["../../src/types/worker-messages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,iBAAiB,GACjB,WAAW,GACX,YAAY,GACZ,WAAW,GACX,WAAW,GACX,sBAAsB,GACtB,cAAc,CAAC;AAEnB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,+BAA+B;IAC/B,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;IAC7B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,2BAA2B;IAC3B,YAAY,CAAC,EAAE,IAAI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,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,iCAAiC;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,+CAA+C;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,0CAA0C;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB;IAClB,IAAI,EAAE,WAAW,CAAC;CACnB"}
|
package/dist/vega.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vega - Main Video Player Class
|
|
3
|
+
* Entry point for the Vega video player library.
|
|
4
|
+
*/
|
|
5
|
+
import type { Vega, VegaOptions, VideoFrameAdapter, MediaInfo, VegaEvent } from "./types/vega.js";
|
|
6
|
+
/**
|
|
7
|
+
* Create a new Vega player instance.
|
|
8
|
+
* @param options - Player options
|
|
9
|
+
* @returns Vega player instance
|
|
10
|
+
*/
|
|
11
|
+
export declare function createVega(options: VegaOptions): Vega;
|
|
12
|
+
export type { Vega, VegaOptions, VideoFrameAdapter, MediaInfo, VegaEvent };
|
|
13
|
+
//# sourceMappingURL=vega.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vega.d.ts","sourceRoot":"","sources":["../src/vega.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,IAAI,EACJ,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,SAAS,EAIV,MAAM,iBAAiB,CAAC;AAifzB;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAErD;AAED,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC"}
|