var b = document.documentElement; b.setAttribute('data-useragent', navigator.userAgent); b.setAttribute('data-platform', navigator.platform);jQuery(function ($) { var supportsAudio = !!document.createElement('audio').canPlayType; if (supportsAudio) { $('#audio1').prop('volume',0.6); // volum al 60% var index = 0, playing = true, mediaPath = '/ultimaker/', extension = '',tracks = [
Warning: opendir(ultimaker): failed to open dir: No such file or directory in /htdocs/public/www/JS.dinamic.musica.php on line 36

Warning: readdir() expects parameter 1 to be resource, boolean given in /htdocs/public/www/JS.dinamic.musica.php on line 38
],trackCount = tracks.length, npAction = $('#npAction'), npTitle = $('#npTitle'), audio = $('#audio1').bind('play', function () { playing = true; npAction.text('Now Playing...'); }).bind('pause', function () { playing = false; npAction.text('Paused...'); }).bind('ended', function () { npAction.text('Paused...'); if ((index + 1) < trackCount) { index++; loadTrack(index); sta_play(index); audio.play(); } else { audio.pause(); index = 0; loadTrack(index); } }).get(0), btnPrev = $('#btnPrev').click(function () { if ((index - 1) > -1) { index--; loadTrack(index); if (playing) { sta_play(index); audio.play(); } } else { audio.pause(); index = 0; loadTrack(index); } }), btnNext = $('#btnNext').click(function () { if ((index + 1) < trackCount) { index++; loadTrack(index); if (playing) { sta_play(index); audio.play(); } } else { audio.pause(); index = 0; loadTrack(index); } }), li = $('#plList li').click(function () { var id = parseInt($(this).index()); if (id !== index) { playTrack(id); } }), loadTrack = function (id) { $('.plSel').removeClass('plSel'); $('#plList li:eq(' + id + ')').addClass('plSel'); npTitle.text(tracks[id].name); index = id; audio.src = mediaPath + tracks[id].file + extension; }, playTrack = function (id) { loadTrack(id); sta_play(id); audio.play(); }; extension = audio.canPlayType('audio/mpeg') ? '.mp3' : audio.canPlayType('audio/ogg') ? '.ogg' : ''; loadTrack(index); } }); function sta_play (id) { $.ajax({ type:'POST', url: 'http://infor4r.cat/musica/statistic_play.php', data: { tema: id } }).done(function( msg ) { //alert( 'Los datos que se recibieron: ' + msg ); }); }