43

Problem:

I'd like to try building a proof-of-concept app using the Samsung SmartTV SDK 2.5 (I have a 2011 model TV - UA55D8000).

Unfortunaltely, the SDK comes in two varieties that only seem to work on Microsoft Windows. It's weird because there's no reason it should be the case: the televisions themselves run Linux and applications are written in JavaScript.

This presents two problems:

  1. As I don't have Microsoft Windows at home, I can't use the build environment (nor the TV emulator) that come with the SDK. (The SDK files themselves are just JavaScript)

  2. Even if I had access to Windows, it's very hard to automate building & testing of the Apps without access to traditional build tools (e.g: Make, Ant, Autotools, etc)

How can I build Samsung Smart TV Applications on Linux? (i.e: without using the Windows-based build tools that come with the SDK)


What I've figured out so far:

From what I can gather, a JavaScript-mode application is simply zip file containing an XML config file, one or more JavaScript files (including supplied JavaScript interface libraries for platform SDK functions), and any required assets (HTML, images, etc).

Also, from what I gather, deployment involves placing the zip file and an XML manifest file on a web-server network accessible to the TV, logging in as 'develop' on the TV and 'syncing' the application to the installed applications on the TV.


Could someone point me to a source for the full deployment requirements & app bundle requirements? Or even just a working sample?

David-SkyMesh
  • 5,041
  • 1
  • 31
  • 38
  • 1
    Really, too narrow: All smarttv developers who aren't windows-using blubs? This question would be independent of smarttv sdk version and tv model, if that helps - only mentioned in case that effects deployment requirements – David-SkyMesh Oct 11 '12 at 07:16
  • 3
    @Jim Garrison and the rest of moderators. You shouldn't close the question as it is quite reasonable. The Samsung SDK works only on Windows but in fact it is possible to develop without it. And when you have linux or Mac you have no choice. So back to the topic... yes you need to have manifest file visible in your LAN (for. example: http://192.168.0.1/widgetlist.xml) and inside you need to have working URL to your's application ZIP file. And the working example you can download here: http://www.samsungdforum.com/Guide/art00021/downloads/art00021_SamsungTVAF2_VideoPlayer_FullScreen.zip – Adam Lukaszczyk Oct 17 '12 at 06:10
  • @Dobiatowski. Thanks for the app example! I also found the BrightCove example, and also SmartMythTV (http://sourceforge.net/projects/smartmythtv/files/). All those examples should suffice to determine the various App bundle possibilities. I was able to use Wireshark plus the publically accessible deployment for SmartMythTV (details here: http://sourceforge.net/p/smartmythtv/wiki/Home/) to get an example manifest file. Full specs for both would be handy though :-) – David-SkyMesh Oct 19 '12 at 04:24
  • 2
    @Dobiatowski No moderators were involved in closing this question. It has been closed by normal users with the privilege of voting to close. – apaderno Dec 15 '12 at 12:26
  • 1
    Could you edit your question and explain why having Microsoft Windows OS is important? – Yauhen Yakimovich Dec 15 '12 at 17:46
  • Question has been updated. – David-SkyMesh Dec 16 '12 at 06:46
  • @David-SkyMesh: thnx. I think I should explain the contradiction that I read in your question "without IDE" and then you say "(e.g. on Linux)". A lot of unix people including me agree on a simple fact UNIX-like system is an IDE http://en.wikipedia.org/wiki/Integrated_development_environment#Attitudes_across_different_computing_platforms. SO in that sense I read the question as ".. without IDE (e.g. on IDE)" and this confusing to me. – Yauhen Yakimovich Dec 16 '12 at 13:47
  • So apparently what you call an IDE is in fact a Samsung SDK plugin for eclipse with requirements: "OS (32bit) : Windows XP Service Pack 2 or higher, Windows 7". I thing that was not immediately obvious at least for me. Thnx for editing the question - it is now much more readable and nicer. – Yauhen Yakimovich Dec 16 '12 at 13:56
  • @David-SkyMesh: BTW your question rose some discussion on meta SE which I think is a good thing http://meta.stackexchange.com/questions/158807/why-is-this-question-closed-as-too-localized/158824#158824 I learned from it a lot more than usual on writing good question and the role of community how to systematically resolve misunderstandings :) – Yauhen Yakimovich Dec 16 '12 at 13:59
  • @YauhenYakimovich: there are *two* options for building apps in the SDK. There's an eclipse plugin, and then there's an IDE (exactly what the term means, I'm not confused about the term): http://www.samsungdforum.com/Devtools/Sdkdownload Either way, you need windows. – David-SkyMesh Dec 18 '12 at 02:04

6 Answers6

60

I've had a reasonable amount of success setting up a development environment on my Ubuntu machine and I'd like to share my methods here for anyone looking to do the same. This answer is intended to be platform independent, so the same advice should work on any fully fledged operating system.

Introduction

First off, the question's assumptions regarding app structure are correct. A JavaScript application consists of the following items:

  • config.xml, a simple configuration file defining various settings and deployment information. See Writing the config.xml File on the official developer site.
  • widget.info, a very small file with a few lines used to define the opacity of the application's body. This may not be required for full-screen applications.
  • index.html, the main HTML file for your application.
  • Images, sounds and other resources.

You can write these files using your favourite editor. I'm happily using vim with linting plugins for my JS and CSS.

Testing

As of version 4.0 of the SDK, a Linux version of the emulator is now available. This allows you to test your apps as they would appear on 2011-2013 TVs. For older TVs, you can run SDK 1.5's emulator in Wine, but emulators belonging to SDK 2.0 and newer will not run.

It is possible to run the emulators in a Windows virtual machine, and, with a little bit of trickery, you can make the emulators use your own application folder to look for apps. This involves sharing your development folders with your virtual machine, then creating a symbolic link to those folders, replacing the "apps" folder inside the SDK's installation directory. A quick overview of this process is available in an article titled, Your Windows IDE sucks? Replace it with Your Favorite Editor on the Mac!

Deployment

Samsung Smart TVs have a built-in developer account that allows you to send an application over from your computer for live testing on the television itself. You enter the IP address of your deployment server and the TV will look for a file called widgetlist.xml on that server. An example of the format is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok">
  <list>
    <widget id="MyTVApp">
      <title>MyTVApp</title>
      <compression size="3383543" type="zip"/>
      <description>A basic application for Samsung TVs</description>
      <download>http://192.168.1.83/Widget/MyTVApp_0.1_America_20120709.zip</download>
    </widget>
  </list>
</rsp>

After that, it will download each app listed using the URL in the <download> tag. All you have to do is zip up the files, modify the widgetlist.xml accordingly and make sure both files are hosted in a web server running on your machine. You can use Apache, lighttpd or anything. I have a small node.js/connect app that will build the widgetlist.xml dynamically based on the zip files I have in a directory labelled deploy.

So there you have it. Development of Samsung Smart TV apps is not impossible without Windows. In fact, there's quite a few options available. Hooray!

Andy E
  • 338,112
  • 86
  • 474
  • 445
  • 1
    I eventually got some example deployment files from the smartmythtv app. Thanks for the nice write up! – David-SkyMesh Dec 14 '12 at 04:54
  • @David-SkyMesh Do you plan to upload this "hello world" example somewhere on github as OSS? – Yauhen Yakimovich Dec 16 '12 at 14:01
  • It's not a "hello world" app. As I mentioned in comments on the question itself, it's a real app (in "the wild"). Unlike most apps, SmartMythTV is not hosted by Samsung, rather you log in using the 'Develop' account so that you can install it from SmartMythTV's deployment repository directly. I'm not sure of the exact license (and as I'm not deriving its code - I don't care), however the code itself is also hosted on Sourceforce: http://sourceforge.net/projects/smartmythtv/files/ – David-SkyMesh Dec 16 '12 at 23:12
  • @Andy E, Just a heads up that *.NET Framework 2.0* is a requirement for the Samsung SmartTV SDK, which then suggests you might want to use the Linux variant called [**`Mono`**](http://www.mono-project.com/Compatibility). – arttronics Dec 23 '12 at 11:44
  • 1
    @arttronics: thanks. Mono is included with wine since 1.5.6 and automatically installed when required, so I don't think that is the problem. However, I did attempt to install it anyway, but still no luck :-( – Andy E Dec 23 '12 at 13:28
  • @AndyE Thank you, that is very useful for me. How to identify size manually? Are you open to share custom script for building widget file? Thanks! – Pavel Binar Feb 13 '13 at 14:04
  • Does the ip address need to be local on the network or can it be a remote address? – Abadaba Apr 23 '13 at 21:46
  • Could this be used with a livereload type setup? – Jeff Voss Oct 14 '15 at 18:34
8

They have now released Smart TV SDK 4.0 which includes support for Linux & Mac OS X: http://www.samsungdforum.com/SamsungDForum/NewsView?newsID=27

"In addition to the Eclipse-based App Editor, a new Linux-based Emulator has been released.
This Emulator executes in an Ubuntu virtual machine that is run in the Virtual Box virtualization tool."

■ Features for 2013 Platform on Linux (First Release)

  • Apps Framework
  • App Engine / WebKit
  • UniPlayer
  • SEF (Service Extension Framework)

You need to register to Samsung D forum and then you can download the SDK from https://www.samsungdforum.com/Devtools/SdkDownload

yelmu
  • 81
  • 1
  • 5
  • 1
    It works for 2011 TV, but SDK dropped support for 2010 models. – Ivan Solntsev Jan 17 '13 at 07:34
  • The current location of the SDK and VirtualBox emulator is very difficult to find, but I finally stumbled upon them here: https://developer.samsung.com/smarttv/develop/tools/tv-extension/archive.html under the heading "Samsung TV SDK for Legacy Platform". – Shaheed Haque Jul 04 '21 at 04:02
8

One tip that I have not seen mentioned in any of the answers, is that the TV will attempt to open a socket connection on port 45634 of the machine where the app was downloaded from (the one with the widgetlist.xml).

All debugging (alerts() calls), will be sent over this port, allowing for remote debugging.

I use NetCat to open a port and dump all logs, like so:

nc -l 45634
Steve
  • 53,375
  • 33
  • 96
  • 141
  • 1
    Very helpful! An alternative for logging I just came across: https://gist.github.com/janmonschke/4992216 – matb33 Aug 21 '14 at 19:20
4

I've created this Answer for a topic that I know nothing about, but nevertheless I did spot something that threw a red flag in my direction... or not.

First, I looked at your WineHQ Bug Report to see if this issue was resolved, but it's still pending as of this writing. I noticed that bug report had a reference link to the discussion which I clicked and followed.

Looking at the machine-code generated dump-error in that discussion proved informative.

Reference:

Z:\home\andy.wine\drive_c\Program Files (x86)\Samsung\Samsung TV SDK(3.5.2)\Emulator\Emulator2012_v3.5\bin\Emulator2.exe

The above Path is the location of the file that caused the dump. That path is the red flag I mentioned.

Let me back up a tiny bit and explain about what I learned about Windows XP SP3 and IE8 which very well may apply here, or you can skip down to the line with the bold text.

I worked on a webpage project that used a lightbox plugin called Shadowbox. That project wasn't on a local server, just in a subfolder of a subfolder. It works fine in Firefox and Chrome but IE choked and didn't render any CSS from the plugins style sheet. Because I was very familiar with Shadowbox, I was 100% convinced it was not the plugin. So I started to think outside the box, and through trials and tribulations I discovered the culprit was just the actual path!

I had created a subfolder for the project that used /test(v1)/ in the Path and that's what broke IE8. Once I removed the parentheses, the CSS was loaded correctly. This same solution was also the cause of a CSS issue for a forum member who used Vista and IE9, so then it's conceivable these issues lie with Wine as well.

What issue is that? It's using illegal characters, the parentheses, in the path name. I will stop short and say the URL name only because it's the file path leading to the index.html file (and only relative paths were used in coding - parentheses could not be escaped - and base tag failed).

Firefox and Chrome were forgiving, but not IE. Even though you may not be using IE, it's possible that this issue extends outside of that.

My solution is not to use parentheses or whitespaces in any portion of your file path. While this may not solve this particular bug, at the very least you will not have sandbox Wine issues for when that file path becomes a URL path for whatever requirement (e.g., accessing a SWF object to be used as a video player). If IE browsers are unforgiving, so too can other embedded browsers or programing modules.

Recommended:

Z:\home\andy.wine\drive_c\Samsung\Samsung_TV SDK_3.5.2\Emulator\Emulator2012_v3.5\bin\Emulator2.exe

Notice the above does not use the Program Files (x86) folder since that can't be changed per OS requirements. Having such a path will surely reduce, if not eliminate, any unforeseen errors. Cheers!

arttronics
  • 9,957
  • 2
  • 26
  • 62
4

I know it's an old question, but since I'm delving into the process, I figured I'd share some links. Enjoy!

Decent quick start guide on developing for the Smart TV platform: http://www.samsungdforum.com/Guide/c02/index.html.

These are the minimum project requirements and some example files: http://www.samsungdforum.com/Guide/art00011/index.html.

Zachary Nicoll
  • 339
  • 1
  • 4
  • 14
1

For people who like doing everything with command line, smarttvjs (http://smarttvjs.org) has made it very easy:

  • $smarttvjs init #create sample project
  • ... do some development (IDE is nor required)
  • $smarttvjs build samsung (create a package for samsung)
  • $smarttvjs run samsung #launch simulator
yawl
  • 719
  • 6
  • 7