@shotstack/shotstack-studio 1.4.1 → 1.5.1
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 +499 -0
- package/dist/shotstack-studio.es.js +4410 -1441
- package/dist/shotstack-studio.umd.js +8 -8
- package/package.json +2 -1
- package/readme.md +155 -12
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"cpuccino",
|
|
6
6
|
"dazzatron"
|
|
7
7
|
],
|
|
8
|
-
"version": "1.
|
|
8
|
+
"version": "1.5.1",
|
|
9
9
|
"description": "A video editing library for creating and editing videos with Shotstack",
|
|
10
10
|
"type": "module",
|
|
11
11
|
"main": "dist/shotstack-studio.umd.js",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"vite-plugin-dts": "^4.5.4"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
+
"fast-deep-equal": "^3.1.3",
|
|
53
54
|
"howler": "^2.2.4",
|
|
54
55
|
"opentype.js": "^1.3.4",
|
|
55
56
|
"pixi-filters": "^6.0.5",
|
package/readme.md
CHANGED
|
@@ -10,16 +10,18 @@ A JavaScript library for creating and editing videos in the browser.
|
|
|
10
10
|
|
|
11
11
|
Try Shotstack Studio in your preferred framework:
|
|
12
12
|
|
|
13
|
-
[](https://stackblitz.com/
|
|
14
|
-
[](https://stackblitz.com/
|
|
15
|
-
[](https://stackblitz.com/
|
|
16
|
-
[](https://stackblitz.com/
|
|
17
|
-
[](https://stackblitz.com/
|
|
13
|
+
[](https://stackblitz.com/fork/github/shotstack/shotstack-studio-sdk-demos/tree/master/typescript)
|
|
14
|
+
[](https://stackblitz.com/fork/github/shotstack/shotstack-studio-sdk-demos/tree/master/react)
|
|
15
|
+
[](https://stackblitz.com/fork/github/shotstack/shotstack-studio-sdk-demos/tree/master/vue)
|
|
16
|
+
[](https://stackblitz.com/fork/github/shotstack/shotstack-studio-sdk-demos/tree/master/angular)
|
|
17
|
+
[](https://stackblitz.com/fork/github/shotstack/shotstack-studio-sdk-demos/tree/master/nextjs)
|
|
18
18
|
|
|
19
19
|
## Features
|
|
20
20
|
|
|
21
21
|
- Create video compositions with multiple tracks and clips
|
|
22
|
+
- Visual timeline interface
|
|
22
23
|
- WYSIWYG text editing
|
|
24
|
+
- Multi-track, drag-and-drop clip manipulation with snap-to-grid
|
|
23
25
|
- Use in conjunction with the [Shotstack Edit API](https://shotstack.io/docs/guide/getting-started/hello-world-using-curl/) to render video
|
|
24
26
|
- Export to video using browser-based FFmpeg
|
|
25
27
|
|
|
@@ -46,14 +48,13 @@ You can skip this if you're using the [Shotstack Edit API](https://shotstack.io/
|
|
|
46
48
|
## Quick Start
|
|
47
49
|
|
|
48
50
|
```typescript
|
|
49
|
-
import { Edit, Canvas, Controls } from "@shotstack/shotstack-studio";
|
|
51
|
+
import { Edit, Canvas, Controls, Timeline } from "@shotstack/shotstack-studio";
|
|
50
52
|
|
|
51
|
-
// 1.
|
|
52
|
-
const
|
|
53
|
-
const response = await fetch(templateUrl);
|
|
53
|
+
// 1. Load a template
|
|
54
|
+
const response = await fetch("https://shotstack-assets.s3.amazonaws.com/templates/hello-world/hello.json");
|
|
54
55
|
const template = await response.json();
|
|
55
56
|
|
|
56
|
-
// 2. Initialize the edit
|
|
57
|
+
// 2. Initialize the edit
|
|
57
58
|
const edit = new Edit(template.output.size, template.timeline.background);
|
|
58
59
|
await edit.load();
|
|
59
60
|
|
|
@@ -64,15 +65,20 @@ await canvas.load(); // Renders to [data-shotstack-studio] element
|
|
|
64
65
|
// 4. Load the template
|
|
65
66
|
await edit.loadEdit(template);
|
|
66
67
|
|
|
67
|
-
// 5.
|
|
68
|
+
// 5. Initialize the Timeline
|
|
69
|
+
const timeline = new Timeline(edit, { width: 1280, height: 300 });
|
|
70
|
+
await timeline.load(); // Renders to [data-shotstack-timeline] element
|
|
71
|
+
|
|
72
|
+
// 6. Add keyboard controls
|
|
68
73
|
const controls = new Controls(edit);
|
|
69
74
|
await controls.load();
|
|
70
75
|
```
|
|
71
76
|
|
|
72
|
-
Your HTML should include
|
|
77
|
+
Your HTML should include containers for both the canvas and timeline:
|
|
73
78
|
|
|
74
79
|
```html
|
|
75
80
|
<div data-shotstack-studio></div>
|
|
81
|
+
<div data-shotstack-timeline></div>
|
|
76
82
|
```
|
|
77
83
|
|
|
78
84
|
## Main Components
|
|
@@ -182,6 +188,25 @@ await controls.load();
|
|
|
182
188
|
// Cmd/Ctrl + Shift + Z - Redo
|
|
183
189
|
```
|
|
184
190
|
|
|
191
|
+
### Timeline
|
|
192
|
+
|
|
193
|
+
The Timeline class provides a visual timeline interface for editing.
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
import { Timeline } from "@shotstack/shotstack-studio";
|
|
197
|
+
|
|
198
|
+
const timeline = new Timeline(edit, { width: 1280, height: 300 });
|
|
199
|
+
await timeline.load();
|
|
200
|
+
|
|
201
|
+
// Timeline features:
|
|
202
|
+
// - Visual track and clip representation
|
|
203
|
+
// - Drag-and-drop clip manipulation
|
|
204
|
+
// - Clip resizing with edge detection
|
|
205
|
+
// - Playhead control for navigation
|
|
206
|
+
// - Snap-to-grid functionality
|
|
207
|
+
// - Zoom and scroll controls
|
|
208
|
+
```
|
|
209
|
+
|
|
185
210
|
### VideoExporter
|
|
186
211
|
|
|
187
212
|
The VideoExporter class exports the edit to a video file.
|
|
@@ -191,6 +216,101 @@ const exporter = new VideoExporter(edit, canvas);
|
|
|
191
216
|
await exporter.export("my-video.mp4", 25); // filename, fps
|
|
192
217
|
```
|
|
193
218
|
|
|
219
|
+
## Theming
|
|
220
|
+
|
|
221
|
+
Shotstack Studio supports theming for visual components. Currently, theming is available for the Timeline component, with Canvas theming coming in a future releases.
|
|
222
|
+
|
|
223
|
+
### Built-in Themes
|
|
224
|
+
|
|
225
|
+
The library includes pre-designed themes that you can use immediately:
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
import { Timeline } from "@shotstack/shotstack-studio";
|
|
229
|
+
import darkTheme from "@shotstack/shotstack-studio/themes/dark.json";
|
|
230
|
+
import minimalTheme from "@shotstack/shotstack-studio/themes/minimal.json";
|
|
231
|
+
|
|
232
|
+
// Apply a theme when creating the timeline
|
|
233
|
+
const timeline = new Timeline(edit, { width: 1280, height: 300 }, { theme: darkTheme });
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Custom Themes
|
|
237
|
+
|
|
238
|
+
Create your own theme by defining colors and dimensions for each component:
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
const customTheme = {
|
|
242
|
+
timeline: {
|
|
243
|
+
// Main timeline colors
|
|
244
|
+
background: "#1e1e1e",
|
|
245
|
+
divider: "#1a1a1a",
|
|
246
|
+
playhead: "#ff4444",
|
|
247
|
+
snapGuide: "#888888",
|
|
248
|
+
dropZone: "#00ff00",
|
|
249
|
+
trackInsertion: "#00ff00",
|
|
250
|
+
|
|
251
|
+
// Toolbar styling
|
|
252
|
+
toolbar: {
|
|
253
|
+
background: "#1a1a1a",
|
|
254
|
+
surface: "#2a2a2a", // Button backgrounds
|
|
255
|
+
hover: "#3a3a3a", // Button hover state
|
|
256
|
+
active: "#007acc", // Button active state
|
|
257
|
+
divider: "#3a3a3a", // Separator lines
|
|
258
|
+
icon: "#888888", // Icon colors
|
|
259
|
+
text: "#ffffff", // Text color
|
|
260
|
+
height: 36 // Toolbar height in pixels
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
// Ruler styling
|
|
264
|
+
ruler: {
|
|
265
|
+
background: "#404040",
|
|
266
|
+
text: "#ffffff", // Time labels
|
|
267
|
+
markers: "#666666", // Time marker dots
|
|
268
|
+
height: 40 // Ruler height in pixels
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
// Track styling
|
|
272
|
+
tracks: {
|
|
273
|
+
surface: "#2d2d2d", // Primary track color
|
|
274
|
+
surfaceAlt: "#252525", // Alternating track color
|
|
275
|
+
border: "#3a3a3a", // Track borders
|
|
276
|
+
height: 60 // Track height in pixels
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
// Clip colors by asset type
|
|
280
|
+
clips: {
|
|
281
|
+
video: "#4a9eff",
|
|
282
|
+
audio: "#00d4aa",
|
|
283
|
+
image: "#f5a623",
|
|
284
|
+
text: "#d0021b",
|
|
285
|
+
shape: "#9013fe",
|
|
286
|
+
html: "#50e3c2",
|
|
287
|
+
luma: "#b8e986",
|
|
288
|
+
default: "#8e8e93", // Unknown asset types
|
|
289
|
+
selected: "#007acc", // Selection border
|
|
290
|
+
radius: 4 // Corner radius in pixels
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
// Canvas theming will be available in future releases
|
|
294
|
+
// canvas: { ... }
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
const timeline = new Timeline(edit, { width: 1280, height: 300 }, { theme: customTheme });
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Theme Structure
|
|
301
|
+
|
|
302
|
+
Themes are organized by component, making it intuitive to customize specific parts of the interface:
|
|
303
|
+
|
|
304
|
+
- **Timeline**: Controls the appearance of the timeline interface
|
|
305
|
+
|
|
306
|
+
- `toolbar`: Playback controls and buttons
|
|
307
|
+
- `ruler`: Time markers and labels
|
|
308
|
+
- `tracks`: Track backgrounds and borders
|
|
309
|
+
- `clips`: Asset-specific colors and selection states
|
|
310
|
+
- Global timeline properties (background, playhead, etc.)
|
|
311
|
+
|
|
312
|
+
- **Canvas** (coming soon): Will control the appearance of the video preview area
|
|
313
|
+
|
|
194
314
|
## Template Format
|
|
195
315
|
|
|
196
316
|
Templates use a JSON format with the following structure:
|
|
@@ -338,6 +458,29 @@ Creates a new controls instance for the provided Edit.
|
|
|
338
458
|
|
|
339
459
|
- `async load()` - Set up event listeners for keyboard controls
|
|
340
460
|
|
|
461
|
+
### Timeline
|
|
462
|
+
|
|
463
|
+
The `Timeline` class provides a visual timeline interface for video editing.
|
|
464
|
+
|
|
465
|
+
```typescript
|
|
466
|
+
import { Timeline } from "@shotstack/shotstack-studio";
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
#### Constructor
|
|
470
|
+
|
|
471
|
+
```typescript
|
|
472
|
+
constructor(edit: Edit, size: { width: number, height: number }, themeOptions?: TimelineThemeOptions)
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
Creates a new timeline interface for the provided Edit.
|
|
476
|
+
|
|
477
|
+
#### Methods
|
|
478
|
+
|
|
479
|
+
- `async load()` - Initialize the timeline and add it to the DOM
|
|
480
|
+
- `setTheme(themeOptions: TimelineThemeOptions)` - Change the timeline theme
|
|
481
|
+
- `setOptions(options: Partial<TimelineOptions>)` - Update timeline options
|
|
482
|
+
- `dispose()` - Clean up resources and remove from DOM
|
|
483
|
+
|
|
341
484
|
### VideoExporter
|
|
342
485
|
|
|
343
486
|
The `VideoExporter` class handles exporting the edit to mp4.
|