Skip to main content

PlayerState

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;
};
PropertyTypeDescription
timestampnumberTimestamp.
context_uristringContext URI from which the track played from.
context_urlstringContext internal URL.
context_restrictionsRecord<string, string[]>Context restrictions.
indexobject | undefinedTrack index.
trackProvidedTrack | undefinedCurrent track.
playback_idstring | undefinedPlayback ID.
playback_qualityobject | undefinedPlayback quality.
playback_speednumber | undefinedPlayback speed.
position_as_of_timestampnumberPosition as of timestamp. Relative to the track's start.
durationnumberTrack duration.
is_playingbooleanWhether the track is playing.
is_pausedbooleanWhether the track is paused.
is_bufferingbooleanWhether the track is buffering.
play_originobjectPlay origin (client info).
optionsobjectRepeat and shuffle state.
restrictionsRecord<string, string[]>Restrictions.
suppressionsobjectSuppressions from providers.
debugobject | undefinedDebug info.
prev_tracksProvidedTrack[] | undefinedPrevious tracks.
next_tracksProvidedTrack[] | undefinedNext tracks.
context_metadataMetadataContext metadata.
page_metadataMetadataPage metadata.
session_idstringSession ID.
queue_revisionstring | undefinedQueue revision.