eligius
    Preparing search index...

    Class KeyboardStepSource

    Keyboard-based position source for stepping through a timeline.

    Supports:

    • Left/Right arrows: step by stepSize (default 1s)
    • Shift+Left/Right: large step by largeStepSize (default 10s)
    • Home/End: jump to start/end
    • Up/Down: configurable (timeline switch, chapter navigation, or disabled)
    const source = new KeyboardStepSource({
    duration: 60,
    verticalMode: 'chapter-navigation',
    markers: [0, 10, 20, 30, 40, 50],
    });

    await source.init();

    source.onPosition((position) => {
    console.log(`Position: ${position}s`);
    });

    source.onMarkerJump((index, position) => {
    console.log(`Jumped to marker ${index} at ${position}s`);
    });

    await source.activate();

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Accessors

    • get loop(): boolean

      Whether to loop when reaching the end boundary.

      When true, the source resets to position 0 and continues. When false, the source emits 'end' boundary and deactivates.

      For sources where looping is not applicable (e.g., mouse position), this property has no effect.

      Returns boolean

    • set loop(value: boolean): void

      Whether to loop when reaching the end boundary.

      When true, the source resets to position 0 and continues. When false, the source emits 'end' boundary and deactivates.

      For sources where looping is not applicable (e.g., mouse position), this property has no effect.

      Parameters

      • value: boolean

      Returns void

    Methods

    • Register a callback for when the source becomes active.

      Called once each time the source transitions to the active state. This is equivalent to "first frame" semantics - for RAF sources it's the first tick, for video sources it's when playback actually starts.

      Parameters

      • callback: () => void

        Function called when source becomes active

      Returns void

    • Register callback for marker jumps (chapter-navigation mode).

      Parameters

      • callback: (markerIndex: number, position: number) => void

        Called with marker index and position when jumping

      Returns void

    • Register callback for timeline change requests (timeline-switch mode).

      Parameters

      • callback: (direction: "prev" | "next") => void

        Called with 'prev' or 'next' when Up/Down is pressed

      Returns void