This topic describes how to implement a public preview for the Smart Hub Preview feature. A public preview shows the same preview content to all users.
Public preview content is defined by a remotely-hosted JSON file. You can configure the JSON file to expire and refresh at a specific time. The public preview generation process is shown in the following figure.
The URL of the remote JSON file is defined in the application's "config.xml" file.
The preview is generated and shown based on the JSON data.
The user clicks a preview tile.
The JSON action_data value corresponding to the selected tile is sent to the application.
The application parses the action_data value and shows the detail page.
Prerequisites
To enable your application to use the public preview functionality:
Define the remote JSON file URL in the "config.xml" file:
Disable reloading the application main page when it receives an application control request. This allows your application, if it is already running, to receive the action_data information without reloading.
If you want the application to support 2015 TV models, set the required_version attribute to "2.3" and the development API version meta data attribute to "2.4" in the "config.xml" file:
The preview content is defined in JSON format. The application can only use 1 preview content JSON file at a time.
The following table lists the structure and parameters for the preview content JSON data.
Parameter
Type
Mandatory
Description
expires
UNIX timestamp
false
For public preview only If specified, the time at which the preview content is updated. The time is at most 1 week into the future. By default, the preview content is updated every 10 minutes, whenever the TV is switched on, or the JSON file changes.
expires_only
Boolean
For public preview only If this value is "true", the preview content is updated only at the time specified by the expires parameter. The default value is "false". It is supported in 2018 TV models and newer.
sections
Array
true
Preview sections
title
String
false
Section title
position
Integer
Section position If specified, sections are shown in ascending position order.
title_display_mode
String
The following three values are supported:
AlwaysOn
HighlightedOnly (default) Show the title while the tile is in focus.
AccessibilityOnly Title is hidden when tile is in focus, Voice Guide is provided when the accessibility setting is set to ON.
For more information, see the detailed description below the table.
subtitle_display_mode
String
The following three values are supported:
AlwaysOn
HighlightedOnly (default) Show the subtitle while the tile is in focus.
AccessibilityOnly Subtitle is hidden when tile is in focus. Voice Guide is provided when the accessibility setting is set to ON.
For more information, see the detailed description below the table.
tiles
Array
true
Tiles within the section
title
String
false
Tile title
subtitle
Tile subtitle
image_url
true
Thumbnail image URL
image_ratio
Thumbnail image aspect ratio:
"16by9"
"4by3"
"1by1" (default)
"2by3"
The thumbnail height is fixed at 250 px on presentation.
action_data
Data to send to the application when the tile is clicked
is_playable
If "true", a "Play" icon is shown over the thumbnail image
display_from
UNIX timestamp
false
Time to begin showing the tile
display_until
Time to stop showing the tile
position
Integer
Section position If specified, sections are shown in an ascending order by the position value.
Table 1. Preview JSON parameters
For an example of a preview content JSON file, see sampleJSON.
The JSON parameters title_display_mode and subtitle_display_mode for displaying title and subtitle of tiles, respectively, support the following options:
AlwaysOn - If this option is enabled, the title or subtitle is always displayed when the preview is visible.
HighlightedOnly - This is the default option, which shows the title or subtitle when the tile is in focus.
AccessibilityOnly - If this option is enabled, the title or subtitle is not displayed. There is only a Voice Guide when the accessibility setting is set to ON and the preview tile is in focus.
ImportantVoice Guide (Text-to-Speech feature) is supported by all the three options detailed above, if the accessibility setting for Voice Guide is turned on by the user.
Please note that this behavior is an accessibility feature to assist users, and it should comply with the policies of the countries the application is released in.
If only the preview tile image is to be shown to user, and the title and subtitle are required to be hidden, add the title and subtitle values to the JSON file, and set the AccessibilityOnly value for both properties. This ensures that the title and subtitle will not be visible to user, but are read out loud when the tile is in focus.
When the preview system requests JSON data from your server, TV information is sent in the HTTP header. You can serve different preview content depending on TV information, such as the language, and application version.
The following table lists the HTTP header fields that contain TV information.
Field
Description
ACCEPT-LANGUAGE
TV language setting, such as 'en-US'
X-SAMSUNG-APP-VERSION
Application version
X-SAMSUNG-COUNTRY-CODE
TV Smarthub country setting, such as 'US' in ISO 3166-1 Alpha 2 Format
Table 2. HTTP header fields
Implementing Public Preview Deep Links
When a tile is clicked, its associated action_data value is converted to an ApplicationControlData object with the PAYLOAD key:
For more information on ApplicationControlData objects, see the Application API.
To implement deep-linking:
To receive action_data information when the application is already running, add an event listener for the appcontrol event to the onload property:
window.addEventListener('appcontrol', deepLink);
In the onload property, receive and parse the PAYLOAD key value, using the getCurrentApplication().getRequestedAppControl() method:
function deepLink() {
var requestedAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
var appControlData;
var actionData;
var videoIdx;
var pictureIdx;
if (requestedAppControl) {
appControlData = requestedAppControl.appControl.data;
for (var i = 0; i < appControlData.length; i++) {
if (appControlData[i].key == 'PAYLOAD') {
actionData = JSON.parse(appControlData[i].value[0]).values;
if (JSON.parse(actionData).videoIdx) {
videoIdx = JSON.parse(actionData).videoIdx;
console.log(videoIdx);
} else if (JSON.parse(actionData).pictureIdx) {
pictureIdx = JSON.parse(actionData).pictureIdx;
console.log(pictureIdx);
}
}
}
} else {
console.log("no req app control");
}
}
Manage Your Cookies
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.