Skip to content

EditorState Schema

The EditorStateSnapshot captures the full state of the editor timeline, overlays, audio, and export settings. It is stored on each work and used to restore the editor after reload.

Defined in packages/shared/src/types/project.ts:

export interface TimelineActionSnapshot {
id: string;
start: number;
end: number;
sceneIndex?: number;
trimStart?: number;
trimEnd?: number;
transitionType?: string;
transitionDuration?: number;
}
export interface TextOverlaySnapshot {
text: string;
fontSize: number;
fontColor: string;
centerX: number;
centerY: number;
}
export interface ImageOverlaySnapshot {
assetId: string;
width: number;
height: number;
centerX: number;
centerY: number;
opacity: number;
rotation: number;
maintainAspectRatio?: boolean;
}
export interface EditorStateSnapshot {
editorData: {
videoTrack: TimelineActionSnapshot[];
textTrack: TimelineActionSnapshot[];
imageTrack?: TimelineActionSnapshot[];
audioTrack: TimelineActionSnapshot[];
};
textOverlays: Record<string, TextOverlaySnapshot>;
imageOverlays?: Record<string, ImageOverlaySnapshot>;
audioUrl?: string;
audioVolume: number;
exportSettings: {
width: number;
height: number;
fps: number;
};
}

Represents a clip or overlay action on a track.

FieldTypeRequiredDescription
idstringYesUnique ID of the action.
startnumberYesStart time (seconds) on the timeline.
endnumberYesEnd time (seconds) on the timeline.
sceneIndexnumberNoAssociated scene index (if any).
trimStartnumberNoTrim start offset within the source.
trimEndnumberNoTrim end offset within the source.
transitionTypestringNoTransition type to the next clip (e.g. fade, dissolve).
transitionDurationnumberNoTransition duration in seconds.

Used on:

  • videoTrack
  • textTrack
  • imageTrack
  • audioTrack

TextOverlaySnapshot:

FieldTypeRequiredDescription
textstringYesOverlay text content.
fontSizenumberYesFont size in pixels.
fontColorstringYesCSS color (e.g. #FFFFFF).
centerXnumberYesX position (center-relative) in pixels.
centerYnumberYesY position (center-relative) in pixels.

ImageOverlaySnapshot:

FieldTypeRequiredDescription
assetIdstringYesProject asset ID (see Assets).
widthnumberYesWidth in pixels.
heightnumberYesHeight in pixels.
centerXnumberYesX position (center-relative).
centerYnumberYesY position (center-relative).
opacitynumberYesOpacity (0–1).
rotationnumberYesRotation in degrees.
maintainAspectRatiobooleanNoWhether to preserve aspect ratio.

Overlays are referenced from tracks by ID via editorData actions.

Top-level structure stored on a work:

FieldTypeRequiredDescription
editorDataobjectYesTrack actions for video, text, image, and audio.
textOverlaysrecordYesMap of text overlay ID → TextOverlaySnapshot.
imageOverlaysrecordNoMap of image overlay ID → ImageOverlaySnapshot.
audioUrlstringNoWork-level audio URL.
audioVolumenumberYesAudio volume (default 1).
exportSettingsobjectYesExport resolution and fps.

exportSettings:

FieldTypeRequiredDescription
widthnumberYesOutput width in pixels.
heightnumberYesOutput height in pixels.
fpsnumberYesFrames per second.
  • On the Work model (works.editorState).
  • Serialized via the Works API when you PUT a work.
  • Populated by the editor UI when saving the timeline.