setAudioVolume (v1.0)

Estimated reading time: 1 minute

This API provides the function to change the audio volume level.

Syntax

http://<Base URL>/audio

Authentication Level

generic

Request

params' Elements
An object composed of the following pair(s).
name type multiplicity default description
target string 1   Output target of the sound. The following values are defined.
  • "" - outputs sound to all output equipment of the device. If the mute information of all outputs is the same, this value is set.
  • "speaker" - outputs sound to the speaker(s).
  • "headphone" - outputs sound to the headphones
volume string 1   Volume level to set. The following formats are applied.
  • "N" - N is a numeric string (ex. "25"). The volume is set to level N.
  • "+N" - N is a numeric string (ex. "+14"). The volume is increased by an increment of N.
  • "-N" - N is a numeric string (ex. "-10"). The volume is reduced by an increment of N.
JSON Example
Set the volume to level 18.
{
    "method": "setAudioVolume",
    "id": 601,
    "params": [{
        "volume": "18",
        "target": "speaker"
    }],
    "version": "1.0"
}
Increase the volume level by 1.
{
    "method": "setAudioVolume",
    "id": 601,
    "params": [{
        "volume": "+1",
        "target": "speaker"
    }],
    "version": "1.0"
}

Response

result's Elements
The following value.
type description
integer Only 0 is returned.
JSON Example
{
    "result": [0],
    "id": 601
}
Error Code
The following error codes are important for this API. Refer to error code for other errors.
code Explanation
40800 Target is not supported or cannot be controlled for some device-specific reason.
40801 Volume is out of range.
Last modified: 6 Feb 2019