@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.
- package/dist/assets/codec-DYZ1sJnW.js +314 -0
- package/dist/assets/{hyperframes-player-DqxUNa9H.js → hyperframes-player-BOxJo7Nx.js} +1 -1
- package/dist/assets/{index-Cq43Ovkf.js → index-Ccf4_r8m.js} +120 -119
- package/dist/assets/index-DKEq8iSv.js +150 -0
- package/dist/assets/{index-Bgfyny02.css → index-dsfjBidg.css} +1 -1
- package/dist/assets/pausedVideoDecoder-B65VVvs_.js +1 -0
- package/dist/{chunk-3EAFE522.js → chunk-45KKBU63.js} +1 -1
- package/dist/chunk-4SPHDECE.js +165 -0
- package/dist/{chunk-OGIOFEC7.js → chunk-63DH4LRB.js} +13 -2
- package/dist/{chunk-7HZGKFFU.js → chunk-J3VJE463.js} +1 -1
- package/dist/{chunk-NUS5R2HO.js → chunk-LRTUWOR4.js} +12 -2
- package/dist/{domEditingLayers-7Z6J4UOK.js → domEditingLayers-7Q56QAU5.js} +2 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.html +2 -2
- package/dist/index.js +105 -196
- package/dist/pausedVideoDecoder-W2SVMXDS.js +404 -0
- package/dist/player.js +3 -3
- package/dist/styles.css +1 -1
- package/dist/ui.js +1 -1
- package/package.json +9 -9
- package/src/components/editor/domEditingDom.preview.test.ts +75 -0
- package/src/components/editor/domEditingDom.ts +19 -2
- package/src/components/nle/NLEContext.tsx +4 -1
- package/src/components/ui/Menu.test.tsx +8 -0
- package/src/components/ui/Menu.tsx +1 -1
- package/src/hooks/useElementPicker.test.ts +13 -0
- package/src/hooks/useElementPicker.ts +3 -2
- package/src/player/components/PlayerControls.test.tsx +1 -1
- package/src/player/components/PlayerControls.tsx +1 -1
- package/src/player/components/PreviewSeekBar.test.tsx +42 -0
- package/src/player/components/PreviewSeekBar.tsx +20 -3
- package/src/player/hooks/usePlaybackKeyboard.test.ts +1 -1
- package/src/player/hooks/usePlaybackKeyboard.ts +2 -1
- package/src/player/hooks/useTimelinePlayer.ts +3 -1
- package/src/player/lib/mediaFetch.test.ts +3 -4
- package/src/player/lib/pausedVideoDecoder.test.ts +717 -0
- package/src/player/lib/pausedVideoDecoder.ts +439 -0
- package/src/player/lib/pausedVideoProvider.test.ts +53 -0
- package/src/player/lib/pausedVideoProvider.ts +54 -0
- package/src/player/lib/playbackTypes.ts +8 -2
- package/src/player/lib/previewVideoTime.test.ts +38 -0
- package/src/player/lib/previewVideoTime.ts +39 -0
- package/src/player/store/previewQualitySlice.test.ts +27 -0
- package/src/player/store/previewQualitySlice.ts +12 -0
- package/src/utils/authoredSource.test.ts +11 -0
- package/src/utils/authoredSource.ts +2 -0
- package/dist/assets/index-CFUJyYA1.js +0 -531
package/dist/ui.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/studio",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.23",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"cn": "0.2.4",
|
|
60
60
|
"dockview-react": "8.3.1",
|
|
61
61
|
"gsap": "^3.13.0",
|
|
62
|
-
"mediabunny": "^1.
|
|
63
|
-
"@hyperframes/core": "0.9.
|
|
64
|
-
"@hyperframes/player": "0.9.
|
|
65
|
-
"@hyperframes/
|
|
66
|
-
"@hyperframes/
|
|
67
|
-
"@hyperframes/
|
|
68
|
-
"@hyperframes/studio-server": "0.9.
|
|
62
|
+
"mediabunny": "^1.65.2",
|
|
63
|
+
"@hyperframes/core": "0.9.23",
|
|
64
|
+
"@hyperframes/player": "0.9.23",
|
|
65
|
+
"@hyperframes/parsers": "0.9.23",
|
|
66
|
+
"@hyperframes/sdk": "0.9.23",
|
|
67
|
+
"@hyperframes/shader-transitions": "0.9.23",
|
|
68
|
+
"@hyperframes/studio-server": "0.9.23"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"vite": "^6.4.2",
|
|
83
83
|
"vitest": "^4.1.11",
|
|
84
84
|
"zustand": "^5.0.0",
|
|
85
|
-
"@hyperframes/producer": "0.9.
|
|
85
|
+
"@hyperframes/producer": "0.9.23"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"react": "19",
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { afterEach, expect, it } from "vitest";
|
|
3
|
+
import {
|
|
4
|
+
PREVIEW_VIDEO_FRAME_ATTR,
|
|
5
|
+
PREVIEW_VIDEO_CANVAS_ATTR,
|
|
6
|
+
} from "@hyperframes/core/studio-preview-mark";
|
|
7
|
+
import { getCuratedComputedStyles, isElementVisibleThroughAncestors } from "./domEditingDom";
|
|
8
|
+
import {
|
|
9
|
+
collectDomEditLayerItems,
|
|
10
|
+
resolveDomEditSelection,
|
|
11
|
+
resolveVisualDomEditSelectionTarget,
|
|
12
|
+
} from "./domEditing";
|
|
13
|
+
|
|
14
|
+
const options = { activeCompositionPath: "index.html", isMasterView: true, skipSourceProbe: true };
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
document.body.innerHTML = "";
|
|
17
|
+
document.head.innerHTML = "";
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
function preview(opacity: string) {
|
|
21
|
+
document.head.innerHTML = `<style>[${PREVIEW_VIDEO_FRAME_ATTR}] { opacity: 0 !important; }</style>`;
|
|
22
|
+
document.body.innerHTML = `<main data-composition-id="main"><canvas ${PREVIEW_VIDEO_CANVAS_ATTR} style="opacity:${opacity}" data-hf-ignore></canvas><video id="clip" ${PREVIEW_VIDEO_FRAME_ATTR} style="opacity:${opacity}" src="clip.mp4"></video></main>`;
|
|
23
|
+
const video = document.querySelector("video")!;
|
|
24
|
+
const canvas = document.querySelector("canvas")!;
|
|
25
|
+
const root = document.querySelector("main")!;
|
|
26
|
+
Object.defineProperty(video, "getBoundingClientRect", {
|
|
27
|
+
value: () => ({
|
|
28
|
+
x: 10,
|
|
29
|
+
y: 20,
|
|
30
|
+
left: 10,
|
|
31
|
+
top: 20,
|
|
32
|
+
right: 210,
|
|
33
|
+
bottom: 120,
|
|
34
|
+
width: 200,
|
|
35
|
+
height: 100,
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
return { video, canvas, root };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
it("keeps a provider-backed video selectable and listed with its logical opacity", async () => {
|
|
42
|
+
const { video, canvas, root } = preview("0.65");
|
|
43
|
+
expect(getComputedStyle(video).opacity).toBe("0");
|
|
44
|
+
expect(isElementVisibleThroughAncestors(video)).toBe(true);
|
|
45
|
+
expect(resolveVisualDomEditSelectionTarget([canvas, video], options)).toBe(video);
|
|
46
|
+
expect(collectDomEditLayerItems(root, options).map((item) => item.element)).toEqual([video]);
|
|
47
|
+
const selected = await resolveDomEditSelection(video, options);
|
|
48
|
+
expect(selected?.computedStyles.opacity).toBe("0.65");
|
|
49
|
+
expect(selected?.inlineStyles.opacity).toBe("0.65");
|
|
50
|
+
expect(getComputedStyle(video).opacity).toBe("0");
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("keeps authored zero opacity invisible and reports zero to the inspector", async () => {
|
|
54
|
+
const { video, canvas } = preview("0");
|
|
55
|
+
expect(isElementVisibleThroughAncestors(video)).toBe(false);
|
|
56
|
+
expect(resolveVisualDomEditSelectionTarget([canvas, video], options)).toBeNull();
|
|
57
|
+
expect(getCuratedComputedStyles(video).opacity).toBe("0");
|
|
58
|
+
const selected = await resolveDomEditSelection(video, options);
|
|
59
|
+
expect(selected?.computedStyles.opacity).toBe("0");
|
|
60
|
+
expect(video.style.opacity).toBe("0");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("still respects a hidden ancestor when the preview frame itself is visible", () => {
|
|
64
|
+
const { video, root } = preview("0.65");
|
|
65
|
+
root.style.opacity = "0";
|
|
66
|
+
expect(isElementVisibleThroughAncestors(video)).toBe(false);
|
|
67
|
+
expect(resolveVisualDomEditSelectionTarget([video], options)).toBeNull();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("does not treat an unrelated preceding canvas as the video's visible frame", () => {
|
|
71
|
+
const { video, canvas } = preview("0.65");
|
|
72
|
+
canvas.removeAttribute(PREVIEW_VIDEO_CANVAS_ATTR);
|
|
73
|
+
expect(isElementVisibleThroughAncestors(video)).toBe(false);
|
|
74
|
+
expect(getCuratedComputedStyles(video).opacity).toBe("0");
|
|
75
|
+
});
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* selector utilities, and composition source resolution.
|
|
4
4
|
* No imports from other domEditing* modules — safe to import from anywhere.
|
|
5
5
|
*/
|
|
6
|
+
import {
|
|
7
|
+
PREVIEW_VIDEO_FRAME_ATTR,
|
|
8
|
+
PREVIEW_VIDEO_CANVAS_ATTR,
|
|
9
|
+
} from "@hyperframes/core/studio-preview-mark";
|
|
6
10
|
import { COLOR_GRADING_SOURCE_HIDDEN_ATTR } from "@hyperframes/core/color-grading";
|
|
7
11
|
import { getSourceScopedSelectorIndex } from "../../utils/sourceScopedSelectorIndex";
|
|
8
12
|
import { CURATED_STYLE_PROPERTIES } from "./domEditingTypes";
|
|
@@ -34,12 +38,24 @@ export function isEditableTextLeaf(el: HTMLElement): boolean {
|
|
|
34
38
|
return isTextBearingTag(el.tagName.toLowerCase()) && el.children.length === 0;
|
|
35
39
|
}
|
|
36
40
|
|
|
41
|
+
/** The preview canvas keeps the source's authored opacity while its native pixels are hidden. */
|
|
42
|
+
export function getLogicalOpacity(el: Element, computed: CSSStyleDeclaration): string {
|
|
43
|
+
const overlay = el.previousElementSibling;
|
|
44
|
+
if (
|
|
45
|
+
el.hasAttribute(PREVIEW_VIDEO_FRAME_ATTR) &&
|
|
46
|
+
overlay?.localName === "canvas" &&
|
|
47
|
+
overlay.hasAttribute(PREVIEW_VIDEO_CANVAS_ATTR)
|
|
48
|
+
)
|
|
49
|
+
return el.ownerDocument.defaultView?.getComputedStyle(overlay).opacity ?? computed.opacity;
|
|
50
|
+
return computed.opacity;
|
|
51
|
+
}
|
|
52
|
+
|
|
37
53
|
/** Does this node render AT ALL, ignoring what it inherits? Sole owner of the
|
|
38
54
|
* rule; the walk below only decides which nodes to ask it about. */
|
|
39
55
|
function elementRendersItself(win: Window, el: HTMLElement): boolean {
|
|
40
56
|
const computed = win.getComputedStyle(el);
|
|
41
57
|
if (computed.display === "none" || computed.visibility === "hidden") return false;
|
|
42
|
-
const opacity = Number.parseFloat(computed
|
|
58
|
+
const opacity = Number.parseFloat(getLogicalOpacity(el, computed));
|
|
43
59
|
return !(
|
|
44
60
|
Number.isFinite(opacity) &&
|
|
45
61
|
opacity <= 0.01 &&
|
|
@@ -101,7 +117,8 @@ export function getCuratedComputedStyles(el: HTMLElement): Record<string, string
|
|
|
101
117
|
if (!computed) return styles;
|
|
102
118
|
|
|
103
119
|
for (const prop of CURATED_STYLE_PROPERTIES) {
|
|
104
|
-
const value =
|
|
120
|
+
const value =
|
|
121
|
+
prop === "opacity" ? getLogicalOpacity(el, computed) : computed.getPropertyValue(prop);
|
|
105
122
|
if (value) styles[prop] = value;
|
|
106
123
|
}
|
|
107
124
|
|
|
@@ -23,7 +23,10 @@ export interface NLEContextValue {
|
|
|
23
23
|
play: () => void;
|
|
24
24
|
pause: () => void;
|
|
25
25
|
togglePlay: () => void;
|
|
26
|
-
seek: (
|
|
26
|
+
seek: (
|
|
27
|
+
time: number,
|
|
28
|
+
options?: { keepPlaying?: boolean; follow?: boolean; settled?: boolean },
|
|
29
|
+
) => boolean;
|
|
27
30
|
refreshPlayer: () => void;
|
|
28
31
|
onIframeLoad: () => void;
|
|
29
32
|
// The hidden reload iframe NLEPreview renders next to the live one during a full reload.
|
|
@@ -434,4 +434,12 @@ describe("open motion", () => {
|
|
|
434
434
|
/\.duration-open \{[\s\S]*?prefers-reduced-motion: reduce[\s\S]*?transition-duration: 0ms/,
|
|
435
435
|
);
|
|
436
436
|
});
|
|
437
|
+
|
|
438
|
+
it("rounds a row's highlight more than the panel that holds it", async () => {
|
|
439
|
+
await openActionMenu();
|
|
440
|
+
|
|
441
|
+
const rowRadius = [...items()[0]!.classList].find((c) => c.startsWith("rounded-"))!;
|
|
442
|
+
expect([...popup()!.classList]).toContain("rounded-lg");
|
|
443
|
+
expect(compileStudioCss([rowRadius])).toMatch(/calc\(var\(--radius-lg\) \+ 6px\)/);
|
|
444
|
+
});
|
|
437
445
|
});
|
|
@@ -72,7 +72,7 @@ const menuPopup = cn(popupSurface, "min-w-36 p-1 shadow-menu");
|
|
|
72
72
|
|
|
73
73
|
/** One row. `data-highlighted` is set by keyboard and pointer alike, so the seen row is the Enter row. */
|
|
74
74
|
const itemBase = cn(
|
|
75
|
-
"flex cursor-default select-none items-center justify-between gap-6 rounded-
|
|
75
|
+
"flex cursor-default select-none items-center justify-between gap-6 rounded-[calc(var(--radius-lg)+6px)] px-2 py-1.5",
|
|
76
76
|
"text-step-11 whitespace-nowrap text-text-1",
|
|
77
77
|
"outline-hidden transition-colors ease-out-quint duration-hover",
|
|
78
78
|
"data-[highlighted]:bg-hover data-[highlighted]:text-text-0",
|
|
@@ -115,6 +115,19 @@ function mountPicker(
|
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
it.each(["0.65", "0"])(
|
|
119
|
+
"reads provider-backed video opacity %s in the picked-element inspector",
|
|
120
|
+
(opacity) => {
|
|
121
|
+
const mounted = `<style>[data-hf-preview-video-frame] { opacity: 0 !important; }</style><canvas data-hf-preview-video-canvas style="opacity:${opacity}"></canvas><video id="provider-video" data-hf-preview-video-frame style="opacity:${opacity}"></video>`;
|
|
122
|
+
const { iframe, picker } = mountPicker({ "index.html": SAVED }, "#provider-video", mounted);
|
|
123
|
+
expect(
|
|
124
|
+
iframe.contentWindow!.getComputedStyle(iframe.contentDocument!.querySelector("video")!)
|
|
125
|
+
.opacity,
|
|
126
|
+
).toBe("0");
|
|
127
|
+
expect(picker().pickedElement?.computedStyles.opacity).toBe(opacity);
|
|
128
|
+
},
|
|
129
|
+
);
|
|
130
|
+
|
|
118
131
|
describe("pick mode cancellation and hover feedback", () => {
|
|
119
132
|
it("cancels pick mode when Escape is pressed with Studio focus", () => {
|
|
120
133
|
const { picker } = mountPicker({ "index.html": SAVED });
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
postRuntimeControlMessage,
|
|
13
13
|
} from "../player/lib/runtimeProtocol";
|
|
14
14
|
import { compositionPathOfPreviewUrl } from "../player/components/CompositionThumbnail";
|
|
15
|
-
import { getSourceFileForElement } from "../components/editor/domEditingDom";
|
|
15
|
+
import { getLogicalOpacity, getSourceFileForElement } from "../components/editor/domEditingDom";
|
|
16
16
|
import {
|
|
17
17
|
createElementPickerHoverLabel,
|
|
18
18
|
type ElementPickerHoverInfo,
|
|
@@ -589,7 +589,8 @@ function readComputedStyles(iframe: HTMLIFrameElement, selector: string): Record
|
|
|
589
589
|
];
|
|
590
590
|
|
|
591
591
|
for (const prop of props) {
|
|
592
|
-
const val =
|
|
592
|
+
const val =
|
|
593
|
+
prop === "opacity" ? getLogicalOpacity(el, computed) : computed.getPropertyValue(prop);
|
|
593
594
|
if (val) styles[prop] = val;
|
|
594
595
|
}
|
|
595
596
|
} catch {
|
|
@@ -57,7 +57,7 @@ describe("PlayerControls preview seeking", () => {
|
|
|
57
57
|
setValue.call(input, String(time));
|
|
58
58
|
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
59
59
|
});
|
|
60
|
-
expect(onSeek).toHaveBeenLastCalledWith(time);
|
|
60
|
+
expect(onSeek).toHaveBeenLastCalledWith(time, { settled: true });
|
|
61
61
|
}
|
|
62
62
|
expect(onSeek).toHaveBeenCalledTimes(4);
|
|
63
63
|
});
|
|
@@ -161,7 +161,7 @@ const FullscreenButton = memo(function FullscreenButton({
|
|
|
161
161
|
|
|
162
162
|
interface PlayerControlsProps {
|
|
163
163
|
onTogglePlay: () => void;
|
|
164
|
-
onSeek: (time: number) => void;
|
|
164
|
+
onSeek: (time: number, options?: { settled?: boolean }) => void;
|
|
165
165
|
disabled?: boolean;
|
|
166
166
|
isFullscreen?: boolean;
|
|
167
167
|
onToggleFullscreen?: () => void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
import React, { act } from "react";
|
|
3
|
+
import { expect, it, vi } from "vitest";
|
|
4
|
+
import { PreviewSeekBar } from "./PreviewSeekBar";
|
|
5
|
+
import { createHappyDomRootHarness } from "./testRootHarness";
|
|
6
|
+
|
|
7
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
|
|
8
|
+
const { mount } = createHappyDomRootHarness();
|
|
9
|
+
|
|
10
|
+
it("marks keyboard and released seeks as settled and pointer scrubbing as interactive", () => {
|
|
11
|
+
const host = document.createElement("div");
|
|
12
|
+
document.body.append(host);
|
|
13
|
+
const onSeek = vi.fn();
|
|
14
|
+
act(() => mount(host).render(<PreviewSeekBar duration={10} disabled={false} onSeek={onSeek} />));
|
|
15
|
+
const input = host.querySelector("input")!;
|
|
16
|
+
const change = (value: number) => {
|
|
17
|
+
Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")!.set!.call(
|
|
18
|
+
input,
|
|
19
|
+
String(value),
|
|
20
|
+
);
|
|
21
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
22
|
+
};
|
|
23
|
+
act(() => {
|
|
24
|
+
input.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowRight", bubbles: true }));
|
|
25
|
+
change(1);
|
|
26
|
+
});
|
|
27
|
+
expect(onSeek).toHaveBeenLastCalledWith(1, { settled: true });
|
|
28
|
+
act(() => {
|
|
29
|
+
input.dispatchEvent(new PointerEvent("pointerdown", { bubbles: true }));
|
|
30
|
+
change(2);
|
|
31
|
+
});
|
|
32
|
+
expect(onSeek).toHaveBeenLastCalledWith(2, { settled: false });
|
|
33
|
+
act(() => {
|
|
34
|
+
input.dispatchEvent(new PointerEvent("pointerup", { bubbles: true }));
|
|
35
|
+
});
|
|
36
|
+
expect(onSeek).toHaveBeenLastCalledWith(2, { settled: true });
|
|
37
|
+
act(() => {
|
|
38
|
+
input.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowRight", bubbles: true }));
|
|
39
|
+
change(3);
|
|
40
|
+
});
|
|
41
|
+
expect(onSeek).toHaveBeenLastCalledWith(3, { settled: true });
|
|
42
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { memo, useEffect, useRef } from "react";
|
|
1
|
+
import { memo, useEffect, useRef, type PointerEvent } from "react";
|
|
2
2
|
import { formatTime } from "../lib/time";
|
|
3
3
|
import { liveTime, usePlayerStore } from "../store/playerStore";
|
|
4
4
|
|
|
@@ -9,9 +9,16 @@ export const PreviewSeekBar = memo(function PreviewSeekBar({
|
|
|
9
9
|
}: {
|
|
10
10
|
duration: number;
|
|
11
11
|
disabled: boolean;
|
|
12
|
-
onSeek: (time: number) => void;
|
|
12
|
+
onSeek: (time: number, options?: { settled?: boolean }) => void;
|
|
13
13
|
}) {
|
|
14
14
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
15
|
+
const settledRef = useRef(true);
|
|
16
|
+
|
|
17
|
+
const finishPointerSeek = (event: PointerEvent<HTMLInputElement>) => {
|
|
18
|
+
if (settledRef.current) return;
|
|
19
|
+
settledRef.current = true;
|
|
20
|
+
onSeek(event.currentTarget.valueAsNumber, { settled: true });
|
|
21
|
+
};
|
|
15
22
|
|
|
16
23
|
useEffect(() => {
|
|
17
24
|
const input = inputRef.current;
|
|
@@ -39,7 +46,17 @@ export const PreviewSeekBar = memo(function PreviewSeekBar({
|
|
|
39
46
|
defaultValue={0}
|
|
40
47
|
disabled={disabled || duration <= 0}
|
|
41
48
|
aria-label="Seek preview"
|
|
42
|
-
|
|
49
|
+
onPointerDown={() => {
|
|
50
|
+
settledRef.current = false;
|
|
51
|
+
}}
|
|
52
|
+
onPointerUp={finishPointerSeek}
|
|
53
|
+
onPointerCancel={finishPointerSeek}
|
|
54
|
+
onKeyDown={() => {
|
|
55
|
+
settledRef.current = true;
|
|
56
|
+
}}
|
|
57
|
+
onChange={(event) =>
|
|
58
|
+
onSeek(event.currentTarget.valueAsNumber, { settled: settledRef.current })
|
|
59
|
+
}
|
|
43
60
|
className="h-6 w-full cursor-pointer accent-neutral-300 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-ink disabled:cursor-default disabled:opacity-30"
|
|
44
61
|
/>
|
|
45
62
|
</div>
|
|
@@ -331,7 +331,7 @@ describe("usePlaybackKeyboard — frame step", () => {
|
|
|
331
331
|
dispatch(keydown({ code: "ArrowRight", key: "ArrowRight" }));
|
|
332
332
|
});
|
|
333
333
|
|
|
334
|
-
expect(spies.seek).toHaveBeenCalledWith((frame + 1) / fps);
|
|
334
|
+
expect(spies.seek).toHaveBeenCalledWith((frame + 1) / fps, { settled: true });
|
|
335
335
|
});
|
|
336
336
|
});
|
|
337
337
|
|
|
@@ -30,7 +30,7 @@ interface UsePlaybackKeyboardParams {
|
|
|
30
30
|
play: () => void;
|
|
31
31
|
playBackward: (rate: number) => void;
|
|
32
32
|
pause: () => void;
|
|
33
|
-
seek: (time: number, options?: { keepPlaying?: boolean }) => void;
|
|
33
|
+
seek: (time: number, options?: { keepPlaying?: boolean; settled?: boolean }) => void;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const FRAME_STEPS = {
|
|
@@ -112,6 +112,7 @@ export function usePlaybackKeyboard({
|
|
|
112
112
|
const currentTime = adapter?.getTime() ?? usePlayerStore.getState().currentTime;
|
|
113
113
|
seek(
|
|
114
114
|
stepFrameTime(currentTime, deltaFrames, useLinkedClipPreferences.getState().compositionFps),
|
|
115
|
+
{ settled: true },
|
|
115
116
|
);
|
|
116
117
|
},
|
|
117
118
|
[getAdapter, seek],
|
|
@@ -28,6 +28,7 @@ export {
|
|
|
28
28
|
} from "../lib/playbackShortcuts";
|
|
29
29
|
|
|
30
30
|
import type { PlaybackAdapter, IframeWindow } from "../lib/playbackTypes";
|
|
31
|
+
import { attachPausedVideoProvider } from "../lib/pausedVideoProvider";
|
|
31
32
|
import { releaseStaticSeekCache, type StaticSeekCacheEntry } from "../lib/playbackAdapter";
|
|
32
33
|
import { mergeTimelineElementsPreservingDowngrades } from "../lib/timelineDOM";
|
|
33
34
|
import { findTimelineElementInIframe } from "../../hooks/timelineEditingHelpers";
|
|
@@ -150,6 +151,7 @@ export function useTimelinePlayer({
|
|
|
150
151
|
const iframe = overrideIframe !== undefined ? overrideIframe : iframeRef.current;
|
|
151
152
|
const win = iframe?.contentWindow as IframeWindow | null;
|
|
152
153
|
if (!iframe || !win) return null;
|
|
154
|
+
attachPausedVideoProvider(iframe, win);
|
|
153
155
|
const adapter = resolvePlaybackAdapter(iframe, win, {
|
|
154
156
|
cache: staticSeekAdapterRef,
|
|
155
157
|
warned: staticSeekWarnedRef,
|
|
@@ -295,7 +297,7 @@ export function useTimelinePlayer({
|
|
|
295
297
|
stopRAFLoop();
|
|
296
298
|
}, [getAdapter, setCurrentTime, setIsPlaying, stopRAFLoop, stopReverseLoop]);
|
|
297
299
|
const seek = useCallback(
|
|
298
|
-
(time: number, options?: { keepPlaying?: boolean; follow?: boolean }) => {
|
|
300
|
+
(time: number, options?: { keepPlaying?: boolean; follow?: boolean; settled?: boolean }) => {
|
|
299
301
|
const wasReverseShuttle = shuttleDirectionRef.current === "backward";
|
|
300
302
|
stopReverseLoop();
|
|
301
303
|
const adapter = getAdapter();
|
|
@@ -611,8 +611,7 @@ describe("mediaUrlSourceOptions", () => {
|
|
|
611
611
|
expect(failure.retries).toBe(0);
|
|
612
612
|
});
|
|
613
613
|
|
|
614
|
-
|
|
615
|
-
it("fails a real mediabunny read, and its unawaited read-ahead, with the typed error", async () => {
|
|
614
|
+
it("fails a real mediabunny read with the typed error without a duplicate unhandled rejection", async () => {
|
|
616
615
|
vi.stubGlobal("fetch", vi.fn().mockResolvedValue(new Response("", { status: 404 })));
|
|
617
616
|
const mb = await import("mediabunny");
|
|
618
617
|
const runnerListeners = process.listeners("unhandledRejection");
|
|
@@ -629,8 +628,8 @@ describe("mediaUrlSourceOptions", () => {
|
|
|
629
628
|
await new Promise(setImmediate);
|
|
630
629
|
|
|
631
630
|
expect(error).toMatchObject({ name: "MediaFetchError", status: 404, retries: 0 });
|
|
632
|
-
expect(
|
|
633
|
-
|
|
631
|
+
expect(error).toBeInstanceOf(MediaFetchError);
|
|
632
|
+
expect(unhandled).toEqual([]);
|
|
634
633
|
} finally {
|
|
635
634
|
process.removeAllListeners("unhandledRejection");
|
|
636
635
|
for (const listener of runnerListeners) process.on("unhandledRejection", listener);
|