Advertisement
Guest User

Untitled

a guest
Aug 14th, 2018
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.09 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//HbbTV//1.1.1//EN" "http://www.hbbtv.org/dtd/HbbTV-1.1.1.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title>Launcher</title>
  6. <meta http-equiv="content-type" content="Content-Type: application/vnd.hbbtv.xhtml+xml; charset=UTF-8" />
  7.  
  8. <link href='launcher.css?version=1528967768' rel='stylesheet' type='text/css'/>
  9. <link href='../dialog.css?version=1528974926' rel='stylesheet' type='text/css'/>
  10. <link href='../common/common.css?version=1528463613' rel='stylesheet' type='text/css'/>
  11. <script src='../jquery-1.11.3.min.js?version=1521445459' type='text/javascript'></script>
  12. <script src='../common.js?version=1528874135' type='text/javascript'></script>
  13. <script src='../TDTplayer/nowrunning.js?version=1528353789' type='text/javascript'></script>
  14. <script src='../dialog.js?version=1528968529' type='text/javascript'></script>
  15. <script src='../tracking.js?version=1527689344' type='text/javascript'></script>
  16. <script src='../debug-screen.js?version=1528968836' type='text/javascript'></script>
  17. <link href='../debugscreen.css?version=1528888739' rel='stylesheet' type='text/css'/>
  18. <script src='clientError.js?version=1521445459' type='text/javascript'></script>
  19.  
  20. <script type="text/javascript" language="javascript">
  21. <![CDATA[
  22.  
  23. var diffTime, curTime, prevm, t_time;
  24. var refTime = 1534235871070;
  25. var ntpTime = 1534235871070;
  26. var localDate = new Date(1534228671070);
  27. var tz = 120;
  28. var loading = true;
  29.  
  30. setInterval( function(){
  31. ntpTime += 1000;
  32. }, 1000 );
  33.  
  34. function getNTPtime(){
  35. return new Date( ntpTime );
  36. }
  37.  
  38. function getGMTTime( timestring ){
  39. var t = new Date(timestring + "Z"); // make it as UTC time
  40. console.log( "time from start transferred to utc time ", t );
  41. var utc = t.getTime() - (tz*1000 *60 ); // shift utc time depending on timesone of local time (millis)
  42. console.log( "difference shifted to timezone " + tz, t.getTime() - utc);
  43. var localTime = new Date( utc ); // new time wth correct utc time
  44. console.log( "new date object ", localTime );
  45. return localTime;
  46. }
  47.  
  48.  
  49. var certified = false;
  50. var development = true;
  51. var analytics = "mediaset";
  52. var broadcastChannel = "";
  53. var SOpromptDelay = 130;
  54. var idCookie = 'NA';
  55. var idSession = '1534235870848';
  56.  
  57. var palyerRoot = "../TDTplayer/";
  58.  
  59. var app = null;
  60. var uivisible = false;
  61. var blueActive, startOverAllowed, yellowActive;
  62. var chlistdvb = null;
  63. var item = null;
  64. var animating = false;
  65. var startOverAllowed = false;
  66. var channelNumber = null;
  67.  
  68.  
  69.  
  70.  
  71. var menu = [{ button : VK_GREEN, title : "Program Guide", action : function(){
  72. //location.href = "../pvr_epg2/index.php?ch=" + broadcastChannel; console.log("green action"); }},
  73. location.href = "http://tvportal.sofiadigital.tv/operator_hbbtv_demo/portal/"; console.log("green action"); }},
  74. { button : VK_YELLOW, title : "Restart Current Programme", action : function(){
  75. console.log("yellow action");
  76. if( startOverAllowed ){
  77. launchStartOver();
  78. }
  79. }},
  80. { button: VK_BLUE, title : "TDT Play (es)", action : function(){
  81. console.log("blue action");
  82. launchTDTplay( {lang : "es"} );
  83. }},
  84. { title : "TDT Play (en help)", action : function(){
  85. console.log("menu action");
  86. launchTDTplay( {lang : "es", section : "help"} );
  87. }},
  88. {
  89. button : VK_RED, action : function(){
  90. console.log("red action");
  91. launchMenu();
  92. }
  93. }];
  94.  
  95. function buttonAction( button ){
  96. var entry = null;
  97. $.each( menu , function(i, item){
  98. if( item.button == button ){
  99. entry = item;
  100. return false;
  101. }
  102. });
  103. return entry;
  104. }
  105.  
  106.  
  107.  
  108. function launchMenu(){
  109. location.href = "menu.php?ch=" + broadcastChannel;
  110. }
  111.  
  112. jQuery(document).ready(function(){
  113.  
  114.  
  115. try {
  116. if( typeof( initHbbTv ) == "function" ){
  117. initHbbTv();
  118. console.log("initHbbTv() succeed");
  119. }
  120. } catch (e) {
  121. console.error(e.message);
  122. }
  123.  
  124. initApp();
  125. registerKeyListener();
  126.  
  127. //registerKeys( (development? 1 : 0) ); // if development register also numbers
  128. /*
  129. // for non certified devives, no actions
  130. if( certified ){
  131.  
  132. showButton("blue");
  133.  
  134. getNowrunning( broadcastChannel, function(){
  135. item = getNowrunningAsset( broadcastChannel );
  136. channelNumber = item.number;
  137. console.log( item, item.startOver );
  138. if( item.startOver ){
  139. showButton("yellow");
  140. startOverAllowed = true;
  141. console.log("Press Yellow to restart programme " + item.title);
  142. }
  143. else{
  144. startOverAllowed = false;
  145. //showInfo("Now running: " + item.title + ". (no start over available)");
  146. }
  147. } );
  148.  
  149. }
  150. */
  151. showApplication();
  152.  
  153. });
  154.  
  155.  
  156. function initApp() {
  157. try {
  158. app = document.getElementById('appmgr').getOwnerApplication(document);
  159. } catch (e) {
  160. // ignore
  161. }
  162. }
  163.  
  164. function showApplication() {
  165. try {
  166. app.show();
  167. app.activate();
  168. } catch (e) {
  169. // ignore
  170. }
  171. }
  172. /*
  173. function onKey(keyCode) {
  174. console.log("onkey", uivisible);
  175.  
  176. if( !certified ){
  177. showInfo("Device not supported");
  178. return;
  179. }
  180.  
  181. if( dialog.open ){
  182. navigateDialog( keyCode );
  183. return;
  184. }
  185.  
  186. switch (keyCode) {
  187. case VK_BACK:
  188. showButtons( false );
  189. break;
  190. case VK_RED:
  191. case VK_BLUE:
  192. case VK_GREEN:
  193. case VK_YELLOW:
  194. console.log("a color button pressed ", keyCode);
  195. var entry = buttonAction( keyCode );
  196. console.log( typeof( entry.action ) );
  197. if( entry && typeof( entry.action ) == "function" ){
  198. entry.action();
  199. }
  200. break;
  201. case VK_ENTER:
  202. break;
  203. case VK_DOWN:
  204. break;
  205. case VK_UP:
  206. break;
  207. case VK_RIGHT:
  208. activateDebug(1);
  209. break;
  210. case VK_LEFT:
  211. activateDebug(0);
  212. break;
  213. case VK_1:
  214. showButtons( true, 99999999 );
  215. break;
  216. case VK_2:
  217. showButtons( false );
  218. break;
  219. case VK_3:
  220. showButtons( true, 5000 );
  221. break;
  222. case VK_4:
  223. showButton( "blue", true, 5000 );
  224. break;
  225. case VK_5:
  226. showButton( "yellow", true, 5000 );
  227. break;
  228. case VK_6:
  229. showButton( "red", true, 5000 );
  230. break;
  231. case VK_7:
  232. // TODO: remove debugs
  233. showDialog("main title here","Start Over Programme ended.", ["Exit Start Over Programme"], function( val ){
  234. showInfo("ookoo selväpä se");
  235. }, 0, 0, "basicInfoDialog" );
  236. break;
  237. }
  238. }
  239. */
  240. function showButtons( show, timeout ) {
  241. $.each( $(".row"), function(i, button){
  242. clearTimeout( timeouts[ button.id ] );
  243. showButton( button.id, show, timeout );
  244. } )
  245. }
  246.  
  247. var timeouts = {};
  248. function showButton( color, show, timeout ) {
  249. if( typeof( show ) == "undefined" || show == true ){
  250. $("#" + color).addClass("fadein").removeClass("fadeout");;
  251. if( typeof( timeout ) == "undefined" ){
  252. timeout = 5000;
  253. }
  254. timeouts[ color ] = setTimeout( function(){ showButton( color, false); }, timeout);
  255. // TODO: show menu bar also when button is displayed
  256. }
  257. else{
  258. $("#" + color).removeClass("fadein").addClass("fadeout");;
  259. clearTimeout( timeouts[ color ] );
  260. delete timeouts[color];
  261. }
  262.  
  263. var hidden = ( Object.keys( timeouts ).length == 0);
  264.  
  265. if( hidden ){
  266. // not visible buttons
  267. // NOTE: no need to remove fadein
  268. //$("#colorbuttons").removeClass("fadein").addClass("fadeout");
  269. $("#colorbuttons").addClass("fadeout");
  270. $(".logo_container").addClass("fadeout");
  271. }
  272. else{
  273. // one or more visible buttons
  274. $("#colorbuttons").addClass("fadein").removeClass("fadeout");
  275. //$(".logo_container").addClass("simplefadein").removeClass("fadeout");
  276. $(".logo_container").addClass("fadein").removeClass("fadeout");
  277. }
  278.  
  279. if( hidden && analytics == "atresmedia" ){
  280. if( Object.keys( timeouts ).length == 0){
  281. SMARTNS.showSC( console.log );
  282. }
  283. else{
  284. SMARTNS.hideSC( console.log );
  285. }
  286. }
  287. }
  288.  
  289. function hideButtons() {
  290. document.getElementById("master").style.opacity = "0";
  291. uivisible = false;
  292. $("#blue, #green, #red, #yellow").hide();
  293. }
  294.  
  295. function launchStartOver() {
  296. if( startOverAllowed ){
  297. window.location = "../TDTplayer/index.php?ch="+channelID;
  298. }
  299. else{
  300. showInfo("Current programme "+ item.title +" is not available for Start Over");
  301. }
  302. }
  303.  
  304. function launchTDTplay( overrides ) {
  305.  
  306. params = {
  307. channelID : channelID,
  308. section : "1lg",
  309. history : "true",
  310. timestamp : ntpTime, // mandatory
  311. boxID : idCookie, // mandatory
  312. sessionID : idSession, // mandatory
  313. };
  314. if( overrides ){
  315. $.each( overrides, function(key, value){
  316. params[ key ] = value; // override defaults
  317. } );
  318. }
  319.  
  320. var url = "http://static.cnx.metaphor-platform.com/app/A/main.html" + Object.keys(params).reduce( function(a,b){ return a + b +"="+ params[b] + "&";}, "?" );
  321.  
  322. showInfo("Launch TDTplay: " + url);
  323.  
  324. //TODO: Send analytics to endpoint
  325. // mandatory for analytcis: ‘idChannel’, ‘idCookie’, ‘idSession’ and ‘page’
  326.  
  327.  
  328. sendTDTanalytics( {"tvID":idCookie,"sID":idSession,"ssID":null,"ts":ntpTime,"env":"dtt","srvID": serviceID ,"age":10,"pos":1} );
  329.  
  330.  
  331.  
  332. //window.location.href = url;
  333. }
  334.  
  335.  
  336.  
  337. function sendTDTanalytics( params ){
  338. var user = "cellnex";
  339. var pass = "Xsw21q@Z";
  340. var auth = "Basic " + btoa(user + ":" + pass);
  341. console.log( auth, JSON.stringify( params ) );
  342. $.ajax({
  343. type: "POST",
  344. data : JSON.stringify( params ),
  345. crossDomain : true,
  346. contentType: "json",
  347. beforeSend: function (xhr) {
  348. xhr.withCredentials = true;
  349. xhr.setRequestHeader ( "authorization", auth );
  350. },
  351. url : "http://hbbtvandraw-pro.eu-west-1.elasticbeanstalk.com/events",
  352. success : function(response){
  353. console.log(response);
  354. showDialog("Succes: Sent data: " + query, "Response: " + response, ["OK"]);
  355. },
  356. fail : function(response){
  357. console.log(response);
  358. showDialog("Error: Sent data: " + query, "Response: " + response, ["OK"]);
  359. }
  360. });
  361. }
  362.  
  363.  
  364.  
  365. ]]>
  366. </script>
  367.  
  368.  
  369. <!-- Ceres + -->
  370. <script src="../ceres-plus/commonHbbtv.js"></script>
  371. <script src="../ceres-plus/stratio-kafka.js"></script>
  372. <script src="../ceres-plus/stratio.js"></script>
  373. <script src="../ceres-plus/hbbtv-client.js"></script>
  374. <script src="../ceres-plus/hbbtv-app-plus.js"></script>
  375.  
  376.  
  377. </head>
  378. <body>
  379. <div style="visibility:hidden;position: absolute; left: 0px; top: 0px; width: 0px; height: 0px;">
  380. <object id="appmgr" type="application/oipfApplicationManager"></object>
  381. <object id="oipfcfg" type="application/oipfConfiguration"></object>
  382. </div>
  383. <div id="info" class="hide"></div>
  384.  
  385. <div id="videodiv" class="video_fullscreen"><object id="video" type="video/broadcast"></object></div>
  386.  
  387.  
  388. <div class="hide" id="loading" style="display:none !important;"></div>
  389.  
  390. </body>
  391. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement