Application Development Guide
for Samsung Smart TV
Version 1.20
Application Development Guide for Samsung Smart TV
APPLICATION DEVELOPMENT GUIDE FOR SAMSUNG SMART TV ... 1
PREFACE ... 7
1. INTRODUCTION ... 8
1.1. WHAT IS SAMSUNG SMART TV? ... 8
2. SAMSUNG SMART TV ... 9
2.1. OPERATING PRINCIPLE ... 9
2.2. OPERATING ENVIRONMENT ... 9
3. APPLICATIONS ... 10
3.1. WHAT ARE APPLICATIONS? ... 10
3.2. STRUCTURE OF AN APPLICATION ... 10
3.3. DISPLAY TYPE OF APPLICATIONS ... 11
3.4. RUNNING AN APPLICATION ... 12
3.5. APPLICATION MANAGER ... 12
3.6. FEATURES OF SAMSUNG APPLICATIONS ... 13
4. CREATING AN APPLICATION ... 14
4.1. WHAT YOU NEED TO CREATE AN APPLICATION... 14
4.2. HOW TO MAKE AN APPLICATION ... 14
4.2.1. Writing config.xml ... 15
4.2.2. Writing index.html ... 16
4.2.3. Writing JavaScript ... 16
4.2.4. Writing a CSS ... 17
4.2.5. Use of the remote control ... 18
4.2.6. Complete your work & Sample code ... 20
4.2.6.1. config.xml ... 20 4.2.6.2. index.html ... 21 4.2.6.3. Main.js ... 21 4.2.6.4. Main.css ... 22 4.3. CONFIG.XML ... 23 4.3.1. Tag information ... 23 4.3.2. Example ... 26 4.4. SINGLE-SIGN-ON ... 27 4.4.1. What is Single-Sign-On ... 27
Application Development Guide for Samsung Smart TV
4.4.3. How to download account information on service sites in applications ... 30
4.5. RESET ... 32
4.5.1. What is Reset? ... 32
4.5.2. How Reset Works? ... 32
4.5.3. Necessary Features Developers Should Realize ... 32
4.5.4. Guide for Config.xml Realization ... 32
4.5.5. Guide for Module Realization ... 32
4.6. EXAMPLE FOR XHR COMMUNICATION ... 34
5. COMMON MODULES ... 37
5.1. APPLICATION MANAGER’S COMMON MODULES ... 37
5.2. HOW TO USE COMMON MODULES ... 37
5.3. TVKEYVALUE ... 37 5.4. WIDGET ... 40 5.4.1. sendReadyEvent() ... 40 5.4.2. sendExitEvent() ... 41 5.4.3. sendReturnEvent() ... 41 5.4.4. blockNavigation() ... 41 5.4.5. putInnerHTML() ... 42 5.4.6. getChannelWidgetListPath() ... 43 5.4.7. getSearchWidgetListPath() ... 43 5.4.8. runSearchWidget() ... 44 5.4.9. checkSapTicket () ... 44 5.4.10. requestSapTicket () ... 45 5.5. PLUGIN ... 45 5.5.1. setOnWatchDog() ... 47 5.5.2. setOffWatchDog() ... 47 5.5.3. setOnOSDState() ... 48 5.5.4. setOffOSDState() ... 48 5.5.5. registKey()... 49 5.5.6. unregistKey() ... 49 5.5.7. registIMEKey() ... 49 5.5.8. unregistIMEKey()... 50 5.5.9. registAllKey... 50 5.5.10. unregistAllKey() ... 51 5.5.11. registFullWidgetKey() ... 51 5.5.12. registPartWidgetKey() ... 52
Application Development Guide for Samsung Smart TV
5.5.13. SetBannerState() ... 52 5.5.14. ShowTools()... 53 5.5.15. setOnIdleEvent() ... 54 5.5.16. setOffIdleEvent() ... 54 5.5.17. setOnScreenSaver() ... 54 5.5.18. setOffScreenSaver()... 55 5.5.19. isViewerKey() ... 55 5.5.20. setOnFullScreen () ... 56 5.5.21. setOffFullScreen() ... 56 5.6. CIMAGEVIEWER ... 57 5.6.1. CImageViewer? ... 57 5.6.2. Specifications ... 57 5.6.3. Basic Instructions ... 57 5.6.4. Transition Effect ... 585.6.4.1. Action Principles of Slideshow ... 59
5.6.4.2. How to Realize Transition Effect ... 60
5.6.4.3. Slideshow Mode and Restrictions ... 61
5.6.5. Events ... 62
5.6.6. Play local files ... 62
5.6.6.1. Play Images in an Application ... 62
5.6.6.2. Play images in USB ... 63
5.6.7. Reference... 64 5.6.7.1. CImageViewer ... 64 5.6.7.2. Effect ... 65 5.6.7.3. clearScreen() ... 66 5.6.7.4. destroy() ... 66 5.6.7.5. endSlideshow() ... 67 5.6.7.6. getStopFlag() ... 67 5.6.7.7. hide() ... 68 5.6.7.8. isEffectAvailable() ... 68 5.6.7.9. play() ... 68 5.6.7.10. prepareNext() ... 69 5.6.7.11. setFrameArea() ... 70 5.6.7.12. setOnBufferingComplete() ... 71 5.6.7.13. setOnBufferingStart() ... 71 5.6.7.14. setOnNetworkError() ... 72
Application Development Guide for Samsung Smart TV
5.6.7.15. setOnRenderError() ... 72 5.6.7.16. setOnRenderingComplete () ... 73 5.6.7.17. show() ... 73 5.6.7.18. showNow () ... 73 5.6.7.19. startSlideshow () ... 74 5.6.7.20. stop () ... 756. TIPS FOR APPLICATION DEVELOPERS ... 76
6.1. FUNCTION NECESSARY TO BE CALLED WHEN YOU OPEN AN APPLICATION ... 76
6.2. ACCESS POINT ... 76
6.3. HANDLING REMOTE CONTROL KEY EVENTS ... 76
6.4. REMOTE CONTROL KEYS FOR APPLICATIONS ... 77
6.5. CLOSING AN APPLICATION ... 79
6.6. PREVENTION OF CLOSING THE TV SCREEN BY THE RETURN OR EXIT KEY ... 79
6.7. ADDITIONAL INFORMATION ... 79
6.8. WHAT CSS NEED TO CONTAIN ... 80
6.9. LOADING IMAGES IN ADVANCE ... 80
6.10. CHARACTER OF THE <INPUT> TAG ... 81
6.11. SCROLL BAR ... 81
6.12. MAKING DYNAMIC WEB PAGES ... 81
6.13. SETTING FOR LETTER-SPACING ... 82
6.14. MEMORY MANAGEMENT ... 82
6.14.1. Using XMLHttpRequest ... 82
6.14.2. Freeing up the memory ... 82
6.15. WATCH DOG ... 82
6.16. PREVENTION FOR OSD DISTORTION... 83
6.17. SUPPORT CSS TEXT-OVERFLOW ... 83
6.18. DIRECTIONS FOR CREATING VIDEO APPLICATION ... 83
6.19. USING IME ... 83
6.20. MINIMIZING INITIAL ENTRY SPEED OF AN APPLICATION ... 83
6.20.1. Load Javascript On-Demand ... 83
6.20.2. Load CSS Background Image On-Demand ... 84
6.20.3. Separation of Main.onLoad functions ... 84
6.21. DIRECTIONS FOR DYNAMIC LOADING OF CSS ... 85
7. APP ENGINE ... 87
Application Development Guide for Samsung Smart TV
7.2. STANDARD SPECIFICATIONS ... 87 8. FILE API ... 88 8.1. FILE API? ... 88 8.2. API ... 88 8.2.1. FileSystem() ... 88 8.2.2. openCommonFile() ... 89 8.2.3. closeCommonFile() ... 90 8.2.4. deleteCommonFile() ... 90 8.2.5. createCommonDir() ... 91 8.2.6. deleteCommonDir() ... 91 8.2.7. isValidCommonPath() ... 92 8.2.8. readLine() ... 92 8.2.9. writeLine() ... 93 8.2.10. readlAll() ... 93 8.2.11. writeAll() ... 94 8.2.12. readDir() ... 94 8.2.13. openFile() ... 95 9. APPENDIX ... 96 9.1. COUNTRY CODE ... 96 9.2. LANGAUAGE CODE ... 97 9.3. REGION CODE ... 99 9.4. PRODUCT CATEGORY ... 100 9.5. CAUTION INFORMATION ... 100Application Development Guide for Samsung Smart TV
Preface
Purpose of Document
This document is written to help application developers who enjoy the Samsung Smart TV service by providing an overview of the service and basic knowledge required to be obtained by application developers. Using this document, developers can develop and manage applications for digital TVs.
Target Readers
This document is aimed at programmers who have used web development languages such as HTML, CSS and JavaScript. This document will be even more helpful for those who have web development experience.
Application Development Guide for Samsung Smart TV
1.
Introduction
This section describes what Samsung Smart TV is, how it is configured and how it works.
1.1.
What is Samsung Smart TV?
Samsung Smart TV is a web-based application running on an application engine installed in digital TVs connected to the Internet. The Samsung Smart TV service makes it possible to extend the functions of the TV by applying a variety of web functions to it, so that users can obtain useful information and interesting content on their TV screens. Users can check internet services such as news, weather, stock, UCC with simple operation.
With Samsung Smart TV, digital TV users can not only download applications from HubSite and install them in their TVs but also personally develop applications tailored to their needs and install them in their TVs.
HubSite
Application Development Guide for Samsung Smart TV
2.
Samsung Smart TV
This section describes the operating principle and environment of Samsung Smart TV.
2.1.
Operating principle
With Samsung Smart TV installed in the TV, users can run Internet-based applications on the TV screen. An application is a special type of web page that is implemented on a web browser and runs on the TV screen. Viewing an application is very much like viewing web pages using a web browser on an ordinary PC. Differences between applications and web pages are made by screen resolution, hardware specifications and remote controller, the user interface for Samsung Smart TV installed TVs.
2.2.
Operating environment
Browser
App Engine 6.0TV screen resolution
1280x720 pixel, 960 Ⅹ 540 pixelWe will look at App Engine, the browser dedicated to internet TVs manufactured by Samsung, in Chapter 7. App Engine.
Application Development Guide for Samsung Smart TV
3.
Applications
This section looks at applications that we will develop for Samsung TVs.
3.1.
What are applications?
Applications are web-based small applications that are run in digital TVs connected to the internet. They are installed in TVs via the Internet and are run on App Engine. It is safe to say that they are web pages displayed on the TV screen having the remote control as the only user interface. The Application Manager (N.Navi.) controls
installing and removing applications, and performing other works for them.
You can exploit the Software development kit (SDK) to develop new applications designed to be run on your TV screen.
3.2.
Structure of an application
An application is a web page consisting of HTML, CSS and JavaScript, and for Samsung TVs it is run on App Engine. The HTML page shows the structure of the application, the CSS file does the style, and the JavaScript file controls the behavior of the application. If you want to run an application on the TV screen, you have to create a config.xml file containing information on the operating environment and the version of the application. If you want to get more information about config.xml, see Ch. 4.3 config.xml.
Application Development Guide for Samsung Smart TV
3.3.
Display type of applications
Display type
Description
Screen layout
Full-screen application
Fills the entire screen with an application.
Single-wide application
Makes an application displayed only on part of the screen.
Ticker
Keeps an application on the screen while you do other
things with your TV.
Application Development Guide for Samsung Smart TV
3.4.
Running an application
In order to start an application, you are required to follow the steps below:
Step
Instruction description
Get the Application Manager started
Press the INTERNET(INFO.L) button on the remote control or go through Menu> Application>Samsung Smart TV to open the application
Select an application Press arrow button located in the center of the remote control to select an application.
Implement an application
Press the Enter button to implement an application. The Application Manager reads the information from the config.xml file of the currently running application to set an operating environment, and reads index.html to implement the application.
3.5.
Application Manager
The Application Manager serves as a “manager” that has the authority to authenticate, install, delete, update, open and finish applications. With the Application Manager, users can install or delete applications, and also register applications they‟ve developed and run them on the TV. The Application Manager is also an application that is continuously updated via the Internet.
Application Development Guide for Samsung Smart TV
Samsung Apps
Settings
Edit Mode
Sort by
3.6.
Features of Samsung applications
Applications for Samsung Smart TV allow you to enjoy functions that only TVs have, unlike general web pages. For example, using plugins, you can volume up or down the application and play video other than broadcasting on the TV screen. In addition, you can use a file storage system. If you want to get detailed information on plug-ins and file storage system, refer to Ch. 7 and 8 File API.
The Application Manager provides several JavaScript modules used in applications. This enhances convenience of application development. If you want to get detailed information on use of a common module, see Ch. 5 Common modules.
Application Development Guide for Samsung Smart TV
4.
Creating an application
This section guides you to create a simple application.
4.1.
What you need to create an application
Our final goal is to create applications and run them on the TV screen. To this end, you need a Samsung TV connected to the Internet and an SDK or a text editor with which you can write HTML, JavaScript and CSS files. The SDK is equipped with a simulator with which you can run an application you‟ve created before actually installing it in your TV. So, if you use an SDK, you can make an application in a more convenient way.
4.2.
How to make an application
An application should contain at least the following elements:
An index.html file. The file serves as the access point of the application.
An application configuration file. This is an XML file in the root of the application structure that holds information about setting an application.
JavaScript files. These are used for a preview of the application and for controlling the behavior of the application.
CSS files. The look of the application is determined by these files.
Image files, which are used by your application.
Let‟s make an application that displays text written in CSS and responds to remote control buttons events. The structure and look of an application we will make now are shown as below.
Application Development Guide for Samsung Smart TV
4.2.1.
Writing config.xml
The config.xml file is called first among all the files the application has in it. <ver> tag value decides whether to update the application and images designated in <ThumbIcon> tag are shown in thumbnail. For information about other tags, turn to Ch. 4.3. config.xml.
<?xml version="1.0" encoding="UTF-8"?> <widget> <ThumbIcon>Resource/image/icon/picasa_106.png</ThumbIcon> <BigThumbIcon>Resource/image/icon/picasa_115.png</BigThumbIcon> <ListIcon>Resource/image/icon/picasa_85.png</ListIcon> <BigListIcon>Resource/image/icon/picasa_95.png</BigListIcon> <category>lifestyle</category> <autoUpdate>y</autoUpdate> <cpname>MyCP</cpname> <cpauthjs></cpauthjs> <login>y</login> <ver>0.930</ver> <mgrver>1.000</mgrver> <fullwidget>n</fullwidget> <srcctl>n</srcctl> <ticker>n</ticker> <childlock>n</childlock> <audiomute>n</audiomute> <videomute>n</videomute> <dcont>y</dcont> <network>y</network> <hubsite>n</hubsite> <widgetname>HelloWorld</widgetname> <description>Welcome!</description> <width>960</width> <height>540</height> <author>
<name>Samsung Electronics Co. Ltd.</name> <email></email>
<link>http://www.sec.co.kr/</link>
<organization>Samsung Electronics Co. Ltd.</organization> </author>
Application Development Guide for Samsung Smart TV
4.2.2.
Writing index.html
What you have to do next is writing index.html which will be the access point of the application. The following example is about HTML code that includes the Main.js file under the JavaScript folder and calls the Main.onLoad() function when the document is loaded.
<!DOCTYPE html> <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Hello World!!</title>
<script type="text/javascript" language="javascript" src="JavaScript/Main.js"></script> </head>
<body onload="Main.onLoad();">
<div>Welcome to Samsung application world!</div> </body>
</html>
4.2.3.
Writing JavaScript
If the HTML document is loaded, the onLoad() function of the Main object is called, because you registered the Main.onLoad() function in the onload property in the <body> tag. Make a Main object and add the onload function.
var Main ={ // Main object
}
Main.onLoad =function(){ // called by <body>'s onload event alert("Main.onLoad()");
/**
*JavaScriptcodeHere! */
}
If you have done all the work, you will get a debug message of Main.onLoad(). But the „Welcome to Samsung application world!‟ that you entered will not appear on the TV screen. If the application is successfully loaded, it has to ask the Application Manager to display itself on the screen using the common module provided by the Application Manager. The common module is a library containing essential functions provided by the Application Manager. For more information, refer to Ch. 5 Common Modules. Add the following code to <head> of index.html.
Application Development Guide for Samsung Smart TV
<script type="text/javascript" language="javascript"src="$MANAGER_WIDGET/Common/API/Widget.js"></script>
If the above code is added, a common module is available to use by JavaScript. Declare the common module as a global variable for Main.js you were working on and call the sendReadyEvent() function. By doing this, you can make the Application Manager display an application on the screen.
var Main ={ // Main object
}
var widgetAPI =new Common.API.Widget(); // Create Common module
Main.onLoad =function(){ // called by <body>'s onload event alert("Main.onLoad()");
widgetAPI.sendReadyEvent(); // Send ready message to Application Manager
/**
*JavaScriptcodeHere! */
}
Ok, now run the application you‟ve just made. You will see the words “Welcome to Samsung application world!” that you entered in the index.html file appearing on the screen. Maybe you don‟t like the look of the application because its font size is too small and font color is just simple black. You may want to make your application more stylish. Then, you can give the application a style using CSS.
4.2.4.
Writing a CSS
Add the following string in
<
head
>
in the index.html file.<link rel='stylesheet' type='text/css' href = 'CSS/Main.css'/> Assign an ID to <div> in the index.html file.
<div id='welcome'>Welcome to Samsung application world!</div>
Create a file in the CSS folder and enter text as you see in the below box to specify the style of the „welcome‟ element.
body {
margin: 0; padding: 0;
Application Development Guide for Samsung Smart TV
background-color: transparent; } #welcome { position: absolute; left: 50px; top: 50px; width: 500px; height: 50px; background-color: #AFAFAF; color: #99FFFF; font-size: 30px; text-align: center; }4.2.5.
Use of the remote control
Now, we‟ll make your application respond to the remote control. By pressing any of the five buttons located in the center of the remote control, you can change the words your application displays on the screen.
If a button on the remote control is pressed, a „keydown‟ event occurs. An element having focus is required to receive the event to the index.html file. Add <a> element and Register a function that will be executed when that event occurs in the onkeydown property. Place focus on <a> and press the remote control key, the function registered previously is executed.
Add <a> which executes Main.keyDown() method when a „keydown‟ event occurs.
<body onload="Main.onLoad();">
<div id='welcome'>Welcome to Samsung application world!</div>
<a href='javascript:void(0);' id='anchor' onkeydown='Main.keyDown();'></a> </body>
Write a keyDown() method bringing key code value when pressing the remote control key
Main.keyDown =function(){ // Key handler var keyCode = event.keyCode;
alert("Main Key code : "+ keyCode); }
In a function processed by keys such as keydown(), each key has its own key code value.
Application Development Guide for Samsung Smart TV
the below code to <head> in the index.html file to use a common module „TVKeyValue‟.
<script type="text/javascript" language="javascript"
src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script>
Modify Main.js in order to change the contents of „welcome‟ Div. This creates common module objects, classify keys in keydown() method, and define actions for each key. For detailed information on common modules and key code list, see Chapter 5. Common Modules.
var Main ={ // Main object
}
var widgetAPI =new Common.API.Widget(); // Create Common module
var tvKey =new Common.API.TVKeyValue();
Main.onLoad =function(){ // called by <body>'s onload event alert("Main.onLoad()");
widgetAPI.sendReadyEvent(); // Send ready message to Application Manager document.getElementById("anchor").focus(); // Focus to Anchor for handling key inputs
// from remote controller /**
*JavaScriptcodeHere!
*/
}
Main.keyDown =function(){ // Key handler var keyCode = event.keyCode;
alert("Main Key code : "+ keyCode);
switch(keyCode){
case tvKey.KEY_LEFT:
alert("left");
document.getElementById("welcome").innerHTML ="Nice to meet you.";
/**
*CodeforLeftkeyevent!
*/
break;
case tvKey.KEY_RIGHT:
alert("right");
document.getElementById("welcome").innerHTML ="I'm so happy.";
break;
case tvKey.KEY_UP:
alert("up");
document.getElementById("welcome").innerHTML ="I Love you.";
break;
case tvKey.KEY_DOWN:
alert("down");
document.getElementById("welcome").innerHTML ="Good job.";
break;
Application Development Guide for Samsung Smart TV
alert("enter");break;
case tvKey.KEY_RETURN:
break;
} }
You will see the value of the „welcome‟ Div tag change as you press the up, down, left or right button.
4.2.6.
Complete your work & Sample code
With Samsung Smart TV, you can do almost everything you do on a web page. You can create “TV-oriented” applications with extended functions using many plugins.
The below are the codes we‟ve written until now.
4.2.6.1.
config.xml
<?xml version="1.0" encoding="UTF-8"?> <widget> <ThumbIcon>Resource/image/icon/picasa_106.png</ThumbIcon> <BigThumbIcon>Resource/image/icon/picasa_115.png</BigThumbIcon> <ListIcon>Resource/image/icon/picasa_85.png</ListIcon> <BigListIcon>Resource/image/icon/picasa_95.png</BigListIcon> <previewjs>PreviewHelloWorld</previewjs> <cpname>Samsung</cpname> <cplogo>Resource/image/settings_logo.png</cplogo> <cpauthjs></cpauthjs> <ver>0.930</ver> <mgrver>1.000</mgrver> <fullwidget>n</fullwidget> <srcctl>n</srcctl> <ticker>n</ticker> <childlock>n</childlock> <audiomute>n</audiomute> <videomute>n</videomute> <dcont>y</dcont> <network>y</network> <hubsite>n</hubsite> <widgetname>HelloWorld</widgetname> <description>Welcome!</description> <width>960</width> <height>540</height>Application Development Guide for Samsung Smart TV
<author><name>Samsung</name> <email></email>
<link>http://acme-widget.example.com</link> <organization>Acme Examples, Inc.</organization> </author> </widget>
4.2.6.2.
index.html
<!DOCTYPE html> <html> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Hello World!!</title>
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/Widget.js"></script> <script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script>
<script type="text/javascript" language="javascript" src="JavaScript/Main.js"></script> <link rel='stylesheet' type='text/css' href = 'CSS/Main.css'/>
</head>
<body onload="Main.onLoad();">
<div id='welcome'>Welcome to Samsung widget world!</div>
<a href='javascript:void(0);' id='anchor' onkeydown='Main.keyDown();'></a> </body>
</html>
4.2.6.3.
Main.js
var Main ={ // Main object
}
var widgetAPI =new Common.API.Widget(); // Create Common module
var tvKey =new Common.API.TVKeyValue();
Main.onLoad =function(){ // called by <body>'s onload event alert("Main.onLoad()");
widgetAPI.sendReadyEvent(); // Send ready message to Application Manager document.getElementById("anchor").focus(); // Focus to Anchor for handling key inputs
// from remote controller /**
*JavaScriptcodeHere!
*/
}
Main.keyDown =function(){ // Key handler var keyCode = event.keyCode;
Application Development Guide for Samsung Smart TV
alert("Main Key code : "+ keyCode);
switch(keyCode){
case tvKey.KEY_LEFT:
alert("left");
document.getElementById("welcome").innerHTML ="Nice to meet you.";
/**
*CodeforLeftkeyevent!
*/
break;
case tvKey.KEY_RIGHT:
alert("right");
document.getElementById("welcome").innerHTML ="I'm so happy.";
break;
case tvKey.KEY_UP:
alert("up");
document.getElementById("welcome").innerHTML ="I Love you.";
break;
case tvKey.KEY_DOWN:
alert("down");
document.getElementById("welcome").innerHTML ="Good job.";
break;
case tvKey.KEY_ENTER:
alert("enter");
break;
case tvKey.KEY_RETURN:
break; } }
4.2.6.4.
Main.css
body { margin: 0; padding: 0; background-color: transparent; } #welcome { position: absolute; left: 50px; top: 50px; width: 500px; height: 50px; background-color: #AFAFAF; color: #99FFFF; font-size: 30px; text-align: center; }Application Development Guide for Samsung Smart TV
4.3.
config.xml
The config.xml file contains information about the application‟s execution, update, operating environment setting and other related issues. Depending on that information, the Application Manager controls the version of your application, sets an environment in which your application is run, and creates and manages user accounts. The config.xml file should be located in the directory in which the application is installed, and contain the following elements.
4.3.1.
Tag information
Element
Description
Value
<widget> Indicates that the information is relevant to the application. - <ThumbIcon> An icon image displayed in the Application Manager.
It is used in case of no focus and its size is 106 x 86pixel. File path
<BigThumbIcon>
An icon image displayed in the Application Manager.
It is used in case that the focus is placed on an image and its size is 115 x 95 pixel.
File path
<ListIcon> An icon image displayed in the Application Manager.
The size is 85 x 70 pixel. File path
<BigListIcon> An icon image displayed in the Application Manager.
The size is 95 x 78 pixel. File path
<category> The category to distinguish applications, available items are video,
sports, game, lifestyle, information, others. String
<autoUpdate> Decides whether to synchronize with hub site. The
application which doesn‟t need synchronization chooses ‟n‟. y | n
<apptype>
Shows information on contents type
- 11: HTML + java-script + Flash Player Object - 12: Adobe SWF ( Ver. Flash Lite 3.1 )
- 13: Adobe SWF ( Ver. Flash 10.1 ) - 14 : Lua Script
Number
<contents>
File path and name at the initial execution of contents Only the following apptype needs contents tag.
- 12: Adobe SWF ( Ver. Flash Lite 3.1 ) - 13: Adobe SWF ( Ver. Flash 10.1 ) - 14 : Lua Script
File Path
<channelType> Channel Bound Service Type(optional) root | child <channelRoot> Confirms the relations with root-child clarifying root application ID. Application
Application Development Guide for Samsung Smart TV
(Optional, Only when the channel bound service type is child.) When connected to more than one root, roots are distinguished by ::.
ID
<channelName>
Channel information to be executed channel bound service (Distinguish each channel using :: Ex AAA::BBB::CCC)
(Optional, only if channel bound service type is root.)
String
<channelDisplay>
It decides whether the installed channelbound service is displayed on the first main screen or not.
(If you want to hide the service in the first main screen, select „n‟.)
y | n
<previewjs> deleted String
<cpname> Enter the application provider in this tag. String
<cpauthjs>
The name of the JavaScript file that allows you to confirm account information of application providers. This file has to be written in a defined format.
String
<cplogo> deleted File path
<preIcon> deleted File path
<login>
Decides a service is available to signin or not. If you select „y‟, you can enter ID and password in Integrated Sign-in site of Application Manager for sign-in. Validity verification should be preceded in JavaScript file corresponding to <cpauthjs> tag value.
y | n
<ver>
Indicates the application version. Depending on that version information, the server computer updates the corresponding application.
x.xxx
<mgrver> Indicates the Application Manager‟s version that is required to run an
application having the config.xml file. x.xxx
<fullwidget>
Indicates whether the application is a full-screen or a single-wide one. Display type affects the audio policy of the application when it‟s run. Refer to Chapter. 6.4. Using Keys on Remote Control for details.
y | n
<srcctl>
If source conversion is needed, set this tag to y. (ex. YouTube application).
If you select „y‟, the TV source automatically switched from current TV channel or external input to the internal media player, and back again when the application is finished.
y | n
<childlock> Determines whether to use the childLock function. This function enables
the user to lock an application. y | n
Application Development Guide for Samsung Smart TV
not outputted when entering the application. Set „y‟ if the application occupies full screen and set „n‟ if the application occupies parts of the screen.
<videomute> Turns on and off the video. If you select „y‟, TV broadcasting is not on
the screen when entering the application. y | n
<dcont>
Sets the Disable dynamic contrast function.
Dynamic contrast is the function to adjust TV contrast ratio and brighten TV screen by darkening the dark screen and lightening the light screen. The screen might get lighter or darker when application is on with Dynamic contrast.
„y‟ turns off the Dynamic contrast, and „N‟ turns on the Dynamic contrast. If the application is occupied on full screen, select „y‟ to remove sparkling. If the application is partially occupied, select „n‟.
y | n
<movie>
Application playing video files can bring problems as stated below. 1. If a video file is played in a device connected to HDMI port such as DVD Player when executing an application (ex. YouTube) converting sources, sounds can be mixed.
2. Sparkling at the entry for appliction due to the difference of Frame rate between the TV image and playing video file.
If you select „y‟, you can prevent it from the problem above by ending operating the connected HDMI device when executing the application and fixing the Frame rate.
y | n
<widgetname> Enter a name of application. String
<description> Enter a brief description of the application. String <width> <height> Enter the screen area that the application will be occupying. Generally,
it is recommended to enter 960 * 540 pixels, digital TV specification. Number
<author> Enter a description of the author. string
<network>
This tage is used when needed to check network while operating an application. If the tage value is „y‟ and the network test result is „fail‟, entry for the application can be blocked with a message indicating the failure.
Without any set value, default is „y‟.
y | n
<hubsite>
This tage is used when needed to check whether the hubsite has been authorized or not while operating an application. If the tage value is „y‟, and the hubsite has not been authorized, entry for the application can be blocked with a message indicating the failure.
Application Development Guide for Samsung Smart TV
Without any set value, default is „n‟.<pushNotice> Indicates whether the application provides Push Notification Service.
Without any set value, default is „n‟. y | n
<pushControl> This tag is reserved for former Push Notification Service.
Without any set value, default is „n‟. y | n
<pushUerbinding> Indicates whether Push Notification Service is provided for specific user.
Without any set value, default is „n‟. y | n
<flashplayer> This tag should be enabled for application that use embedded flash
player object, or stand-alone flash player. y | n
4.3.2.
Example
<?xml version="1.0" encoding="UTF-8"?> <widget> <ThumbIcon>Resource/image/icon/picasa_106.png</ThumbIcon> <BigThumbIcon>Resource/image/icon/picasa_115.png</BigThumbIcon> <ListIcon>Resource/image/icon/picasa_85.png</ListIcon> <BigListIcon>Resource/image/icon/picasa_95.png</BigListIcon> <category>lifestyle</category> <autoUpdate>y</autoUpdate> <cpname>Picasa</cpname> <cpauthjs>Auth11101000000</cpauthjs> <login>y</login> <ver>2.000</ver> <mgrver>1.035</mgrver> <fullwidget>y</fullwidget> <srcctl>n</srcctl> <ticker>n</ticker> <childlock>n</childlock> <audiomute>y</audiomute> <videomute>y</videomute> <dcont>y</dcont> <movie>y</movie> <network>y</network> <hubsite>n</hubsite><widgetname>Picasa Web Albums</widgetname> <description>View photo albums online</description> <width>960</width>
<height>540</height> <author>
<name>Samsung Electronics Co. Ltd.</name> <email></email>
<link>http://www.sec.co.kr/</link>
<organization>Samsung Electronics Co. Ltd.</organization> </author>
Application Development Guide for Samsung Smart TV
4.4.
Single-Sign-On
This section describes SSO functions supported by the application manager, how to register account information and get the information from the application.
4.4.1.
What is Single-Sign-On
Input of account information via TV remote control is so inconvenient that users could be stressed out if they should enter account information whenever they use the application. To improve this inconvenience, Single-Sign-On (hereinafter referred to as “SSO”) is provided by application manager. Application manager saves the account information that users have entered and sends it to the application. These enable users not to enter account information repetitively. The account information is encrypted and saved in safe area.
SSO operates as stated below.
① Generate a TV Account
It is necessary to create a TV account to use SSO. TV account is an account generated in the Application manager and has four-digit PIN number as a password. You can make the account in Settings->Samsung Smart TV-ID.
② Register Service Sites
Registers account information of service sites (ex: YouTube, Picasa) in the generated TV account. Only when the entered account information is determined valid, the information is registered in the account. Registration can be made in „Settings‟ -> Samsung Smart TV ID.
③ Sign-in to TV account
You can sign in to the TV account created in ① pressing Red key on the initial screen. In general, account information on several service sites can be registered in a TV account. Sign-in make you enable to get account information on a service site you want to get in several applications.
④ Execution of an Application
At this stage, the application manager decides whether the application SSO is available to sign in or not. If available, the account information is given. Account information should be inputted through the process in
②.
⑤ Use account information on service sites
Application Development Guide for Samsung Smart TV
application manager. Thus, it is required to use account information after parsing.
Following chapter describes modules necessary to be realized in an application to register service sites, how to parse and use the account information received by the application manager.
4.4.2.
Registration of Account Information on Service Sites
Registration of account information on service sites can be done through „Settings‟ -> Samsung Smart TV ID. If you wish to display the names of the service sites you want to show, configure config.xml as suggested below.
<cpname>YourCompany</cpname> <login>y</login>
Then, you can find YourCompany item in the list of service sites. If you can‟t, restart TV. Application manager could need to be reloaded.
Now, the account information on service site, „YourCompany‟ can be entered. However, if there is no module which confirms validity of the entered account information, the registration cannot be completed. You should generate the module in person.
Validity Confirmation is to make sure that the entered account information is consistent with the ID and Password which are available to sign-in on the real service site. If sign-in can be made by API in each service site, the information is turned out to be valid.
In Google, there is ClientLogin to judge validity. If sign-in is successfully done and auth token is granted, the account information is regarded valid. Refer to the URL states below regarding Client Login.
(http://code.google.com/intl/ko/apis/accounts/docs/AuthForInstalledApps.html)
The module to confirm validity of account information is drawn up as shown below.
① Enter the name of js file whose config.xml has a module.
Put the name of js file which has a module to confirm account information validity in <cpauthjs> item. If the file name is Auth11101000000.js, put Auth11101000000. The application manager executes the module including the file. File names should be unique for each application. Check the variables such as curWidget.id and write the name distinctively.
Application Development Guide for Samsung Smart TV
<cpauthjs>Auth11101000000</cpauthjs>② Create a file
Create a js file corresponding to the entered file name in the process of ①. A module will be written in this file. This file is embedded in the top level directory where index.html exists.
③ Draw up a module which confirms validity of account information.
This module is generated in the file made in ②, the format should be in observance of regulations.
Declare the object whose name is the entered value in ①.
Add a method „checkAccount‟ to the object.
checkAccount method confirms validity of the account information on the service site, and it should deliver the results to the callback function transferred to the factor.
Example
// Object Generated
var Auth11101000000 ={
}
// checkAccount Method Added
Auth11101000000.checkAccount =function(id, pw, fnCallback){
/**
*The id and pw inputted from the application manager are transferred to the factor. *Check validity of id andpw, and then operatecallbackfunction.
*/
// ...
// Confirmation on Validity // ...
// Deliver the results
if(isValidAccount){ fnCallback ('TRUE'); } else{ fnCallback ('FALSE'); }
Application Development Guide for Samsung Smart TV
}
The value transferring to the Callback function and the effect are like below.
Return value
Description
'TRUE' If the transferred ID and Password are valid, return „TRUE‟. Application manager registers ID and Password in the TV account.
'FALSE' If the account information is invalid, return „FALSE‟.
The application Manager let the user reenter the account information.
'ERROR' Errors occur while confirming validity, return „ERROR‟. The application manager regards it as an error, after a while, it leads the user to try reusing account information.
Others Values other than three values above are processed identically with „ERROR‟.
4.4.3.
How to download account information on service sites in applications
Applications are able to get account information on service sites. Proceed like the order stated below.
① Configure config.xml like below.
This enables the application manager to understand that this application is available to sign-in and necessary service site is ‟YourCompany‟.
<cpname>YourCompany</cpname> <login>y</login>
② Sign-in to the TV account
The account information registered in the account can be available when sign-in process to the TV account is completed.
③ Execution for an application
Execute the application. Account information on CP(YourCompany) needs to be registered in the designated TV account in ①. Generally, several service sites are registered in a TV account, on the other hand, an application can get one service site relevant to the designated CP in ①.
④ How to parse ID and Password
Application Development Guide for Samsung Smart TV
window.location.search. This variable includes circumstances information, and it should be parsed. Refer to 6.7 for further information on window.location.search.
Application Development Guide for Samsung Smart TV
4.5.
Reset
Reset describes functions to initialize the application.
4.5.1.
What is Reset?
The function to execute initial modules realized by applications when deleting or initializing applications in Application Manager.
4.5.2.
How Reset Works?
1. Application Manager brings information in config.xml of the installed application when deleting/initializing.
2. Check if the application needs a module which initializes through the information in config.xml. 3. If the application has the module that initializes, bring information on the module.
4. Execute the module in accordance with rules and try initializing.
* Application Manager does not obtain any return value but operate the module to initialize.
4.5.3.
Necessary Features Developers Should Realize
1. Peculiar Information on config.xml(Refer to Chapter 4) 2. Initialization Module (Refer to Chapter 5)
4.5.4.
Guide for Config.xml Realization
Add xml Element as shown below.
<deleteJS>MyReset</deleteJS>
* Without deleteJS Element, the application does not operate the initialization module.
4.5.5.
Guide for Module Realization
1. The file name should be the same as class name. 2. No factor.
3. The name of function is “reset”.
var MyReset={
…
}
Application Development Guide for Samsung Smart TV
... ...
alert("Reset Complete!"); }
Application Development Guide for Samsung Smart TV
4.6.
Example for XHR communication
In this section, we‟ll look at an example for XHR communication, which is a key factor comprising AJAX technology.
The below example is HTML code that includes XHRExample.js, and executes the XHRExample.onload() function when the „load‟ event occurs.
<!DOCTYPE html> <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>XHR Example</title>
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script>
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/Widget.js"></script>
<script type="text/javascript" language="javascript" src="XHRExample.js"></script> </head>
<body onload="XHRExample.onload()"> <div id='intro'>XHR Example.</div> </body>
</html>
The below is JavaScript code. XHRExample is has been declared as an object and has the variable of XHRObj in it. If XHRObj already exists, XHRExample calls the destroy() method. We will look at this more specifically later in this chapter. If an XHR object has been successfully created, set it and request data. If the state of XHR changes to 4, which means data reception is completed, recieveData() that you registered in onreadystatechange is executed.
var XHRExample ={
XHRObj :null }
var tvKey =new Common.API.TVKeyValue(); var widgetAPI =new Common.API.Widget();
XHRExample.onload =function(){
widgetAPI.sendReadyEvent();
Application Development Guide for Samsung Smart TV
if(this.XHRObj !=null)
this.XHRObj.destroy(); this.XHRObj =new XMLHttpRequest(); if(this.XHRObj){
this.XHRObj.onreadystatechange =function(){ if(XHRExample.XHRObj.readyState ==4){
XHRExample.recieveData(); }
};
this.XHRObj.open("GET", URL,true); this.XHRObj.send(null);
} }
XHRExample.recieveData =function(){
alert(this.XHRObj.responseText); }
The above example has two remarkable points. One is that the variable of XHRObj is in the XHRExample object. The other is that the destroy() method is called before an object is assigned to XHRObj.
With Samsung TVs, if you run out of the memory by continuing to create and use the XHR object, applications in your TV do not work anymore at a certain time. In order to avoid this kind of situation, you should delete objects you used in the past and assign new ones when you use XHR. To free up objects that had been used, the object pointer should be maintained. For this, developers should memorize and manage the variable dealing with XHR objects.
If you want to remove an XHR object from the memory, use the destroy() method of it, and this is the method that App Engine provides to allow you to use the limited memory efficiently.
XHRObjet.destroy
Free up the XHR object you created from the memory. Syntax XHRObject.destroy()
Parameter None Return Value None
Application Development Guide for Samsung Smart TV
App Engine for Samsung TV users.Example
if(this.XHRObj !=null)
this.XHRObj.destroy(); this.XHRObj =new XMLHttpRequest();
In the above example, two common modules provided by the Application Manager are included. For more information, turn to Ch. 5 Common modules.
Application Development Guide for Samsung Smart TV
5.
Common modules
In this section, we will look at a library shared by all your applications.
5.1.
Application Manager’s common modules
The Application Manager provides object modules that all your applications can use. Those common modules enable your applications to do basic work to be normally running on the screen. Also, using common modules, individual applications can recognize and identify remote control button events, use plugins, and communicate with the Application Manager in more convenient and simpler ways.
5.2.
How to use common modules
Include common modules you want to use in the index.html file. In order to prevent occurrence of any parsing order error, it is recommended that you include them at the top of the document. „$MANAGER_WIDGET‟ allows your applications to access common modules provided by the Application Manager.
* In SDK, „$MANAGER_WIDGET‟ points the „commonlib‟ folder that SDK installed in.
<script type="text/javascript" language="javascript"
src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script>
Create an object.
var tvKey =new Common.API.TVKeyValue();
Use known member variable and method.
alert(tvKey.KEY_LEFT);
5.3.
TVKeyValue
TVKeyValue
An object that defines TV key code.
Application Development Guide for Samsung Smart TV
Syntax new Common.API.TVKeyValue()Parameter None
Return Value TVKeyValue object
Remarks
This is an object having key code used by the TV as a member variable, and identifies remote control keys pressed by the user by referring to member variables.
(Since Samsung Smart TV version 2.265)
Example
var tvKey =new Common.API.TVKeyValue(); switch(KEY_CODE){
case tvKey.KEY_LEFT:
// Do something
break;
case tvKey.KEY_RIGHT:
// Do something break; default: break; } Members KEY_TOOLS KEY_MUTE KEY_RETURN KEY_UP KEY_DOWN KEY_LEFT KEY_RIGHT KEY_WHEELDOWN KEY_WHEELUP KEY_ENTER KEY_INFO KEY_EXIT KEY_RED KEY_GREEN KEY_YELLOW KEY_BLUE KEY_INFOLINK KEY_RW KEY_PAUSE KEY_FF KEY_PLAY
Application Development Guide for Samsung Smart TV
KEY_STOP KEY_1 KEY_2 KEY_3 KEY_4 KEY_5 KEY_6 KEY_7 KEY_8 KEY_9 KEY_0 KEY_EMPTY KEY_PRECH KEY_SOURCE KEY_CHLIST KEY_MENU KEY_WLINK KEY_CC KEY_CONTENT KEY_FAVCH KEY_REC KEY_EMODE KEY_DMA KEY_PANEL_CH_UP KEY_PANEL_CH_DOWN KEY_PANEL_VOL_UP KEY_PANEL_VOL_DOWN KEY_PANEL_ENTER KEY_PANEL_SOURCE KEY_PANEL_MENU KEY_PANEL_POWER Methods NoneApplication Development Guide for Samsung Smart TV
5.4.
Widget
This is an object that has functions needed for desirable operation of an application. A method that notifies the Application Manager of starting of an application, a method that registers and frees up keys users want to use, and other methods are contained in this object.
Widget
Object having functions needed for desirable operation of an application Library path $MANAGER_WIDGET/Common/API/Widget.js
Syntax new Common.API.Widget()
Parameter None
Return Value Widget object
Remarks (Since Samsung Smart TV version 2.265)
Example var widgetAPI =new Common.API.Widget(); widgetAPI. sendReadyEvent(); Members None Methods sendReadyEvent sendExitEvent sendReturnEvent blockNavigation putInnerHTML getChannelWidgetListPath getSearchWidgetListPath runSearchWidget
5.4.1.
sendReadyEvent()
sendReadyEvent
Notifies the Application Manager that the application is ready to be displayed. This event should be passed to display and run the application on the screen.
Syntax sendReadyEvent() Parameter None
Return Value None
Application Development Guide for Samsung Smart TV
Example var widgetAPI =new Common.API.Widget(); widgetAPI.sendReadyEvent();
Enumeration None
5.4.2.
sendExitEvent()
sendExitEvent
Brings the same effect as pressing the exit key. Stops the application and goes back to the TV screen. Syntax sendExitEvent()
Parameter None Return Value None
Remarks (Since Samsung Smart TV version 2.265)
Example var widgetAPI =new Common.API.Widget(); widgetAPI.sendExitEvent ();
Enumeration None
5.4.3.
sendReturnEvent()
sendReturnEvent
Brings the same effect of pressing the Return key. Finishes the application and takes you to the Application Manager.
Syntax sendReturnEvent() Parameter None
Return Value None
Remarks (Since Samsung Smart TV version 2.265)
Example var widgetAPI =new Common.API.Widget(); widgetAPI.sendReturnEvent ();
Enumeration None
5.4.4.
blockNavigation()
Application Development Guide for Samsung Smart TV
Key event cannot be forced to return.Syntax blockNavigation(keyEvent) Parameter keyEvent: Key event Return Value None
Remarks
KEY_RETURN and KEY_EXIT events forcibly close the operating application. The func prevents forced closure and keep being executing.
(Since Samsung Smart TV version 2.265)
Example
function keyDown (){
switch(event.keyCode){
casethis.tvKey.KEY_LEFT:
// Do something
break;
casethis.tvKey.KEY_RIGHT:
// Do something
break;
casethis.tvKey.KEY_RETURN:
widgetAPI.blockNavigation(event);
// Not terminated
break;
casethis.tvKey.KEY_EXIT:
// Terminated by force break; default: break; } } Enumeration None
5.4.5.
putInnerHTML()
putInnerHTML
innerHTML method to fix memory issues.
Syntax putInnerHTML(div, contents) Parameter div: Div Element to use innerHTML
contents: Things to insert in innerHTML Return Value None
Remarks
Required to use this method because repetitive use of innerHTML can occur memory issues.
(Since Samsung Smart TV version 2.265) Example var widgetAPI =new Common.API.Widget();
Application Development Guide for Samsung Smart TV
var divElement = document.getElementById("divID"); var contents ="Text to change";
widgetAPI.putInnerHTML(divElement, contents);
Enumeration None
5.4.6.
getChannelWidgetListPath()
getChannelWidgetListPath
Method that brings the path of xml file having the child application list of the current channel bound application
Syntax getChannelWidgetListPath() Parameter None
Return Value string : xml file path
Remarks
This method is used when the channel bound application needs information on the currently installed child application.
(Since Samsung Smart TV version 2.265) Example varvar widgetAPI xmlPath = widgetAPI=new Common.getChannelWidgetListPath();.API.Widget();
Enumeration None
5.4.7.
getSearchWidgetListPath()
getSearchWidgetListPath
Method that brings the path of xml file having the list of applications related Syntax getSearchWidgetListPath()
Parameter None
Return Value string : xml file path
Remarks
This method is used when a search tag in config.xml requires information on an application whose search tag is set as „y‟.
(Since Samsung Smart TV version 2.265) Example varvar widgetAPI xmlPath = widgetAPI=new Common.getSearchWidgetListPath();.API.Widget();
Application Development Guide for Samsung Smart TV
5.4.8.
runSearchWidget()
runSearchWidget
Method called when executing another application in an application Syntax runSearchWidget ()
Parameter appID : The application ID you intend to operate
extraInfo : The string that transferred to the executing application Return Value None
Remarks
This method is used when the channel bound application requires information on the installed child application at present.
(Since Samsung Smart TV version 2.265) Example varwidgetAPI widgetAPI .runSearchWidget(“111011000001”,”key1=value1&key2=value2”);=new Common.API.Widget();
Enumeration None
5.4.9.
checkSapTicket ()
checkSapTicket
Method called when checking to have the valid ticket for current logged-in user. Syntax checkSapTicket ()
Parameter None Return Value None
Remarks
You should register event handler for passing the return value.
If you have valid ticket, the return value is “stat=ok&ticket=686a8281-e952-4dcc-a67b-57e8f92e5530”
Otherwise, it is “stat=fail&ticket=null”.
(Since Samsung Smart TV version 3.037)
Example
// Register Event Handler
curWidget.onWidgetEvent = AAAA;
var widgetAPI =new Common.API.Widget();
widgetAPI.checkSapTicket(); function AAAA(event){
if( event.type == Common.API.EVENT_ENUM.PNS_CHECK_TICKET){ // The return value is event.data.
// TODO }
Application Development Guide for Samsung Smart TV
}Enumeration None
5.4.10.
requestSapTicket ()
requestSapTicket
Method called when requesting new Sap Ticket for Application Server. Syntax requestSapTicket ()
Parameter None Return Value None
Remarks
You should register event handler for passing the return value.
If new ticket is generated normally, the return value is “stat=ok&ticket=686a8281-e952-4dcc-a67b-57e8f92e5530”
Otherwise, it is “stat=fail&ticket=null”.
(Since Samsung Smart TV version 3.037)
Example
// Register Event Handler
curWidget.onWidgetEvent = AAAA;
var widgetAPI =new Common.API.Widget();
widgetAPI.requestSapTicket(); function AAAA(event){
if( event.type == Common.API.EVENT_ENUM.PNS_REQUEST_TICKET){ // The return value is event.data.
// TODO }
} Enumeration None
5.5.
Plugin
The Application Manager provides a wrapper class that allows you to use some plugin functions in more convenient ways. If you want to take advantage of this class, just insert objects needed for use of plugins in the index.html document. Then, the Application Manager will give you an appropriate class method.
Plugin
Application Development Guide for Samsung Smart TV
Library path $MANAGER_WIDGET/Common/API/Plugin.jsSyntax new Common.API.Plugin()
Parameter None
Return Value Plugin object
Remarks (Since Samsung Smart TV version 2.265)
Example var pluginAPI =new Common.API.Plugin(); pluginAPI.setOnWatchDog(); Members None Methods Object ID : pluginObjectTVMW setOnWatchDog setOffWatchDog registKey unregistKey registIMEKey unregistIMEKey registAllKey unregistAllKey registFullWidgetKey registPartWidgetKey Object ID : pluginObjectVideo setOnOSDState setOffOSDState Object ID : pluginObjectVideo setOnOSDState setOffOSDState Object ID : pluginObjectNNavi SetBannerState ShowTools setOnIdleEvent setOffIdleEvent setOnScreenSaver setOffScreenSaver Object ID : pluginObjectAppCommon isViewerKey Object list pluginObjectTVMW
Application Development Guide for Samsung Smart TV
style='opacity:0.0;background-color:#000000;width:0px;height:0px;'></OBJECT>
pluginObjectVideo
<OBJECT id='pluginObjectVideo' border=0 classid='clsid:SAMSUNG-INFOLINK-VIDEO' style='opacity:0.0;background-color:#000000;'></OBJECT>
pluginObjectNNavi
<OBJECT id='pluginObjectNNavi' classid='clsid:SAMSUNG-INFOLINK-NNAVI'
style='opacity:0.0;background-color:#000000;width:0px;height:0px;'></OBJECT>
pluginObjectAppCommon
<OBJECT id='pluginObjectAppCommon' classid='clsid:SAMSUNG-INFOLINK-APPCOMMON' style='opacity:0.0;background-color:#000000;width:0px;height:0px;'></OBJECT>
5.5.1.
setOnWatchDog()
setOnWatchDog
Turns on the Watch dog function.Syntax setOnWatchDog() Parameter None
Return Value None
Remarks (Since Samsung Smart TV version 2.265)
Example var pluginAPI =new Common.API.Plugin(); pluginAPI.setOnWatchDog();
Enumeration None
5.5.2.
setOffWatchDog()
setOffWatchDog
Turns off the Watch dog function.Syntax setOffWatchDog() Parameter None
Return Value None
Remarks (Since Samsung Smart TV version 2.265)
Example var pluginAPI =new Common.API.Plugin(); pluginAPI.setOffWatchDog();
Application Development Guide for Samsung Smart TV
5.5.3.
setOnOSDState()
setOnOSDState
Sets the area where OSD is protected.
Syntax setOnOSDState(left, top, width, height)
Parameter
left : left coordinate of the area top : top coordinate of the area width : width of the area height : height of the area Return Value None
Remarks (Since Samsung Smart TV version 2.265)
Example var pluginAPI =new Common.API.Plugin(); pluginAPI.setOnOSDState(0,0, 330, 540); Enumeration None
5.5.4.
setOffOSDState()
setOffOSDState
Cancels the previously set OSD area.
Syntax setOffOSDState(left, top, width, height)
Parameter
left : left coordinate of the area top : top coordinate of the area width : width of the area
height : height of the area Return Value None
Remarks (Since Samsung Smart TV version 2.265)
Example var pluginAPI =new Common.API.Plugin(); pluginAPI.setOffOSDState(0,0, 330, 540); Enumeration None
Application Development Guide for Samsung Smart TV
5.5.5.
registKey()
registKey
Lets the Application Manager register specific key Syntax registKey(pNumKeyCode) Parameter pNumKeyCode: key code Return Value None
Remarks
Registration/Unregistration of keys should be done after window.onshow event. Refer to Chap. 6.4 How to use keys on remote control for more details.
(Since Samsung Smart TV version 2.265) Example var pluginAPI =new Common.API.Plugin();
pluginAPI.registKey(tvKey.KEY_ TOOLS);
Enumeration None
5.5.6.
unregistKey()
unregistKey
Lets the Application Manager unregister specific key Syntax unregistKey(pNumKeyCode) Parameter pNumKeyCode: key code Return Value None
Remarks
Registration/Unregistration of keys should be done after window.onshow event. Refer to Chap. 6.4 How to use keys on remote control for more details.
(Since Samsung Smart TV version 2.265) Example var pluginAPI =new Common.API.Plugin();
pluginAPI.unregistKey(tvKey.KEY_ TOOLS);
Enumeration None