I am using the macbook simulator and raspberry to develop a web application.
I need to control the sound.
Switch between hdmi .
I am trying to call the following functions .
function volumeUp() {
return webOS.service.request("luna://com.webos.audio", {
method: "volumeUp",
onComplete: function (inResponse) { })
console.log('Volume increased by 1.');
// Do something
},
onFailure: function (inError) {
console.log('Failed to increase volume by 1.')
console.log('[' + inError.errorCode + ']: ' + inError.errorText);
// Do something
return;
},
});
}
function volumeDown() {
return webOS.service.request('luna://com.webos.audio', {
method: 'volumeDown',
onComplete: function (inResponse) { } }
console.log('Volume down by 1.');
// Do something
},
onFailure: function (inError) {
console.log('Failed to turn the volume down by 1.')
console.log('[' + inError.errorCode + ']: ' + inError.errorText);
// Do something
return;
},
});
}
function setMuted() {
return webOS.service.request('luna://com.webos.audio', {
method: 'setMuted',
onComplete: function (inResponse) { } }
console.log('Volume is muted');
// do something
},
onFailure: function (inError) {
console.log('Unable to mute the sound.');
console.log('[' + inError.errorCode + ']: ' + inError.errorText);
// Do something
return;
},
});
}
But they don’t work.
If you connect via ssh to raspberry . Then the command in the console works
luna-send -f -n 1 luna://com.webos.service.audio/media/setVolume '{"volume":1, "sessionId":0}'