Samsung TVs allow developers to use voice commands such as Navigation, Search, Selection and Media Control to control their application.
The Voice Assistant in the TV can be Bixby or other assistants. Regardless of which assistant is used, the application will interact with it via the Voice Interaction APIs.
For best results, we recommend the application to be implemented with all the features that are described in this document.
The VoiceInteractionManagerObject interface defines what is instantiated by the WebAPIs object from the Tizen Platform.
There will be a webapis.voiceinteraction object that allows access to the functionality of the Voice Interaction API.
To use the Voice Interaction API, the following privileges must be declared in the manifest file of the application.
If they are not declared, all usage of these APIs are blocked, and security exceptions are thrown. To use these privileges, the minimum ‘required_version’ is 6.0.
readonlyVoiceInteractionManagervoiceinteraction
This attribute defines the namespace for voiceinteraction APIs.
2.2 VoiceInteractionContentContext
This interface represents information about the content context for an item.
[NoInterfaceObject] interface VoiceInteractionContentContext {
attribute long positionX;
attribute long positionY;
attribute DOMString title;
attribute boolean bFocused;
};
Attributes
longpositionX
The field for x-axis position of the item.
longpositionY
The field for y-axis position of the item.
DOMStringtitle
The field for the title of the item.
booleanbFocused
The field for whether this item has focus.
2.3 VoiceInteractionManager
The VoiceInteractionManager interface is the top-level interface for the VoiceInteractionManager API that provides access to the module functionalities.
Every voice interaction application should implement a callback function, so that the Assistant can operate the controls.
Your application can interact with voice assistant by passing the callbacks in webapis.voiceinteraction.setCallback and calling webapis.voiceinteraction.listen.
Except onupdatestate callback, the return value for the callback is the boolean flag for support or not.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
Developers must specify the current application status to the onupdatestate function to get a proper voice control from the Voice Assistant.
This function is called right before processing every utterance, so that the Voice Assistant can be aware of the application status dynamically.
Depending on the status, the callback function called could be different. Therefore, it is important to return the real status of the application.
VoiceApplicationState : the status of the current application status.
"None" : Application is in its default status. Same as "Player" status.
"List" : The application is showing something in list.
During this status, the utterances "Play this" or "Play" will call onselection(0).
The utterance "Previous" will call onnavigation ("NAV_PREVIOUS").
"Player" : The application is playing a piece of content.
During this status, the utterance "Play this" will call onplay().
Since : 6.0
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
console.log("Assistant tries to get app state");
return "List";
}
});
onnavigation
To support navigation controls via voice, the application should have the following callbacks. Otherwise, the Key Event will be generated.
voiceNavigation : The navigation enumeration via Voice.
Return Value :
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
Since : 6.0
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
console.log("Assistant tries to get app state");
return "List";
},
onnavigation : function (voiceNavigation) {
var bSupport = true;
console.log("onnavigation : " + voiceNavigation);
switch(voiceNavigation) {
case "NAV_PREVIOUS":
// "Previous page"
break;
case "NAV_NEXT":
// "Next page"
break;
case "NAV_LEFT":
// "Go to left"
break;
case "NAV_RIGHT":
// "Move to right"
break;
case "NAV_UP":
// "Move up"
break;
case "NAV_DOWN":
// "Go down"
break;
// If there is no callback implementation for these enums,
// TV will Generate Remote Control Key Events: "ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown".
case "NAV_SHOW_MORE":
// "Show me more"
break;
default:
bSupport = false;
break;
}
return bSupport;
}
});
onplay
Supports the media control to handle playback(Play).
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
Since : 6.0
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
console.log("Assistant tries to get app state");
return "Player";
},
onplay : function () {
// TV Default Action: Generates the Remote Control Key, "MediaPlay".
console.log("OnPlay called");
return true;
}
});
onpause
Supports the media control to handle playback(Pause).
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
Since : 6.0
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
console.log("Assistant tries to get app state");
return "Player";
},
onpause : function () {
// TV Default Action: Generates the Remote Control Key, "MediaPlayPause".
console.log("OnPause called");
return true;
}
});
onselection
To support selection controls via voice, the application should have the following callbacks.
This callback supports the ordinal, relative selection control.
voiceSelection : The relative index via voice, (ex. the last item is -1, the current item is 0, the first item is 1).
Return Value :
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
Since : 6.0
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
console.log("Assistant tries to get app state");
return "List";
},
onselection : function (voiceSelection) {
var bSupport = true;
console.log("onselection : " + voiceSelection);
switch(voiceSelection) {
case -1 :
// "Select the last one"
break;
case 0 :
// "Select this"
break;
default:
{
if(voiceSelection >= 1)
// "Select the first one"
{
// Select the (voiceSelection)th item
// index of the first item is 1
console.log("For Ordinal : " + voiceSelection);
}
else
{
bSupport = false;
}
}
break;
}
return bSupport;
}
});
ontitleselection
Title selection refers to an utterance in the format "Select {Title Name}".
To support the title selection via voice, the following two callbacks are required : onrequestcontentcontext and ontitleselection.
The onrequestcontentcontext callback provides the information regarding the content of the screen (such as title and position) to the Samsung TV.
This method will be invoked at the beginning of every utterance. The response consists of positionX(int), positionY(int), title(string), alias(string array) and bFocused(bool).
The title property is used for ASR conversion and the other properties are used to set the priority of each title.
The ontitleselection callback receives the title name from the utterance.
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
Since : 6.5
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
console.log("Assistant tries to get app state");
return "List";
},
onrequestcontentcontext : function () {
console.log("onrequestcontentcontext");
var result = [];
try {
var item = {
"positionX" : 0,
"positionY" : 0,
"title" : "Title Text1",
"alias" : ["Title1", "My Text1"],
"bFocused" : true
};
result.push(item);
var item2 = {
"positionX" : 1,
"positionY" : 0,
"title" : "Title Text2",
"alias" : ["Title2", "My Text2"],
"bFocused" : false
};
result.push(item2);
result.push(webapis.voiceinteraction.buildVoiceInteractionContentContextItem(2,0,"Title Text3", ["Title3", "My Text3"], false));
} catch (e) {
console.log("exception [" + e.code + "] name: " + e.name + " message: " + e.message);
}
return webapis.voiceinteraction.buildVoiceInteractionContentContextResponse(result);
},
ontitleselection : function (title) {
console.log("ontitleselection" + title);
return true;
}
});
onfastforward
Supports the media control to handle playback(FF).
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
Since : 6.0
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
console.log("Assistant tries to get app state");
return "Player";
},
onfastforward : function () {
// TV Default Action: Generates the Remote Control Key, "MediaFastForward".
console.log("onfastforward called");
return true;
}
});
onrewind
Supports the media control to handle playback(Rewind).
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
Since : 6.0
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
console.log("Assistant tries to get app state");
return "Player";
},
onrewind : function () {
// TV Default Action: Generates the Remote Control Key, "MediaRewind".
console.log("onrewind called");
return true;
}
});
onchangeappstate
To support the utterance of shortcut commands, the application must have the onchangeappstate callback.
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
Since : 6.0
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
console.log("Assistant tries to get app state");
return "None";
},
onchangeappstate: function (state) {
// TV Default Action: Launches the Samsung TV FirstScreen, Menu or Search application. Depending on the input parameter.
// "Go to Home", "Go to Settings", "Go to Search".
console.log("onchangeappstate : " + state);
var bSupport = true;
switch (state) {
case "Home":
// Go to App's Home
break;
default:
bSupport = false;
break;
}
return bSupport;
}
});
onchangeprevioustrack
In order to handle requests to move to the previous track via voice, the application should override the onchangeprevioustrack callback.
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
Since : 6.0
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
return "List";
},
onchangeprevioustrack : function () {
console.log("onchangeprevioustrack");
return true;
}
});
onchangenexttrack
In order to handle requests to move to the next track via voice, the application should override the onchangenexttrack callback.
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
Since : 6.0
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
return "List";
},
onchangenexttrack : function () {
console.log("onchangenexttrack");
return true;
}
});
onrestart
In order to handle requests to restart to this track via voice, the application should override the onrestart callback.
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
Since : 6.0
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
return "List";
},
onrestart : function () {
console.log("onrestart");
return true;
}
});
onskipbackward
In order to handle requests to skip backward via voice, the application should override the onskipbackward callback.
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
mode : MEDIA_FUNCTION_ON : Turning On / MEDIA_FUNCTION_OFF : Turning Off
Return Value :
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
mode : MEDIA_FUNCTION_ON : Turning On / MEDIA_FUNCTION_OFF : Turning Off
Return Value :
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
mode : MEDIA_FUNCTION_ON : Turning On / MEDIA_FUNCTION_OFF : Turning Off
Return Value :
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
zoom : MEDIA_ZOOM_IN : zoom in / MEDIA_ZOOM_OUT : zoom out
Return Value :
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
direction : MEDIA_ROTATE_LEFT : rotate left / MEDIA_ROTATE_RIGHT : rotate right
Return Value :
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
mode : MEDIA_FUNCTION_ON : Turning On / MEDIA_FUNCTION_OFF : Turning Off
Return Value :
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
mode : MEDIA_REPEAT_OFF : repeat mode off / MEDIA_REPEAT_ONE : repeat this track / MEDIA_REPEAT_ALL : repeat all tracks
Return Value :
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung device may perform its basic function.
Since : 6.0
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
return "List";
},
onchangerepeatmode : function (mode) {
console.log("onchangerepeatmode");
switch(mode) {
case "MEDIA_REPEAT_ONE" :
console.log("ONE");
break;
case "MEDIA_REPEAT_ALL" :
console.log("ALL");
break;
default :
console.log("OFF");
break;
}
return true;
}
});
onrequestcontentcontext
In order to support the voice title selection via voice, the application should override the onrequestcontentcontext callback, return the JsonObject string for the current content context list showing.
list : LIST_BOOKMARKS : bookmarks / LIST_WATCH_LATER : watch later / LIST_PREFERENCE : preference / LIST_SUBSCRIPTION : subscription
Return Value :
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung TV may perform its basic function.
Since : 6.5
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
return "List";
},
onadditiontolist : function (list) {
console.log("onadditiontolist");
switch(list) {
case "LIST_BOOKMARKS" :
console.log("Add this context to Bookmarks");
break;
case "LIST_WATCH_LATER" :
console.log("Add this context to Watch later");
break;
case "LIST_PREFERENCE" :
console.log("Like this context");
break;
case "LIST_SUBSCRIPTION" :
console.log("Subscribe to context");
break;
default :
break;
}
return true;
}
});
onremovalfromlist
In order to handle requests to remove this context from list via voice, the application should override the onremovalfromlist callback.
list : LIST_BOOKMARKS : bookmarks / LIST_WATCH_LATER : watch later / LIST_PREFERENCE : preference / LIST_SUBSCRIPTION : subscription
Return Value :
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung TV may perform its basic function.
Since : 6.5
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
return "List";
},
onremovalfromlist : function (list) {
console.log("onremovalfromlist");
switch(list) {
case "LIST_BOOKMARKS" :
console.log("Remove this context from Bookmarks");
break;
case "LIST_WATCH_LATER" :
console.log("Remove this context from Watch later");
break;
case "LIST_PREFERENCE" :
console.log("Dislike this context");
break;
case "LIST_SUBSCRIPTION" :
console.log("Unsubscribe from this context");
break;
default :
break;
}
return true;
}
});
onplaylist
In order to handle requests to play this context from list via voice, the application should override the onplaylist callback.
NOTE: This feature is only available for 25Y TV models at the moment.
list : LIST_PREFERENCE : preference / LIST_SUBSCRIPTION : subscription / LIST_WATCH_LATER : watch later
Return Value :
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung TV may perform its basic function.
Since : 6.5
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
return "List";
},
onplaylist : function (list) {
console.log("onplaylist");
switch(list) {
case "LIST_PREFERENCE" :
console.log("Play liked content");
break;
case "LIST_SUBSCRIPTION" :
console.log("Play subscription content");
break;
case "LIST_WATCH_LATER" :
console.log("Play watch later content");
break;
default :
break;
}
return true;
}
});
onbrowselist
In order to handle requests to browse this context from list via voice, the application should override the onbrowselist callback.
NOTE: This feature is only available for 25Y TV models at the moment.
list : LIST_PREFERENCE : preference / LIST_SUBSCRIPTION : subscription / LIST_WATCH_LATER : watch later
Return Value :
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung TV may perform its basic function.
Since : 6.5
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
return "List";
},
onbrowselist : function (list) {
console.log("onbrowselist");
switch(list) {
case "LIST_PREFERENCE" :
console.log("Browse liked content");
break;
case "LIST_SUBSCRIPTION" :
console.log("Browse subscription content");
break;
case "LIST_WATCH_LATER" :
console.log("Browse watch later content");
break;
default :
break;
}
return true;
}
});
onskipad
In order to handle requests to skip ad content via voice, the application should override the onskipad callback.
NOTE: This feature is only available for 25Y TV models at the moment.
boolean : boolean value of whether the app supports this feature.
If a callback returns the false/undefined value, or there is no callback implementation for the utterance, Samsung TV may perform its basic function.
Since : 6.5
Code Example :
webapis.voiceinteraction.setCallback({
onupdatestate : function () {
return "Player";
},
onskipad : function () {
console.log("onskipad");
return true;
}
});
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
developer.samsung.com, .samsung.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
Samsung Electronics
.samsung.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
Samsung Electronics
developer.samsung.com, google.account.samsung.com
Preferences Submitted
You have successfully updated your cookie preferences.