© 2013 Samsung Electronics Co., Ltd. All rights reserved.
This API provides the audio control features (such as volume and mute) on the TV associated device.
There will be a webapis.audiocontrol object that allows accessing the functionality of the audiocontrol API.
For more information on the Audio Control features, see Audio Control Guide.
Interface | Method |
---|---|
WebAPIsAudioControlManager | |
AudioControlManager | boolean setMute(boolean mute) boolean getMute() unsigned short getOutputMode() boolean setVolume(unsigned short volume) boolean setVolumeUp() boolean setVolumeDown() unsigned short getVolume() void playSound(unsigned short soundType) |
The AudioControl module supports the control of audio-related functions of the Smart TV platform.
[NoInterfaceObject] interface WebAPIsAudioControlManager { readonly attribute AudioControlManager audiocontrol; };
WebAPIs implements WebAPIsAudioControlManager;
A webapis.audiocontrol object provides access to the functionality of the TV Audio Control module.
The AudioControl interface that provides access to the TV audio API. This manager interface exposes the TV audio API to provide functionality for setting audio sources, volume, etc.
[NoInterfaceObject] interface AudioControlManager { const short MODE_AUDIO_OUTPUT_PCM = 0; const short MODE_AUDIO_OUTPUT_DOLBY = 1; const short MODE_AUDIO_OUTPUT_DTS = 2; const short AUDIO_SOUND_TYPE_UP = 1; const short AUDIO_SOUND_TYPE_DOWN = 2; const short AUDIO_SOUND_TYPE_LEFT = 3; const short AUDIO_SOUND_TYPE_RIGHT = 4; const short AUDIO_SOUND_TYPE_PAGE_LEFT = 5; const short AUDIO_SOUND_TYPE_PAGE_RIGHT = 6; const short AUDIO_SOUND_TYPE_BACK = 7; const short AUDIO_SOUND_TYPE_SELECT = 8; const short AUDIO_SOUND_TYPE_CANCEL = 9; const short AUDIO_SOUND_TYPE_WARNING = 10; const short AUDIO_SOUND_TYPE_KEYPAD = 11; const short AUDIO_SOUND_TYPE_KEYPAD_ENTER = 12; const short AUDIO_SOUND_TYPE_KEYPAD_DEL = 13; const short AUDIO_SOUND_TYPE_SMARTCONTROL_MOVE = 14; const short AUDIO_SOUND_TYPE_SMARTCONTROL_SELECT = 15; const short AUDIO_SOUND_TYPE_MOVE = 16; const short AUDIO_SOUND_TYPE_PREPARING = 17; boolean setMute(boolean mute); boolean getMute(); unsigned short getOutputMode(); boolean setVolume(unsigned short volume); boolean setVolumeUp(); boolean setVolumeDown(); unsigned short getVolume(); void playSound(unsigned short soundType); };
short MODE_AUDIO_OUTPUT_PCM
identifier for the PCM audio output mode
short MODE_AUDIO_OUTPUT_DOLBY
identifier for the DOLBY audio output mode
short MODE_AUDIO_OUTPUT_DTS
identifier for the DTS audio output mode
short AUDIO_SOUND_TYPE_UP
identifier for the UP sound
short AUDIO_SOUND_TYPE_DOWN
identifier for the DOWN sound
short AUDIO_SOUND_TYPE_LEFT
identifier for the LEFT sound
short AUDIO_SOUND_TYPE_RIGHT
identifier for the RIGHT sound
short AUDIO_SOUND_TYPE_PAGE_LEFT
identifier for the PAGE LEFT sound
short AUDIO_SOUND_TYPE_PAGE_RIGHT
identifier for the PAGE RIGHT sound
short AUDIO_SOUND_TYPE_BACK
identifier for the BACK sound
short AUDIO_SOUND_TYPE_SELECT
identifier for the SELECT sound
short AUDIO_SOUND_TYPE_CANCEL
identifier for the CANCEL sound
short AUDIO_SOUND_TYPE_WARNING
identifier for the WARNING sound
short AUDIO_SOUND_TYPE_KEYPAD
identifier for the KEYPAD sound
short AUDIO_SOUND_TYPE_KEYPAD_ENTER
identifier for the KEYPAD ENTER sound
short AUDIO_SOUND_TYPE_KEYPAD_DEL
identifier for the KEYPAD DEL sound
short AUDIO_SOUND_TYPE_SMARTCONTROL_MOVE
identifier for the SMART CONTROL MOVE sound
short AUDIO_SOUND_TYPE_SMARTCONTROL_SELECT
identifier for the SMART CONTROL SELECT sound
short AUDIO_SOUND_TYPE_MOVE
identifier for the MOVE sound
short AUDIO_SOUND_TYPE_PREPARING
identifier for the PREPARING sound
setMute
Sets the muting state of the audio device.
boolean setMute(boolean mute);
with error type UnknownError, In the case of any other error.
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
webapis.audiocontrol.setMute(true);
getMute
Gets the muting state of the audio device.
boolean getMute();
with error type UnknownError, In the case of any other error.
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
try { if (webapis.audiocontrol.getMute()) { console.log("tv is on mute"); } else { console.log("tv is not on mute"); } } catch (error) { console.log(error.name); }
getOutputMode
Gets the current audio output mode (PCM, DOLBY, DTS, ..)
unsigned short getOutputMode();
with error type UnknownError, In the case of any other error.
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
try { var output = webapis.audiocontrol.getOutputMode(); switch(output) { case webapis.audiocontrol.MODE_AUDIO_OUTPUT_PCM : console.log("audio mode is PCM"); break; case webapis.audiocontrol.MODE_AUDIO_OUTPUT_DOLBY : console.log("audio mode is DOLBY"); break; case webapis.audiocontrol.MODE_AUDIO_OUTPUT_DTS : console.log("audio mode is DTS"); break; } } catch (error) { console.log(error.name); }
setVolume
Sets the volume level on Smart TV system. The volume range is 0 ~ 100.
boolean setVolume(unsigned short volume);
with error type UnknownError In the case of any other error.
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
with error type InvalidValuesError if the input attributes do not contain a valid value
with error type TypeMismatchError if any of the input attributes are of the wrong type
var volume = 10; try { if (webapis.audiocontrol.setVolume(volume)) { console.log("Volume is " + volume); } } catch (error) { console.log(error.name); }
setVolumeUp
Raises the volume level up on the Smart TV system. The volume range is 0 ~ 100. If setVolumeUp() is invoked when the volume is 100, it will be ignored.
boolean setVolumeUp();
with error type UnknownError In the case of any other error.
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
try { if (webapis.audiocontrol.setVolumeUp()) { console.log("Volume is up"); } } catch (error) { console.log(error.name); }
setVolumeDown
Lowers the volume level on the Smart TV system. The volumn range is 0 ~ 100. If setVolumeDown() is invoked when volume is 0, it will be ignored.
boolean setVolumeDown();
with error type UnknownError In the case of any other error.
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
try { if (webapis.audiocontrol.setVolumeDown()) { console.log("Volume is down"); } } catch (error) { console.log(error.name); }
getVolume
Gets the volume level from the Smart TV system. The volumn range is 0 ~ 100.
unsigned short getVolume();
with error type UnknownError In the case of any other error.
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
try { var volume = webapis.audiocontrol.getVolume(); console.log("Volume is " + volume); } catch (error) { console.log(error.name); }
playSound
Plays a specific beep sound
void playSound(unsigned short soundType);
with error type UnknownError In the case of any other error.
with error type NotSupportedError if the feature is not supported.
with error type SecurityError if this functionality is not allowed.
with error type InvalidValuesError if the input attributes do not contain a valid value
with error type TypeMismatchError if any of the input attributes are of the wrong type
try { webapis.audiocontrol.playSound(webapis.audiocontrol.AUDIO_SOUND_TYPE_UP); } catch (error) { console.log(error.name); }
module AudioControl { [NoInterfaceObject] interface WebAPIsAudioControlManager { readonly attribute AudioControlManager audiocontrol; }; WebAPIs implements WebAPIsAudioControlManager; [NoInterfaceObject] interface AudioControlManager { const short MODE_AUDIO_OUTPUT_PCM = 0; const short MODE_AUDIO_OUTPUT_DOLBY = 1; const short MODE_AUDIO_OUTPUT_DTS = 2; const short AUDIO_SOUND_TYPE_UP = 1; const short AUDIO_SOUND_TYPE_DOWN = 2; const short AUDIO_SOUND_TYPE_LEFT = 3; const short AUDIO_SOUND_TYPE_RIGHT = 4; const short AUDIO_SOUND_TYPE_PAGE_LEFT = 5; const short AUDIO_SOUND_TYPE_PAGE_RIGHT = 6; const short AUDIO_SOUND_TYPE_BACK = 7; const short AUDIO_SOUND_TYPE_SELECT = 8; const short AUDIO_SOUND_TYPE_CANCEL = 9; const short AUDIO_SOUND_TYPE_WARNING = 10; const short AUDIO_SOUND_TYPE_KEYPAD = 11; const short AUDIO_SOUND_TYPE_KEYPAD_ENTER = 12; const short AUDIO_SOUND_TYPE_KEYPAD_DEL = 13; const short AUDIO_SOUND_TYPE_SMARTCONTROL_MOVE = 14; const short AUDIO_SOUND_TYPE_SMARTCONTROL_SELECT = 15; const short AUDIO_SOUND_TYPE_MOVE = 16; const short AUDIO_SOUND_TYPE_PREPARING = 17; boolean setMute(boolean mute); boolean getMute(); unsigned short getOutputMode(); boolean setVolume(unsigned short volume); boolean setVolumeUp(); boolean setVolumeDown(); unsigned short getVolume(); void playSound(unsigned short soundType); }; };