@hyperframes/studio 0.9.20 → 0.9.22
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-DLDwVbqW.js +314 -0
- package/dist/assets/{hyperframes-player-ZQZslutT.js → hyperframes-player-C5DA6O5u.js} +3 -3
- package/dist/assets/index-B6RxZt-8.js +150 -0
- package/dist/assets/{index-Bz2pYyGM.js → index-Buvugo_O.js} +120 -119
- package/dist/assets/pausedVideoDecoder-BGKlQc66.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-NUS5R2HO.js → chunk-AX6G6YL5.js} +1 -1
- package/dist/{domEditingLayers-7Z6J4UOK.js → domEditingLayers-7Q56QAU5.js} +2 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.html +1 -1
- package/dist/index.js +104 -195
- package/dist/pausedVideoDecoder-KBQXSWFQ.js +393 -0
- package/dist/player.js +2 -2
- 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/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 +644 -0
- package/src/player/lib/pausedVideoDecoder.ts +428 -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/utils/authoredSource.test.ts +11 -0
- package/src/utils/authoredSource.ts +2 -0
- package/dist/assets/index-Bn5atbhb.js +0 -531
|
@@ -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);
|