Integration of adaptive services

Middleware Stalker allows to integrate services which are adaptive for working on STB.

The integration is to create separate module, adding icons for main menu and adding the name of created module in list which is initialized with boot. The service can be either in middleware or in the remote http server.

Requirenments for adaptive services

support at least 3 resolutions: 720х480 (NTSC), 720х576 (PAL), 1280х720 (720p)

correct exit process from service (using GET parameter referrer for returning)

interface optimization on RC

Exit process from service

One of the reqirenment is an ability to exit from service and return back to Stalker. URL for returning is in GET parameter referrer in urlencoded, so it is neccessary previously to decode it.

Getting GET parameters in JavaScript:

var $_GET = {}; function decode(s) { return decodeURIComponent(s.split("+").join(" ")); } document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () { $_GET[decode(arguments[1])] = decode(arguments[2]); });

Code of returning in Stalker:

window.location = decodeURIComponent($_GET['referrer']);

Example of integration

There is an example of abstract service integration example.tv. For example the service is available by url http://tv.example.com/index.html

Module creation

Creating the file exampletv.js in folder /c/ with content:

(function(){ // The first argument - caption under the icon in the main menu // Третий аргумент - icon file name main_menu.add('EXAMPLE.TV', [], 'mm_ico_exampletv.png', function(){ var params = ''; if (stb.user['web_proxy_host']){ params = '?proxy=http://'+stb.user['web_proxy_host']+':' +stb.user['web_proxy_port']; } stb.setFrontPanel('.'); if (!params){ params += '?'; }else{ params += '&'; } params += 'referrer='+encodeURIComponent(window.location); //window.location = '/' + stb.portal_path + '/external/olltv/index.html'+params; window.location = 'http://tv.example.com/index.html'+params; }, {layer_name : "exampletv"}); // For correct module work it is neccessary to point unique layer_name loader.next(); })();

Icons adding in the main menu

It is necessary to create three icon files with mm_ico_exampletv.png name corresponding to three using resolutions.

Icon sizes:

200x100px - NTSC

200x120px - PAL

360x160px - 720p

Place the files in folder with corresponding resolutions:

NTSC - catalogue /c/i_480/

PAL - catalogue /c/i/

720p - catalogue /c/i_720/

For compatibility with mechanism of module loading it is necessary to create three empty css files in /c/.

exampletv.css

exampletv_480.css

exampletv_720.css

Module adding in the initialization list

In the config file (custom.ini) in all_modules parameter it is necessary to add the module name in correct place, for example after Video Club

all_modules[] = vclub all_modules[] = exampletv ;our module all_modules[] = ex

If all step are complited then there icon of added service must appear in the main menu (after reloading Stalker).