spotifywebapipython.models.playerplaystate

@export
class PlayerPlayState:

Spotify Web API PlayerPlayState object.

Information about the user's current playback state, including track or episode, progress, and active device.

PlayerPlayState(root: dict = None)

Initializes a new instance of the class.

Arguments:
  • root (dict): Spotify Web API JSON response in dictionary format, used to load object attributes; otherwise, None to not load attributes.

Allows to update the user interface based on which playback actions are available within the current context.

A Context Object; can be null.

CurrentlyPlayingType: str

The object type of the currently playing item, or null if nothing is playing.

If not null, it can be one of track, episode, ad or unknown.

The device that is currently active.

Item: object

The currently playing track or episode; can be null.

Will be of type Track, Episode, or null.

IsAdvertisement: bool

True if the currently playing media is an advertisement; otherwise, false.

IsMuted: bool

True if the player device volume is zero (muted) OR there is no device; otherwise, false.

IsPlaying: bool

True if something is currently playing; otherwise, false.

IsRepeatEnabled: bool

True if repeat play (one or all) is enabled; otherwise, False.

The RepeatState property contains the actual repeat setting.

IsShuffleEnabled: bool

True if shuffle play is enabled; otherwise, False.

IsSmartShuffleEnabled: bool

True if smart shuffle play is enabled; otherwise, False.

ProgressMS: int

Progress into the currently playing track or episode; can be null.

RepeatState: str

The repeat state of the playing track: off, track, or context.

ShuffleState: str

If shuffle is on or off.

SmartShuffle: str

If smart shuffle is on or off.

Summary: str

Returns a summary of what is playing.

Timestamp: int

Unix Millisecond Timestamp when data was fetched.

def ToDictionary(self) -> dict:

Returns a dictionary representation of the class.

def ToString(self) -> str:

Returns a displayable string representation of the class.