diff --git a/airtime_mvc/application/views/scripts/playlist/update.phtml b/airtime_mvc/application/views/scripts/playlist/update.phtml index a51fd37db..70176ff9e 100644 --- a/airtime_mvc/application/views/scripts/playlist/update.phtml +++ b/airtime_mvc/application/views/scripts/playlist/update.phtml @@ -21,7 +21,7 @@ if ($item['type'] == 2) { -
"> +
" blocktype="">
diff --git a/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js b/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js index 0f5a0b0fe..e7435ee2e 100644 --- a/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js +++ b/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js @@ -123,6 +123,7 @@ function buildplaylist(p_url, p_playIndex) { var media; var index; var total = 0; + var skipped = 0; for(index in data) { if (data[index]['type'] == 0) { if (data[index]['element_mp3'] != undefined){ @@ -145,22 +146,30 @@ function buildplaylist(p_url, p_playIndex) { artist: data[index]['element_artist'], wav:data[index]['uri'] }; - } + } else { + // skip this track since it's not supported + console.log("continue"); + skipped++; + continue; + } } else if (data[index]['type'] == 1) { media = {title: data[index]['element_title'], artist: data[index]['element_artist'], mp3:data[index]['uri'] }; } + console.log(data[index]); if (media && isAudioSupported(data[index]['mime'])) { - myPlaylist[index] = media; + // javascript doesn't support associative array with numeric key + // so we need to remove the gap if we skip any of tracks due to + // browser incompatibility. + myPlaylist[index-skipped] = media; } // we should create a map according to the new position in the // player itself total is the index on the player _idToPostionLookUp[data[index]['element_id']] = total; total++; } - _playlist_jplayer.setPlaylist(myPlaylist); _playlist_jplayer.option("autoPlay", true); play(p_playIndex); diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index a5937820d..e79678201 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -366,7 +366,7 @@ var AIRTIME = (function(AIRTIME){ //and verify whether they can be previewed by the browser or not. If not //then the playlist element is greyed out mod.validatePlaylistElements = function(){ - $.each($(".big_play ui-icon-play"), function(index, value){ + $.each($("div .big_play"), function(index, value){ if ($(value).attr('blockId') === undefined) { var mime = $(value).attr("data-mime-type"); if (isAudioSupported(mime)) { @@ -393,6 +393,31 @@ var AIRTIME = (function(AIRTIME){ }, }) } + } else { + if ($(value).attr('blocktype') === 'dynamic') { + $(value).attr("class", "big_play_disabled dark_class"); + $(value).qtip({ + content: 'Dynamic block is not previewable', + show: 'mouseover', + hide: { + delay: 500, + fixed: true + }, + style: { + border: { + width: 0, + radius: 4 + }, + classes: "ui-tooltip-dark ui-tooltip-rounded" + }, + position: { + my: "left bottom", + at: "right center" + }, + }) + } else { + $(value).bind("click", openAudioPreview); + } } }); }