var lastSong = 'melodie';
getLastSongs();
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
mp3:"http://142.4.223.16:8099/stream",
title: "Radio Vocea Evangheliei ♥ Sibiu",
}).jPlayer("play").jPlayer('volume',0.85);
},
swfPath: "js",
supplied: "mp3",
wmode: "window",
});
setInterval(function(){
getLastSongs();
},15000);
});
function getLastSongs(){
$.ajax({
type: "GET",
url: "http://s5.radioboss.fm:8099/played?sid=1&type=json&callback=",
async: false,
jsonpCallback: 'func',
contentType: "application/json",
dataType: 'jsonp',
success:function(data){
writeData(data);
}
});
}
function writeData(response){
if(response[0].title != lastSong){
lastSong = response[0].title;
$('.lastSongs > p').remove();
for(var i = 0; i < response.length; i++) {
$(".lastSongs").append('<p> → '+response[i].title+'</p>');
//getTimePlayed(response[i].playedat);
}
$(".lastSongs p").first().addClass("currentSong");
}
}