Documentation

PlaylistInterface extends QueueInterface, UriInterface

Provides an interface for managing Sonos playlists on the current network.

Table of Contents

Methods

addTrack()  : QueueInterface
Add a track to the queue.
addTracks()  : QueueInterface
Add tracks to the queue.
clear()  : QueueInterface
Remove all tracks from the queue.
delete()  : void
Delete this playlist from the network.
getId()  : string
Get the id of the playlist.
getMetaData()  : string
Get the metadata xml for this object.
getName()  : string
Get the name of the playlist.
getTracks()  : array<string|int, TrackInterface>
Get tracks from the queue.
getUri()  : string
Get the URI for this object.
moveTrack()  : PlaylistInterface
Move a track from one position in the playlist to another.
removeTrack()  : bool
Remove a track from the queue.
removeTracks()  : bool
Remove tracks from the queue.

Methods

addTrack()

Add a track to the queue.

public addTrack(string|UriInterface $track[, int|null $position = null ]) : QueueInterface
Parameters
$track : string|UriInterface

The URI of the track to add, or an object that implements the UriInterface

$position : int|null = null

The position to insert the track in the queue (zero-based), by default the track will be added to the end of the queue

Return values
QueueInterface

addTracks()

Add tracks to the queue.

public addTracks(array<string|int, string>|array<string|int, UriInterface$tracks[, int|null $position = null ]) : QueueInterface
Parameters
$tracks : array<string|int, string>|array<string|int, UriInterface>

An array where each element is either the URI of the tracks to add, or an object that implements the UriInterface

$position : int|null = null

The position to insert the tracks in the queue (zero-based), by default the tracks will be added to the end of the queue

Return values
QueueInterface

getId()

Get the id of the playlist.

public getId() : string
Return values
string

getMetaData()

Get the metadata xml for this object.

public getMetaData() : string
Return values
string

getName()

Get the name of the playlist.

public getName() : string
Return values
string

getTracks()

Get tracks from the queue.

public getTracks([int $start = 0 ][, int $total = 0 ]) : array<string|int, TrackInterface>
Parameters
$start : int = 0

The zero-based position in the queue to start from

$total : int = 0

The maximum number of tracks to return

Return values
array<string|int, TrackInterface>

getUri()

Get the URI for this object.

public getUri() : string
Return values
string

moveTrack()

Move a track from one position in the playlist to another.

public moveTrack(int $from, int $to) : PlaylistInterface
Parameters
$from : int

The current position of the track in the playlist (zero-based)

$to : int

The desired position in the playlist (zero-based)

Return values
PlaylistInterface

removeTrack()

Remove a track from the queue.

public removeTrack(int $position) : bool
Parameters
$position : int

The zero-based position of the track to remove

Return values
bool

removeTracks()

Remove tracks from the queue.

public removeTracks(array<string|int, int> $positions) : bool
Parameters
$positions : array<string|int, int>

The zero-based positions of the tracks to remove

Return values
bool
On this page

Search results