@vestra-player/sdk - v1.11.3
    Preparing search index...

    Interface Scrub

    A drag gesture: each seek is conditional on the previous one, latest value wins. Any outside change (another plugin opens a file, the user pauses) ends the gesture.

    The video follows the slider while it is dragged. scrub() starts a gesture from the current state; each seek is conditional on the previous one and only the newest target is sent while one is running, so a fast drag does not queue seeks. A change from outside (another file, the user pausing) ends the gesture and later seeks resolve false.

    let scrub: Scrub | null = null;
    bar.on("dragStart", () => (scrub = plugin.player.scrub()));
    // Latest value wins: superseded targets resolve false, not an error.
    bar.on("dragMove", (seconds: number) => void scrub?.seek(seconds));
    bar.on("dragEnd", () => scrub?.end());

    A drag gesture on a seek slider. Each seek is conditional on the previous one and only the newest target is sent while a seek is running, so a fast drag never queues seeks. Any outside change (another file, the user pausing) ends the gesture: active turns false and later seeks resolve false.

    1.0.0

    interface Scrub {
        seek(
            seconds: number,
            options?: { keyframes?: boolean },
        ): Promise<boolean>;
        active: boolean;
        end(): void;
    }
    Index
    • Seek within the gesture. Resolves true when this target was applied, false when a newer target superseded it or the gesture ended. Rejects on a host failure.

      keyframes: true: land on the last keyframe at or before seconds instead of decoding up to that exact frame. The picture appears at once on any file (tens of milliseconds instead of seconds on 4K video with keyframes far apart), up to one keyframe interval before the target; the position the player reports is the keyframe's. Use it when the user chose keyframe seeks (the same switch as Player.setStepSeek), and the exact seek otherwise. The player sends a repeated target of the same gesture only once while the seek is still running (a click is a press and a release), but an exact seek to the target of a keyframe seek is always sent. Omitted or false: exact, as before.

      Parameters

      • seconds: number
      • Optionaloptions: { keyframes?: boolean }

      Returns Promise<boolean>

      While dragging, the picture jumps to the nearest earlier keyframe at once instead of decoding up to the exact frame. With keyframes: true the player lands each target on the last keyframe at or before it; the plugin follows the user's keyframe-seek setting.

      const keyframes = true; // the plugin's own setting
      bar.on("dragMove", (seconds: number) => void scrub?.seek(seconds, { keyframes }));

      stale (rejects) The source changed from outside while this seek was being sent (a superseded target or an ended gesture resolves false instead).

      unsupported (rejects) The source is a generated stream.

      backend (rejects) The player failed the seek.

      1.0.0

    • End the gesture; later seeks resolve false.

      Returns void

      Releasing the slider ends the gesture, so a late dragMove cannot move playback any more. After end, seek resolves false without doing anything.

      bar.on("dragEnd", () => scrub.end()); // later seeks resolve false
      

      1.0.0

    active: boolean

    False once anyone else changed the source; later seeks are ignored.