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

NameRequiredTypeDescription
muted
Yes
Boolean
The flag that indicates whether to mute or unmute the volume.
  • true: Mute the volume.
  • false: Unmute the volume.

Call returns

NameRequiredTypeDescription
returnValue
Yes
Boolean
The flag that indicates the success/failure of the request.
  • true: Success
  • false: Failure
errorCode
No
Number
`errorCode` contains the error code if the method fails. The method returns `errorCode` only if it fails.
See the Error code reference of this method for more details.
errorText
No
String
`errorText` contains the error text if the method fails. The method returns `errorText` only if it fails.
See the Error code reference of this method for more details.

Error code 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

NameRequiredTypeDescription
returnValue
Yes
Boolean
The flag that indicates the success/failure of the request.
  • true: Success
  • false: Failure
errorCode
No
Number
`errorCode` contains the error code if the method fails. The method returns `errorCode` only if it fails.
See the Error code reference of this method for more details.
errorText
No
String
`errorText` contains the error text if the method fails. The method returns `errorText` only if it fails.
See the Error code reference of this method for more details.

Error code 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

NameRequiredTypeDescription
returnValue
Yes
Boolean
The flag that indicates the success/failure of the request.
  • true: Success
  • false: Failure
errorCode
No
Number
`errorCode` contains the error code if the method fails. The method returns `errorCode` only if it fails.
See the Error code reference of this method for more details.
errorText
No
String
`errorText` contains the error text if the method fails. The method returns `errorText` only if it fails.
See the Error code reference of this method for more details.

Error code 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