$id
$id : string
Provides an interface for managing Sonos playlists on the current network.
$controller : \duncan3dc\Sonos\Interfaces\ControllerInterface
$trackFactory : \duncan3dc\Sonos\Interfaces\Tracks\FactoryInterface
__construct(string|\duncan3dc\DomParser\XmlElement $param, \duncan3dc\Sonos\Interfaces\ControllerInterface $controller)
Create an instance of the Playlist class.
string|\duncan3dc\DomParser\XmlElement | $param | The id of the playlist, or an xml element with the relevant attributes |
\duncan3dc\Sonos\Interfaces\ControllerInterface | $controller | A controller instance on the playlist's network |
getTracks(integer $start, integer $total) : array<mixed,\duncan3dc\Sonos\Interfaces\TrackInterface>
Get tracks from the queue.
integer | $start | The zero-based position in the queue to start from |
integer | $total | The maximum number of tracks to return |
addTrack(string|\duncan3dc\Sonos\Interfaces\UriInterface $track, integer $position = null) : $this
Add a track to the queue.
string|\duncan3dc\Sonos\Interfaces\UriInterface | $track | The URI of the track to add, or an object that implements the UriInterface |
integer | $position | The position to insert the track in the queue (zero-based), by default the track will be added to the end of the queue |
addTracks(array<mixed,string>|array<mixed,\duncan3dc\Sonos\Interfaces\UriInterface> $tracks, integer $position = null) : $this
Add tracks to the queue.
array<mixed,string>|array<mixed,\duncan3dc\Sonos\Interfaces\UriInterface> | $tracks | An array where each element is either the URI of the tracks to add, or an object that implements the UriInterface |
integer | $position | The position to insert the tracks in the queue (zero-based), by default the tracks will be added to the end of the queue |
browse(string $type, integer $start, integer $limit = 1) : mixed
Send a browse request to the controller to get queue info.
string | $type | The type of browse request to send |
integer | $start | The position to start browsing from |
integer | $limit | The number of tracks from the queue to return |
addUris(array<mixed,\duncan3dc\Sonos\Interfaces\UriInterface> $tracks, integer $position = null) : void
Add tracks to the playlist.
If no $position is passed the track will be added to the end of the playlist
array<mixed,\duncan3dc\Sonos\Interfaces\UriInterface> | $tracks | The tracks to add |
integer | $position | The position to insert the track in the playlist (zero-based) |