diff --git a/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js b/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js index e7435ee2e..a18f31d5d 100644 --- a/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js +++ b/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js @@ -153,12 +153,24 @@ function buildplaylist(p_url, p_playIndex) { continue; } } else if (data[index]['type'] == 1) { - media = {title: data[index]['element_title'], - artist: data[index]['element_artist'], - mp3:data[index]['uri'] - }; + var mime = data[index]['mime']; + if (mime.search(/mp3/i) > 0 || mime.search(/mpeg/i) > 0) { + key = "mp3"; + } else if (mime.search(/og(g|a)/i) > 0 || mime.search(/vorbis/i) > 0) { + key = "oga"; + } else if (mime.search(/mp4/i) > 0) { + key = "m4a"; + } else if (mime.search(/wav/i) > 0) { + key = "wav"; + } + + if (key) { + media = {title: data[index]['element_title'], + artist: data[index]['element_artist'] + }; + media[key] = data[index]['uri'] + } } - console.log(data[index]); if (media && isAudioSupported(data[index]['mime'])) { // javascript doesn't support associative array with numeric key // so we need to remove the gap if we skip any of tracks due to diff --git a/airtime_mvc/public/js/airtime/common/audioplaytest.js b/airtime_mvc/public/js/airtime/common/audioplaytest.js index f96ad09af..078d8f1e4 100644 --- a/airtime_mvc/public/js/airtime/common/audioplaytest.js +++ b/airtime_mvc/public/js/airtime/common/audioplaytest.js @@ -15,5 +15,6 @@ function isAudioSupported(mime){ //is adding a javascript library to do the work for you, which seems like overkill.... return (!!audio.canPlayType && audio.canPlayType(bMime) != "") || (mime.indexOf("mp3") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) || - (mime.indexOf("mp4") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined); + (mime.indexOf("mp4") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) || + (mime.indexOf("mpeg") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined); }