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

    Interface WireCommandsExperimental

    Bare command registrations (plugin.wire.commands): the player's declaration as given, a state of values and a handler. Experimental: the wire protocol is not semver; this member changes with versions.

    Commands.add checks the options, builds the declaration and keeps function fields current through the update passes. register sends a declaration of the plugin's own making and leaves its state to explicit WireCommand.update calls. The player checks the declaration and refuses it as for add; during activation the registration is awaited and a refusal is handled like add's (logged and skipped by the player's runner, failing startPlugin in tests).

    Playback ▸ Cycle Speed, bound to C, from a declaration written as the player takes it. Picking it runs run, as for a command of add.

    plugin.wire.commands.register({
    id: "rate.cycle",
    declaration: {
    // the player's fields, as commands.register takes them
    title: "Cycle Speed",
    path: ["Playback", "Cycle Speed"],
    order: 0,
    group: "domain",
    radio: false,
    bindings: ["C"],
    focus: null,
    repeat: false,
    },
    run: () => plugin.player.setRate(1.5),
    });

    1.7.0

    interface WireCommands {
        register(options: WireCommandOptions): WireCommand;
    }
    Index
    • Experimental

      Register a command with a declaration as the player takes it.

      Parameters

      Returns WireCommand

      The command, owned by this scope.

      Experimental: the wire protocol is not semver; this member changes with versions. declaration is commands.register's: title, path, order, group, radio, bindings, focus, repeat, button, category and home (as in CommandOptions). The SDK adds the id, the revision and the state and checks nothing in it: bindings must already be in the player's canonical form (Ctrl+H).

      invalid (throws) id is not a non-empty string, or declaration is not an object.

      conflict (throws) A command of this plugin already has the id.

      The command starts enabled; once the plugin has nothing to export, it greys it out with an explicit state. No update pass evaluates it.

      const exporter = plugin.wire.commands.register({ id: "export", declaration });
      await exporter.update({ enabled: false, reason: "Nothing to export" });

      1.7.0