A Smart TV Service or "App" is a type of application written for a Smart TV Platform (device). This page describes briefly what it typically consists of, which standards are available that describe how a Smart TV Service is written and provides some further background information. Smart TV itself is a broad term, that concerns both Services/Apps as well as native functionality of a Smart TV device. For the purpose of this page, this native functionality (Electronic Program Guide, PVR functionality etc.) is out-of-scope.
The most common form of a Smart TV App/Service is (web) browser-based. Additionally, some newer platforms expose additional non-browser based API's for making Smart TV Apps, such as Android. This page describes the common browser based Smart TV Apps. In addition it will also cover some description of native android based app and some functionalities it can provide. Also, there are some discussions related to some services/functionality used in our app which is combination of web and native functionality. This kind of app is known as Hybrid App.
Examples of Smart TV Apps/Services that run inside a browser:
- BBC iPlayer
- ARD/ZDF Mediathek
- Uitzending Gemist
In SAM, the Smart TV First Screen App is basically an android application, which after launch triggers the browser application to launch which then acts as a container to show Generic Dashboard web application. As it is a native android application, so its can use all the native features/services of the Smart TV.
Relevance to SAM
A Smart TV can be a device representation for SAM, and this page is part of the "Multi-device Representation and 2nd Screen" RTD work package. This page specifically focuses on the format of the representation layer, which should be compatible with Smart TV devices.
State of the Art Analysis
Smart TV Standards
A number of standards have been made that describe how a Smart TV App/Service can be written, a list of some of the more known standards:
- CEA-2014 (describes CE-HTML, a HTML4 subset) 
- HbbTV 1.5 (based on CE-HTML) 
- Open IPTV Forum (based on CE-HTML) 
- Smart TV Alliance (based on HTML5) 
- Smart Android TV Developer Apis 
The latest standards for Smart TV Apps that run inside a browser are based on HTML5 (related) standard(s), which offers for example advanced use cases for media streaming and improved user interface design options.
Typical service architecture
Native Smart TV Application runs on native TV platform. This application has the capability to use all Smart TV native features.
Browser based Smart TV Applications run on the (web) browser that resides in the Smart TV Client. The code is hosted on a remote server, that is accessed over the HTTP protocol. Below is a description of both client and server interface for the Smart TV Application. The picture shows an overview of the relationship between the client and server for rendering and controlling a Smart TV Application.
Hybrid Application is the combination of both kind of application ie Native Smart TV Application and Browser based Smart TV Application. In hybrid application, the native application can launch browser from inside it which can then run the web application.
Unlike native applications, Smart TV Apps that are browser based are hosted on an HTTP server, just like regular web pages on the internet. This also implies that these applications do not have to be pre-installed on the platform on which they run, but can be started from the remote server location (using a Uniform Resource Locator, URL), just like opening a web page in a desktop browser. On some platforms, configuration of the Service URL can still be done using a small pre-installed application, but this application would typically only contain Metadata (URL, description, title, etc.). Some related concepts, such as Widgets, do allow for the possibility to pre-install actual packaged application data to the client, but only a very few Smart TV platforms support this type of downloaded application, which still has to gather data (media, real-time data) from a remote server, just like a regular Smart TV App.
Based on the standard for which the App is written, the server can contain some extensions to allow for more advanced use cases. Examples of such use cases:
- Digital Rights Management (DRM), for securing served media content.
- Adaptive Streaming Server, for serving streaming media to the client according to one of the known 'Adaptive Streaming' protocols . Examples are HTTP Live Streaming , MPEG-DASH  and Smooth Streaming .
- Cross-Origin Resource Sharing, enabling the sharing of resources that are not located on the server that is hosting the content.
The Smart TV App itself is written in a language such as HTML(5), with certain client-side extensions that are part of the standard for which the App was written. Important client-side building blocks of an App:
- HTML  - the markup language describing the Application
- CSS  - Cascading Style Sheets, for defining/modifying the look and feel of the application. Refer also to the SmartTV User Interfaces page.
- Miscellaneous content, such as pictures and remote data (JSON , XML ) served over the XMLHTTPRequest  interface
Client-side extensions of an application are for example:
- Capability description mechanisms - some standards offer methods to retrieve the Smart TV Platform capabilities, these capabilities can then be used to adapt the Application to the Platform. Example of a capability is the availability of color-keys on the remote control, or the presence of a specific DRM method.
- Special key constants - a uniform way to refer to remote control key codes inside the App. Instead of codes (20, 23, etc.) that differ per Smart TV Platform, some standards define constants such as VK_PLAY, VK_RED, VK_1 that are the same regardless of the platform on which the App is running.
- Media playback - although part of HTML5, some earlier standards describe specific extensions to play back media inside the browser. Additionally, these extensions can in later standards be combined with DRM functionality. HTML5 offers advanced options for media playback that include closed captioning and multi-track audio.
- Multi-screen functionality - the latest Smart TV standards support methods to interact between the TV device and an external device such as a Smart Phone through various Multi-screen protocols such as DIAL. Refer to Multiscreen (App-to-app) Communication for more information.
Developing a Smart TV Service/App
As the Smart TV App is running in a browser, developing the app can be done using known web developer tools. However, Smart TV standards such as the ones described above will sometimes offer Software/Service Development Kits that include documentation and tooling specifically targeted towards development for that standard. This tooling can consist of an emulator to test the App, documentation on best practices and Integrated Development Environments to quickly create a new App from scratch. An advantage of using such an SDK over more rudimentary development methods is that the tooling will render and validate the application based on the Smart TV Platform that will ultimately run the application, without the need to obtain specific Smart TV hardware, thereby shortening the development cycle considerably. Additionally, the SDK can offer tooling for advanced debugging of the application which, by design, is often not available on regular Smart TV platforms.
Examples of Software/Service Development Kits:
Developing of Sam Smart TV Service/App
In SAM, the Smart TV is an Android Smart TV. The Smart TV app in an hybrid app, so it combines the features of android platform and Web App. The application is launched as native android application. Once launched, it has the capability to launch browser application from inside which can then host the web app.
The services used in this application which are provided using Android APIs are :
- Network Service Discovery (NSD) 
- Web Sockets for communication between First Screen and Second Screen
- Web Server for hosting Web Application in first screen
The web related services are provided through Web Browser which is launched from inside the application.
- CEA-2014 https://www.ce.org/Standards/Standard-Listings/R7-Home-Network-Committee/CEA-2014-B-(ANSI).aspx
- HbbTV http://www.hbbtv.org/
- Open IPTV Forum http://www.oipf.tv
- Smart TV Alliance https://developers.smarttv-alliance.org
- Android TV Developer APIs https://developer.android.com/tv/index.html
- HTML5 http://www.w3.org/TR/2012/CR-html5-20121217/
- HTTP http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
- Adaptive streaming http://en.wikipedia.org/wiki/Adaptive_bitrate_streaming
- HTTP Live Streaming http://en.wikipedia.org/wiki/HTTP_Live_Streaming
- MPEG-DASH http://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP
- Smooth Streaming http://www.iis.net/downloads/microsoft/smooth-streaming
- HTML http://en.wikipedia.org/wiki/Html
- CSS http://en.wikipedia.org/wiki/Css
- DOM http://en.wikipedia.org/wiki/Document_object_model
- JSON http://en.wikipedia.org/wiki/Json
- XML http://en.wikipedia.org/wiki/Xml
- XMLHTTPRequest http://en.wikipedia.org/wiki/XMLHTTPRequest
- DIAL http://www.dial-multiscreen.org/
- Tizen SDK https://developer.tizen.org/downloads/tizen-sdk
- Smart TV Alliance SDK https://developers.smarttv-alliance.org/sdk
- NSD http://developer.android.com/training/connect-devices-wirelessly/nsd.html