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

    Interface Conditional

    Controls act on the current state by default. While a Player.stream (or anything else that follows the source) keeps player.state current, that is the state they act on; otherwise the SDK reads the state first (calls made together share one read). If another plugin or the user changed the source in between, the call fails with code stale and nothing happens. Pass ifCurrent to pin the call to an older snapshot instead (for example the state when a dialog opened); it is sent as given.

    The SDK refreshes player.state after its own operations, so a plugin's consecutive calls do not make each other stale. Player.open is unconditional unless ifCurrent is given.

    When the plugin's file ends, the next one starts, unless the user or another plugin opened something in the meantime. onEnd passes the state at the end; open with ifCurrent: ended is refused with stale when the source changed after that state, so nothing is replaced.

    media.onEnd(async (ended) => {
    try {
    await plugin.player.open(next, { ifCurrent: ended });
    } catch (error) {
    // Someone opened another file: leave it playing.
    if ((error as PluginError).code !== "stale") throw error;
    }
    });

    1.0.0

    interface Conditional {
        ifCurrent?: PlayerState;
    }

    Hierarchy (View Summary)

    Index
    ifCurrent?: PlayerState

    The state the call is conditional on; default: the current state (read first when no stream keeps player.state current).