@shotstack/shotstack-studio 1.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 +164 -0
- package/dist/core/animations/curve-interpolator.d.ts +6 -0
- package/dist/core/animations/effect-preset-builder.d.ts +18 -0
- package/dist/core/animations/keyframe-builder.d.ts +12 -0
- package/dist/core/animations/transition-preset-builder.d.ts +20 -0
- package/dist/core/entities/audio-player.d.ts +17 -0
- package/dist/core/entities/edit.d.ts +46 -0
- package/dist/core/entities/entity.d.ts +5 -0
- package/dist/core/entities/html-player.d.ts +17 -0
- package/dist/core/entities/image-player.d.ts +15 -0
- package/dist/core/entities/inspector.d.ts +18 -0
- package/dist/core/entities/luma-player.d.ts +18 -0
- package/dist/core/entities/player.d.ts +73 -0
- package/dist/core/entities/shape-player.d.ts +15 -0
- package/dist/core/entities/text-player.d.ts +18 -0
- package/dist/core/entities/video-player.d.ts +22 -0
- package/dist/core/events/asset-load-tracker.d.ts +16 -0
- package/dist/core/events/event-emitter.d.ts +10 -0
- package/dist/core/export/video-exporter.d.ts +17 -0
- package/dist/core/inputs/controls.d.ts +11 -0
- package/dist/core/inputs/pointer.d.ts +4 -0
- package/dist/core/layouts/geometry.d.ts +8 -0
- package/dist/core/layouts/position-builder.d.ts +8 -0
- package/dist/core/loaders/asset-loader.d.ts +9 -0
- package/dist/core/loaders/audio-load-parser.d.ts +11 -0
- package/dist/core/loaders/font-load-parser.d.ts +13 -0
- package/dist/core/schemas/asset.d.ts +648 -0
- package/dist/core/schemas/audio-asset.d.ts +82 -0
- package/dist/core/schemas/clip.d.ts +1185 -0
- package/dist/core/schemas/edit.d.ts +4061 -0
- package/dist/core/schemas/html-asset.d.ts +27 -0
- package/dist/core/schemas/image-asset.d.ts +57 -0
- package/dist/core/schemas/keyframe.d.ts +26 -0
- package/dist/core/schemas/luma-asset.d.ts +13 -0
- package/dist/core/schemas/shape-asset.d.ts +199 -0
- package/dist/core/schemas/text-asset.d.ts +155 -0
- package/dist/core/schemas/track.d.ts +1491 -0
- package/dist/core/schemas/video-asset.d.ts +126 -0
- package/dist/core/shotstack-canvas.d.ts +24 -0
- package/dist/index.d.ts +4 -0
- package/dist/main.d.ts +1 -0
- package/dist/shotstack-studio.es.js +5546 -0
- package/dist/shotstack-studio.umd.js +183 -0
- package/package.json +56 -0
- package/readme.md +298 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# PolyForm Shield License 1.0.0
|
|
2
|
+
|
|
3
|
+
<https://polyformproject.org/licenses/shield/1.0.0>
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
In order to get any license under these terms, you must agree
|
|
8
|
+
to them as both strict obligations and conditions to all
|
|
9
|
+
your licenses.
|
|
10
|
+
|
|
11
|
+
## Copyright License
|
|
12
|
+
|
|
13
|
+
The licensor grants you a copyright license for the
|
|
14
|
+
software to do everything you might do with the software
|
|
15
|
+
that would otherwise infringe the licensor's copyright
|
|
16
|
+
in it for any permitted purpose. However, you may
|
|
17
|
+
only distribute the software according to [Distribution
|
|
18
|
+
License](#distribution-license) and make changes or new works
|
|
19
|
+
based on the software according to [Changes and New Works
|
|
20
|
+
License](#changes-and-new-works-license).
|
|
21
|
+
|
|
22
|
+
## Distribution License
|
|
23
|
+
|
|
24
|
+
The licensor grants you an additional copyright license
|
|
25
|
+
to distribute copies of the software. Your license
|
|
26
|
+
to distribute covers distributing the software with
|
|
27
|
+
changes and new works permitted by [Changes and New Works
|
|
28
|
+
License](#changes-and-new-works-license).
|
|
29
|
+
|
|
30
|
+
## Notices
|
|
31
|
+
|
|
32
|
+
You must ensure that anyone who gets a copy of any part of
|
|
33
|
+
the software from you also gets a copy of these terms or the
|
|
34
|
+
URL for them above, as well as copies of any plain-text lines
|
|
35
|
+
beginning with `Required Notice:` that the licensor provided
|
|
36
|
+
with the software. For example:
|
|
37
|
+
|
|
38
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
39
|
+
|
|
40
|
+
## Changes and New Works License
|
|
41
|
+
|
|
42
|
+
The licensor grants you an additional copyright license to
|
|
43
|
+
make changes and new works based on the software for any
|
|
44
|
+
permitted purpose.
|
|
45
|
+
|
|
46
|
+
## Patent License
|
|
47
|
+
|
|
48
|
+
The licensor grants you a patent license for the software that
|
|
49
|
+
covers patent claims the licensor can license, or becomes able
|
|
50
|
+
to license, that you would infringe by using the software.
|
|
51
|
+
|
|
52
|
+
## Noncompete
|
|
53
|
+
|
|
54
|
+
Any purpose is a permitted purpose, except for providing any
|
|
55
|
+
product that competes with the software or any product the
|
|
56
|
+
licensor or any of its affiliates provides using the software.
|
|
57
|
+
|
|
58
|
+
## Competition
|
|
59
|
+
|
|
60
|
+
Goods and services compete even when they provide functionality
|
|
61
|
+
through different kinds of interfaces or for different technical
|
|
62
|
+
platforms. Applications can compete with services, libraries
|
|
63
|
+
with plugins, frameworks with development tools, and so on,
|
|
64
|
+
even if they're written in different programming languages
|
|
65
|
+
or for different computer architectures. Goods and services
|
|
66
|
+
compete even when provided free of charge. If you market a
|
|
67
|
+
product as a practical substitute for the software or another
|
|
68
|
+
product, it definitely competes.
|
|
69
|
+
|
|
70
|
+
## New Products
|
|
71
|
+
|
|
72
|
+
If you are using the software to provide a product that does
|
|
73
|
+
not compete, but the licensor or any of its affiliates brings
|
|
74
|
+
your product into competition by providing a new version of
|
|
75
|
+
the software or another product using the software, you may
|
|
76
|
+
continue using versions of the software available under these
|
|
77
|
+
terms beforehand to provide your competing product, but not
|
|
78
|
+
any later versions.
|
|
79
|
+
|
|
80
|
+
## Discontinued Products
|
|
81
|
+
|
|
82
|
+
You may begin using the software to compete with a product
|
|
83
|
+
or service that the licensor or any of its affiliates has
|
|
84
|
+
stopped providing, unless the licensor includes a plain-text
|
|
85
|
+
line beginning with `Licensor Line of Business:` with the
|
|
86
|
+
software that mentions that line of business. For example:
|
|
87
|
+
|
|
88
|
+
> Licensor Line of Business: YoyodyneCMS Content Management
|
|
89
|
+
> System (http://example.com/cms)
|
|
90
|
+
|
|
91
|
+
## Sales of Business
|
|
92
|
+
|
|
93
|
+
If the licensor or any of its affiliates sells a line of
|
|
94
|
+
business developing the software or using the software
|
|
95
|
+
to provide a product, the buyer can also enforce
|
|
96
|
+
[Noncompete](#noncompete) for that product.
|
|
97
|
+
|
|
98
|
+
## Fair Use
|
|
99
|
+
|
|
100
|
+
You may have "fair use" rights for the software under the
|
|
101
|
+
law. These terms do not limit them.
|
|
102
|
+
|
|
103
|
+
## No Other Rights
|
|
104
|
+
|
|
105
|
+
These terms do not allow you to sublicense or transfer any of
|
|
106
|
+
your licenses to anyone else, or prevent the licensor from
|
|
107
|
+
granting licenses to anyone else. These terms do not imply
|
|
108
|
+
any other licenses.
|
|
109
|
+
|
|
110
|
+
## Patent Defense
|
|
111
|
+
|
|
112
|
+
If you make any written claim that the software infringes or
|
|
113
|
+
contributes to infringement of any patent, your patent license
|
|
114
|
+
for the software granted under these terms ends immediately. If
|
|
115
|
+
your company makes such a claim, your patent license ends
|
|
116
|
+
immediately for work on behalf of your company.
|
|
117
|
+
|
|
118
|
+
## Violations
|
|
119
|
+
|
|
120
|
+
The first time you are notified in writing that you have
|
|
121
|
+
violated any of these terms, or done anything with the software
|
|
122
|
+
not covered by your licenses, your licenses can nonetheless
|
|
123
|
+
continue if you come into full compliance with these terms,
|
|
124
|
+
and take practical steps to correct past violations, within
|
|
125
|
+
32 days of receiving notice. Otherwise, all your licenses
|
|
126
|
+
end immediately.
|
|
127
|
+
|
|
128
|
+
## No Liability
|
|
129
|
+
|
|
130
|
+
**_As far as the law allows, the software comes as is, without
|
|
131
|
+
any warranty or condition, and the licensor will not be liable
|
|
132
|
+
to you for any damages arising out of these terms or the use
|
|
133
|
+
or nature of the software, under any kind of legal claim._**
|
|
134
|
+
|
|
135
|
+
## Definitions
|
|
136
|
+
|
|
137
|
+
The **licensor** is the individual or entity offering these
|
|
138
|
+
terms, and the **software** is the software the licensor makes
|
|
139
|
+
available under these terms.
|
|
140
|
+
|
|
141
|
+
A **product** can be a good or service, or a combination
|
|
142
|
+
of them.
|
|
143
|
+
|
|
144
|
+
**You** refers to the individual or entity agreeing to these
|
|
145
|
+
terms.
|
|
146
|
+
|
|
147
|
+
**Your company** is any legal entity, sole proprietorship,
|
|
148
|
+
or other kind of organization that you work for, plus all
|
|
149
|
+
its affiliates.
|
|
150
|
+
|
|
151
|
+
**Affiliates** means the other organizations than an
|
|
152
|
+
organization has control over, is under the control of, or is
|
|
153
|
+
under common control with.
|
|
154
|
+
|
|
155
|
+
**Control** means ownership of substantially all the assets of
|
|
156
|
+
an entity, or the power to direct its management and policies
|
|
157
|
+
by vote, contract, or otherwise. Control can be direct or
|
|
158
|
+
indirect.
|
|
159
|
+
|
|
160
|
+
**Your licenses** are all the licenses granted to you for the
|
|
161
|
+
software under these terms.
|
|
162
|
+
|
|
163
|
+
**Use** means anything you do with the software requiring one
|
|
164
|
+
of your licenses.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Size } from "../layouts/geometry";
|
|
2
|
+
import { type Clip } from "../schemas/clip";
|
|
3
|
+
import { type Keyframe } from "../schemas/keyframe";
|
|
4
|
+
export type EffectKeyframeSet = {
|
|
5
|
+
offsetXKeyframes: Keyframe[];
|
|
6
|
+
offsetYKeyframes: Keyframe[];
|
|
7
|
+
opacityKeyframes: Keyframe[];
|
|
8
|
+
scaleKeyframes: Keyframe[];
|
|
9
|
+
rotationKeyframes: Keyframe[];
|
|
10
|
+
};
|
|
11
|
+
export declare class EffectPresetBuilder {
|
|
12
|
+
private clipConfiguration;
|
|
13
|
+
constructor(clipConfiguration: Clip);
|
|
14
|
+
build(editSize: Size, clipSize: Size): EffectKeyframeSet;
|
|
15
|
+
private getPresetName;
|
|
16
|
+
private getZoomSpeed;
|
|
17
|
+
private getSlideStart;
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Keyframe } from "../schemas/keyframe";
|
|
2
|
+
export declare class KeyframeBuilder {
|
|
3
|
+
private readonly property;
|
|
4
|
+
private readonly length;
|
|
5
|
+
private readonly cubicBuilder;
|
|
6
|
+
constructor(value: Keyframe[] | number, length: number, initialValue?: number);
|
|
7
|
+
getValue(time: number): number;
|
|
8
|
+
private createKeyframes;
|
|
9
|
+
private createNormalizedKeyframes;
|
|
10
|
+
private validateKeyframes;
|
|
11
|
+
private insertFillerKeyframes;
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Clip } from "../schemas/clip";
|
|
2
|
+
import { type Keyframe } from "../schemas/keyframe";
|
|
3
|
+
export type TransitionKeyframeSet = {
|
|
4
|
+
offsetXKeyframes: Keyframe[];
|
|
5
|
+
offsetYKeyframes: Keyframe[];
|
|
6
|
+
opacityKeyframes: Keyframe[];
|
|
7
|
+
scaleKeyframes: Keyframe[];
|
|
8
|
+
rotationKeyframes: Keyframe[];
|
|
9
|
+
};
|
|
10
|
+
export declare class TransitionPresetBuilder {
|
|
11
|
+
private clipConfiguration;
|
|
12
|
+
constructor(clipConfiguration: Clip);
|
|
13
|
+
build(): TransitionKeyframeSet;
|
|
14
|
+
private buildInPreset;
|
|
15
|
+
private buildOutPreset;
|
|
16
|
+
private getInPresetName;
|
|
17
|
+
private getOutPresetName;
|
|
18
|
+
private getInPresetLength;
|
|
19
|
+
private getOutPresetLength;
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Size } from "../layouts/geometry";
|
|
2
|
+
import { type Clip } from "../schemas/clip";
|
|
3
|
+
import type { Edit } from "./edit";
|
|
4
|
+
import { Player } from "./player";
|
|
5
|
+
export declare class AudioPlayer extends Player {
|
|
6
|
+
private audioResource;
|
|
7
|
+
private isPlaying;
|
|
8
|
+
private volumeKeyframeBuilder;
|
|
9
|
+
private syncTimer;
|
|
10
|
+
constructor(edit: Edit, clipConfiguration: Clip);
|
|
11
|
+
load(): Promise<void>;
|
|
12
|
+
update(deltaTime: number, elapsed: number): void;
|
|
13
|
+
draw(): void;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
getSize(): Size;
|
|
16
|
+
getVolume(): number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EventEmitter } from "../events/event-emitter";
|
|
3
|
+
import type { Size } from "../layouts/geometry";
|
|
4
|
+
import { AssetLoader } from "../loaders/asset-loader";
|
|
5
|
+
import { ClipSchema } from "../schemas/clip";
|
|
6
|
+
import { EditSchema } from "../schemas/edit";
|
|
7
|
+
import { TrackSchema } from "../schemas/track";
|
|
8
|
+
import { Entity } from "./entity";
|
|
9
|
+
type EditType = z.infer<typeof EditSchema>;
|
|
10
|
+
type ClipType = z.infer<typeof ClipSchema>;
|
|
11
|
+
type TrackType = z.infer<typeof TrackSchema>;
|
|
12
|
+
export declare class Edit extends Entity {
|
|
13
|
+
private static readonly ZIndexPadding;
|
|
14
|
+
assetLoader: AssetLoader;
|
|
15
|
+
events: EventEmitter;
|
|
16
|
+
private edit;
|
|
17
|
+
private tracks;
|
|
18
|
+
private clipsToDispose;
|
|
19
|
+
private clips;
|
|
20
|
+
playbackTime: number;
|
|
21
|
+
totalDuration: number;
|
|
22
|
+
constructor(size: Size, backgroundColor?: string);
|
|
23
|
+
load(): Promise<void>;
|
|
24
|
+
play(): void;
|
|
25
|
+
pause(): void;
|
|
26
|
+
seek(target: number): void;
|
|
27
|
+
stop(): void;
|
|
28
|
+
loadEdit(edit: EditType): Promise<void>;
|
|
29
|
+
getEdit(): EditType;
|
|
30
|
+
addClip(trackIdx: number, clip: ClipType): void;
|
|
31
|
+
getClip(trackIdx: number, clipIdx: number): ClipType | null;
|
|
32
|
+
deleteClip(trackIdx: number, clipIdx: number): void;
|
|
33
|
+
addTrack(trackIdx: number, track: TrackType): void;
|
|
34
|
+
getTrack(trackIdx: number): TrackType | null;
|
|
35
|
+
deleteTrack(trackIdx: number): void;
|
|
36
|
+
getTotalDuration(): number;
|
|
37
|
+
private queueDisposeClip;
|
|
38
|
+
protected disposeClips(): void;
|
|
39
|
+
private disposeClip;
|
|
40
|
+
private unloadClipAssets;
|
|
41
|
+
protected clearClips(): void;
|
|
42
|
+
private updateTotalDuration;
|
|
43
|
+
private createPlayerFromAssetType;
|
|
44
|
+
private addPlayer;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Size } from "../layouts/geometry";
|
|
2
|
+
import { type Clip } from "../schemas/clip";
|
|
3
|
+
import type { Edit } from "./edit";
|
|
4
|
+
import { Player } from "./player";
|
|
5
|
+
export declare class HtmlPlayer extends Player {
|
|
6
|
+
private background;
|
|
7
|
+
private text;
|
|
8
|
+
constructor(timeline: Edit, clipConfiguration: Clip);
|
|
9
|
+
load(): Promise<void>;
|
|
10
|
+
update(deltaTime: number, elapsed: number): void;
|
|
11
|
+
draw(): void;
|
|
12
|
+
dispose(): void;
|
|
13
|
+
getSize(): Size;
|
|
14
|
+
protected getFitScale(): number;
|
|
15
|
+
private parseDocument;
|
|
16
|
+
private parseAlignment;
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Size } from "../layouts/geometry";
|
|
2
|
+
import { type Clip } from "../schemas/clip";
|
|
3
|
+
import type { Edit } from "./edit";
|
|
4
|
+
import { Player } from "./player";
|
|
5
|
+
export declare class ImagePlayer extends Player {
|
|
6
|
+
private texture;
|
|
7
|
+
private sprite;
|
|
8
|
+
constructor(timeline: Edit, clipConfiguration: Clip);
|
|
9
|
+
load(): Promise<void>;
|
|
10
|
+
update(deltaTime: number, elapsed: number): void;
|
|
11
|
+
draw(): void;
|
|
12
|
+
dispose(): void;
|
|
13
|
+
getSize(): Size;
|
|
14
|
+
private createCroppedTexture;
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Entity } from "./entity";
|
|
2
|
+
export declare class Inspector extends Entity {
|
|
3
|
+
private static readonly Width;
|
|
4
|
+
private static readonly Height;
|
|
5
|
+
fps: number;
|
|
6
|
+
playbackTime: number;
|
|
7
|
+
playbackDuration: number;
|
|
8
|
+
isPlaying: boolean;
|
|
9
|
+
private background;
|
|
10
|
+
private text;
|
|
11
|
+
constructor();
|
|
12
|
+
load(): Promise<void>;
|
|
13
|
+
update(_: number, __: number): void;
|
|
14
|
+
draw(): void;
|
|
15
|
+
dispose(): void;
|
|
16
|
+
private getMemoryInfo;
|
|
17
|
+
private bytesToMegabytes;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as pixi from "pixi.js";
|
|
2
|
+
import { type Size } from "../layouts/geometry";
|
|
3
|
+
import { type Clip } from "../schemas/clip";
|
|
4
|
+
import type { Edit } from "./edit";
|
|
5
|
+
import { Player } from "./player";
|
|
6
|
+
export declare class LumaPlayer extends Player {
|
|
7
|
+
private texture;
|
|
8
|
+
private sprite;
|
|
9
|
+
private isPlaying;
|
|
10
|
+
constructor(edit: Edit, clipConfiguration: Clip);
|
|
11
|
+
load(): Promise<void>;
|
|
12
|
+
update(deltaTime: number, elapsed: number): void;
|
|
13
|
+
draw(): void;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
getSize(): Size;
|
|
16
|
+
getVolume(): number;
|
|
17
|
+
getMask(): pixi.Sprite | null;
|
|
18
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type Size, type Vector } from "../layouts/geometry";
|
|
2
|
+
import { type Clip } from "../schemas/clip";
|
|
3
|
+
import { type Edit } from "./edit";
|
|
4
|
+
import { Entity } from "./entity";
|
|
5
|
+
/**
|
|
6
|
+
* TODO: Move handles on UI level (screen space)
|
|
7
|
+
* TODO: Handle overlapping frames - ex: length of a clip is 1.5s but there's an in (1s) and out (1s) transition
|
|
8
|
+
* TODO: Scale X and Y needs to be implemented separately for getFitScale cover
|
|
9
|
+
* TODO: Move animation effects and transitions out of player
|
|
10
|
+
* TODO: On pointer down and custom keyframe, add a keyframe at the current time. Get current and time and push a keyframe into the state, and then reconfigure the keyframes.
|
|
11
|
+
* TODO: Move bounding box to a separate entity
|
|
12
|
+
*/
|
|
13
|
+
export declare abstract class Player extends Entity {
|
|
14
|
+
private static readonly SnapThreshold;
|
|
15
|
+
private static readonly DiscardedFrameCount;
|
|
16
|
+
private static readonly ScaleHandleRadius;
|
|
17
|
+
private static readonly RotationHandleRadius;
|
|
18
|
+
private static readonly RotationHandleOffset;
|
|
19
|
+
private static readonly OutlineWidth;
|
|
20
|
+
private static readonly MinScale;
|
|
21
|
+
private static readonly MaxScale;
|
|
22
|
+
layer: number;
|
|
23
|
+
shouldDispose: boolean;
|
|
24
|
+
protected edit: Edit;
|
|
25
|
+
clipConfiguration: Clip;
|
|
26
|
+
private positionBuilder;
|
|
27
|
+
private offsetXKeyframeBuilder?;
|
|
28
|
+
private offsetYKeyframeBuilder?;
|
|
29
|
+
private scaleKeyframeBuilder?;
|
|
30
|
+
private opacityKeyframeBuilder?;
|
|
31
|
+
private rotationKeyframeBuilder?;
|
|
32
|
+
private outline;
|
|
33
|
+
private topLeftScaleHandle;
|
|
34
|
+
private topRightScaleHandle;
|
|
35
|
+
private bottomLeftScaleHandle;
|
|
36
|
+
private bottomRightScaleHandle;
|
|
37
|
+
private rotationHandle;
|
|
38
|
+
private isHovering;
|
|
39
|
+
private isDragging;
|
|
40
|
+
private dragOffset;
|
|
41
|
+
private scaleDirection;
|
|
42
|
+
private scaleStart;
|
|
43
|
+
private scaleOffset;
|
|
44
|
+
private isRotating;
|
|
45
|
+
private rotationStart;
|
|
46
|
+
private rotationOffset;
|
|
47
|
+
constructor(edit: Edit, clipConfiguration: Clip);
|
|
48
|
+
protected configureKeyframes(): void;
|
|
49
|
+
load(): Promise<void>;
|
|
50
|
+
update(_: number, __: number): void;
|
|
51
|
+
draw(): void;
|
|
52
|
+
dispose(): void;
|
|
53
|
+
getStart(): number;
|
|
54
|
+
getLength(): number;
|
|
55
|
+
getEnd(): number;
|
|
56
|
+
getPlaybackTime(): number;
|
|
57
|
+
abstract getSize(): Size;
|
|
58
|
+
getOpacity(): number;
|
|
59
|
+
getPosition(): Vector;
|
|
60
|
+
getPivot(): Vector;
|
|
61
|
+
protected getFitScale(): number;
|
|
62
|
+
getScale(): number;
|
|
63
|
+
getRotation(): number;
|
|
64
|
+
isActive(): boolean;
|
|
65
|
+
shouldDiscardFrame(): boolean;
|
|
66
|
+
private onPointerStart;
|
|
67
|
+
private onPointerMove;
|
|
68
|
+
private onPointerUp;
|
|
69
|
+
private onPointerOver;
|
|
70
|
+
private onPointerOut;
|
|
71
|
+
private clipHasPresets;
|
|
72
|
+
private clipHasKeyframes;
|
|
73
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Size } from "../layouts/geometry";
|
|
2
|
+
import { type Clip } from "../schemas/clip";
|
|
3
|
+
import type { Edit } from "./edit";
|
|
4
|
+
import { Player } from "./player";
|
|
5
|
+
export declare class ShapePlayer extends Player {
|
|
6
|
+
private shape;
|
|
7
|
+
private shapeBackground;
|
|
8
|
+
constructor(timeline: Edit, clipConfiguration: Clip);
|
|
9
|
+
load(): Promise<void>;
|
|
10
|
+
update(deltaTime: number, elapsed: number): void;
|
|
11
|
+
draw(): void;
|
|
12
|
+
dispose(): void;
|
|
13
|
+
getSize(): Size;
|
|
14
|
+
protected getFitScale(): number;
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Size } from "../layouts/geometry";
|
|
2
|
+
import { type Clip } from "../schemas/clip";
|
|
3
|
+
import type { Edit } from "./edit";
|
|
4
|
+
import { Player } from "./player";
|
|
5
|
+
/**
|
|
6
|
+
* TODO: Add constants for text defaults
|
|
7
|
+
*/
|
|
8
|
+
export declare class TextPlayer extends Player {
|
|
9
|
+
private background;
|
|
10
|
+
private text;
|
|
11
|
+
constructor(timeline: Edit, clipConfiguration: Clip);
|
|
12
|
+
load(): Promise<void>;
|
|
13
|
+
update(deltaTime: number, elapsed: number): void;
|
|
14
|
+
draw(): void;
|
|
15
|
+
dispose(): void;
|
|
16
|
+
getSize(): Size;
|
|
17
|
+
protected getFitScale(): number;
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Size } from "../layouts/geometry";
|
|
2
|
+
import { type Clip } from "../schemas/clip";
|
|
3
|
+
import type { Edit } from "./edit";
|
|
4
|
+
import { Player } from "./player";
|
|
5
|
+
export declare class VideoPlayer extends Player {
|
|
6
|
+
private texture;
|
|
7
|
+
private sprite;
|
|
8
|
+
private isPlaying;
|
|
9
|
+
private volumeKeyframeBuilder;
|
|
10
|
+
private syncTimer;
|
|
11
|
+
constructor(edit: Edit, clipConfiguration: Clip);
|
|
12
|
+
/**
|
|
13
|
+
* TODO: Add support for .mov and .webm files
|
|
14
|
+
*/
|
|
15
|
+
load(): Promise<void>;
|
|
16
|
+
update(deltaTime: number, elapsed: number): void;
|
|
17
|
+
draw(): void;
|
|
18
|
+
dispose(): void;
|
|
19
|
+
getSize(): Size;
|
|
20
|
+
getVolume(): number;
|
|
21
|
+
private createCroppedTexture;
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EventEmitter } from "./event-emitter";
|
|
2
|
+
export type AssetLoadInfoStatus = "pending" | "loading" | "success" | "failed";
|
|
3
|
+
export type AssetLoadInfo = {
|
|
4
|
+
progress: number;
|
|
5
|
+
status: AssetLoadInfoStatus;
|
|
6
|
+
};
|
|
7
|
+
export type AssetLoadInfoUpdatedPayload = {
|
|
8
|
+
registry: Record<string, AssetLoadInfo>;
|
|
9
|
+
};
|
|
10
|
+
export type AssetEventMap = {
|
|
11
|
+
onAssetLoadInfoUpdated: AssetLoadInfoUpdatedPayload;
|
|
12
|
+
};
|
|
13
|
+
export declare class AssetLoadTracker extends EventEmitter<AssetEventMap> {
|
|
14
|
+
registry: Record<string, AssetLoadInfo>;
|
|
15
|
+
constructor();
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Listener<TPayload = any> = (payload: TPayload) => void;
|
|
2
|
+
export type EventPayloadMap<TPayload = any> = Record<string, TPayload>;
|
|
3
|
+
export declare class EventEmitter<TEventPayloadMap extends EventPayloadMap = EventPayloadMap> {
|
|
4
|
+
private readonly events;
|
|
5
|
+
constructor();
|
|
6
|
+
on<TEventName extends keyof TEventPayloadMap>(name: TEventName, listener: Listener<TEventPayloadMap[TEventName]>): void;
|
|
7
|
+
off<TEventName extends keyof TEventPayloadMap>(name: TEventName, listener: Listener<TEventPayloadMap[TEventName]>): void;
|
|
8
|
+
clear(name: keyof TEventPayloadMap): void;
|
|
9
|
+
emit<TEventName extends keyof TEventPayloadMap>(name: TEventName, payload: TEventPayloadMap[TEventName]): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Edit } from "../entities/edit";
|
|
2
|
+
import { Canvas } from "../shotstack-canvas";
|
|
3
|
+
export declare class VideoExporter {
|
|
4
|
+
private readonly ffmpeg;
|
|
5
|
+
private isReady;
|
|
6
|
+
private readonly edit;
|
|
7
|
+
private readonly application;
|
|
8
|
+
constructor(edit: Edit, canvas: Canvas);
|
|
9
|
+
private init;
|
|
10
|
+
export(filename?: string, fps?: number): Promise<void>;
|
|
11
|
+
private findAudioPlayers;
|
|
12
|
+
private searchContainerForPlayers;
|
|
13
|
+
private processAudioTrack;
|
|
14
|
+
private createProgressOverlay;
|
|
15
|
+
private updateProgressOverlay;
|
|
16
|
+
private removeProgressOverlay;
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Edit } from "../entities/edit";
|
|
2
|
+
export declare class Controls {
|
|
3
|
+
private edit;
|
|
4
|
+
private seekDistance;
|
|
5
|
+
private seekDistanceLarge;
|
|
6
|
+
private frameTime;
|
|
7
|
+
constructor(timeline: Edit);
|
|
8
|
+
load(): Promise<void>;
|
|
9
|
+
private handleKeyDown;
|
|
10
|
+
private handleKeyUp;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ClipAnchor } from "../schemas/clip";
|
|
2
|
+
import { type Size, type Vector } from "./geometry";
|
|
3
|
+
export declare class PositionBuilder {
|
|
4
|
+
private containerSize;
|
|
5
|
+
constructor(containerSize: Size);
|
|
6
|
+
relativeToAbsolute(entitySize: Size, anchor: ClipAnchor, relativePosition: Vector): Vector;
|
|
7
|
+
absoluteToRelative(entitySize: Size, anchor: ClipAnchor, absolutePosition: Vector): Vector;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as pixi from "pixi.js";
|
|
2
|
+
import { AssetLoadTracker } from "../events/asset-load-tracker";
|
|
3
|
+
export declare class AssetLoader {
|
|
4
|
+
loadTracker: AssetLoadTracker;
|
|
5
|
+
constructor();
|
|
6
|
+
load<TResolvedAsset>(identifier: string, loadOptions: pixi.UnresolvedAsset): Promise<TResolvedAsset | null>;
|
|
7
|
+
getProgress(): number;
|
|
8
|
+
private updateAssetLoadMetadata;
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as pixi from "pixi.js";
|
|
2
|
+
export declare class AudioLoadParser implements pixi.LoaderParser<Howl | null> {
|
|
3
|
+
static readonly Name = "AudioLoadParser";
|
|
4
|
+
name: string;
|
|
5
|
+
extension: pixi.ExtensionFormat;
|
|
6
|
+
private validAudioExtensions;
|
|
7
|
+
constructor();
|
|
8
|
+
test(url: string): boolean;
|
|
9
|
+
load(url: string, _?: pixi.ResolvedAsset<Howl>, __?: pixi.Loader): Promise<Howl | null>;
|
|
10
|
+
unload(asset: Howl | null): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as pixi from "pixi.js";
|
|
2
|
+
export declare class FontLoadParser implements pixi.LoaderParser<FontFace | null> {
|
|
3
|
+
static readonly Name = "FontLoadParser";
|
|
4
|
+
name: string;
|
|
5
|
+
extension: pixi.ExtensionFormat;
|
|
6
|
+
private validFontExtensions;
|
|
7
|
+
private woff2Decompressor;
|
|
8
|
+
constructor();
|
|
9
|
+
test(url: string): boolean;
|
|
10
|
+
load(url: string, _?: pixi.ResolvedAsset<FontFace>, __?: pixi.Loader): Promise<FontFace | null>;
|
|
11
|
+
private loadWoff2Decompressor;
|
|
12
|
+
unload(asset: FontFace | null): void;
|
|
13
|
+
}
|