CC-4506: Audio Preview in Playlist doesn't work

- fixed
This commit is contained in:
James 2012-10-16 12:06:47 -04:00
parent 8a93717415
commit 7796b23a58
2 changed files with 13 additions and 4 deletions

View file

@ -123,6 +123,7 @@ function buildplaylist(p_url, p_playIndex) {
var media; var media;
var index; var index;
var total = 0; var total = 0;
var skipped = 0;
for(index in data) { for(index in data) {
if (data[index]['type'] == 0) { if (data[index]['type'] == 0) {
if (data[index]['element_mp3'] != undefined){ if (data[index]['element_mp3'] != undefined){
@ -145,22 +146,30 @@ function buildplaylist(p_url, p_playIndex) {
artist: data[index]['element_artist'], artist: data[index]['element_artist'],
wav:data[index]['uri'] wav:data[index]['uri']
}; };
} } else {
// skip this track since it's not supported
console.log("continue");
skipped++;
continue;
}
} else if (data[index]['type'] == 1) { } else if (data[index]['type'] == 1) {
media = {title: data[index]['element_title'], media = {title: data[index]['element_title'],
artist: data[index]['element_artist'], artist: data[index]['element_artist'],
mp3:data[index]['uri'] mp3:data[index]['uri']
}; };
} }
console.log(data[index]);
if (media && isAudioSupported(data[index]['mime'])) { 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 // we should create a map according to the new position in the
// player itself total is the index on the player // player itself total is the index on the player
_idToPostionLookUp[data[index]['element_id']] = total; _idToPostionLookUp[data[index]['element_id']] = total;
total++; total++;
} }
_playlist_jplayer.setPlaylist(myPlaylist); _playlist_jplayer.setPlaylist(myPlaylist);
_playlist_jplayer.option("autoPlay", true); _playlist_jplayer.option("autoPlay", true);
play(p_playIndex); play(p_playIndex);

View file

@ -366,7 +366,7 @@ var AIRTIME = (function(AIRTIME){
//and verify whether they can be previewed by the browser or not. If not //and verify whether they can be previewed by the browser or not. If not
//then the playlist element is greyed out //then the playlist element is greyed out
mod.validatePlaylistElements = function(){ mod.validatePlaylistElements = function(){
$.each($(".big_play ui-icon-play"), function(index, value){ $.each($("div .big_play"), function(index, value){
if ($(value).attr('blockId') === undefined) { if ($(value).attr('blockId') === undefined) {
var mime = $(value).attr("data-mime-type"); var mime = $(value).attr("data-mime-type");
if (isAudioSupported(mime)) { if (isAudioSupported(mime)) {