CC-3429: Firefox does not natively support mp3 file playing so preview does nothing.

- after reading about the trick foudn in Mark Panaghiston's posting from this link https://groups.google.com/forum/#!topic/jplayer/gTJrSCjwftw
- the current imperfect solution for firefox sould be to show a video jplayer that can play all the audio types.
This commit is contained in:
Daniel 2012-03-16 18:03:35 -04:00
parent 77e1c1c0cb
commit 7914b30233
2 changed files with 18 additions and 5 deletions

View File

@ -150,8 +150,11 @@ class ApiController extends Zend_Controller_Action
//user clicks play button for track and downloads it.
header('Content-Disposition: inline; filename="'.$file_base_name.'"');
}
$this->smartReadFile($filepath, 'audio/'.$ext);
if ($ext === 'mp3'){
$this->smartReadFile($filepath, 'audio/mpeg');
} else {
$this->smartReadFile($filepath, 'audio/'.$ext);
}
exit;
}else{
header ("HTTP/1.1 404 Not Found");

View File

@ -8,16 +8,22 @@ var _idToPostionLookUp;
*/
$(document).ready(function(){
if (useFlash())
mySupplied = "oga, mp3, m4v";
else
mySupplied = "oga, mp3";
_playlist_jplayer = new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
},[], //array of songs will be filled with below's json call
{
swfPath: "/js/jplayer",
//supplied: "mp3,oga",
supplied:mySupplied,
wmode: "window"
});
$.jPlayer.timeFormat.showHour = true;
var audioFileID = $('.audioFileID').text();
@ -35,6 +41,10 @@ $(document).ready(function(){
}
});
function useFlash() {
console.log(navigator.userAgent);
return navigator.userAgent.toLowerCase().match('firefox');
}
/**
* Sets up the jPlayerPlaylist to play.
* - Get the playlist info based on the playlistID give.
@ -122,7 +132,7 @@ function play(p_playlistIndex){
function playOne(p_audioFileID) {
var playlist = new Array();
var fileExtensioin = p_audioFileID.split('.').pop();
console.log(p_audioFileID);
if (fileExtensioin === 'mp3') {
media = {title: $('.audioFileTitle').text() !== 'null' ?$('.audioFileTitle').text():"",
artist: $('.audioFileArtist').text() !== 'null' ?$('.audioFileArtist').text():"",
@ -135,7 +145,7 @@ function playOne(p_audioFileID) {
};
}
_playlist_jplayer.option("autoPlay", true);
console.log(media);
playlist[0] = media;
//_playlist_jplayer.setPlaylist(playlist); --if I use this the player will call _init on the setPlaylist and on the ready
_playlist_jplayer._initPlaylist(playlist);