diff --git a/script/public/index.html b/script/public/index.html
index d20ecd05..f2bff804 100644
--- a/script/public/index.html
+++ b/script/public/index.html
@@ -60,6 +60,7 @@
+
diff --git a/script/public/index.js b/script/public/index.js
index 0fcc1c1d..c9e6a99d 100644
--- a/script/public/index.js
+++ b/script/public/index.js
@@ -123,13 +123,6 @@ function getURLsFromPLS(sUrl, fn_callback) {
}
});
fn_callback($urls)
-
- //$.each($urls, function( index, value ) {
- // if (checkIfWebsiteWorks(value)) {
- // fn_callback(value);
- // break;
- // }
- //});
});
};
@@ -166,16 +159,8 @@ function getUrlParameter(sParam) {
}
};
-// Check an URL is valid or broken
-// FIXME: For streams if it works it keeps loading infinite time
-function checkIfWebsiteWorks(sUrl){
- $.get(sUrl, function(data, status){
- alert("Data: " + data + "\nStatus: " + status);
- });
-}
-
function filterChannelsList() {
- var input, filter, div, li, a, i, txtValue;
+ var input, filter, div, elements, txtValue;
input = document.getElementById("searchInput");
filter = input.value.toUpperCase();
@@ -192,11 +177,24 @@ function filterChannelsList() {
}
}
-function onChannelClick(channel){
- channel = JSON.parse(channel);
- reproduceVideo(channel['options'][0]['url'])
+function reproduceChannel(channel_options) {
+ options = channel_options;
- //document.getElementById("titleh1").innerText = document.getElementById("container").offsetWidth
+ document.getElementById("option-buttons").innerHTML = ""
+ if (options.length == 1) {
+ reproduceVideo(channel['options'][0]['url'])
+ } else if (options.length > 1) {
+ for (i = 0; i < options.length; ++i) {
+ var url = options[i]['url'];
+ document.getElementById("option-buttons").innerHTML +=
+ "
OpciĆ³n " + (i+1) + "";
+ }
+ }
+}
+
+function onChannelClick(channel) {
+ channel = JSON.parse(channel);
+ reproduceChannel(channel['options'])
if (document.getElementById("container").offsetWidth < 720) {
document.getElementById("video").scrollIntoView({behavior: "smooth", block: "start", inline: "nearest"});
@@ -209,13 +207,12 @@ function loadChannelsInList() {
return response.json();
})
.then(function(myJson) {
- console.log(myJson);
nacionales = myJson[1];
var items = [];
$.each(nacionales["ambits"], function( ambit, ambit_val ) {
$.each(ambit_val["channels"], function( key, val ) {
- items.push("
" + val["name"] + "")
+ items.push("
" + val["name"] + "")
});
});