Skip to content

Commit

Permalink
Added support for HLS streams
Browse files Browse the repository at this point in the history
Added a whole lot of stations
  • Loading branch information
Koenvh1 committed Oct 29, 2016
1 parent 05cb3d4 commit f0d7e6f
Show file tree
Hide file tree
Showing 4 changed files with 587 additions and 17 deletions.
8 changes: 8 additions & 0 deletions cities/cities-promods-rusmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,14 @@ var cities = [
"y": "132.84",
"z": "-59401.6"
},
{
"gameName": "brussel",
"realName": "Brussel",
"country": "belgium-nl",
"x": "-21853.1",
"y": "99.3594",
"z": "-2960.22"
},
{
"gameName": "brussel",
"realName": "Brussel",
Expand Down
8 changes: 8 additions & 0 deletions cities/cities-promods.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,14 @@ var cities = [
"y": "132.84",
"z": "-59401.6"
},
{
"gameName": "brussel",
"realName": "Brussel",
"country": "belgium-nl",
"x": "-21853.1",
"y": "99.3594",
"z": "-2960.22"
},
{
"gameName": "brussel",
"realName": "Brussel",
Expand Down
19 changes: 17 additions & 2 deletions dashboard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//current version:
var version = "0.0.5";
var version = "0.0.6";
//skinConfig global:
var g_skinConfig;
//countries near you global:
Expand All @@ -11,6 +11,8 @@ var g_last_nearest_country = "";
//whitenoise active:
var g_whitenoise = false;

var g_hls;

Funbit.Ets.Telemetry.Dashboard.prototype.initialize = function (skinConfig, utils) {
//
// skinConfig - a copy of the skin configuration from config.json
Expand All @@ -24,6 +26,9 @@ Funbit.Ets.Telemetry.Dashboard.prototype.initialize = function (skinConfig, util

//Get bootstrap:
$.getScript("/skins/" + skinConfig.name + "/bootstrap.js");
$.getScript("https://cdn.jsdelivr.net/hls.js/latest/hls.js", function () {
g_hls = new Hls();
});
//Get city locations:
$.getScript("/skins/" + skinConfig.name + "/cities/" + skinConfig.map);
//Get stations per country:
Expand Down Expand Up @@ -192,7 +197,17 @@ function setRadioStation(url, country, volume) {
} else {
g_whitenoise = false;
$("#player").animate({volume: 0}, 750, function() {
document.getElementById("player").src = url;
//Detach previous HLS if it is there
g_hls.detachMedia();
if(url.endsWith("m3u8")){
//If HLS, continue here
g_hls.attachMedia(document.getElementById("player"));
g_hls.on(Hls.Events.MEDIA_ATTACHED, function () {
g_hls.loadSource(url);
});
} else {
document.getElementById("player").src = url;
}
$("#player").animate({volume: 1}, 750, function () {
g_whitenoise = g_skinConfig.whitenoise;
});
Expand Down
Loading

0 comments on commit f0d7e6f

Please sign in to comment.