1
0
Fork 0
mirror of https://github.com/LaQuay/TDTChannels.git synced 2024-11-23 09:23:24 +01:00
TDTChannels/script/public/index.html

137 lines
5.5 KiB
HTML
Raw Normal View History

2018-09-22 19:28:28 +02:00
<html>
<head>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/clappr@latest/dist/clappr.min.js"></script>
2018-12-09 01:15:31 +01:00
<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.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
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>
2018-09-22 19:28:28 +02:00
</head>
<body>
2018-12-09 01:15:31 +01:00
<div class="container" style="margin-top: 50px">
<h1 class="display-3">TDTChannels</h1>
<p class="lead">
Bienvenido al reproductor del proyecto opensource TDTChannels
</p>
<br>
<a class="btn btn-outline-secondary" role="button" href="https://github.com/LaQuay/TDTChannels"
target="_blank">Repositorio TDT Channels</a>
<a class="btn btn-outline-success" role="button" href="http://www.marcvila.me/"
target="_blank">Sitio personal</a>
<a class="btn btn-outline-warning" role="button" href="https://github.com/LaQuay/"
target="_blank">GitHub</a>
<a class="btn btn-outline-primary" role="button" href="https://www.linkedin.com/in/marcvilagomez/"
target="_blank">LinkedIn</a>
<div style="margin-top: 30px">
<div id="video">
<p class="lead">
Reproductor de Televisión
</p>
<p>Formatos soportado: <em>m3u8</em></p>
<div class="input-group mb-3 col-8">
<input id="input-reproduccion-video" type="text" class="form-control" placeholder="URL de reproducción">
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button" id="button-reproduccion-video"
onclick="loadItem('video');">Cargar
</button>
</div>
</div>
<div id="video-player" class="col-8"></div>
</div>
<div id="audio">
<p class="lead">
Reproductor de Radio
</p>
<p>Formatos soportado: <em>nsv</em></p>
<div class="input-group mb-3 col-8">
<input id="input-reproduccion-audio" type="text" class="form-control" placeholder="URL de reproducción">
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button" id="button-reproduccion-audio"
onclick="loadItem('audio');">Cargar
</button>
</div>
</div>
<audio id="audio-controller" controls>
<source id="audio-player" src="http://rac105.radiocat.net/;*.nsv" autoplay>
Your browser does not support the audio element.
</audio>
</div>
</div>
</div>
2018-09-22 19:28:28 +02:00
<script>
2018-12-09 01:15:31 +01:00
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 channelToReproduce = getUrlParameter("channel");
function loadItem(from) {
var value;
if (from == "audio") {
value = document.getElementById("input-reproduccion-audio").value;
reproduceAudio(value);
} else if (from == "video") {
value = document.getElementById("input-reproduccion-video").value;
reproduceVideo(value);
}
}
function reproduceVideo(channelToReproduce) {
console.log("Reproducing " + channelToReproduce);
if (channelToReproduce.includes("m3u8")) {
console.log("Reproducing video")
var player = new Clappr.Player({
source: channelToReproduce,
parentId: '#video-player',
height: '50%',
width: '100%',
autoPlay: true,
});
}
}
function reproduceAudio(channelToReproduce) {
console.log("Reproducing " + channelToReproduce);
if (channelToReproduce.includes("nsv")) {
console.log("Reproducing audio")
var audioSource = document.getElementById('audio-controller');
var audioPlayer = document.getElementById('audio-player');
audioPlayer.src = channelToReproduce;
audioSource.load();
audioSource.pause();
var playPromise = audioSource.play();
if (playPromise !== undefined) {
playPromise.then(function() {
// Automatic playback started!
}).catch(function(error) {
// Automatic playback failed.
// Show a UI element to let the user manually start playback.
});
}
}
}
2018-09-22 19:28:28 +02:00
</script>
</body>
</html>