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

    Interface PackageChange

    An install or uninstall in progress. The SDK never submits a change twice: after a lost reply it only queries the same request.

    An install or uninstall the player carries out in steps (preparing, activating, possibly restoring) until a terminal status. The SDK asks the player for the status about every 400 ms until then; done resolves with the terminal status and does not reject for a failed change: message says why.

    The OSD shows each step of the install and the end result. onChange runs for every new status; done resolves when the change is over.

    change.onChange((status) => void plugin.osd.show("Install: {}", [status]));
    const end = await change.done;
    if (end !== "committed") await plugin.osd.show("Not installed: {}", [change.message ?? end]);

    1.0.0

    interface PackageChange {
        status: PackageChangeStatus;
        message: string | null;
        onChange(listener: (status: PackageChangeStatus) => void): Disposable;
        done: Promise<PackageChangeStatus>;
        cancel(): Promise<void>;
    }
    Index
    • The status changed.

      Parameters

      Returns Disposable

      The plugin's progress window closes once the install is over, whatever the outcome. The listener receives each new status; the terminal ones are committed, cancelled, failed, failedDegraded and tooLate (tooLate only answers a cancel of a change that had committed, and committed may follow it).

      change.onChange((status) => {
      if (["committed", "cancelled", "failed", "failedDegraded", "tooLate"].includes(status))
      void progress.close();
      });

      1.0.0

    • Ask to cancel (it may be tooLate).

      Returns Promise<void>

      The install stops if it has not gone too far. cancel asks the player; the change then ends cancelled. When the change had already committed the player answers tooLate and done still resolves committed; a change that is restoring cannot be cancelled and ends failed or failedDegraded.

      await change.cancel();
      console.log(await change.done); // "cancelled"; "committed" when it was too late

      disabled (rejects) The plugin is stopping.

      1.0.0

    Current status.

    message: string | null

    Details for failures, null otherwise.

    Resolves with the final status.

    missing (rejects) The player no longer knows the change (a HostError with that code); a failed change is a terminal status, not a rejection.