FrontPage SamsungSmartTvSdkInstall

Difference between r1.30 and the current

@@ -190,7 +190,6 @@
<!-- TODO : Common API -->
<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="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js"></script>

<!-- TODO : Javascript code -->
<script language="javascript" type="text/javascript" src="app/javascript/Main.js"></script>



1. Preparation

1.1. Samsung SDK download

  1. download Samsung Smart TV SDK
    1. Go http://www.samsungdforum.com/ and register yourself.
    2. Click on [http]SDK and Click on [http]SDK Download
      temp5.png
      [PNG image (8.84 KB)]

    3. Select one of the SDK packages and download it: 4.5
      1. SDK IDE Download for Windows 32bit
      2. SDK IDE Download for Windows 64bit . . .
    4. Select SDK Emulator Image for Virtual Box <---- 6th row of the download files list.
      temp6.png
      [PNG image (69.15 KB)]

    5. Once downloaded,

1.2. WAMP

  1. download WAMP : Windows, Apache, Mysql, Php
    1. WAMP: go to http://www.wampserver.com/en/ and download one of the WAMPSERVERs (Apache 32bit vs 64bit | Apache 2.4 vs. 2.2).
    2. Install the package -> this will install at c:/Wamp :
      1. Apache: World Wide Web server
      2. PHP: Interactive programing language
      3. Mysql: database tool
      4. Some utilities like PhpMyAdmin. . . .
      5. Take a note that the default www directory is c:/wamp/www
      6. Or you can change them. -->
        • Edit the FILE: C:\Wamp\bin\apache\Apache2.4.4\conf\httpd.conf
        • eg.,

           
           DocumentRoot "c:/Wamp/www"
           <Directory "c:/Wamp/www">
          
          To
           # DocumentRoot "c:/Wamp/www"
           # <Directory "c:/Wamp/www">
           DocumentRoot "d:/htdocs"
           <Directory "d:/htdocs">
          
        • restart the apache service
          temp7.png
          [PNG image (21.72 KB)]

  2. Check the server with web browser enter the local server address, http://localhost/ , then, hit enter key.
    temp8.png
    [PNG image (37.79 KB)]

  1. Open a text file in the html directory
    <?php
        phpinfo
    ();
    ?>
    then, save the file as "phpinfo.php" http://localhost/phpinfo.php Check the version of PHP . . . .
  2. Interaction . . .
    ask.php
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
    </head>
    <body>
    <form method="post" action="catchName.php">
        <input type="text" name = "name">
        <input type="text" name = "email">
        <input type="submit" name = "submit" value="전송합니다" />
    </form>
    </body>
    </html>
    catchName.php
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
    </head>
    <body>
    <?php
        
    echo $_POST['name'];
        echo 
    "<br />";
        echo 
    $_POST['email'];

    ?>

    </body>
    </html>

1.3. Java, JRE, Oracle Virtualbox, etc

  1. Java, Virtualbox, etc. stuff: Install them into c:/Bin .
    1. [http]Java SDK | [http]JRE
    2. [http]Python 2.7 choose version 2.7 not 3.
    3. [https]VurtualBox is needed to installed.
    4. Once Virtualbox installed, see http://www.samsungdforum.com/Guide/d11/index.html to load the Samsung Smart TV emulator.
    5. Unzip Samusung Smart TV SDK onto your hard disk drive: c:\bin\SamsungSmartTvSdk
    6. execute eclipse.exe as an administrator

2. Hello world

  1. Click on "Samsung Smart TV SDK" menu
  2. Pick Samsung Smart TV SDK Javascript App Project
  3. Project Name - HelloTV
  4. Resolution - 1280 x 720

2.1. Main.js

var widgetAPI = new Common.API.Widget();
widgetAPI.sendReadyEvent(); // Send "ready" message to app manager 

var tvKey = new Common.API.TVKeyValue();

var Main =
{
};


Main.onLoad = function()
{
	// Enable key event processing
	this.enableKeys();
	widgetAPI.sendReadyEvent();
};

Main.onUnload = function()
{

};

Main.enableKeys = function()
{
	document.getElementById("anchor").focus();
};

Main.keyDown = function()
{
	var keyCode = event.keyCode;
	alert("Key pressed: " + keyCode);

	switch(keyCode)
	{
		case tvKey.KEY_RETURN:
		case tvKey.KEY_PANEL_RETURN:
			alert("RETURN");
			widgetAPI.sendReturnEvent();
			break;
		case tvKey.KEY_LEFT:
			// alert("LEFT");
			document.getElementById("hello").innerHTML = "LEFT";
			break;
		case tvKey.KEY_RIGHT:
			// alert("RIGHT");
			document.getElementById("hello").innerHTML = "RIGHT";
			break;
		case tvKey.KEY_UP:
			alert("UP");
			break;
		case tvKey.KEY_DOWN:
			alert("DOWN");
			break;
		case tvKey.KEY_ENTER:
		case tvKey.KEY_PANEL_ENTER:
			// alert("ENTER");
			document.getElementById("hello").innerHTML = "Here we go. Enter!";
			break;
		default:
			alert("Unhandled key");
			break;
	}
};

2.2. Main.css

*
{
	padding: 0;
	margin: 0;
	border: 0;
}

/* Layout */
body
{
	width: 1280px;
	height: 720px;
	background-color: #FFF;
}

#hello {
	font-size:250px;	
}

2.3. index.html

<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>HelloTV</title>

		<!-- TODO : Common API -->
		<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>

		<!-- TODO : Javascript code -->
		<script language="javascript" type="text/javascript" src="app/javascript/Main.js"></script>

		<!-- TODO : Style sheets code -->
		<link rel="stylesheet" href="app/stylesheets/Main.css" type="text/css">

		<!-- TODO: Plugins -->

	</head>

	<body onload="Main.onLoad();" onunload="Main.onUnload();">

		<!-- Dummy anchor as focus for key events -->
		<a href="javascript:void(0);" id="anchor" onkeydown="Main.keyDown();"></a>

		<!-- TODO: your code here -->
		<label id="hello">Hello TV</label>
		
	</body>
</html>


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2013-11-04 12:05:18
Processing time 0.0294 sec