@hyperframes/studio 0.9.21 → 0.9.23

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.
Files changed (47) hide show
  1. package/dist/assets/codec-DYZ1sJnW.js +314 -0
  2. package/dist/assets/{hyperframes-player-DqxUNa9H.js → hyperframes-player-BOxJo7Nx.js} +1 -1
  3. package/dist/assets/{index-Cq43Ovkf.js → index-Ccf4_r8m.js} +120 -119
  4. package/dist/assets/index-DKEq8iSv.js +150 -0
  5. package/dist/assets/{index-Bgfyny02.css → index-dsfjBidg.css} +1 -1
  6. package/dist/assets/pausedVideoDecoder-B65VVvs_.js +1 -0
  7. package/dist/{chunk-3EAFE522.js → chunk-45KKBU63.js} +1 -1
  8. package/dist/chunk-4SPHDECE.js +165 -0
  9. package/dist/{chunk-OGIOFEC7.js → chunk-63DH4LRB.js} +13 -2
  10. package/dist/{chunk-7HZGKFFU.js → chunk-J3VJE463.js} +1 -1
  11. package/dist/{chunk-NUS5R2HO.js → chunk-LRTUWOR4.js} +12 -2
  12. package/dist/{domEditingLayers-7Z6J4UOK.js → domEditingLayers-7Q56QAU5.js} +2 -2
  13. package/dist/index.d.ts +7 -2
  14. package/dist/index.html +2 -2
  15. package/dist/index.js +105 -196
  16. package/dist/pausedVideoDecoder-W2SVMXDS.js +404 -0
  17. package/dist/player.js +3 -3
  18. package/dist/styles.css +1 -1
  19. package/dist/ui.js +1 -1
  20. package/package.json +9 -9
  21. package/src/components/editor/domEditingDom.preview.test.ts +75 -0
  22. package/src/components/editor/domEditingDom.ts +19 -2
  23. package/src/components/nle/NLEContext.tsx +4 -1
  24. package/src/components/ui/Menu.test.tsx +8 -0
  25. package/src/components/ui/Menu.tsx +1 -1
  26. package/src/hooks/useElementPicker.test.ts +13 -0
  27. package/src/hooks/useElementPicker.ts +3 -2
  28. package/src/player/components/PlayerControls.test.tsx +1 -1
  29. package/src/player/components/PlayerControls.tsx +1 -1
  30. package/src/player/components/PreviewSeekBar.test.tsx +42 -0
  31. package/src/player/components/PreviewSeekBar.tsx +20 -3
  32. package/src/player/hooks/usePlaybackKeyboard.test.ts +1 -1
  33. package/src/player/hooks/usePlaybackKeyboard.ts +2 -1
  34. package/src/player/hooks/useTimelinePlayer.ts +3 -1
  35. package/src/player/lib/mediaFetch.test.ts +3 -4
  36. package/src/player/lib/pausedVideoDecoder.test.ts +717 -0
  37. package/src/player/lib/pausedVideoDecoder.ts +439 -0
  38. package/src/player/lib/pausedVideoProvider.test.ts +53 -0
  39. package/src/player/lib/pausedVideoProvider.ts +54 -0
  40. package/src/player/lib/playbackTypes.ts +8 -2
  41. package/src/player/lib/previewVideoTime.test.ts +38 -0
  42. package/src/player/lib/previewVideoTime.ts +39 -0
  43. package/src/player/store/previewQualitySlice.test.ts +27 -0
  44. package/src/player/store/previewQualitySlice.ts +12 -0
  45. package/src/utils/authoredSource.test.ts +11 -0
  46. package/src/utils/authoredSource.ts +2 -0
  47. package/dist/assets/index-CFUJyYA1.js +0 -531
@@ -1,5 +1,6 @@
1
1
  import type { StoreApi } from "zustand";
2
2
  import { isPreviewQuality, type PreviewQuality } from "@hyperframes/core/preview-quality";
3
+ import type { PlaybackHeldBy } from "@hyperframes/core";
3
4
  import type { MediaLoadFailure } from "@hyperframes/core/runtime/protocol";
4
5
  import { readStudioUiPreferences, writeStudioUiPreferences } from "../../utils/studioUiPreferences";
5
6
 
@@ -25,6 +26,7 @@ export interface PlaybackHealth {
25
26
  gapP50Ms?: number;
26
27
  gapP95Ms?: number;
27
28
  clockSource?: "audio" | "webaudio" | "monotonic";
29
+ heldBy?: PlaybackHeldBy | null;
28
30
  mode: "play";
29
31
  }
30
32
 
@@ -118,6 +120,15 @@ export function parsePreviewCopies(value: unknown): PreviewCopies | null {
118
120
  const optionalNumber = (n: unknown) => (typeof n === "number" ? n : undefined);
119
121
  const CLOCK_SOURCES = ["audio", "webaudio", "monotonic"] as const;
120
122
  const optionalClock = (clock: unknown) => CLOCK_SOURCES.find((known) => known === clock);
123
+ function parseHeldBy(value: unknown): PlaybackHealth["heldBy"] {
124
+ if (value === null) return null;
125
+ if (typeof value !== "object") return undefined;
126
+ const { kind, readyState, networkState, fetchMs } = value as Record<string, unknown>;
127
+ if (kind !== "audio" && kind !== "video") return undefined;
128
+ if (typeof readyState !== "number" || typeof networkState !== "number") return undefined;
129
+ if (typeof fetchMs !== "number" && fetchMs !== null) return undefined;
130
+ return { kind, readyState, networkState, fetchMs };
131
+ }
121
132
 
122
133
  export function parsePlaybackHealth(value: unknown): PlaybackHealth | null {
123
134
  if (typeof value !== "object" || value === null) return null;
@@ -137,6 +148,7 @@ export function parsePlaybackHealth(value: unknown): PlaybackHealth | null {
137
148
  gapP50Ms: optionalNumber(extra.gapP50Ms),
138
149
  gapP95Ms: optionalNumber(extra.gapP95Ms),
139
150
  clockSource: optionalClock(extra.clockSource),
151
+ heldBy: parseHeldBy(extra.heldBy),
140
152
  mode: "play",
141
153
  };
142
154
  }
@@ -4,10 +4,21 @@ import {
4
4
  PREVIEW_RASTER_ATTR,
5
5
  RUNTIME_STAMPED_ATTR,
6
6
  STUDIO_PREVIEW_LAZY_ATTR,
7
+ PREVIEW_VIDEO_CANVAS_ATTR,
8
+ PREVIEW_VIDEO_FRAME_ATTR,
9
+ PREVIEW_VIDEO_SOURCE_ATTR,
7
10
  } from "@hyperframes/core/studio-preview-mark";
8
11
  import { liveMarkupWithoutPreviewMarks } from "./authoredSource";
9
12
 
10
13
  describe("liveMarkupWithoutPreviewMarks", () => {
14
+ it("omits generated video surfaces and their hiding marks from copied composition markup", () => {
15
+ const live = document.createElement("div");
16
+ live.innerHTML = `<canvas ${PREVIEW_VIDEO_CANVAS_ATTR}></canvas><video src="original.webm" ${PREVIEW_VIDEO_FRAME_ATTR} ${PREVIEW_VIDEO_SOURCE_ATTR}></video><canvas id="authored"></canvas>`;
17
+ expect(liveMarkupWithoutPreviewMarks(live)).toBe(
18
+ '<div><video src="original.webm"></video><canvas id="authored"></canvas></div>',
19
+ );
20
+ expect(live.querySelectorAll("canvas")).toHaveLength(2);
21
+ });
11
22
  it("drops the preview's raster mark from an element and its descendants", () => {
12
23
  const live = document.createElement("div");
13
24
  live.innerHTML = `<div class="line" ${PREVIEW_RASTER_ATTR}><span class="word">LOUD</span></div>`;
@@ -1,6 +1,7 @@
1
1
  import { ensureHfIds, isCompositionTemplate } from "@hyperframes/parsers/hf-ids";
2
2
  import {
3
3
  PREVIEW_ONLY_ATTRS,
4
+ PREVIEW_VIDEO_CANVAS_ATTR,
4
5
  STUDIO_PREVIEW_LAZY_ATTR,
5
6
  } from "@hyperframes/core/studio-preview-mark";
6
7
 
@@ -97,6 +98,7 @@ export function authoredMarkup(authored: Element, live: Element, sourceFile: str
97
98
 
98
99
  export function liveMarkupWithoutPreviewMarks(live: Element): string {
99
100
  const copy = live.cloneNode(true) as Element;
101
+ for (const canvas of copy.querySelectorAll(`[${PREVIEW_VIDEO_CANVAS_ATTR}]`)) canvas.remove();
100
102
  for (const el of [copy, ...Array.from(copy.querySelectorAll("*"))]) {
101
103
  if (el.hasAttribute(STUDIO_PREVIEW_LAZY_ATTR)) el.removeAttribute("loading");
102
104
  for (const attr of PREVIEW_ONLY_ATTRS) el.removeAttribute(attr);