This post is also available in: Russian
Over the past two years, we have witnessed a rapid growth of a new trend in the mass TV set market. Next generation TV sets that are connected to the Internet and empowered with an application platform, are becoming exceedingly popular. Like with smart phones, the TV applications can be supplied with a device or installed from a directory. The mass media and promotional publications often dub such an approach as "Smart TV" or, less frequently, "Connected TV" or "Hybrid TV". We believe that this trend is mostly neglected today by the developer community. It is little written and spoken about, but at the same time, it offers tremendous opportunities to attract that part of the audience which is poorly or even not yet covered by the ubiquity of computer and smart phone technology. In particular, for applications designed to deliver video content, the television video platforms are a natural environment, and they should be given the same attention as the mobile applications.
Unfortunately, at this point the TV based development is highly fragmented. As there is no common standardized platform for TV application development , each manufacturer offers its own SDK, APIs, application requirements and installation agreements. Each manufacturer is yearly updating its SDK with new features. Good news is that all of them are, in one way or another, based on Web technologies, each offering its specific restrictions and additional features. The most abundant today on the market, are Smart TV based devices made by LG, Samsung and Philips. In this post, we will brief you on developing of TV based applications exemplified by LG Smart TV.
In addition to the software features of the platform, there are also limitations inherent to the type of user interaction with the TV and their hardware functionality. Let’s discuss the main of them.
Compared to desktops and laptops, TVs have been traditionally using quite slow CPUs, usually based on the MIPS architecture. This limits the capabilities of GUI visual design, including all kinds of page element animation, semi-transparency, interface smoothness, not to mention the 3D graphics.
But the main challenge for a developer accustomed to common Web based applications, is the way the user interacts with the TV: usually laying on a sofa at a distance of several meters and using a relatively slow and awkward input device, a remote control. Such a big TV watching distance means that text and the images should be shown large. As a result, the information density is comparable to mobile devices. Also, it is recommended to avoid page scrolling as it is not user friendly.
Navigating with the Remote Control
Along with that, the plugin automatically detects, en every direction, the closest element focusable by arrow keys. To track pressing of arrows or a confirm button (Enter/OK), the plugin uses standard keyboard codes that match the codes on the LG remote. The keynav plugin is very easy to use, but its algorithm to determine a neighboring element is not suitable for complex layouts, e.g., when the screen is divided into several independent areas, including the top menu, sidebar, content, footer. In this case, we would prefer that navigation within each of these areas has also been independent of the others. However, a strange effect might occur with keynav, when on sequential pressing of the same arrow the cursor jumps between areas, as it identifies the closest element in another zone. But even if you have a pretty simplistic design, jquery-keynav can still behave wierdly at the slightest several-pixel deviation of elements.
How can this be avoided? Based on performance considerations, the LG developer documentation recommends to avoid using of any libraries altogether. Following this principle, in the sample provided with the SDK, the entire logic of arrow navigation is manually coded. But for us, such an approach is a premature optimization, as it would create undesirable application complexity, but the gain in performance would be minimal. For ease of development, we need such a level of abstraction which is flexible enough and would allow you to intervene with the automatic navigation logic where needed. Such features are offered by the KeyController class which is part of the Web Google TV UI Library. With the useGeometry option, this class is similar to jquery-keynav, but offers the following additional benefits:
- A more accurate algorithm to find the closest element, taking into account the arrow direction.
- An ability to split the page into areas and layers with an independent navigation (for instance, to display modal dialogs) .
- The capability to override the default navigation behavior.
- Control the browser engine: going to the previous page (the "Back" button feature), exit the application and return to the main menu, show the download indicator.
- Control video playback: set the zoom mode, invoke a built-in menu with settings of video and sound, call the scale settings menu.
- Manage the functions of Magic-RCU control (point-and-click, similar to a mouse): hide the cursor, enable control’s on and off events.
- Get the TV specific details: version of software and hardware, supported features and options.
- Manage the Media Player.
The LG NetCast Video Player
In the LG Web applications, the media player is a browser plugin embedded into a page using the object tag. Depending on the content of the type attribute, it can run as a video or audio player. The player can play back content encoded in different formats and codecs. In particular, support of H.264/AVC has been declared with settings up to High Profile (3.2/4.1), 4 Mbps, 1920×1080 and AAC-LC/HE, MP3 audio codecs. A complete list is given in the developer documentation. HTTP Live Streaming with multi-bitrate is also supported. The video player can support two operating modes: full-screen or embedded, and enables 3D video on the application level with 3D-enabled TVs. The player can run content in accelerated or slow motion, provided that it is supported by the video protocol.
The media player supports two DRM systems: Windows Media DRM and Widewine. If you are not willing to invest your effort in the purchase and deployment of a full-fledged DRM system, the player can help protect your content from unauthorized download using oneshot URLs. In this mode, the Web server provides content links valid for one download, and the player adequately handles such operations.
All the necessary design documentation and sample code are available and regularly updated on a dedicated LG Developer Lounge portal. First of all, please read the guide on how to run your applications on real TVs, download sample applications, try to launch them and become familiar with the source code. If you are familiar with Web based application development, mastering all this is not a big deal, and the sample code will help you learn the specifics of the platform. If you are going to port an existing application, try running it on a platform first. This way you will immediately understand what challenges you are going to face and what needs to be changed. Then read through the Web Application Development Guide describing the technical features of the platform: supported HTML features, codecs, video formats, transport protocols, screen resolution, etc., recommendations to the Smart TV user interface as well as Media Product User Interface Guidelines.
To publish an application in the store, you should fill out several forms and submit an application for testing. The details of this process are described in Required documents for application submission to LG Seller Lounge.
To push your application not just to the the store, but also to the NetCast main page with the next automatic update, you should acquire the LG partner status. Partner development guidelines embrace not just the technical issues and GUI requirements, but also the process of application development: its various phases, length, milestones, internal application testing at LG, etc. This allows to ensure a higher quality of partner applications.