This API provides the audio control features (such as volume and mute) on the TV associated device. There will be a tizen.tvaudiocontrol object that allows access to the functionality of the TV Audio Control API.
Note that turning on mute mode does not change volume level but it simply disables any sound. Turning off the mute will enable sound with the volume level. If setVolumeUp or setVolumeDown functions are used, then mute is disabled.
Privilege level: public
Privilege: http://tizen.org/privilege/tv.audio
Warning: http://tizen.org/privilege/tv.audio (public level) has been deprecated since 5.0.
Parameters:
mute: The mute state (true = turn on the silent mode, false = turn off the silent mode)
Exceptions:
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method. This type of error is deprecated since Tizen 5.0.
with error type UnknownError in any other error case.
Code example:
// Turn on the silent mode
tizen.tvaudiocontrol.setMute(true);
Code example:
// Turn off the silent mode
tizen.tvaudiocontrol.setMute(false);
isMute
Gets the mute state.
boolean isMute();
Since: 2.3
Privilege level: public
Privilege: http://tizen.org/privilege/tv.audio
Warning: http://tizen.org/privilege/tv.audio (public level) has been deprecated since 5.0.
Return value:
boolean The current mute state
Exceptions:
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method. This type of error is deprecated since Tizen 5.0.
with error type UnknownError in any other error case.
Code example:
// Mute to turn off the sound
tizen.tvaudiocontrol.setMute(true);
// Check if it is mute or not
if (tizen.tvaudiocontrol.isMute()) {
console.log("At this moment, the sound output of this device is turned off.");
} else {
alert("It's not possible!");
}
Code example:
// Checks if increasing the volume makes the silent mode turned off.
// Mute to turn off the sound
tizen.tvaudiocontrol.setMute(true);
// By increasing the volume level, the mute state is changed to be off.
tizen.tvaudiocontrol.setVolumeUp();
// Check if it is mute or not
if (tizen.tvaudiocontrol.isMute()) {
alert("It's not possible! (API bug)");
} else {
console.log("setVolumeUp() turns off the silent mode.");
}
setVolume
Changes the volume level.
void setVolume(unsigned short volume);
Since: 2.3
The value of volume is allowed from 0 to 100. If an invalid value is passed, InvalidValuesError will occur.
Privilege level: public
Privilege: http://tizen.org/privilege/tv.audio
Warning: http://tizen.org/privilege/tv.audio (public level) has been deprecated since 5.0.
Parameters:
volume: The volume (the available volume range is 0 ~100)
Exceptions:
WebAPIException
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type SecurityError, if the application does not have the privilege to call this method. This type of error is deprecated since Tizen 5.0.
with error type UnknownError in any other error case.
Code example:
// Sets the volume
tizen.tvaudiocontrol.setVolume(10);
try {
tizen.tvaudiocontrol.setVolume(-1);
} catch (e) {
if (e.name === "InvalidValuesError") {
alert("The passed value value should be in the range of 0 to 100.");
}
}
setVolumeUp
Increases the volume by 1 level.
If it is called when the volume level is 100, it will be ignored
because the maximum volume level is 100. If mute is enabled,
then execution of this functions will disable it.
void setVolumeUp();
Since: 2.3
Privilege level: public
Privilege: http://tizen.org/privilege/tv.audio
Warning: http://tizen.org/privilege/tv.audio (public level) has been deprecated since 5.0.
Exceptions:
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method. This type of error is deprecated since Tizen 5.0.
with error type UnknownError in any other error case.
Code example:
// Sets the volume
tizen.tvaudiocontrol.setVolume(99);
tizen.tvaudiocontrol.setVolumeUp();
// Check if the current volume is 100 or not.
if (tizen.tvaudiocontrol.getVolume() === 100) {
alert("setVolumeUp() is successfully called.");
}
tizen.tvaudiocontrol.setVolumeUp();
// Check if the volume level has been changed or not at the maximum volume level.
if (tizen.tvaudiocontrol.getVolume() === 100) {
alert("setVolumeUp() is successfully called.");
}
setVolumeDown
Decreases the volume by 1 level.
void setVolumeDown();
Since: 2.3
If it is called when the volume level is 0, it will be
ignored because the minimum volume level is 0. If mute is enabled,
then execution of this functions will disable it.
Privilege level: public
Privilege: http://tizen.org/privilege/tv.audio
Warning: http://tizen.org/privilege/tv.audio (public level) has been deprecated since 5.0.
Exceptions:
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method. This type of error is deprecated since Tizen 5.0.
with error type UnknownError in any other error case.
Code example:
// Sets the volume
tizen.tvaudiocontrol.setVolume(1);
tizen.tvaudiocontrol.setVolumeDown();
// Check if the current volume is 0 or not.
if (tizen.tvaudiocontrol.getVolume() === 0) {
alert("setVolumeDown() is successfully called.");
}
tizen.tvaudiocontrol.setVolumeDown();
// Check if the volume level has been changed or not at the minimum volume level.
if (tizen.tvaudiocontrol.getVolume() === 0) {
alert("setVolumeDown() is successfully called.");
}
getVolume
Gets the current volume level.
unsigned short getVolume();
Since: 2.3
Privilege level: public
Privilege: http://tizen.org/privilege/tv.audio
Warning: http://tizen.org/privilege/tv.audio (public level) has been deprecated since 5.0.
Return value:
unsigned short The current volume (the volume range is 0 ~ 100)
Exceptions:
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method. This type of error is deprecated since Tizen 5.0.
with error type UnknownError in any other error case.
setVolumeChangeListener
Registers a volume change callback for getting notified when TV volume has been changed.
Note that this method overwrites the previously registered listener.
Privilege level: public
Privilege: http://tizen.org/privilege/tv.audio
Warning: http://tizen.org/privilege/tv.audio (public level) has been deprecated since 5.0.
Parameters:
callback: The method to invoke when the volume has been changed. It will not be triggered when the silent mode is changed.
Exceptions:
WebAPIException
with error type TypeMismatchError, if any input attribute is not compatible with the expected type for this attribute.
with error type SecurityError, if the application does not have the privilege to call this method. This type of error is deprecated since Tizen 5.0.
with error type UnknownError in any other error case.
Code example:
var expectedVolumeLevel = 50;
function onVolumeChanged(volume) {
if (volume === expectedVolumeLevel) {
console.log("Succeeded! The volume level has been changed to "+ volume+". ");
} else {
alert("Failed. The volume level has been changed to "+ volume+" . We expect 50.");
}
}
tizen.tvaudiocontrol.setVolume(0);
tizen.tvaudiocontrol.setVolumeChangeListener(onVolumeChanged);
tizen.tvaudiocontrol.setVolume(expectedVolumeLevel);
unsetVolumeChangeListener
Unregisters the volume change callback for detecting the volume changes.
void unsetVolumeChangeListener();
Since: 2.3
Privilege level: public
Privilege: http://tizen.org/privilege/tv.audio
Warning: http://tizen.org/privilege/tv.audio (public level) has been deprecated since 5.0.
Exceptions:
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method. This type of error is deprecated since Tizen 5.0.
with error type UnknownError in any other error case.
Code example:
var expectedVolumeLevel = 50;
function onVolumeChanged(volume) {
alert("This function must not be called.");
}
tizen.tvaudiocontrol.setVolume(0);
tizen.tvaudiocontrol.setVolumeChangeListener(onVolumeChanged);
tizen.tvaudiocontrol.unsetVolumeChangeListener();
tizen.tvaudiocontrol.setVolume(expectedVolumeLevel);
getOutputMode
Gets the current audio output mode.
AudioOutputMode getOutputMode();
Since: 2.3
Privilege level: public
Privilege: http://tizen.org/privilege/tv.audio
Warning: http://tizen.org/privilege/tv.audio (public level) has been deprecated since 5.0.
Return value:
AudioOutputMode The current audio output mode
Exceptions:
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method. This type of error is deprecated since Tizen 5.0.
with error type UnknownError in an unspecified error case.
playSound
Plays the sound of a specific beep.
void playSound(AudioBeepType type);
Since: 2.3
Privilege level: public
Privilege: http://tizen.org/privilege/tv.audio
Warning: http://tizen.org/privilege/tv.audio (public level) has been deprecated since 5.0.
Parameters:
type: The beep type to play
Exceptions:
WebAPIException
with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
with error type SecurityError, if the application does not have the privilege to call this method. This type of error is deprecated since Tizen 5.0.
with error type UnknownError in any other error case.
2.3. VolumeChangeCallback
This interface defines a volume change callback for getting notified information about the volume changes.
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
.samsungdeveloperconference.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
LinkedIn
.ads.linkedin.com, .linkedin.com
Advertising Cookies
These cookies gather information about your browser habits. They remember that
you've visited our website and share this information with other organizations such
as advertisers.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Preferences Submitted
You have successfully updated your cookie preferences.