Properties

Methods

getStateName()

getStateName() : string

Get the current state of the group of speakers as the string reported by sonos: PLAYING, PAUSED_PLAYBACK, etc

Returns

string

getState()

getState() : integer

Get the current state of the group of speakers.

Returns

integer —

One of the class STATE_ constants

setState()

setState(integer  $state) : $this

Set the state of the group.

Parameters

integer $state

One of the class STATE_ constants

Returns

$this

play()

play() : $this

Start playing the active music for this group.

Returns

$this

pause()

pause() : $this

Pause the group.

Returns

$this

next()

next() : $this

Skip to the next track in the current queue.

Returns

$this

previous()

previous() : $this

Skip back to the previous track in the current queue.

Returns

$this

selectTrack()

selectTrack(integer  $position) : $this

Skip to the specific track in the current queue.

Parameters

integer $position

The zero-based position of the track to skip to

Returns

$this

seek()

seek(\duncan3dc\Sonos\Interfaces\Utils\TimeInterface  $position) : $this

Seeks to a specific position within the current track.

Parameters

\duncan3dc\Sonos\Interfaces\Utils\TimeInterface $position

The position to seek to in the track

Returns

$this

getMediaInfo()

getMediaInfo() : array

Get the currently active media info.

Returns

array

isStreaming()

isStreaming() : boolean

Check if this controller is currently playing a stream.

Returns

boolean

useStream()

useStream(\duncan3dc\Sonos\Tracks\Stream  $stream) : $this

Play a stream on this controller.

Parameters

\duncan3dc\Sonos\Tracks\Stream $stream

The Stream object to play

Returns

$this

useLineIn()

useLineIn(\duncan3dc\Sonos\Interfaces\SpeakerInterface|null  $speaker = null) : static

Play a line-in from a speaker.

If no speaker is passed then the current controller's is used.

Parameters

\duncan3dc\Sonos\Interfaces\SpeakerInterface|null $speaker

The speaker to get the line-in from

Returns

static

isUsingQueue()

isUsingQueue() : boolean

Check if this controller is currently using its queue.

Returns

boolean

useQueue()

useQueue() : $this

Set this controller to use its queue (rather than a stream).

Returns

$this

addSpeaker()

addSpeaker(\duncan3dc\Sonos\Interfaces\SpeakerInterface  $speaker) : $this

Adds the specified speaker to the group of this Controller.

Parameters

\duncan3dc\Sonos\Interfaces\SpeakerInterface $speaker

The speaker to add to the group

Returns

$this

removeSpeaker()

removeSpeaker(\duncan3dc\Sonos\Interfaces\SpeakerInterface  $speaker) : $this

Removes the specified speaker from the group of this Controller.

Parameters

\duncan3dc\Sonos\Interfaces\SpeakerInterface $speaker

The speaker to remove from the group

Returns

$this

getMode()

getMode() : array

Get the current play mode settings.

Returns

array —

An array with 2 boolean elements (shuffle and repeat)

setMode()

setMode(array  $options) : $this

Set the current play mode settings.

Parameters

array $options

An array with 2 boolean elements (shuffle and repeat)

Returns

$this

getRepeat()

getRepeat() : boolean

Check if repeat is currently active.

Returns

boolean

setRepeat()

setRepeat(boolean  $repeat) : $this

Turn repeat mode on or off.

Parameters

boolean $repeat

Whether repeat should be on or not

Returns

$this

getShuffle()

getShuffle() : boolean

Check if shuffle is currently active.

Returns

boolean

setShuffle()

setShuffle(boolean  $shuffle) : $this

Turn shuffle mode on or off.

Parameters

boolean $shuffle

Whether shuffle should be on or not

Returns

$this

getCrossfade()

getCrossfade() : boolean

Check if crossfade is currently active.

Returns

boolean

setCrossfade()

setCrossfade(boolean  $crossfade) : $this

Turn crossfade on or off.

Parameters

boolean $crossfade

Whether crossfade should be on or not

Returns

$this

getQueue()

getQueue() : \duncan3dc\Sonos\Queue

Get the queue for this controller.

Returns

\duncan3dc\Sonos\Queue

exportState()

exportState(boolean  $pause = true) : \duncan3dc\Sonos\Interfaces\ControllerStateInterface

Grab the current state of the Controller (including it's queue and playing attributes).

Parameters

boolean $pause

Whether to pause the controller or not

Returns

\duncan3dc\Sonos\Interfaces\ControllerStateInterface

restoreState()

restoreState(\duncan3dc\Sonos\Interfaces\ControllerStateInterface  $state) : $this

Restore the Controller to a previously exported state.

Parameters

\duncan3dc\Sonos\Interfaces\ControllerStateInterface $state

The state to be restored

Returns

$this

interrupt()

interrupt(\duncan3dc\Sonos\Interfaces\UriInterface  $track, integer  $volume = null) : $this

Interrupt the current audio with a track.

The current state of the controller is stored, the passed track is played, and then when it has finished the previous state of the controller is restored. This is useful for making announcements over the Sonos network.

Parameters

\duncan3dc\Sonos\Interfaces\UriInterface $track

The track to play

integer $volume

The volume to play the track at

Returns

$this

soap()

soap(string  $service, string  $action, array  $params = array()) : mixed

Send a soap request to the speaker.

Parameters

string $service

The service to send the request to

string $action

The action to call

array $params

The parameters to pass

Returns

mixed

getIp()

getIp() : string

Get the IP address of this speaker.

Returns

string

getName()

getName() : string

Get the "Friendly" name of this speaker.

Returns

string

getRoom()

getRoom() : string

Get the room name of this speaker.

Returns

string

getGroup()

getGroup() 

updateGroup()

updateGroup() 

setGroup()

setGroup(\duncan3dc\Sonos\string  $group) 

Parameters

\duncan3dc\Sonos\string $group

isCoordinator()

isCoordinator() : boolean

Check if this speaker is the coordinator of it's current group.

This method is only here for SpeakerInterface compatibility. A Controller instance is always the coordinator of it's group.

Returns

boolean

getUuid()

getUuid() : string

Get the uuid of this speaker.

Returns

string —

The uuid of this speaker

getVolume()

getVolume() : integer

Get the current volume of this speaker.

Returns

integer —

The current volume between 0 and 100

setVolume()

setVolume(integer  $volume) : $this

Set the volume of all the speakers this controller manages.

Parameters

integer $volume

The amount to set the volume to between 0 and 100

Returns

$this

adjustVolume()

adjustVolume(integer  $adjust) : $this

Adjust the volume of all the speakers this controller manages.

Parameters

integer $adjust

The amount to adjust by between -100 and 100

Returns

$this

isMuted()

isMuted() : boolean

Check if this speaker is currently muted.

Returns

boolean

mute()

mute(boolean  $mute = true) : $this

Mute this speaker.

Parameters

boolean $mute

Whether the speaker should be muted or not

Returns

$this

unmute()

unmute() : $this

Unmute this speaker.

Returns

$this

getIndicator()

getIndicator() : boolean

Check whether the indicator light is on or not.

Returns

boolean

setIndicator()

setIndicator(boolean  $on) : $this

Turn the indicator light on or off.

Parameters

boolean $on

Whether the indicator should be on or off

Returns

$this

getTreble()

getTreble() : integer

Get the treble equalisation level.

Returns

integer

setTreble()

setTreble(integer  $treble) : $this

Set the treble equalisation.

Parameters

integer $treble

The treble level (between -10 and 10)

Returns

$this

getBass()

getBass() : integer

Get the bass equalisation level.

Returns

integer

setBass()

setBass(integer  $bass) : $this

Set the bass equalisation.

Parameters

integer $bass

The bass level (between -10 and 10)

Returns

$this

getLoudness()

getLoudness() : boolean

Check whether loudness normalisation is on or not.

Returns

boolean

setLoudness()

setLoudness(boolean  $on) : $this

Set whether loudness normalisation is on or not.

Parameters

boolean $on

Whether loudness should be on or not

Returns

$this

getPlayMode()

getPlayMode(string  $type) : boolean

Get a particular PlayMode.

Parameters

string $type

The play mode attribute to get

Returns

boolean

setPlayMode()

setPlayMode(string  $type, boolean  $value) : $this

Set a particular PlayMode.

Parameters

string $type

The play mode attribute to update

boolean $value

The value to set the attribute to

Returns

$this