@vosjs/studio-core 0.30.1 → 0.30.3

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
@@ -301,9 +301,28 @@ interface RecordingMeta {
301
301
  dpr: number;
302
302
  /** page/browser zoom at capture. */
303
303
  zoom: number;
304
- /** wall-clock origin (Date.now at first frame). */
304
+ /**
305
+ * Wall-clock origin (Date.now) of the take's timeline: the instant the
306
+ * recorder's `start()` was CALLED, which is where the file's first frame
307
+ * sits. Never the recorder's `start` EVENT — Chrome fires that from the
308
+ * muxer's first write, seconds late under load, and a t0 stamped there runs
309
+ * every cursor event ahead of the footage by that lag.
310
+ */
305
311
  t0: number;
312
+ /**
313
+ * The take's length in ACTIVE ms — the file's timeline, which a pause does
314
+ * not advance (MediaRecorder removes paused time from the file). Cursor
315
+ * event times live on the same timeline.
316
+ */
306
317
  durationMs: number;
318
+ /** Total ms the take was paused (removed from the file and from every `t`). Absent = none. */
319
+ pausedMs?: number;
320
+ /**
321
+ * Diagnostic: how long after the `start()` call the recorder's `start`
322
+ * event fired. A large value is the load the recorder was under; it is
323
+ * never used for alignment.
324
+ */
325
+ startEventDelayMs?: number;
307
326
  /** captured pixel dimensions. */
308
327
  width: number;
309
328
  height: number;
@@ -322,10 +341,11 @@ interface RecordingMeta {
322
341
  */
323
342
  hasMic?: boolean;
324
343
  /**
325
- * Recorder start skew: wall-clock ms between the main recorder's start and
326
- * the mic/cam sidecar recorders' starts (positive = sidecar started later).
327
- * Lets the consume path trim/pad a sidecar head instead of assuming t0
328
- * equality. Absent on takes without the matching sidecar.
344
+ * Recorder start skew: wall-clock ms between the main recorder's `start()`
345
+ * call and the mic/cam sidecar recorders' `start()` calls (positive =
346
+ * sidecar started later), each the zero of its own file. Lets the consume
347
+ * path trim/pad a sidecar head instead of assuming t0 equality. Absent on
348
+ * takes without the matching sidecar.
329
349
  */
330
350
  micT0DeltaMs?: number;
331
351
  camT0DeltaMs?: number;
@@ -2404,6 +2424,12 @@ interface PlanOptions {
2404
2424
  dragLevel?: number;
2405
2425
  /** emit spans with focusMode 'auto' (cursor-follow camera). */
2406
2426
  followByDefault?: boolean;
2427
+ /**
2428
+ * the footage's length in seconds: no span runs past it. The cursor
2429
+ * track ends at the last event, before the footage does, so the track
2430
+ * alone cannot say where the footage ends.
2431
+ */
2432
+ duration?: number;
2407
2433
  /** typing sessions plan spans. */
2408
2434
  typingZoom?: boolean;
2409
2435
  /** max silence between `key` pings before the typing session ends. */
package/dist/index.js CHANGED
@@ -1749,8 +1749,10 @@ function planAutoZoom(track, options) {
1749
1749
  typingZoom = style.typingZoom,
1750
1750
  typingGap = style.typingGap,
1751
1751
  typingHold = style.typingHold,
1752
- typingMinLevel = style.typingMinLevel
1752
+ typingMinLevel = style.typingMinLevel,
1753
+ duration
1753
1754
  } = options;
1755
+ const within = (spans2) => duration === void 0 ? spans2 : spans2.map((z) => ({ ...z, out: Math.min(z.out, round(duration)) })).filter((z) => z.out - z.in >= 0.3);
1754
1756
  const grouped = groupTrack(track, {
1755
1757
  width,
1756
1758
  height,
@@ -1870,12 +1872,14 @@ function planAutoZoom(track, options) {
1870
1872
  // the FIELD is the anchor, and a follow would be a no-op at best.
1871
1873
  source: "auto"
1872
1874
  }));
1873
- const spans = [...zSpans, ...kSpans, ...dragSpans].sort((a, b) => a.in - b.in);
1875
+ const spans = within([...zSpans, ...kSpans, ...dragSpans]).sort(
1876
+ (a, b) => a.in - b.in
1877
+ );
1874
1878
  const dwells = dwellSpans(track, width, height, maxLevel, [
1875
1879
  ...spans,
1876
1880
  ...dragReserved
1877
1881
  ]);
1878
- return [...spans, ...dwells].sort((a, b) => a.in - b.in);
1882
+ return within([...spans, ...dwells]).sort((a, b) => a.in - b.in);
1879
1883
  }
1880
1884
  function typingSessions(track, width, height, typingGap) {
1881
1885
  const pings = track.filter((e) => e.type === "key").map((e) => ({ t: e.t / 1e3, rect: e.rect, x: e.x, y: e.y }));