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

    Interface Bindings

    plugin.bindings: list and override every command's bindings, including the player's.

    The player's Mute command loses its default key, and later gets it back. set with [] saves an override that unbinds the command (remembered across launches); reset removes the override, so the command's own default bindings apply again.

    await plugin.bindings.set({ plugin: "host", command: "mute" }, []);
    // later
    await plugin.bindings.reset({ plugin: "host", command: "mute" });

    The player's binding table: every command's default keys (from CommandOptions.bindings, the player's own as host/<action>) and the user's overrides on top, saved across launches. A key-settings plugin lists the table, writes overrides and resets them; the player applies the change at once to every running plugin.

    1.0.0

    interface Bindings {
        list(): Promise<
            {
                commands: BindingInfo[];
                orphans: { ref: BindingRef; inputs: string[] }[];
            },
        >;
        set(ref: BindingRef, inputs: string[]): Promise<void>;
        reset(ref?: BindingRef): Promise<void>;
        onChange(listener: () => void): Disposable;
    }
    Index
    • Every declared command, and overrides whose command is gone.

      Returns Promise<
          {
              commands: BindingInfo[];
              orphans: { ref: BindingRef; inputs: string[] }[];
          },
      >

      A key-settings window shows which commands Ctrl+K is bound to now. list resolves with every declared command and its current bindings (the defaults with the user's overrides applied) and with the overrides whose command is not running (orphans).

      const { commands } = await plugin.bindings.list();
      const users = commands.filter((command) => command.current.includes("Ctrl+K"));
      console.log(users.map((command) => `${command.plugin}/${command.command}`)); // "host" for the player

      disabled (rejects) The plugin is stopping.

      1.0.0

    • Override a command's bindings ([] unbinds it); saved across launches. invalid for a bad binding, missing for an unknown command that has no override either. At most 16 inputs, syntax as CommandOptions.bindings.

      Parameters

      Returns Promise<void>

      invalid (rejects) A malformed binding, or more than 16.

      missing (rejects) An unknown command that has no override either.

      Mute now answers to M and to Ctrl+M. set replaces the command's bindings with the list given (an override saved across launches), so it repeats the default it keeps; [] would unbind it.

      await plugin.bindings.set({ plugin: "host", command: "mute" }, ["M", "Ctrl+M"]);
      

      1.0.0

    • Back to the defaults: one command, or every override when omitted.

      Parameters

      Returns Promise<void>

      missing (rejects) A command that has no override and is not declared.

      A "Restore defaults" button removes all of the user's overrides, so every command has its declared keys again. Without an argument reset clears every override; with a reference only that command's.

      await plugin.bindings.reset(); // every override
      

      1.0.0

    • The binding list changed (read list() again): a declaration or an override. At most every 200 ms, and only when the list itself changed, not when a plugin starts again with the same commands.

      Parameters

      • listener: () => void

      Returns Disposable

      The plugin's key list stays current when the user changes a key in the player or a plugin with other commands is installed. The listener carries no data and runs at most every 200 ms; the plugin reads the table again with list.

      plugin.bindings.onChange(async () => {
      const { commands } = await plugin.bindings.list(); // read the new table
      render(commands);
      });

      1.0.0