@video-editor/protocol 0.0.1-beta.1 → 0.0.1-beta.11
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 +120 -9
- package/dist/index.js +12240 -7572
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { IEffectSegment } from '@video-editor/shared';
|
|
|
6
6
|
import { IFillMode } from '@video-editor/shared';
|
|
7
7
|
import { IFilterSegment } from '@video-editor/shared';
|
|
8
8
|
import { IFramesSegmentUnion } from '@video-editor/shared';
|
|
9
|
-
import { IImageSegment } from '@video-editor/shared';
|
|
10
9
|
import { ISamples } from './fetch';
|
|
10
|
+
import { IStickerSegment } from '@video-editor/shared';
|
|
11
11
|
import { ITextSegment } from '@video-editor/shared';
|
|
12
12
|
import { ITrackType } from '@video-editor/shared';
|
|
13
13
|
import { ITransition } from '@video-editor/shared';
|
|
@@ -36,7 +36,7 @@ export declare function createValidator(): {
|
|
|
36
36
|
};
|
|
37
37
|
verifyFramesSegment: (o: object) => IFramesSegmentUnion;
|
|
38
38
|
verifyTextSegment: (o: object) => ITextSegment;
|
|
39
|
-
|
|
39
|
+
verifyStickerSegment: (o: object) => IStickerSegment;
|
|
40
40
|
verifyAudioSegment: (o: object) => IAudioSegment;
|
|
41
41
|
verifyEffectSegment: (o: object) => IEffectSegment;
|
|
42
42
|
verifyFilterSegment: (o: object) => IFilterSegment;
|
|
@@ -45,10 +45,15 @@ export declare function createValidator(): {
|
|
|
45
45
|
};
|
|
46
46
|
verifySegment: (o: object & {
|
|
47
47
|
segmentType: ITrackType;
|
|
48
|
-
}) => IFramesSegmentUnion | IAudioSegment | IEffectSegment | IFilterSegment |
|
|
48
|
+
}) => IFramesSegmentUnion | IAudioSegment | IEffectSegment | IFilterSegment | IStickerSegment | ITextSegment;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
export declare function createVideoProtocolManager(protocol: IVideoProtocol
|
|
51
|
+
export declare function createVideoProtocolManager(protocol: IVideoProtocol, options?: {
|
|
52
|
+
idFactory?: {
|
|
53
|
+
segment?: () => string;
|
|
54
|
+
track?: () => string;
|
|
55
|
+
};
|
|
56
|
+
}): {
|
|
52
57
|
videoBasicInfo: {
|
|
53
58
|
version: `${number}.${number}.${number}`;
|
|
54
59
|
width: number;
|
|
@@ -111,6 +116,9 @@ export declare function createVideoProtocolManager(protocol: IVideoProtocol): {
|
|
|
111
116
|
readonly startTime: number;
|
|
112
117
|
readonly endTime: number;
|
|
113
118
|
readonly segmentType: "frames";
|
|
119
|
+
readonly extra?: {
|
|
120
|
+
readonly [x: string]: never;
|
|
121
|
+
} | null | undefined;
|
|
114
122
|
} | {
|
|
115
123
|
readonly type: "image";
|
|
116
124
|
readonly format: "img" | "gif";
|
|
@@ -158,6 +166,9 @@ export declare function createVideoProtocolManager(protocol: IVideoProtocol): {
|
|
|
158
166
|
readonly startTime: number;
|
|
159
167
|
readonly endTime: number;
|
|
160
168
|
readonly segmentType: "frames";
|
|
169
|
+
readonly extra?: {
|
|
170
|
+
readonly [x: string]: never;
|
|
171
|
+
} | null | undefined;
|
|
161
172
|
} | {
|
|
162
173
|
readonly type: "3D";
|
|
163
174
|
readonly url: string;
|
|
@@ -204,7 +215,13 @@ export declare function createVideoProtocolManager(protocol: IVideoProtocol): {
|
|
|
204
215
|
readonly startTime: number;
|
|
205
216
|
readonly endTime: number;
|
|
206
217
|
readonly segmentType: "frames";
|
|
218
|
+
readonly extra?: {
|
|
219
|
+
readonly [x: string]: never;
|
|
220
|
+
} | null | undefined;
|
|
207
221
|
})[];
|
|
222
|
+
readonly extra?: {
|
|
223
|
+
readonly [x: string]: never;
|
|
224
|
+
} | null | undefined;
|
|
208
225
|
readonly isMain?: boolean | undefined;
|
|
209
226
|
}[];
|
|
210
227
|
text: readonly {
|
|
@@ -257,13 +274,19 @@ export declare function createVideoProtocolManager(protocol: IVideoProtocol): {
|
|
|
257
274
|
readonly startTime: number;
|
|
258
275
|
readonly endTime: number;
|
|
259
276
|
readonly url?: string | undefined;
|
|
277
|
+
readonly extra?: {
|
|
278
|
+
readonly [x: string]: never;
|
|
279
|
+
} | null | undefined;
|
|
260
280
|
}[];
|
|
281
|
+
readonly extra?: {
|
|
282
|
+
readonly [x: string]: never;
|
|
283
|
+
} | null | undefined;
|
|
261
284
|
}[];
|
|
262
|
-
|
|
285
|
+
sticker: readonly {
|
|
263
286
|
readonly trackId: string;
|
|
264
|
-
readonly trackType: "
|
|
287
|
+
readonly trackType: "sticker";
|
|
265
288
|
readonly children: readonly {
|
|
266
|
-
readonly segmentType: "
|
|
289
|
+
readonly segmentType: "sticker";
|
|
267
290
|
readonly format: "img" | "gif";
|
|
268
291
|
readonly url: string;
|
|
269
292
|
readonly fillMode?: IFillMode | undefined;
|
|
@@ -296,7 +319,13 @@ export declare function createVideoProtocolManager(protocol: IVideoProtocol): {
|
|
|
296
319
|
readonly id: string;
|
|
297
320
|
readonly startTime: number;
|
|
298
321
|
readonly endTime: number;
|
|
322
|
+
readonly extra?: {
|
|
323
|
+
readonly [x: string]: never;
|
|
324
|
+
} | null | undefined;
|
|
299
325
|
}[];
|
|
326
|
+
readonly extra?: {
|
|
327
|
+
readonly [x: string]: never;
|
|
328
|
+
} | null | undefined;
|
|
300
329
|
}[];
|
|
301
330
|
audio: readonly {
|
|
302
331
|
readonly trackId: string;
|
|
@@ -312,7 +341,13 @@ export declare function createVideoProtocolManager(protocol: IVideoProtocol): {
|
|
|
312
341
|
readonly id: string;
|
|
313
342
|
readonly startTime: number;
|
|
314
343
|
readonly endTime: number;
|
|
344
|
+
readonly extra?: {
|
|
345
|
+
readonly [x: string]: never;
|
|
346
|
+
} | null | undefined;
|
|
315
347
|
}[];
|
|
348
|
+
readonly extra?: {
|
|
349
|
+
readonly [x: string]: never;
|
|
350
|
+
} | null | undefined;
|
|
316
351
|
}[];
|
|
317
352
|
effect: readonly {
|
|
318
353
|
readonly trackId: string;
|
|
@@ -325,7 +360,13 @@ export declare function createVideoProtocolManager(protocol: IVideoProtocol): {
|
|
|
325
360
|
readonly startTime: number;
|
|
326
361
|
readonly endTime: number;
|
|
327
362
|
readonly url?: string | undefined;
|
|
363
|
+
readonly extra?: {
|
|
364
|
+
readonly [x: string]: never;
|
|
365
|
+
} | null | undefined;
|
|
328
366
|
}[];
|
|
367
|
+
readonly extra?: {
|
|
368
|
+
readonly [x: string]: never;
|
|
369
|
+
} | null | undefined;
|
|
329
370
|
}[];
|
|
330
371
|
filter: readonly {
|
|
331
372
|
readonly trackId: string;
|
|
@@ -339,24 +380,73 @@ export declare function createVideoProtocolManager(protocol: IVideoProtocol): {
|
|
|
339
380
|
readonly startTime: number;
|
|
340
381
|
readonly endTime: number;
|
|
341
382
|
readonly url?: string | undefined;
|
|
383
|
+
readonly extra?: {
|
|
384
|
+
readonly [x: string]: never;
|
|
385
|
+
} | null | undefined;
|
|
342
386
|
}[];
|
|
387
|
+
readonly extra?: {
|
|
388
|
+
readonly [x: string]: never;
|
|
389
|
+
} | null | undefined;
|
|
343
390
|
}[];
|
|
344
391
|
}>;
|
|
345
392
|
segmentMap: ComputedRef<Record<string, DeepReadonly<SegmentUnion | undefined>>>;
|
|
346
393
|
getSegment: <T extends ITrackType>(id: SegmentUnion["id"], type?: T) => DeepReadonly<TrackTypeMapSegment[T]> | undefined;
|
|
347
|
-
addSegment: (segment: PartialByKeys<TrackTypeMapSegment[ITrackType], "id">) =>
|
|
348
|
-
|
|
394
|
+
addSegment: (segment: PartialByKeys<TrackTypeMapSegment[ITrackType], "id">) => {
|
|
395
|
+
id: string;
|
|
396
|
+
affectedSegments: SegmentUnion[];
|
|
397
|
+
affectedTracks: TrackUnion[];
|
|
398
|
+
createdTracks: TrackUnion[];
|
|
399
|
+
removedTrackIds: string[];
|
|
400
|
+
};
|
|
401
|
+
removeSegment: (id: SegmentUnion["id"]) => {
|
|
402
|
+
success: boolean;
|
|
403
|
+
affectedSegments: SegmentUnion[];
|
|
404
|
+
affectedTracks: TrackUnion[];
|
|
405
|
+
createdTracks: TrackUnion[];
|
|
406
|
+
removedTrackIds: string[];
|
|
407
|
+
};
|
|
349
408
|
updateSegment: <T extends ITrackType>(updater: (segment: TrackTypeMapSegment[T]) => void, id?: string, type?: T) => void;
|
|
409
|
+
moveSegment: (moveOptions: {
|
|
410
|
+
segmentId: string;
|
|
411
|
+
sourceTrackId: string;
|
|
412
|
+
targetTrackId?: string;
|
|
413
|
+
startTime: number;
|
|
414
|
+
endTime: number;
|
|
415
|
+
isNewTrack?: boolean;
|
|
416
|
+
newTrackInsertIndex?: number;
|
|
417
|
+
newTrackId?: string;
|
|
418
|
+
}) => {
|
|
419
|
+
success: boolean;
|
|
420
|
+
affectedSegments: SegmentUnion[];
|
|
421
|
+
affectedTracks: TrackUnion[];
|
|
422
|
+
createdTracks: TrackUnion[];
|
|
423
|
+
removedTrackIds: string[];
|
|
424
|
+
};
|
|
425
|
+
resizeSegment: (options: {
|
|
426
|
+
segmentId: string;
|
|
427
|
+
trackId: string;
|
|
428
|
+
startTime: number;
|
|
429
|
+
endTime: number;
|
|
430
|
+
}) => {
|
|
431
|
+
success: boolean;
|
|
432
|
+
affectedSegments: SegmentUnion[];
|
|
433
|
+
affectedTracks: TrackUnion[];
|
|
434
|
+
createdTracks: TrackUnion[];
|
|
435
|
+
removedTrackIds: string[];
|
|
436
|
+
};
|
|
350
437
|
exportProtocol: () => IVideoProtocol;
|
|
351
438
|
addTransition: (transition: ITransition, addTime?: number) => boolean;
|
|
352
439
|
removeTransition: (segmentId: string) => boolean;
|
|
353
440
|
updateTransition: (segmentId: string, updater: (transition: ITransition) => void) => boolean;
|
|
441
|
+
replaceTrackId: (oldTrackId: string, newTrackId: string) => boolean;
|
|
354
442
|
undo: () => void;
|
|
355
443
|
redo: () => void;
|
|
356
444
|
redoCount: ComputedRef<number>;
|
|
357
445
|
undoCount: ComputedRef<number>;
|
|
358
446
|
};
|
|
359
447
|
|
|
448
|
+
export declare const DEFAULT_RESOURCE_DIR = "/video-editor-res";
|
|
449
|
+
|
|
360
450
|
export declare const DUPLICATE_SEGMENT_ID = "duplicate segment id";
|
|
361
451
|
|
|
362
452
|
export declare const DUPLICATE_TRACK_ID = "duplicate track id";
|
|
@@ -379,6 +469,22 @@ export declare function fileToMP4Samples(input: string | OPFSToolFile, cbs: {
|
|
|
379
469
|
stop: () => void;
|
|
380
470
|
}>;
|
|
381
471
|
|
|
472
|
+
/** Generate thumbnails for a video, preferring OPFS resources with network fallback. */
|
|
473
|
+
export declare function generateThumbnails(url: string, options?: GenerateThumbnailsOptions): Promise<Thumbnail[]>;
|
|
474
|
+
|
|
475
|
+
declare interface GenerateThumbnailsOptions {
|
|
476
|
+
/** Thumbnail width in pixels (default 100). */
|
|
477
|
+
imgWidth?: number;
|
|
478
|
+
/** Start time in microseconds. */
|
|
479
|
+
start?: number;
|
|
480
|
+
/** End time in microseconds. */
|
|
481
|
+
end?: number;
|
|
482
|
+
/** Step duration in microseconds; fallback to keyframes when omitted. */
|
|
483
|
+
step?: number;
|
|
484
|
+
/** OPFS resource directory; defaults to `/video-editor-res`. */
|
|
485
|
+
resourceDir?: string;
|
|
486
|
+
}
|
|
487
|
+
|
|
382
488
|
export declare function getResourceType(url: string): Promise<{
|
|
383
489
|
type: IResType;
|
|
384
490
|
totalSize: number;
|
|
@@ -414,6 +520,11 @@ declare type PartialByKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T,
|
|
|
414
520
|
|
|
415
521
|
export { SegmentUnion }
|
|
416
522
|
|
|
523
|
+
declare interface Thumbnail {
|
|
524
|
+
ts: number;
|
|
525
|
+
img: Blob;
|
|
526
|
+
}
|
|
527
|
+
|
|
417
528
|
export { TrackTypeMapSegment }
|
|
418
529
|
|
|
419
530
|
export { TrackUnion }
|