Skip to content

Commit

Permalink
enable timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminpkane committed Oct 4, 2024
1 parent b7d6c78 commit 2bafc34
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
8 changes: 7 additions & 1 deletion app/packages/core/src/components/Modal/use-looker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ function useLooker<L extends fos.Lookers>({
const ref = useRef<HTMLDivElement>(null);
const [reset, setReset] = useState(false);
const lookerOptions = fos.useLookerOptions(true);
const createLooker = fos.useCreateLooker(true, false, lookerOptions);
const createLooker = fos.useCreateLooker(
true,
false,
lookerOptions,
undefined,
true
);
const selectedMediaField = useRecoilValue(fos.selectedMediaField(true));
const colorScheme = useRecoilValue(fos.colorScheme);
const looker = React.useMemo(() => {
Expand Down
17 changes: 2 additions & 15 deletions app/packages/looker/src/lookers/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,20 +219,6 @@ export class VideoLooker extends AbstractLooker<VideoState, VideoSample> {

get waiting() {
const video = this.lookerElement.children[0].element as HTMLVideoElement;
if (
!this.state.config.thumbnail &&
video &&
(video.seeking ||
video.readyState < 2 ||
!this.hasFrame(this.state.frameNumber))
) {
console.log(
video,
video.seeking,
video.readyState < 2,
!this.hasFrame(this.state.frameNumber)
);
}
return (
video &&
(video.seeking ||
Expand Down Expand Up @@ -541,11 +527,12 @@ export class VideoLooker extends AbstractLooker<VideoState, VideoSample> {
this.state.setZoom = false;
}

!this.state.config.thumbnail &&
if (this.state.config.enableTimeline) {
getDefaultStore().set(setFrameNumberAtom, {
name: `timeline-${this.state.config.sampleId}`,
newFrameNumber: this.state.frameNumber,
});
}

return super.postProcess();
}
Expand Down
1 change: 1 addition & 0 deletions app/packages/looker/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export interface FrameConfig extends BaseConfig {
export type ImageConfig = BaseConfig;

export interface VideoConfig extends BaseConfig {
enableTimeline: boolean;
frameRate: number;
support?: [number, number];
}
Expand Down
4 changes: 3 additions & 1 deletion app/packages/state/src/hooks/useCreateLooker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export default <T extends AbstractLooker<BaseState>>(
isModal: boolean,
thumbnail: boolean,
options: Omit<Parameters<T["updateOptions"]>[0], "selected">,
highlight?: (sample: Sample) => boolean
highlight?: (sample: Sample) => boolean,
enableTimeline?: boolean
) => {
const environment = useRelayEnvironment();
const selected = useRecoilValue(selectedSamples);
Expand Down Expand Up @@ -112,6 +113,7 @@ export default <T extends AbstractLooker<BaseState>>(
}

let config: ConstructorParameters<T>[1] = {
enableTimeline,
fieldSchema: {
...fieldSchema,
frames: {
Expand Down

0 comments on commit 2bafc34

Please sign in to comment.