Audio
Service URI - luna://com.webos.audio
Provides methods for volume control.
The Audio Setting service enables apps to control volume, with the following methods.
Methods
Method | Description | Supported in Emulator |
---|---|---|
setMuted | Mutes or unmutes the volume. | Yes |
volumeDown | Decreases the volume by 1. | Yes |
volumeUp | Increases the volume by 1. | Yes |
setMuted
Description
Mutes or unmutes the volume.
Parameters
Name | Required | Type | Description |
---|---|---|---|
muted | Required | Boolean | The flag that indicates whether to mute the volume or unmute the volume.
|
Call returns
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | The flag that indicates the success/failure of the request.
|
errorCode | Optional | Number | errorCode contains the error code if the method fails. The method returns errorCode only if it fails. See the Error Codes Reference of this method for more details. |
errorText | Optional | String | errorText contains the error text if the method fails. The method returns errorText only if it fails. See the Error Codes Reference of this method for more details. |
Error reference
Error Code | Error Message |
---|---|
1 | Not a valid JSON message |
Example
// One-time call
var request = webOS.service.request('luna://com.webos.audio', {
method: 'setMuted',
parameters: { muted: true },
onSuccess: function (inResponse) {
console.log('TV is muted');
// To-Do something
},
onFailure: function (inError) {
console.log('Failed to set muted');
console.log('[' + inError.errorCode + ']: ' + inError.errorText);
// To-Do something
return;
},
});
Return example
{
'returnValue': true
}
See also
volumeDown
Description
Decreases the volume by 1.
Parameters
None
Call returns
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | The flag that indicates the success/failure of the request.
|
errorCode | Optional | Number | errorCode contains the error code if the method fails. The method returns errorCode only if it fails. See the Error Codes Reference of this method for more details. |
errorText | Optional | String | errorText contains the error text if the method fails. The method returns errorText only if it fails. See the Error Codes Reference of this method for more details. |
Error reference
Error Code | Error Message |
---|---|
ERROR_3 | Parameters should be empty |
Example
// One-time call
var request = webOS.service.request('luna://com.webos.audio', {
method: 'volumeDown',
onSuccess: function (inResponse) {
console.log('The volume is decreased by 1.');
// To-Do something
},
onFailure: function (inError) {
console.log('Failed to decrease volume by 1.');
console.log('[' + inError.errorCode + ']: ' + inError.errorText);
// To-Do something
return;
}
});
Return example
{
'returnValue': true
}
See also
volumeUp
Description
Increases the volume by 1.
Parameters
None
Call returns
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | The flag that indicates the success/failure of the request.
|
errorCode | Optional | Number | errorCode contains the error code if the method fails. The method returns errorCode only if it fails. See the Error Codes Reference of this method for more details. |
errorText | Optional | String | errorText contains the error text if the method fails. The method returns errorText only if it fails. See the Error Codes Reference of this method for more details. |
Error reference
Error Code | Error Message |
---|---|
ERROR_3 | Parameters should be empty |
Example
// One-time call
var request = webOS.service.request('luna://com.webos.audio', {
method: 'volumeUp',
onComplete: function (inResponse) {
console.log('The volume is increased by 1.');
// To-Do something
},
onFailure: function (inError) {
console.log('Failed to increase volume by 1.');
console.log('[' + inError.errorCode + ']: ' + inError.errorText);
// To-Do something
return;
},
});
Return example
{
'returnValue': true
}
See also
No Headings