playerVolume > setVolume

Use the setVolume command in the playerVolume namespace to set player volume and mute state.


Endpoint

POST


Request Parameters

This command requires a playerId 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.

Parameter Type Value
volume number (Optional) Between 0 and 100. If your app submits a number outside of this range, you will receive an ERROR_INVALID_PARAMETER error.
muted boolean (Optional) true to mute the player or false to unmute the player.

Note that while both parameters are optional, your app must send at least one parameter or the player will send an ERROR_MISSING_PARAMETERS error. See globalError for details.


Response

Returns an empty body with a success value of true if successful. The player generates a playerVolume event if the volume was changed.

In the event of a failure, returns a globalError.

Additionally, if setVolume is called on a player that has a fixed player volume state that is true, the command will fail and you will receive an ERROR_COMMAND_FAILED globalError. This is because players with fixed volumes cannot be changed, for example, a CONNECT with fixed line out would respond with this error if your app tried to set the volume on it.


Example

Request