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

    Interface PlayerState

    An immutable view of the player. Keep one to make a later call conditional on it.

    Without an open Player.stream, Player.state only updates at start, after this plugin's own operations and with the state an event carries.

    interface PlayerState {
        sourceId: number;
        kind: "media" | "stream";
        phase: "empty" | "loading" | "ready" | "ended" | "error";
        source: string | null;
        paused: boolean;
        position: number | null;
        duration: number | null;
        rate: number;
        volume: number;
        muted: boolean;
        endReason: "unknown" | "stopped" | "natural" | "replaced" | null;
        error: string | null;
        can: {
            pause: boolean;
            seek: boolean;
            rate: boolean;
            restart: boolean;
            close: boolean;
            snapshot: boolean;
            next: boolean;
            previous: boolean;
        };
        audioTracks: AudioTrack[]
        | null;
        loop?: { a: number; b: number; count: number | null } | null;
        audioOutput?: { requested: string | null; active: string | null };
    }
    Index
    sourceId: number

    Changes every time a source is opened, even the same file again.

    kind: "media" | "stream"

    stream for a generated source (Player.openStream).

    phase: "empty" | "loading" | "ready" | "ended" | "error"

    The source's life cycle.

    source: string | null

    Path or URL; null when empty. A generated stream started with Player.openStream has the opaque producer://<n> (do not parse it); one a file resolver generates (FileResolverOptions) keeps the path that was opened. Tell streams apart by kind, not by source.

    paused: boolean

    Playback is paused.

    position: number | null

    Seconds, null without media.

    duration: number | null

    Seconds, null when unknown (live streams).

    rate: number

    Playback speed (1 = normal).

    volume: number

    Device volume 0–200.

    muted: boolean

    Device output is muted.

    endReason: "unknown" | "stopped" | "natural" | "replaced" | null

    Why the last playthrough stopped.

    error: string | null

    Load failure text when phase is error.

    can: {
        pause: boolean;
        seek: boolean;
        rate: boolean;
        restart: boolean;
        close: boolean;
        snapshot: boolean;
        next: boolean;
        previous: boolean;
    }

    Which controls the current source allows.

    Type Declaration

    audioTracks: AudioTrack[] | null

    The media's audio tracks; null before they are known.

    loop?: { a: number; b: number; count: number | null } | null

    The A-B loop (setLoop) as requested; count null = endless. Cleared by a new source. The SDK always sets it (null = no loop); it is optional only so hand-written test states without it still type-check.

    Type Declaration

    • { a: number; b: number; count: number | null }
      • a: number

        Loop start, seconds.

      • b: number

        Loop end, seconds.

      • count: number | null

        Requested repetitions (not the remaining ones); null = endless.

    • null
    audioOutput?: { requested: string | null; active: string | null }

    The output device setAudioDevice asked for and the one in use (null = system default). Always set by the SDK; optional for the same reason as loop.

    Type Declaration

    • requested: string | null

      The device id asked for, null = system default.

    • active: string | null

      The device in use, null = system default.