1
0
Fork 0
mirror of https://github.com/LaQuay/TDTChannels.git synced 2024-11-26 18:54:57 +01:00

Read data from URL

This commit is contained in:
Marc 2018-12-09 08:54:29 +01:00
parent 29e1798a81
commit 03bee7c121

View file

@ -14,7 +14,7 @@
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
</head> </head>
<body> <body>
<div class="container" style="margin-top: 50px"> <div class="container" style="margin-top: 30px">
<h1 class="display-3">TDTChannels</h1> <h1 class="display-3">TDTChannels</h1>
<p class="lead"> <p class="lead">
Bienvenido al reproductor del proyecto opensource TDTChannels Bienvenido al reproductor del proyecto opensource TDTChannels
@ -28,7 +28,7 @@
target="_blank">GitHub</a> target="_blank">GitHub</a>
<a class="btn btn-outline-primary" role="button" href="https://www.linkedin.com/in/marcvilagomez/" <a class="btn btn-outline-primary" role="button" href="https://www.linkedin.com/in/marcvilagomez/"
target="_blank">LinkedIn</a> target="_blank">LinkedIn</a>
<div style="margin-top: 30px"> <div style="margin-top: 25px">
<div id="video"> <div id="video">
<p class="lead"> <p class="lead">
Reproductor de Televisión Reproductor de Televisión
@ -45,7 +45,7 @@
<div id="video-player" class="col-8"></div> <div id="video-player" class="col-8"></div>
</div> </div>
<div id="audio"> <div id="audio" style="margin-top: 15px">
<p class="lead"> <p class="lead">
Reproductor de Radio Reproductor de Radio
</p> </p>
@ -66,6 +66,8 @@
</div> </div>
</div> </div>
<script> <script>
// Se espera en la URL este tipo de llamada
// .html?type={audio,video}&channel={url_a_reproducir}
var getUrlParameter = function getUrlParameter(sParam) { var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)), var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'), sURLVariables = sPageURL.split('&'),
@ -80,7 +82,15 @@
} }
} }
}; };
//var channelToReproduce = getUrlParameter("channel"); var typeToReproduce = getUrlParameter("type");
var channelToReproduce;
if (typeToReproduce == "audio") {
channelToReproduce = getUrlParameter("channel");
reproduceAudio(channelToReproduce);
} else if (typeToReproduce == "video") {
channelToReproduce = getUrlParameter("channel");
reproduceVideo(channelToReproduce);
}
function loadItem(from) { function loadItem(from) {
var value; var value;
@ -100,7 +110,7 @@
var player = new Clappr.Player({ var player = new Clappr.Player({
source: channelToReproduce, source: channelToReproduce,
parentId: '#video-player', parentId: '#video-player',
height: '50%', height: '400px',
width: '100%', width: '100%',
autoPlay: true, autoPlay: true,
}); });