Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

602 B
Raw Blame
import type { ThumbnailScheduler } from "./thumbnailScheduler";

interface PlaybackStore {
  getState(): { isPlaying: boolean };
  subscribe(listener: (state: { isPlaying: boolean }) => void): () => void;
}

/** Subscribed to the state, not to setIsPlaying, so a reset that writes isPlaying: false also lets go. */
export function bindThumbnailPlaybackHold(
  store: PlaybackStore,
  scheduler: Pick<ThumbnailScheduler, "setPlaybackActive">,
): () => void {
  scheduler.setPlaybackActive(store.getState().isPlaying);
  return store.subscribe((state) => scheduler.setPlaybackActive(state.isPlaying));
}