setAudioVolume (v1.2)

Estimated reading time: 1 minute

此API提供了更改音频音量级别的功能。

语法

http://<Base URL>/audio

认证级别

generic

需求

params' Elements
An object composed of the following pair(s).
name type multiplicity default description
target string 1 声音的输出目标。 定义了以下值。
  • -向设备的所有输出设备输出声音。 如果所有输出的静音信息相同,则设置此值。
  • “扬声器”-向扬声器输出声音
  • “耳机”-输出声音到耳机
volume string 1 要设置的卷级别。应用以下格式。
  • "N" - N是一个数字字符串 (ex. "25"). 音量设置为N级。
  • "+N" - N是一个数字字符串 (ex. "+14"). 音量增加了N。
  • "-N" - N是一个数字字符串 (ex. "-10"). 音量减少了N。
ui string ? null 如果需要显示UI(音量条等),请将其设置为“开”。
  • “开”-显示UI。
  • "关" - UI没有显示。
  • 错误 - 未指定。(取决于服务器)
JSON Example
{
    "method": "setAudioVolume",
    "id": 98,
    "params": [{
        "volume": "5",
        "ui": "on",
        "target": "speaker"
    }],
    "version": "1.2"
}

Response

result's Elements
Not necessary.
JSON Example
{
    "result": [],
    "id": 98
}
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: 13 Feb 2019