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 index;
var total = 0;
var skipped = 0;
for(index in data) {
if (data[index]['type'] == 0) {
if (data[index]['element_mp3'] != undefined){
@ -145,6 +146,11 @@ 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'],
@ -152,15 +158,18 @@ function buildplaylist(p_url, p_playIndex) {
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);

View file

@ -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)) {