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.
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']);
There is an example of abstract service integration example.tv. For example the service is available by url http://tv.example.com/index.html
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(); })();
It is necessary to create three icon files with mm_ico_exampletv.png name corresponding to three using resolutions.
Icon sizes:
Place the files in folder with corresponding resolutions:
For compatibility with mechanism of module loading it is necessary to create three empty css files in /c/.
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).