var playerReady = false; var theMP3, theFile, theSec; var fragments = new Array(); var currentTime; var playing = false; function handleTimer(event) { var sec = parseInt(event.jPlayer.status.currentTime); currentTime = sec; var obj; var found = false; if (sec == 0) $("#ug_info").html(""); for (var t=0; t= parseInt(obj.sec) && parseInt(sec) < parseInt(obj.endsec)) { $("#ug_info").html(obj.message); found = true; } } } if (!found) { $("#ug_info").html(""); } $("#player_song").html(" "); $(".playlist-line").each(function(i) { if ($(this).attr('einde') <= currentTime) { $(this).addClass("playlist-line-played"); } else { $(this).removeClass("playlist-line-played"); } if (currentTime >= $(this).attr('start') && currentTime <= $(this).attr('einde')) { $(this).addClass("playlist-line-now"); $("#player_song").html($(this).html()); } else { $(this).removeClass("playlist-line-now"); } }); } function handlePlayerStop(event) { //console.log("stop pressed"); } function handlePlayerPause(event) { if (playing) $("#jquery_jplayer_1").jPlayer("pause"); } function notePlay(event) { //console.log("play pressed"); playing = true; } function notePause(event) { //console.log("pause pressed"); playing = false; } function initPlayer() { $("#jquery_jplayer_1").jPlayer({ ready: function(event) { $("#jquery_jplayer_1").bind($.jPlayer.event.timeupdate, handleTimer); $("#jquery_jplayer_1").bind($.jPlayer.event.ended, handlePlayerStop); $("#jquery_jplayer_1").bind($.jPlayer.event.play, notePlay); $("#jquery_jplayer_1").bind($.jPlayer.event.pause, notePause); $(".jp-play").click(handlePlayerPause); }, swfPath: "js/plugins/jPlayer-2.9.2/dist/jplayer", supplied: "mp3", "customCssIds": false }); } function playMP3(fi, ti, sec, prog) { theMP3 = "http://www.lokaleomroepkrimpen.nl/rel3/" + fi; tmpArray = fi.split("/"); theFile = tmpArray[tmpArray.length-1]; theSec = sec; // register Google Analytics event ga('send', 'event', 'Uitzending Gemist', 'Play', ti + ": " + prog); ga('send', 'event', 'Uitzending Gemist per programma', 'Play', prog); $("#jplayer_title").html(ti + ": " + prog); $("#ug_info").html(""); $("#jquery_jplayer_1").jPlayer("setMedia", { mp3: theMP3 }); $("#jquery_jplayer_1").jPlayer("play", theSec); } function downloadMP3(ti) { // register Google Analytics event ga('send', 'event', 'Uitzending Gemist', 'Download', ti); } function prepareMP3(fi, ti) { theMP3 = "http://www.lokaleomroepkrimpen.nl/rel/" + fi; tmpArray = fi.split("/"); theFile = tmpArray[tmpArray.length-1]; theSec = 0; $("#jplayer_title").html(ti); $("#ug_info").html(""); $("#jquery_jplayer_1").jPlayer("setMedia", { mp3: theMP3 }); } function registerFragment(filename, ti, end, message) { var obj = {filename: filename, sec: ti, endsec: end, message: message}; fragments.push(obj); } function setUGpage(nr) { $("#ug_page" + visiblePage).hide(); $("#ug_page" + nr).show(); visiblePage = nr; document.location.hash = nr; }