@hyperframes/studio 0.8.131 → 0.8.132
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/{hyperframes-player-BpOOAOcm.js → hyperframes-player-Cp8e_Zst.js} +1 -1
- package/dist/assets/{index-DASBNWML.js → index-CASEBNy2.js} +1 -1
- package/dist/assets/{index-DbSXe5_2.js → index-DMTt9nTf.js} +1 -1
- package/dist/assets/{index-BEcHKkGY.js → index-oE1pOdAy.js} +55 -55
- package/dist/{chunk-DRVWEPO5.js → chunk-FOEID72M.js} +3 -1
- package/dist/{chunk-DRVWEPO5.js.map → chunk-FOEID72M.js.map} +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.html +1 -1
- package/dist/index.js +19 -10
- package/dist/index.js.map +1 -1
- package/dist/player.js +1 -1
- package/package.json +8 -8
- package/src/player/hooks/usePlaybackKeyboard.ts +1 -0
- package/src/player/hooks/useTimelinePlayer.playLock.test.ts +137 -0
- package/src/player/hooks/useTimelinePlayer.ts +15 -6
- package/src/player/hooks/useTimelinePlayerLoop.ts +1 -1
- package/src/player/lib/playbackSeek.ts +2 -0
- package/src/player/store/readinessSlice.ts +4 -0
package/dist/index.d.ts
CHANGED
|
@@ -272,6 +272,8 @@ interface PlaybackReadinessSlice {
|
|
|
272
272
|
previewBooted: boolean;
|
|
273
273
|
setTimelineReady: (ready: boolean) => void;
|
|
274
274
|
markPreviewBooted: () => void;
|
|
275
|
+
playLocked: boolean;
|
|
276
|
+
setPlayLocked: (locked: boolean) => void;
|
|
275
277
|
/** Sets timelineReady once doc's readiness inputs settle, or immediately
|
|
276
278
|
* if doc is null. A wait a later call supersedes never wins the race.
|
|
277
279
|
* Waits for doc's load step first: it pauses and rewinds the preview, so a
|
package/dist/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
document.documentElement.dataset.theme = "paper";
|
|
15
15
|
}
|
|
16
16
|
</script>
|
|
17
|
-
<script type="module" crossorigin src="/assets/index-
|
|
17
|
+
<script type="module" crossorigin src="/assets/index-oE1pOdAy.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="/assets/index-D11atkBt.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
usePreviewVariablesStore,
|
|
40
40
|
whenPreviewBooted,
|
|
41
41
|
writeStudioUiPreferences
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-FOEID72M.js";
|
|
43
43
|
import {
|
|
44
44
|
Button,
|
|
45
45
|
ContextMenu,
|
|
@@ -28278,6 +28278,7 @@ function usePlaybackKeyboard({
|
|
|
28278
28278
|
);
|
|
28279
28279
|
const shuttle = useCallback38(
|
|
28280
28280
|
(direction) => {
|
|
28281
|
+
if (usePlayerStore.getState().playLocked) return;
|
|
28281
28282
|
if (shuttleDirectionRef.current === direction) {
|
|
28282
28283
|
shuttleSpeedIndexRef.current = Math.min(
|
|
28283
28284
|
shuttleSpeedIndexRef.current + 1,
|
|
@@ -31213,7 +31214,7 @@ function useTimelinePlayerLoop({
|
|
|
31213
31214
|
const looping = usePlayerStore.getState().loopEnabled && dur > 0;
|
|
31214
31215
|
setLoopStart(looping ? loopStart : null);
|
|
31215
31216
|
if (time >= loopEnd) {
|
|
31216
|
-
if (looping) {
|
|
31217
|
+
if (looping && !usePlayerStore.getState().playLocked) {
|
|
31217
31218
|
adapter.seek(loopStart, { keepPlaying: true });
|
|
31218
31219
|
liveTime.notify(loopStart);
|
|
31219
31220
|
adapter.play();
|
|
@@ -31506,7 +31507,7 @@ function pumpProbeQueue() {
|
|
|
31506
31507
|
|
|
31507
31508
|
// src/player/lib/playbackSeek.ts
|
|
31508
31509
|
function shouldResumeForwardPlaybackAfterSeek(input) {
|
|
31509
|
-
return input.keepPlaying && !input.wasReverseShuttle && input.storeWasPlaying && (input.duration <= 0 || input.nextTime < input.duration);
|
|
31510
|
+
return !input.playLocked && input.keepPlaying && !input.wasReverseShuttle && input.storeWasPlaying && (input.duration <= 0 || input.nextTime < input.duration);
|
|
31510
31511
|
}
|
|
31511
31512
|
function shouldStopAfterSeek(input) {
|
|
31512
31513
|
return !input.keepPlaying || input.wasReverseShuttle;
|
|
@@ -31709,7 +31710,8 @@ function useTimelinePlayer({
|
|
|
31709
31710
|
applyPreviewAudioFlags(iframeRef.current, audioMuted, audioVolume);
|
|
31710
31711
|
}, []);
|
|
31711
31712
|
const play = useCallback42(() => {
|
|
31712
|
-
|
|
31713
|
+
const { timelineReady, playLocked } = usePlayerStore.getState();
|
|
31714
|
+
if (!timelineReady || playLocked) return;
|
|
31713
31715
|
stopRAFLoop();
|
|
31714
31716
|
stopReverseLoop();
|
|
31715
31717
|
stopScrubPreviewAudio();
|
|
@@ -31793,9 +31795,8 @@ function useTimelinePlayer({
|
|
|
31793
31795
|
const pause = useCallback42(() => {
|
|
31794
31796
|
stopReverseLoop();
|
|
31795
31797
|
const adapter = getAdapter();
|
|
31796
|
-
|
|
31797
|
-
adapter.
|
|
31798
|
-
setCurrentTime(adapter.getTime());
|
|
31798
|
+
adapter?.pause();
|
|
31799
|
+
if (adapter) setCurrentTime(adapter.getTime());
|
|
31799
31800
|
setIsPlaying(false);
|
|
31800
31801
|
shuttleDirectionRef.current = null;
|
|
31801
31802
|
shuttleSpeedIndexRef.current = 0;
|
|
@@ -31813,17 +31814,19 @@ function useTimelinePlayer({
|
|
|
31813
31814
|
const duration = Math.max(0, adapter.getDuration());
|
|
31814
31815
|
const nextTime = clampToDuration(time, duration);
|
|
31815
31816
|
const keepPlaying = options?.keepPlaying === true;
|
|
31817
|
+
const { playLocked, isPlaying: storeWasPlaying } = usePlayerStore.getState();
|
|
31816
31818
|
const shouldResumeAfterSeek = shouldResumeForwardPlaybackAfterSeek({
|
|
31817
31819
|
keepPlaying,
|
|
31818
31820
|
wasReverseShuttle,
|
|
31819
|
-
storeWasPlaying
|
|
31821
|
+
storeWasPlaying,
|
|
31820
31822
|
duration,
|
|
31821
|
-
nextTime
|
|
31823
|
+
nextTime,
|
|
31824
|
+
playLocked
|
|
31822
31825
|
});
|
|
31823
31826
|
adapter.seek(nextTime, options);
|
|
31824
31827
|
publishSeek(nextTime, options);
|
|
31825
31828
|
setCurrentTime(nextTime);
|
|
31826
|
-
if (!
|
|
31829
|
+
if (!keepPlaying && !playLocked) scrubMusicAtSeek(iframeRef.current, nextTime);
|
|
31827
31830
|
if (shouldResumeAfterSeek) {
|
|
31828
31831
|
stopRAFLoop();
|
|
31829
31832
|
applyPlaybackRate(usePlayerStore.getState().playbackRate);
|
|
@@ -31855,6 +31858,12 @@ function useTimelinePlayer({
|
|
|
31855
31858
|
shuttleSpeedIndexRef
|
|
31856
31859
|
]
|
|
31857
31860
|
);
|
|
31861
|
+
useEffect35(
|
|
31862
|
+
() => usePlayerStore.subscribe((state, prev) => {
|
|
31863
|
+
if (state.playLocked && !prev.playLocked && state.isPlaying) pause();
|
|
31864
|
+
}),
|
|
31865
|
+
[pause]
|
|
31866
|
+
);
|
|
31858
31867
|
useEffect35(() => {
|
|
31859
31868
|
return usePlayerStore.subscribe((state, prev) => {
|
|
31860
31869
|
if (state.requestedSeekTime !== null && state.requestedSeekTime !== prev.requestedSeekTime) {
|