@shotstack/shotstack-studio 2.28.2 → 2.29.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/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "dazzatron",
7
7
  "kratos2k7"
8
8
  ],
9
- "version": "2.28.2",
9
+ "version": "2.29.1",
10
10
  "description": "A video editing library for creating and editing videos with Shotstack",
11
11
  "type": "module",
12
12
  "main": "dist/shotstack-studio.umd.js",
package/readme.md CHANGED
@@ -187,6 +187,21 @@ const edit = new Edit(templateJson, { html5Prerender: "on-play" });
187
187
 
188
188
  Captured frames are the same either way. Until the edit plays, the canvas shows each `html5` clip as a still of its frame at the playhead, in its layer and with its effects. Playback stays choppy until the frames are ready, so keep the default, `"on-load"`, for an edit that someone watches.
189
189
 
190
+ `edit.getPendingCaptures()` returns `{ pending, total, progress }`: how many `html5` clips are still preparing smooth playback, out of those that will play pre-rendered frames, and how far along they are, from 0 to 1 by frames baked. Failed clips, and an `"on-play"` edit's clips before it plays, count in neither number. The timeline shows this as a ring around its play button and a ring in each preparing clip. A player of your own can read it on the capture events, and a few times a second in between, since progress moves without them:
191
+
192
+ ```typescript
193
+ const showPreparing = () => {
194
+ const { pending, progress } = edit.getPendingCaptures();
195
+ ring.hidden = pending === 0;
196
+ ring.style.setProperty("--progress", String(progress));
197
+ };
198
+ edit.events.on("clip:captureStarted", showPreparing);
199
+ edit.events.on("clip:captureCompleted", showPreparing);
200
+ edit.events.on("clip:captureFailed", showPreparing);
201
+ setInterval(showPreparing, 250);
202
+ showPreparing();
203
+ ```
204
+
190
205
  #### Events
191
206
 
192
207
  Listen using string event names:
@@ -221,6 +236,9 @@ Available event names:
221
236
  | Duration | `duration:changed` |
222
237
  | Output | `output:resized`, `output:resolutionChanged`, `output:aspectRatioChanged`, `output:fpsChanged`, `output:formatChanged`, `output:destinationsChanged` |
223
238
  | Merge fields | `mergefield:changed` |
239
+ | `html5` pre-rendering | `clip:captureStarted`, `clip:captureCompleted`, `clip:captureFailed` |
240
+
241
+ A failed capture's `fallback` is `"static-placeholder"` when the clip shows a placeholder, or `"scaled-frames"` when a sharper pre-render failed and the clip keeps its current frames.
224
242
 
225
243
  ### Generating assets from prompts
226
244