player-state
https://open.spotify.com/playlist/37i9dQZF1E4u2kB4r0C698?si=lz_b2bR9RI2ZA1IlxRGYVw&pi=a-7_c-f0NWSDuD--- title: PlayerState description: PlayerState type definition.
note
This type is deducted from Spotify's internal usage. It may not be accurate and may change in the future.
type PlayerState = {
timestamp: number;
context_uri: string;
context_url: string;
context_restrictions: Record<string, string[]>;
index?: {
page: number;
track: number;
};
track?: ProvidedTrack;
playback_id?: string;
playback_quality?: {
bitrate_level: string;
hifi_status?: string;
strategy?: string;
target_bitrate_available?: boolean;
target_bitrate_level?: string;
}
playback_speed?: number;
position_as_of_timestamp: number;
duration: number;
is_playing: boolean;
is_paused: boolean;
is_buffering: boolean;
play_origin: {
feature_identifier: string;
feature_version: string;
view_uri?: string;
external_referrer?: string;
referrer_identifier?: string;
device_identifier?: string;
};
options: {
shuffling_context?: boolean;
repeating_context?: boolean;
repeating_track?: boolean;
};
restrictions: Record<string, string[]>;
suppressions: {
providers: string[];
};
debug?: {
log: string[];
};
prev_tracks?: ProvidedTrack[];
next_tracks?: ProvidedTrack[];
context_metadata: Metadata;
page_metadata: Metadata;
session_id: string;
queue_revision?: string;
};
Property | Type | Description |
---|---|---|
timestamp | number | Timestamp. |
context_uri | string | Context URI from which the track played from. |
context_url | string | Context internal URL. |
context_restrictions | Record<string, string[]> | Context restrictions. |
index | object | undefined | Track index. |
track | ProvidedTrack | undefined | Current track. |
playback_id | string | undefined | Playback ID. |
playback_quality | object | undefined | Playback quality. |
playback_speed | number | undefined | Playback speed. |
position_as_of_timestamp | number | Position as of timestamp. Relative to the track's start. |
duration | number | Track duration. |
is_playing | boolean | Whether the track is playing. |
is_paused | boolean | Whether the track is paused. |
is_buffering | boolean | Whether the track is buffering. |
play_origin | object | Play origin (client info). |
options | object | Repeat and shuffle state. |
restrictions | Record<string, string[]> | Restrictions. |
suppressions | object | Suppressions from providers. |
debug | object | undefined | Debug info. |
prev_tracks | ProvidedTrack[] | undefined | Previous tracks. |
next_tracks | ProvidedTrack[] | undefined | Next tracks. |
context_metadata | Metadata | Context metadata. |
page_metadata | Metadata | Page metadata. |
session_id | string | Session ID. |
queue_revision | string | undefined | Queue revision. |