1(function (window) { 2 yomvi.addPackage('yomvi.ficha.grabaciones', function () { 3 4 var llamadas = 0; 5 var timeout_grabacion; 6 7 this.getDisponible = function (_url) { 8 const { params } = yomvi.util.parseURL(_url); 9 const endTime = params.end_time || ''; 10 const endTimestamp = new Date(endTime).getTime(); 11 const now = Date.now(); 12 13 if (endTimestamp > now) { 14 const formatoHora = yomvi.util.phpDate('H:i', endTime); 15 return yomvi.txt('ERROR_PLAYER_NO_DISPONIBLE', 'grabaciones', { ENDTIME: formatoHora }); 16 } 17 18 return true; 19 }; 20 21 22 this.botonGrabacion = function (ficha) { 23 if (ficha.datos.boton_grabacion) { 24 var plantilla = 'btn_grabacion'; 25 ficha.html.boton_grabacion = yomvi.util.parseTpl(plantilla, ficha.datos.boton_grabacion); 26 switch (ficha.datos.boton_grabacion.state) { 27 case 3: 28 break; 29 case "Completed": 30 if (ficha.datos.boton_grabacion.disponible == 'disponible') { 31 $('#deleteGrabacion').show(); 32 } 33 default: 34 if (ficha.datos.boton_grabacion.temporal && ficha.estaDisponible()) { 35 if (timeout_grabacion) { 36 clearTimeout(timeout_grabacion); 37 } 38 timeout_grabacion = setTimeout(function () { 39 progressGrabacion(ficha); 40 }, (ficha.datos.boton_grabacion.emitiendo) ? 1000 : 60000); 41 break; 42 } 43 } 44 } 45 }; 46 47 this.showBoton = function (_boton) { 48 49 $('#buttons_temporada_container').html(_boton); 50 }; 51 52 53 this.eventos = function (ficha) { 54 $('body').off('click', '.buttons #play_directo_startover'); 55 $('body').on('click', '.buttons #play_directo_startover', { ficha: ficha }, function (e) { 56 yomvi.marcado.setMarcadoClick(); 57 var params = {page : ficha.AssetType(), action: 'VIEW', par: [{k: 'option', v: 'VER DIRECTO'}]}; 58 yomvi.marcado.marcar("eventoVerAhora", params); 59 return e.data.ficha.onClickGrabacion(e); 60 }); 61 62 $('body').off('click', '.buttons #play_directo_u7d'); 63 $('body').on('click', '.buttons #play_directo_u7d', { ficha: ficha }, function (e) { 64 yomvi.marcado.setMarcadoClick(); 65 var params = {page : ficha.AssetType(), action: 'VIEW', par: [{k: 'option', v: 'VER DIRECTO'}]}; 66 yomvi.marcado.marcar("eventoVerAhora", params); 67 return e.data.ficha.onClickU7DDirecto(e); 68 }); 69 70 $('body').off('click', '.buttons #play_grabacion_btn'); 71 $('body').on('click', '.buttons #play_grabacion_btn', { ficha: ficha }, function (e) { 72 yomvi.marcado.setMarcadoClick(); 73 var params = {page : ficha.AssetType(), action: 'VIEW', par: [{k: 'option', v:'VER AHORA'}]}; 74 yomvi.marcado.marcar("eventoVerAhora", params); 75 return e.data.ficha.onClickGrabacion(e); 76 }); 77 $('body').off('click', '#solicitud_grabacion'); 78 $('body').on('click', '#solicitud_grabacion', { ficha: ficha }, function (e) { 79 return e.data.ficha.onClickGrabar(e); 80 }); 81 $('body').off('click', '.cancelacion_grabacion'); 82 $('body').on('click', '.cancelacion_grabacion', { ficha: ficha }, function (e) { 83 return e.data.ficha.onClickCancelarGrabar(e); 84 }); 85 86 }; 87 88 function progressGrabacion(ficha) { 89 var datos_grabacion = ficha.datos.boton_grabacion; 90 var state = datos_grabacion.state; 91 if (state == -1) { 92 if (datos_grabacion.emitiendo) { 93 state = "Ongoing"; 94 } else { 95 state = "Scheduled"; 96 } 97 } 98 var emitiendo = ficha.canalEmitiendoDirecto(); 99 switch (state) { 100 case "Ongoing": 101 if (!emitiendo) { 102 var _url_params = yomvi.util.getUrlParams(); 103 if (_url_params.tipo == 'npvr') { 104 var _params = { 105 id: ficha.ShowId() || _url_params.id, 106 tipo: 'npvr', 107 state: 'Completed', 108 catalog: _url_params.catalog, 109 mode: _url_params.mode, 110 version: _url_params.version 111 }; 112 yomvi.ficha.getData(_params).done(function (_data) { 113 yomvi.ficha.crear(_data); 114 clearTimeout(timeout_grabacion); 115 return yomvi.ficha.html.mostrar(); 116 }); 117 } else { 118 if (datos_grabacion.state === "Ongoing"){ 119 datos_grabacion.state = "Completed"; 120 } 121 clearTimeout(timeout_grabacion); 122 return yomvi.ficha.activa().reload(); 123 } 124 } 125 break; 126 case 0: 127 if (emitiendo && llamadas <= 4) { 128 llamadas++; 129 return yomvi.ficha.activa().reloadBotonGrabacion(); 130 } 131 break; 132 } 133 if (emitiendo) { 134 var tT = ficha.getTiempoTranscurrido(); 135 var transcurrido = tT.transcurrido; 136 var porcentaje = tT.porcentaje; 137 $('.buttonBox .transcurrido').html(transcurrido); 138 $('.porcentaje').width(porcentaje + '%'); 139 } 140 141 timeout_grabacion = setTimeout(function () { 142 progressGrabacion(ficha); 143 }, (datos_grabacion.emitiendo) ? 1000 : 60000); 144 } 145 146 }); 147}(window));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.