Dune HD STB - HTML APPLICATIONS



Overview

Dune HD STB models starting with Dune HD TV-101 support fullscreen HTML
applications.

HTML applications can use HTML, CSS, JavaScript, DHTML, AJAX.

HTML applications can use Dune HD STB JS API which provides operations for
controlling video/audio playback (start/stop/pause/seek/set video
window/etc) and accessing and controlling various STB functions.

When Opera web browser is used, HTML5 media playback API also can be used,
if required.

STB JS API

Dune HD STB JS API documentation and usage examples are available in "JS
STB SDK" packages (js_stb_sdk-*.zip), see "JS STB STB" section here:
   http://files.dune-hd.com/sdk/doc/html/sdk.html

See the following files in the JS STB SDK package:
   - Documentation:
      - js_stb_sdk-*/doc/dune_js_stb_api.txt
   - Usage examples:
      - js_stb_sdk-*/test/*.html

Web browser engines

The following web browser engines are available:

   - Opera:
      - Provides HTML5 media playback support.
      - For SMP8672/SMP8674-based Dune HD models: available w/o additional
        licensing.
      - Is included into the standard retail firmware of
        SMP8672/SMP8674-based Dune HD models.
      - For SMP8670-based Dune HD models: available for testing/development
        only; production use would require additional licensing (if you
        need it, please discuss it with your Dune HD contacts).
      - The following Opera firmware versions are available:
         - Based on Opera Devices SDK 3.3.
            - This is is the same Opera version as used in the standard
              retail firmware and is recommended by default, especially for
              old projects which used Opera 3.3 based firmware before.
         - Based on Opera Devices SDK 3.5.
            - This is a newer Opera version which has some
              incompatibilities in comparison with Opera 3.3, but it is
              known that it may provide better performance in some cases
              (depends on implementation details of a particular HTML
              application).
            - May be considered for new projects, e.g. if the improved
              performance or some other specific features of Opera 3.5 are
              important.
            - Old projects should be carefully retested when migrating from
              Opera 3.3 to Opera 3.5.
         - Based on Opera Devices SDK 3.5 with HbbTV support.
            - Suitable for projects which require HbbTV support.

   - WebKit:
      - Does not provide HTML5 media playback support.
      - Available on all supported Dune HD models w/o additional licensing.
      - Is included into the standard retail firmware of SMP8670-based Dune
        HD models.
      - The following WebKit firmware versions are available:
         - Based on QtWebkit from Qt 4.7:
            - This is the same QtWebKit version as used in the standard
              retail firmware and is recommended by default, especially for
              older projects which used Qt 4.7 based firmware before.
            - This QtWebkit version support transitions between the native
              Dune GUI and HTML application. E.g. it is possible to launch
              HTML applications from the native Dune GUI and then return
              back to the native Dune GUI, or, vice versa, it is possible
              to launch the native Dune GUI from the native stb_home HTML
              application and then return back to the HTML application.
         - Based on QtWebKit from Qt 4.8:
            - This is a newer QtWebkit version which has some limitations
              and incompatibilities in comparison with Qt 4.7, but it is
              known that it may provide better performance in some cases
              (depends on implementation details of a particular HTML
              application).
            - There may be some incompatibilities and rendering issues in
              comparison with Qt 4.7 version (depends on implementation
              details of a particular HTML application).
            - Transitions between the native Dune GUI and HTML applications
              is not supported in general case (except perhaps some
              specific cases, which should be carefully tested).
            - May be considered for new projects, e.g. if the improved
              performance or some other specific features of Qt 4.8 are
              important, and the limitations of this version are
              acceptable.
            - Old projects should be carefully retested when migrating from
              Qt 4.7 to Qt 4.8.

Different ways to launch HTML application

HTML application can be launched on the STB in several ways:

   - An HTML page can be manually launched from the native Dune HD UI using
     a M3U file.
      - See "Launching HTML application via M3U file" section.

   - The HTML application can be packaged as a "plugin", which, when
     installed, adds an item (icon) allowing to launch the HTML application
     in native Dune HD UI.
      - See "HTML plugins" section.

   - The HTML application can be installed into the flash memory of the STB
     and launched on STB boot instead of the native Dune HD UI using
     "stb_home" mechanism.
      - See "Boot to HTML page via stb_home mechanism" section.

   - An HTML page can be manually launched from the native Dune HD UI using
     "Web browser" function.
      - Choose the "Web browser" item in the "Applications" menu and enter
        the HTTP URL pointing to the HTML page (using remote control,
        on-screen-keyboard, or a real USB keyboard).

   - If the web browser is already launched, the web browser can be requested
     to (re)load a certain URL via telnet/SSH session.
      - See "Forcing web browser to load URL from command line" section.

Launching HTML application via M3U file

The following simple approach allows to easily launch the web browser and
load a HTML page from the given HTTP URL into it:
   - Put a special www:// media URL into an .M3U file.
   - Navigate to the .M3U file in the file browser of the native Dune HD UI
     (e.g. by putting the .M3U file to a USB flash drive), and press
     "ENTER" RC button to launch it.

The .M3U file can also be copied into the "Favorites" menu by pressing "POP
UP MENU" RC button and choosing "Add to favorites". Besides, the .M3U file
added into the "Favorites" menu can be additionally configured to start
automatically on STB boot (by pressing "POP UP MENU" RC button and choosing
"Enable autostart").

For more information about "www://" media URL, see "www:// media URL" section.

HTML plugins

HTML application can be packaged as a plugin, which can be integrated as an
item (icon) into the native Dune HD UI.

HTML pages and other resources of HTML application can be completely contained
by the plugin, partially contained by the plugin (e.g. the initial HTML page
can be part of the plugin, the rest of HTML pages and resources can reside on
a server), or can completely reside on a server.

HTML application can also be launched from more complicated plugins, which are
integrated into the native Dune UI via PHP API.

To launch an HTML application from a plugin, the plugin should execute
LaunchMediaUrl plugin action with "www://" media URL parameter pointing to the
main HTML page of the HTML application.

For more information about "www://" media URL, see "www:// media URL" section.

For more information about plugins, see here:
   http://files.dune-hd.com/sdk/doc/html/plugins.html

See "HTML plugin examples" section for examples of HTML applications packaged
as plugins.

HTML plugin examples

Examples of HTML applications implemented as plugins:
   - http://files.dune-hd.com/sdk/plugins/dune_plugin_iptv_demo.2013_09_03.zip
   - http://files.dune-hd.com/sdk/plugins/dune_plugin_html_demo.2012_11_01.zip
   - http://files.dune-hd.com/sdk/plugins/dune_plugin_custom_input_demo.2014_03_12.zip

Automatic startup of HTML plugin on STB boot

When an HTML plugin it used to launch the HTML application, the STB can be
configured to automatically launch it on STB boot. For more information,
see "Auto-start specification in plugin manifest" and "Configuring plugin
auto-start via menu" here:
   http://files.dune-hd.com/sdk/doc/html/plugins.html

Boot to HTML page via stb_home mechanism

The "stb_home" mechanism allows to configure Dune HD STB to automatically
boot to a given HTML page (stored in the flash memory of the STB) instead
of the native Dune HD UI.

When the STB boots to a HTML application via the "stb_home" mechanism, the
custom HTML application can still switch to the standard native Dune HD UI
(the same as in the standard retail Dune HD firmware versions) via Dune JS
STB API. This way all standard Dune HD media player functionality can be
accessed, including powerful browser of local storage devices (USB etc) and
network file servers, file player with a huge number of supported
audio/video file formats, photo viewer, etc. The user can return from the
native Dune HD UI back to the HTML application by pressing RETURN RC
button on top level screen.

To use "stb_home" mechanism, certain files should be created in the STB
filesystem in the flash memory of the STB. This can be done e.g. using
telnet/SSH access to the STB. Alternatively, the required files can be
included into a custom firmware build.

When there is a file /config/stb_home/index.html (or
/firmware/config/stb_home/index.html in custom firmware build), Dune HD STB
automatically launches the web browser and loads this index.html document
instead of launching the native Dune HD UI.

If the file /config/web_browser_start_params (or
/firmware/config/web_browser_start_params in custom firmware builds)
exists, the web browser starts with the parameters specified in this file.
The file has standard properties format ("name=value"). If such a file does
not exist, the following default parameters are used:
   fullscreen=1
   webapp_keys=1
   zoom_level=100
   overscan=0
   background_color=black
   input_handler=1
   engine_flags=0
   navigation_highlight=1
   auto_auth_cancel=0
   user_agent= (i.e. use default)
   osd_size= (i.e. use default)
   exit_key= (i.e. use default)
   power_key= (i.e. use default)
   volume_handler=0

For more information about web browser start parameters, see "Web browser
start parameters" section.

Also see "Custom HTML application" here:
   http://files.dune-hd.com/sdk/doc/html/dune_custom_firmware.html

Tools for installing files into /config/stb_home

There are the following service files that can be used to conveniently
install files into /config/stb_home/ via the standard native Dune HD UI
(w/o the need to use telnet/SSH access to the STB).

http://files.dune-hd.com/sdk/js_stb_sdk/dune_service_install_index_html.dsf
   - Installs "index.html" located near the DSF file into
     /config/stb_home/.
   - Usage: put the DSF file and index.html to a USB flash file, launch the
     DSF file in the file browser of the native Dune UI.

http://files.dune-hd.com/sdk/js_stb_sdk/dune_service_install_stb_home.dsf
   - Installs the content of "dune_stb_home.tgz" archive located near the
     DSF file into /config/stb_home/. (NOTE: the content of
     /config/stb_home is completely rewritten, i.e. old files from
     /config/stb_home are removed.)
   - Additionally, if the archive contains any of the following files at
     the top level, they are installed into /config/:
      - web_browser_start_params
      - stbapi_settings.properties
   - Usage: put the DSF file and dune_stb_home.tgz to a USB flash file,
     launch the DSF file in the file browser of the native Dune UI.

Differences between stb_home mechanism and auto-start of M3U-file/plugin

The "stb_home" mechanism and M3U-file/plugin auto-start approach, although
allow to achieve a similar behavior of automatic startup of a given HTML
application on STB boot, have the following differences:

The "stb_home" mechanism:
	- The HTML application acts as the main software running on the STB, and
	  the native Dune HD UI can be completely disabled, or access to the
	  native Dune HD UI can be managed by the HTML application (e.g. the
	  HTML application can provide a special menu item allowing to launch
	  the native Dune HD UI).
	- The firmware upgrade mechanism built-in into the native Dune UI is
	  skipped and not used. The HTML application should implement firmware
	  upgrade logic on its own.

M3U-file/plugin auto-start approach:
   - In case of M3U-file/plugin auto-start approach, automatic startup of
     HTML application is performed exactly the same way as if the user
     manually launched the corresponding menu item in the native Dune HD
     UI. To switch from the HTML application to the native Dune HD UI, the
     user would need to exit the HTML application; to return back to the
     HTML application, the user would need to launch the same menu item in
     the Dune HD UI again.
	- The firmware upgrade mechanism built-in into the native Dune UI works in
	  the usual way.

In general, the "stb_home" mechanism provides more control for the HTML
application on the STB behavior. When a custom firmware is prepared for an
IPTV/OTT operator project which requires automatic launch of HTML
middleware client on STB boot, the "stb_home" mechanism is typically
recommended.

www:// media URL

The www:// media URL has the following syntax:
   www://{HTTP-or-file-URL}:::param1=value1&...&paramN=valueN

Example:
   www://http://myserver.com/action?x=10:::fullscreen=1&zoom_level=100&background_color=black&webapp_keys=1

The ":::param1=value1&..." part here is optional and can be used to control
the web browser start parameters, when the default web browser start
parameters are not suitable.

See section "Web browser start parameters" for more information about
available web browser start parameters and their default values.

Web browser start parameters

NOTE: The default values specified below are used when the web browser is
launched.

   fullscreen=0|1 (default: 0)
      0 = show standard web browser controls, such as URL bar.
      1 = HTML page takes full screen, no web browser controls are shown.
      NOTE: 1 is recommended for fullscreen TV-apps.

   webapp_keys=0|1|2 (default: 0)
      0 = certain keys/buttons (e.g. STOP) are handled by web browser
        itself.
      1 = JavaScript code in HTML page handles all keys/buttons.
      2 = CE-HTML mode (supported by Opera only).
      NOTE: 1 or 2 is recommended for fullscreen TV-apps.

   zoom_level={N} (default: according to user-defined settings)
      100 = no zoom (render HTML page 1:1).
      NOTE: 100 is recommended for fullscreen TV-apps.

   overscan={N} (default: according to user-defined settings)
      0 = no overscan (100% fullscreen)
      NOTE: 0 is recommended for fullscreen TV-apps.

   user_agent={string} (default: web browser defined)
      NOTE: Redefine user agent string sent by web browser.
      NOTE: For Opera web browser, some parts of the user agent string are
      determined by web browser anyway and it is only possible to partially
      affect the user agent string.

   background_color={color} (default: white)
      NOTE: 'black' is recommended for fullscreen TV-apps with black or
      dark background.

   osd_size=720x480|720x576|1280x720|1920x1080 (default: according to user-defined settings)
      NOTE: for fullscreen TV-apps rendered for a particular screen
      resolution (e.g. 1280x720), this resolution should be specified here.

   input_handler=0|1|2 (default: 1)
      0 = disable the special handling of input fields performed by the web
        browser (may be needed by certain HTML applications, which use
        input fields and want to disable this browser behavior).
      1 = keep the special handling.
      2 = disable the special handling, and additionally provide a
        possibility to exit input fields using arrow keys.
      NOTE: Affects Opera web browser only.

   navigation_highlight=0|1 (default: 1)
      0 = disable automatic highlighting by the browser of the active HTML
        element.
      NOTE: Affects Opera web browser only.

   power_key=<empty>|NONE (default: <empty>)
      Defines the behavior of "POWER" RC button in the browser.
      <empty> = "POWER" RC button is handled by the browser itself by putting
      the STB into system standby mode (when system standby mode is
      entered, the HTML application and the web browser are terminated).
      NONE = "POWER" RC button is delivered to the JS code of the HTML
      application and is not handled by the browser itself.
      NOTE: Affects Opera web browser only.

   exit_key=key1[,...,keyN] (default: KEY_STOP)
      Defines which RC buttons can be used to stop and exit the application.
      Supported key values:
         - KEY_STOP
         - KEY_TOP_MENU
         - KEY_RETURN
      NOTE: Affects Opera web browser only.
      NOTE: available starting with firmware versions 130731_b8+.

   engine_flags=0|1 (default: 0)
      1 = enable a different engine configuration for Opera, which could
        significantly improve the performance of some kinds of HTML
        applications.
      NOTE: Affects Opera web browser only.
      NOTE: Available starting with firmware versions 130524_b6+.

   auto_auth_cancel=0|1 (default: 0)
      1 = enable automatic cancellation of HTTP authorization dialogs shown
         by web browser.
      NOTE: Affects Opera web browser only.

   volume_handler=0|1 (default: 1)
      1 = enable volume control with builtin volume handler when V+/V-/MUTE
         buttons are pressed.
      NOTE: Affects Opera web browser only.
      NOTE: Available starting with firmware versions 140729_b9+.

Forcing web browser to load URL from command line

If the web browser is already launched, the following method can be used to
request the web browser to (re)load a given URL from the command line (e.g. in
telnet or SSH session).

Put the HTTP URL into the file "/tmp/run/web_browser_force_load". The web browser
will detect this file, read it, delete it, and load the given HTTP URL. E.g.:
   echo 'http://192.168.137.1/page.html' >/tmp/run/web_browser_force_load

This method may be convenient e.g. in the following cases:
   - During HTML application development: force the web browser to reload a
     given page.
   - When performing remote administration (e.g. via SSH) of an STB running
     an HTML middleware client: force the web browser to load a certain page
     containing certain JS code which will trigger certain operations on the
     STB (e.g. launch firmware upgrade) via Dune JS STB API.

NOTE: HTTP URL must be used here; www:// media URLs are not supported in this
method.
NOTE: Affects WebKit web browser only.

Opera Dragonfly debugger

To connect Opera on PC to Opera on Dune HD box, perform the following
steps:

1) On the PC:

   1. Launch Opera. Version 12.16 is known to work.

   2. In Opera, start Dragonfly: choose "Page / Developer Tools / Opera
      Dragonfly".

   3. In Opera Dragonfly, enable remote debug: choose "Remote debug
      configuration" and press "Apply" button.

2) On the Dune HD box (the box should have any firmware with Opera):

   1. Create text file /config/web_browser_enable_debug with the following
      contents:

         ip_address = 192.168.137.1
         port = 7001

      Use IP address of PC running Opera Dragonfly, use port number
      specified in the remote debug configuration on the PC.

   2. Launch Opera. The browser will automatically connect to Opera
      Dragonfly running on the PC.

3) On the PC:

   1. In Opera Dragonfly, in the menu "Select the debugging context",
      choose the main window of Opera running on Dune HD box as the current
      window for the debugger. The main window title depends on URL loaded
      into browser.

   2. In Opera Dragonfly, in Console, type Javascript commands, e.g.:

         window.location.href = "http://dune-hd.com"