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

    Interface Host

    plugin.host: the player's own core actions.

    The player's core actions (play/pause, stop, step seeks, speed, volume, fullscreen…) are commands of the player itself, host/<action> in the binding table. Running them through host.run gives a plugin's own buttons exactly the player's behaviour: the same checks, the same accumulation of repeated presses and the same on-screen text, instead of reimplementing them with Player calls.

    The plugin's bar buttons stop playback and mute exactly as the player's own keys do, with the same on-screen text. Each callback runs a core action; the player applies its checks and rejects with unavailable while the action is disabled, which the bar ignores.

    const run = (action: HostAction) =>
    plugin.host.run(action).catch((error: PluginError) => {
    if (error.code !== "unavailable") throw error; // disabled right now
    });
    bar.on("stop", () => run("stop"));
    bar.on("mute", () => run("mute"));

    1.0.0

    interface Host {
        run(action: HostAction): Promise<void>;
        run(
            action: "seek-backward" | "seek-forward",
            options: { seconds: number },
        ): Promise<void>;
    }
    Index
    • Run a core action exactly like its menu item or key: same checks, same on-screen text. Resolves when it finished (or was dropped because the same action is still running). Rejects unavailable when disabled, invalid for an unknown id. Needs commands.

      Prefer this over reimplementing playback buttons.

      Parameters

      Returns Promise<void>

      The plugin's own Play button behaves exactly like the player's Space key, including its on-screen text. host.run runs the core action with the player's checks; it resolves when the action finished, and rejects with unavailable while the action is disabled (nothing open).

      bar.on("playPause", async () => {
      try {
      await plugin.host.run("play-pause");
      } catch (error) {
      if ((error as PluginError).code !== "unavailable") throw error;
      // Nothing to play: the button simply does nothing.
      }
      });

      unavailable (rejects) The action is disabled right now (nothing open, no window for fullscreen).

      invalid (rejects) An unknown action, or seconds out of range.

      1.0.0

    • One step seek of seconds (0.1–3600 in tenths) instead of the Player.setStepSeek step: the same checks, mode (exact or keyframes), accumulation and on-screen text as ← / →. Use it for more seek steps of your own (Ctrl+→ and the like) so that they add up with the core's and land the same way.

      In keyframe mode it resolves once the seek has landed (so player.state.position is current after the await); presses that add up resolve together, the last with the text. In exact mode it resolves once the seek is submitted, as before. invalid for seconds out of range.

      Parameters

      • action: "seek-backward" | "seek-forward"
      • options: { seconds: number }

      Returns Promise<void>

      0.5.1

      1.5.19

      The plugin's "+30 s" button seeks forward 30 seconds and shows the same text as →. Passing seconds makes the core step seek use that step with the player's mode (exact or keyframes); quick presses of it and of → add up into one seek.

      bar.on("forward30", () => plugin.host.run("seek-forward", { seconds: 30 }));
      

      unavailable (rejects) The action is disabled right now (nothing open, no window for fullscreen).

      invalid (rejects) An unknown action, or seconds out of range.