mirror of
https://github.com/LaQuay/TDTChannels.git
synced 2025-04-29 12:25:25 +02:00
Add information to video
This commit is contained in:
parent
08694e67c9
commit
9c55d849e6
2 changed files with 69 additions and 29 deletions
script/public
|
@ -3,18 +3,12 @@
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<title>TDT Channels - Marc Vila</title>
|
<title>TDT Channels - Marc Vila</title>
|
||||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/clappr@latest/dist/clappr.min.js"></script>
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/clappr@latest/dist/clappr.min.js"></script>
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
|
||||||
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
|
||||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
|
||||||
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
|
||||||
crossorigin="anonymous"></script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
|
|
||||||
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
|
|
||||||
crossorigin="anonymous"></script>
|
|
||||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
|
|
||||||
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
|
|
||||||
crossorigin="anonymous"></script>
|
|
||||||
|
|
||||||
|
<script src="./index.js"></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -37,7 +31,7 @@
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
Reproductor de Televisión
|
Reproductor de Televisión
|
||||||
</p>
|
</p>
|
||||||
<p>Formatos soportados: <em>m3u8</em></p>
|
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<input id="input-reproduccion-video" type="text" class="form-control" placeholder="URL de reproducción">
|
<input id="input-reproduccion-video" type="text" class="form-control" placeholder="URL de reproducción">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
|
@ -47,13 +41,22 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="video-player"></div>
|
<div id="video-player"></div>
|
||||||
|
<div id="video-information" class="shadow-sm p-3 mb-5 bg-white rounded" style="margin-top: 15px">
|
||||||
|
<p class="lead">Información de la reproducción</p>
|
||||||
|
Formatos soportados
|
||||||
|
<br>
|
||||||
|
<em>m3u8</em>
|
||||||
|
<br><br>
|
||||||
|
Resoluciones disponibles
|
||||||
|
<br>
|
||||||
|
<em id="video-resolution"></em>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="audio" style="margin-top: 15px">
|
<div id="audio" style="margin-top: 15px">
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
Reproductor de Radio
|
Reproductor de Radio
|
||||||
</p>
|
</p>
|
||||||
<p>Formatos soportados: <em>nsv</em></p>
|
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<input id="input-reproduccion-audio" type="text" class="form-control" placeholder="URL de reproducción">
|
<input id="input-reproduccion-audio" type="text" class="form-control" placeholder="URL de reproducción">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
|
@ -66,28 +69,18 @@
|
||||||
<source id="audio-player" src="" autoplay>
|
<source id="audio-player" src="" autoplay>
|
||||||
Your browser does not support the audio element.
|
Your browser does not support the audio element.
|
||||||
</audio>
|
</audio>
|
||||||
|
<div id="audio-information" class="shadow-sm p-3 mb-5 bg-white rounded" style="margin-top: 15px">
|
||||||
|
<p class="lead">Información de la reproducción</p>
|
||||||
|
Formatos soportados
|
||||||
|
<br>
|
||||||
|
<em>nsv</em>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
// Se espera en la URL este tipo de llamada
|
// Se espera en la URL este tipo de llamada
|
||||||
// .html?type={audio,video}&channel={url_a_reproducir}
|
// .html?type={audio,video}&channel={url_a_reproducir}
|
||||||
|
|
||||||
var getUrlParameter = function getUrlParameter(sParam) {
|
|
||||||
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
|
|
||||||
sURLVariables = sPageURL.split('&'),
|
|
||||||
sParameterName,
|
|
||||||
i;
|
|
||||||
|
|
||||||
for (i = 0; i < sURLVariables.length; i++) {
|
|
||||||
sParameterName = sURLVariables[i].split('=');
|
|
||||||
|
|
||||||
if (sParameterName[0] === sParam) {
|
|
||||||
return sParameterName[1] === undefined ? true : sParameterName[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var player;
|
var player;
|
||||||
|
|
||||||
var typeToReproduce = getUrlParameter("type");
|
var typeToReproduce = getUrlParameter("type");
|
||||||
|
@ -130,6 +123,8 @@
|
||||||
source: channelToReproduce,
|
source: channelToReproduce,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getResolution(channelToReproduce);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +153,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateResolution(resolutions) {
|
||||||
|
console.log("Resoluciones: " + resolutions);
|
||||||
|
document.getElementById("video-resolution").innerHTML = "";
|
||||||
|
for (i = 0; i < resolutions.length; i++) {
|
||||||
|
var resolutionToAdd = resolutions[i];
|
||||||
|
if (i < resolutions.length - 1){
|
||||||
|
resolutionToAdd += ", ";
|
||||||
|
}
|
||||||
|
document.getElementById("video-resolution").innerHTML += resolutionToAdd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
33
script/public/index.js
Normal file
33
script/public/index.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
function getResolution(from) {
|
||||||
|
$.get(from, function(data) {
|
||||||
|
$response = data.split("\n");
|
||||||
|
|
||||||
|
$resolutions=[];
|
||||||
|
$.each($response, function( index, value ) {
|
||||||
|
$line_separated_value = value.split(",");
|
||||||
|
for (i = 0; i < $line_separated_value.length; i++) {
|
||||||
|
if ($line_separated_value[i].indexOf("RESOLUTION=") != -1) {
|
||||||
|
$resolutions.push($line_separated_value[i].split('=')[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: This should be a Callback
|
||||||
|
updateResolution($resolutions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getUrlParameter(sParam) {
|
||||||
|
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
|
||||||
|
sURLVariables = sPageURL.split('&'),
|
||||||
|
sParameterName,
|
||||||
|
i;
|
||||||
|
|
||||||
|
for (i = 0; i < sURLVariables.length; i++) {
|
||||||
|
sParameterName = sURLVariables[i].split('=');
|
||||||
|
|
||||||
|
if (sParameterName[0] === sParam) {
|
||||||
|
return sParameterName[1] === undefined ? true : sParameterName[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue