@video-editor/renderer 0.0.1-beta.33 → 0.0.1-beta.34

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/dist/index.d.ts CHANGED
@@ -3,11 +3,35 @@ import { ApplicationOptions } from 'pixi.js';
3
3
  import { ComputedRef } from '@vue/reactivity';
4
4
  import { Container } from 'pixi.js';
5
5
  import { file } from 'opfs-tools';
6
+ import { Filter } from 'pixi.js';
6
7
  import { IClip } from '@webav/av-cliper';
7
8
  import { ICombinatorOpts } from '@webav/av-cliper';
9
+ import { ITrackType } from '@video-editor/shared';
8
10
  import { IVideoProtocol } from '@video-editor/shared';
9
11
  import { OffscreenSprite } from '@webav/av-cliper';
10
12
  import { Ref } from '@vue/reactivity';
13
+ import { SegmentUnion } from '@video-editor/shared';
14
+
15
+ export declare interface ActiveVoiceRef {
16
+ voiceId: string;
17
+ segmentId: string;
18
+ trackId: string;
19
+ segmentKind: 'audio' | 'video';
20
+ }
21
+
22
+ export declare interface AudioPlanEvent {
23
+ voiceId: string;
24
+ segmentId: string;
25
+ trackId: string;
26
+ segmentKind: 'audio' | 'video';
27
+ action: AudioVoiceAction;
28
+ atTimelineMs: number;
29
+ sourceTimeMs?: number;
30
+ gain?: number;
31
+ rate?: number;
32
+ }
33
+
34
+ export declare type AudioVoiceAction = 'start' | 'stop' | 'seek' | 'gain' | 'rate';
11
35
 
12
36
  declare interface ClipMeta {
13
37
  width: number;
@@ -15,6 +39,21 @@ declare interface ClipMeta {
15
39
  duration: number;
16
40
  }
17
41
 
42
+ export declare function collectTransitionByFromSegmentId(protocol: IVideoProtocol): Map<string, ResolvedTransitionEdge>;
43
+
44
+ export declare interface ComposeAudioInput {
45
+ segmentId: string;
46
+ segmentKind: 'audio' | 'video';
47
+ url: string;
48
+ startTime: number;
49
+ endTime: number;
50
+ fromTime?: number;
51
+ playRate?: number;
52
+ volume?: number;
53
+ fadeInDuration?: number;
54
+ fadeOutDuration?: number;
55
+ }
56
+
18
57
  export declare function composeProtocol(protocol: IVideoProtocol, opts?: ComposeProtocolOptions): Promise<ComposeProtocolResult>;
19
58
 
20
59
  export declare interface ComposeProtocolOptions extends Omit<ICombinatorOpts, 'width' | 'height' | 'fps'> {
@@ -34,6 +73,19 @@ export declare interface ComposeProtocolResult {
34
73
  destroy: () => void;
35
74
  }
36
75
 
76
+ export declare interface ComposeRunner {
77
+ evaluateAt: (protocol: IVideoProtocol, atMs: number, options?: ComposeRunnerEvaluateOptions) => TimelinePlan;
78
+ evaluateSequence: (protocol: IVideoProtocol, atMsList: number[]) => TimelinePlan[];
79
+ reset: () => void;
80
+ getState: () => EvaluatorState;
81
+ }
82
+
83
+ export declare interface ComposeRunnerEvaluateOptions {
84
+ windowStartMs?: number;
85
+ windowEndMs?: number;
86
+ discontinuity?: boolean;
87
+ }
88
+
37
89
  export declare interface ConcatVideoOptions extends Omit<ICombinatorOpts, 'width' | 'height'> {
38
90
  width?: number;
39
91
  height?: number;
@@ -54,6 +106,14 @@ export declare interface ConcatVideoSource {
54
106
  source: VideoConcatSource;
55
107
  }
56
108
 
109
+ export declare function createComposeAudioInputs(protocol: IVideoProtocol): ComposeAudioInput[];
110
+
111
+ export declare function createComposeRunner(): ComposeRunner;
112
+
113
+ export declare function createEmptyEvaluatorState(): EvaluatorState;
114
+
115
+ export declare function createPixiFiltersFromVisualEffects(effects: VisualEffectParam[] | undefined): Filter[];
116
+
57
117
  /**
58
118
  * Create a renderer that reacts to protocol updates and drives playback state.
59
119
  * - Pass a reactive `protocol` (Ref/readonly/normal object)
@@ -62,6 +122,36 @@ export declare interface ConcatVideoSource {
62
122
  */
63
123
  export declare function createRenderer(opts: RendererOptions): Promise<Renderer>;
64
124
 
125
+ export declare function createTimelineTransport(opts?: CreateTimelineTransportOptions): TimelineTransport;
126
+
127
+ export declare interface CreateTimelineTransportOptions {
128
+ now?: () => number;
129
+ initialTimelineMs?: number;
130
+ initialRate?: number;
131
+ playing?: boolean;
132
+ }
133
+
134
+ export declare function createVisualRenderItems(protocol: IVideoProtocol, visuals: VisualPlanItem[]): VisualRenderItem[];
135
+
136
+ export declare interface EvalContext {
137
+ atMs: number;
138
+ windowStartMs: number;
139
+ windowEndMs: number;
140
+ fps: number;
141
+ discontinuity?: boolean;
142
+ }
143
+
144
+ export declare function evaluateTimelinePlan(protocol: IVideoProtocol, context: EvalContext, previousState?: EvaluatorState): EvaluatorOutput;
145
+
146
+ export declare interface EvaluatorOutput {
147
+ plan: TimelinePlan;
148
+ state: EvaluatorState;
149
+ }
150
+
151
+ export declare interface EvaluatorState {
152
+ activeVoices: ActiveVoiceRef[];
153
+ }
154
+
65
155
  declare type MaybeRef<T> = T | Ref<T>;
66
156
 
67
157
  export declare class ProtocolVideoClip implements IClip {
@@ -117,6 +207,84 @@ export declare interface RendererOptions {
117
207
  warmUpResources?: boolean;
118
208
  }
119
209
 
210
+ export declare interface ResolvedTransitionEdge {
211
+ id: string;
212
+ name: string;
213
+ duration: number;
214
+ fromSegmentId: string;
215
+ toSegmentId: string;
216
+ }
217
+
218
+ export declare interface TimelinePlan {
219
+ atMs: number;
220
+ windowStartMs: number;
221
+ windowEndMs: number;
222
+ visuals: VisualPlanItem[];
223
+ audioEvents: AudioPlanEvent[];
224
+ }
225
+
226
+ export declare interface TimelineTransport {
227
+ getSnapshot: (nowMs?: number) => TransportSnapshot;
228
+ play: (nowMs?: number) => TransportSnapshot;
229
+ pause: (nowMs?: number) => TransportSnapshot;
230
+ seek: (timelineMs: number, nowMs?: number) => TransportSnapshot;
231
+ setRate: (rate: number, nowMs?: number) => TransportSnapshot;
232
+ subscribe: (listener: (snapshot: TransportSnapshot) => void) => () => void;
233
+ }
234
+
235
+ export declare interface TransportSnapshot {
236
+ playing: boolean;
237
+ timelineMs: number;
238
+ rate: number;
239
+ epochWallMs: number;
240
+ epochTimelineMs: number;
241
+ discontinuitySeq: number;
242
+ }
243
+
120
244
  export declare type VideoConcatSource = string | ReadableStream<Uint8Array> | Blob | ReturnType<typeof file>;
121
245
 
246
+ export declare type VisualEffectParam = VisualTrackEffectParam | VisualTrackFilterParam;
247
+
248
+ export declare interface VisualPlanItem {
249
+ segmentId: string;
250
+ trackId: string;
251
+ trackType: ITrackType;
252
+ segmentType: ITrackType;
253
+ zOrder: number;
254
+ sourceTimeMs: number;
255
+ opacity: number;
256
+ transition?: {
257
+ fromSegmentId: string;
258
+ toSegmentId: string;
259
+ progress: number;
260
+ durationMs: number;
261
+ transitionId?: string;
262
+ transitionName?: string;
263
+ };
264
+ effects?: VisualEffectParam[];
265
+ }
266
+
267
+ export declare interface VisualRenderItem {
268
+ segment: SegmentUnion;
269
+ sourceTimeMs: number;
270
+ opacity: number;
271
+ includeAudio: boolean;
272
+ effects?: VisualEffectParam[];
273
+ }
274
+
275
+ export declare interface VisualTrackEffectParam {
276
+ segmentType: 'effect';
277
+ segmentId: string;
278
+ effectId: string;
279
+ name: string;
280
+ }
281
+
282
+ export declare interface VisualTrackFilterParam {
283
+ segmentType: 'filter';
284
+ segmentId: string;
285
+ filterId: string;
286
+ name: string;
287
+ intensity: number;
288
+ }
289
+
122
290
  export { }