Start the party!
You can start your whole network playing music:
$controllers = $sonos->getControllers();
foreach ($controllers as $controller) {
if ($controller->getState() !== Controller::STATE_PLAYING) {
$controller->play();
}
}
Or check on your networks current status:
$controllers = $sonos->getControllers();
foreach ($controllers as $controller) {
echo $controller->getRoom() . " = " . $controller->getStateName() . "\n";
}
As well as a bunch of other stuff:
# I'm bored of this track
$controller->next();
# Oh wait, that was my favourite song
$controller->previous();
# Shush a minute
$controller->pause();
You can position to specific tracks, or a specific part of a track:
# Start at the beginning of the queue
$controller->selectTrack(0);
# I love this bit
$controller->seek(Time::inSeconds(55));
# 3 minutes and 15 seconds
$controller->seek(Time::parse("3:15"));
See the Tracks documentation for info on adding tracks to your controller’s queue.