Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE html PUBLIC "-//HbbTV//1.1.1//EN" "http://www.hbbtv.org/dtd/HbbTV-1.1.1.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Launcher</title>
- <meta http-equiv="content-type" content="Content-Type: application/vnd.hbbtv.xhtml+xml; charset=UTF-8" />
- <link href='launcher.css?version=1528967768' rel='stylesheet' type='text/css'/>
- <link href='../dialog.css?version=1528974926' rel='stylesheet' type='text/css'/>
- <link href='../common/common.css?version=1528463613' rel='stylesheet' type='text/css'/>
- <script src='../jquery-1.11.3.min.js?version=1521445459' type='text/javascript'></script>
- <script src='../common.js?version=1528874135' type='text/javascript'></script>
- <script src='../TDTplayer/nowrunning.js?version=1528353789' type='text/javascript'></script>
- <script src='../dialog.js?version=1528968529' type='text/javascript'></script>
- <script src='../tracking.js?version=1527689344' type='text/javascript'></script>
- <script src='../debug-screen.js?version=1528968836' type='text/javascript'></script>
- <link href='../debugscreen.css?version=1528888739' rel='stylesheet' type='text/css'/>
- <script src='clientError.js?version=1521445459' type='text/javascript'></script>
- <script type="text/javascript" language="javascript">
- <![CDATA[
- var diffTime, curTime, prevm, t_time;
- var refTime = 1534236393106;
- var ntpTime = 1534236393106;
- var localDate = new Date(1534229193106);
- var tz = 120;
- var loading = true;
- setInterval( function(){
- ntpTime += 1000;
- }, 1000 );
- function getNTPtime(){
- return new Date( ntpTime );
- }
- function getGMTTime( timestring ){
- var t = new Date(timestring + "Z"); // make it as UTC time
- console.log( "time from start transferred to utc time ", t );
- var utc = t.getTime() - (tz*1000 *60 ); // shift utc time depending on timesone of local time (millis)
- console.log( "difference shifted to timezone " + tz, t.getTime() - utc);
- var localTime = new Date( utc ); // new time wth correct utc time
- console.log( "new date object ", localTime );
- return localTime;
- }
- var certified = true;
- var development = false;
- var analytics = "";
- var broadcastChannel = "";
- var SOpromptDelay = 130;
- var idCookie = 'b4783e0bcee5765833581806b04c4570';
- var idSession = '1534236393105';
- var fsatPrivacyPolicy = '';
- var cdn = 'level3';
- var palyerRoot = "../TDTplayer/";
- var app = null;
- var uivisible = false;
- var blueActive, startOverAllowed, yellowActive;
- var chlistdvb = null;
- var item = null;
- var animating = false;
- var startOverAllowed = false;
- var channelNumber = null;
- var menu = [{ button : VK_GREEN, title : "WC", action : function(){
- if( analytics == "mediaset" ){
- location.href = "http://cdnwc.cellnextelecom.net/mundial18/mundial/app/v1.0.0/index.html";
- }
- console.log("green action"); }},
- { button : VK_YELLOW, title : "Restart Current Programme", action : function(){
- console.log("yellow action");
- if( startOverAllowed ){
- launchStartOver();
- }
- }},
- { button: VK_BLUE, title : "TDT Play (es)", action : function(){
- console.log("blue action");
- launchTDTplay( {lang : "es"} );
- }},
- { title : "TDT Play (en help)", action : function(){
- console.log("menu action");
- //launchTDTplay( {lang : "es", section : "help"} );
- }},
- {
- button : VK_RED, action : function(){
- console.log("red action");
- if( debugScreenOn ){
- activateDebug(false);
- }
- else{
- activateDebug(true);
- }
- // currently not in use
- //launchMenu();
- }
- }];
- function buttonAction( button ){
- var entry = null;
- $.each( menu , function(i, item){
- if( item.button == button ){
- entry = item;
- return false;
- }
- });
- return entry;
- }
- function launchMenu(){
- location.href = "menu.php?ch=" + broadcastChannel;
- }
- jQuery(document).ready(function(){
- try {
- if( typeof( initHbbTv ) == "function" ){
- initHbbTv();
- console.log("initHbbTv() succeed");
- }
- } catch (e) {
- console.error(e.message);
- }
- initApp();
- registerKeyListener();
- registerKeys( (development? 1 : 0) ); // if development register also numbers
- // for non certified devives, no actions
- if( certified ){
- if( launcherActive){
- showHook();
- }
- // for certified devices on mediaset channels enable WC app
- if( !launcherActive && analytics == "mediaset" ){
- setTimeout( function(){
- $("#mundial").css("display", "block");
- showWChook();
- }, 500);
- }
- }
- showApplication();
- });
- function showWChook(){
- $("#mundial").css("display", "block");
- $("#mundial").addClass("fadein").removeClass("fadeout");
- setTimeout( function(){
- $("#mundial").removeClass("fadein").addClass("fadeout");
- }, 5000);
- }
- function showHook(){
- $(".ui_wrapper").css("display", "block");
- showButton("blue");
- // WC app for mediaset channels
- if( analytics == "mediaset" ){
- showButton("green");
- }
- getNowrunning( broadcastChannel, function(){
- item = getNowrunningAsset( broadcastChannel );
- channelNumber = item.number;
- console.log( item, item.startOver );
- if( item.startOver && fsatPrivacyPolicy ){
- showButton("yellow");
- startOverAllowed = true;
- console.log("Press Yellow to restart programme " + item.title);
- }
- else{
- startOverAllowed = false;
- //showInfo("Now running: " + item.title + ". (no start over available)");
- }
- } );
- }
- function initApp() {
- try {
- app = document.getElementById('appmgr').getOwnerApplication(document);
- } catch (e) {
- // ignore
- }
- }
- function showApplication() {
- try {
- app.show();
- app.activate();
- } catch (e) {
- // ignore
- }
- }
- var buttonSequence = [];
- var buttonSequenceCode = [ VK_BLUE, VK_YELLOW, VK_BLUE, VK_YELLOW ];
- var launcherActive = true;
- function onKey(keyCode) {
- console.log("onkey", uivisible);
- if( dialog.open ){
- navigateDialog( keyCode );
- return;
- }
- if( (analytics == "mediaset" && keyCode == VK_GREEN) ){
- var entry = buttonAction( keyCode );
- console.log( typeof( entry.action ) );
- if( entry && typeof( entry.action ) == "function" ){
- entry.action();
- }
- return;
- }
- // TODO: remove when application is allowed for all
- if( !launcherActive ){
- buttonSequence.push( keyCode );
- if( buttonSequence.length > 4 ){
- buttonSequence.shift();
- }
- if( buttonSequenceCode.toString() == buttonSequence.toString() ){
- launcherActive = true;
- showHook();
- }
- return;
- }
- switch (keyCode) {
- case VK_BACK:
- showButtons( false );
- break;
- case VK_RED:
- case VK_BLUE:
- case VK_GREEN:
- case VK_YELLOW:
- console.log("a color button pressed ", keyCode);
- // only blue button is active without fsatPrivacyPolicy;
- if( !fsatPrivacyPolicy && keyCode != VK_BLUE){
- console.log( "No privacy policy agreed");
- break;
- }
- var entry = buttonAction( keyCode );
- console.log( typeof( entry.action ) );
- if( entry && typeof( entry.action ) == "function" ){
- entry.action();
- }
- break;
- case VK_ENTER:
- break;
- case VK_DOWN:
- break;
- case VK_UP:
- break;
- case VK_RIGHT:
- if( development ){
- activateDebug(1);
- }
- break;
- case VK_LEFT:
- if( development ){
- activateDebug(0);
- }
- break;
- case VK_1:
- showButtons( true, 99999999 );
- break;
- case VK_2:
- showButtons( false );
- break;
- case VK_3:
- showButtons( true, 5000 );
- break;
- case VK_4:
- showButton( "blue", true, 5000 );
- break;
- case VK_5:
- showButton( "yellow", true, 5000 );
- break;
- case VK_6:
- showButton( "red", true, 5000 );
- break;
- }
- }
- function showButtons( show, timeout ) {
- $.each( $(".row"), function(i, button){
- clearTimeout( timeouts[ button.id ] );
- showButton( button.id, show, timeout );
- } )
- }
- var timeouts = {};
- function showButton( color, show, timeout ) {
- if( typeof( show ) == "undefined" || show == true ){
- $("#" + color).addClass("fadein").removeClass("fadeout");;
- if( typeof( timeout ) == "undefined" ){
- timeout = 5000;
- }
- timeouts[ color ] = setTimeout( function(){ showButton( color, false); }, timeout);
- // TODO: show menu bar also when button is displayed
- }
- else{
- $("#" + color).removeClass("fadein").addClass("fadeout");;
- clearTimeout( timeouts[ color ] );
- delete timeouts[color];
- }
- var hidden = ( Object.keys( timeouts ).length == 0);
- if( hidden ){
- // not visible buttons
- // NOTE: no need to remove fadein
- //$("#colorbuttons").removeClass("fadein").addClass("fadeout");
- $("#colorbuttons").addClass("fadeout");
- $(".logo_container").addClass("fadeout");
- }
- else{
- // one or more visible buttons
- $("#colorbuttons").addClass("fadein").removeClass("fadeout");
- //$(".logo_container").addClass("simplefadein").removeClass("fadeout");
- $(".logo_container").addClass("fadein").removeClass("fadeout");
- }
- if( hidden && analytics == "atresmedia" ){
- if( Object.keys( timeouts ).length == 0){
- SMARTNS.showSC( console.log );
- }
- else{
- SMARTNS.hideSC( console.log );
- }
- }
- }
- function hideButtons() {
- document.getElementById("master").style.opacity = "0";
- uivisible = false;
- $("#blue, #green, #red, #yellow").hide();
- }
- function launchStartOver() {
- if( startOverAllowed ){
- window.location = "../TDTplayer/index.php?ch="+channelID;
- }
- else{
- //showInfo("Current programme "+ item.title +" is not available for Start Over");
- }
- }
- function launchTDTplay( overrides ) {
- params = {
- channelID : channelID,
- section : "1lg",
- ch : channelID,
- timestamp : ntpTime, // mandatory
- boxID : idCookie, // mandatory
- sessionID : idSession, // mandatory
- };
- if( overrides ){
- $.each( overrides, function(key, value){
- params[ key ] = value; // override defaults
- } );
- }
- //var url = "http://static.cnx.metaphor-platform.com/app/A/main.html" + Object.keys(params).reduce( function(a,b){ return a + b +"="+ params[b] + "&";}, "?" );
- var url = "http://gcpstatic.lovestv.es/app/A/main.html" + Object.keys(params).reduce( function(a,b){ return a + b +"="+ params[b] + "&";}, "?" );
- //showInfo("Launch TDTplay: " + url);
- //TODO: Send analytics to endpoint
- // mandatory for analytcis: ‘idChannel’, ‘idCookie’, ‘idSession’ and ‘page’
- sendTDTanalytics( {"tvID":idCookie,"sID":idSession,"ssID":null,"ts":ntpTime,"env":"dtt","srvID": serviceID ,"age":10,"pos":1} );
- window.location.href = url;
- }
- function sendTDTanalytics( params ){
- var user = "cellnex";
- var pass = "Xsw21q@Z";
- var auth = "Basic " + btoa(user + ":" + pass);
- console.log( auth, JSON.stringify( params ) );
- $.ajax({
- type: "POST",
- data : JSON.stringify( params ),
- crossDomain : true,
- contentType: "json",
- beforeSend: function (xhr) {
- xhr.withCredentials = true;
- xhr.setRequestHeader( "authorization", auth );
- },
- //url : "http://hbbtvandraw-pro.eu-west-1.elasticbeanstalk.com/events",
- url : "http://api-events.lovestv.es/events",
- success : function(response){
- console.log(response);
- showDialog("Succes: Sent data: " + query, "Response: " + response, ["OK"]);
- },
- fail : function(response){
- console.log(response);
- showDialog("Error: Sent data: " + query, "Response: " + response, ["OK"]);
- },
- alwasy : function(response){
- console.log("sending analytics");
- console.log(response);
- }
- });
- }
- ]]>
- </script>
- </head>
- <body>
- <div style="visibility:hidden;position: absolute; left: 0px; top: 0px; width: 0px; height: 0px;">
- <object id="appmgr" type="application/oipfApplicationManager"></object>
- <object id="oipfcfg" type="application/oipfConfiguration"></object>
- </div>
- <div id="info" class="hide"></div>
- <object id="video" type="video/broadcast"></object>
- <div id="ui_wrapper" class="ui_wrapper ch_" style="display:none;">
- <div id="colorbuttons" class="blue fadein fadeout">
- <div class="row" id="blue"><div class="label">Pulsa</div><div class="button"></div></div>
- <div class="row" id="yellow"><div class="label"><small>Inicio</small> Pulsa</div><div class="button"></div></div>
- <div class="row" id="green"><div class="label">Ver MUNDIAL</div><div class="button"></div></div>
- <div class="row" id="red"><div class="label">Broadcaster App</div><div class="button"></div></div>
- </div>
- <div class="logo_container fadein fadeout">
- <div class="logo"></div>
- </div>
- </div>
- <div class="hide" id="loading"></div>
- <div id="mundial" class="fadeout" style="display:none;">
- <img src="images/icon_mundial.png" />
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement