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

    Interface SourceEventPayloads

    The data each SourceEvent carries, as the listener of Player.on gets it.

    state is the SDK's PlayerState, not the player's wire shape, so it can be passed as ifCurrent and to Player.isCurrent. The state of an opening or a ready is also taken into plugin.player.state when it is newer than what the plugin has.

    1.10.0

    interface SourceEventPayloads {
        "source.opening": {
            state: PlayerState;
            previous: { sourceId: number } | null;
        };
        "source.ready": { state: PlayerState };
        "source.ended": {
            state: PlayerState;
            reason: "error" | "stopped" | "natural" | "replaced" | "quit";
            error?: string;
        };
    }
    Index
    "source.opening": { state: PlayerState; previous: { sourceId: number } | null }

    A new source starts to open (also the same file again, and Player.restart). state is the player's state at that moment, as a PlayerState (pass it as ifCurrent or to Player.isCurrent); previous names the source that was open before it, null when nothing was.

    Type Declaration

    • state: PlayerState

      The player's state as the source starts to open.

    • previous: { sourceId: number } | null

      The source open before this one (null: nothing was open).

    "source.ready": { state: PlayerState }

    The source is loaded: its duration, tracks and seekability are known. Once per opening, after its source.opening.

    Type Declaration

    • state: PlayerState

      The player's state as the source became ready.

    "source.ended": {
        state: PlayerState;
        reason: "error" | "stopped" | "natural" | "replaced" | "quit";
        error?: string;
    }

    A source left playback: it played to its end (natural), was closed (stopped), another source took its place (replaced), it could not be played (error, with the failure text in error), or the player quits (quit, sent only to a plugin that is running then). state is that source's last state, with its last position, not the player's current one.

    Type Declaration

    • state: PlayerState

      The ended source's last state, as a PlayerState.

    • reason: "error" | "stopped" | "natural" | "replaced" | "quit"

      Why it left playback.

    • Optionalerror?: string

      The failure text, when reason is error and the player has one.