setVolume command in the
groupVolume namespace to set group volume to a specific level and unmute the group if muted.
How it works
When your app sets the group volume, the group coordinator calculates the required changes to the volume level for each player in the group so that the result is the average volume level of the group as a whole. The group coordinator then adjusts its local volume and initiates network transactions with the other players in the group to adjust their volumes accordingly. While players adjust their volumes, the group coordinator may generate one or more
Since this command can generate additional network transactions and events, your app should optimize how often it is invoked to maintain a good user experience without flooding the network, such as when implementing a touch screen volume slider that controls a group of five players.
This command requires a
groupId to determine the target of the command. See the Control documentation for details.
See the table below for a description of the parameter in the body.
||number||The new group volume as an integer between 0 and 100, inclusive. If your app submits a number outside of this range, you will receive an
The group coordinator reports the group mute state in the
muted parameter of the
groupVolume event. If all players in the group are muted (the group mute state is true) then all players are unmuted in response to the
setVolume command, even if the volume level was not changed. However, if the group mute state is false, but one or more players in the group is individually muted, then these players will not be unmuted in response to the
setVolume is called on a group that has a
fixed group volume state that is true, the command will fail and you will receive an
ERROR_COMMAND_FAILED error. This is because groups with fixed volumes cannot be changed, for example, a group including a CONNECT with fixed line out would respond with this error if your app tried to set the volume on it.