CC-3395: Play preview for playlists and timelines for shows should show a list under the pop-up player which will play the entire playlist.

- Updated detection of ogg or mp3 files
This commit is contained in:
Daniel 2012-03-13 14:12:14 -04:00
parent 48c8607d17
commit 927e5033c8
3 changed files with 43 additions and 20 deletions

View File

@ -31,7 +31,7 @@ class PlaylistController extends Zend_Controller_Action
{
$pl = null;
if (isset($this->pl_sess->id)) {
if (isset($this->pl_sess->id)) {
$pl = new Application_Model_Playlist($this->pl_sess->id);
$modified = $this->_getParam('modified', null);
@ -205,11 +205,7 @@ class PlaylistController extends Zend_Controller_Action
$audioFileTitle = $this->_getParam('audioFileTitle');
$playlistIndex = $this->_getParam('playlistIndex');
$playlistID = $this->_getParam('playlistID');
Logging::log($audioFileID);
Logging::log($audioFileArtist);
Logging::log($audioFileTitle);
Logging::log($playlistIndex);
Logging::log($playlistID);
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
@ -226,7 +222,7 @@ class PlaylistController extends Zend_Controller_Action
} else {
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
}
Logging::log("The play list index is $playlistIndex");
$this->view->audioFileID = $audioFileID;
$this->view->audioFileArtist = $audioFileArtist;
$this->view->audioFileTitle = $audioFileTitle;
@ -251,12 +247,20 @@ class PlaylistController extends Zend_Controller_Action
$result = Array();
foreach ( $pl->getContents() as $track ){
$trackMap = array( 'title' => isset($track['CcFiles']['track_title'])?$track['CcFiles']['track_title']:"",
'artist' => isset($track['CcFiles']['artist_name'])?$track['CcFiles']['artist_name']:"",
'mp3' => '/api/get-media/fileID/'.$track['CcFiles']['gunid'].'.'.pathinfo($track['CcFiles']['filepath'], PATHINFO_EXTENSION),
'id' => isset($track['id'])?$track['id']:"",
'position' => isset($track['position'])?$track['position']:"",
);
$fileExtension = pathinfo($track['CcFiles']['filepath'], PATHINFO_EXTENSION);
if ($fileExtension === 'mp3'){
$trackMap['mp3'] = $track['CcFiles']['gunid'].'.'.$fileExtension;
} else if( $fileExtension === 'ogg') {
$trackMap['oga'] = $track['CcFiles']['gunid'].'.'.$fileExtension;
} else {
//the media was neither mp3 or ogg
}
$result[] = $trackMap;
}

View File

@ -652,9 +652,15 @@ function addQtipToSCIcons(){
}
});
}
/**
*handle to the jplayer window
*/
var preview_window = null;
/**
*Gets the info from the view when menu action play choosen and opens the jplayer window.
*/
function openAudioPreview(event) {
event.stopPropagation();
@ -665,12 +671,21 @@ function openAudioPreview(event) {
open_playlist_preview(audioFileID, "", "", playlistID, playlistIndex);
}
/**
*Opens a jPlayer window for the specified info, for either an audio file or playlist.
*If audioFile, audioFileTitle, audioFileArtist is supplied the jplayer opens for one file
*Otherwise the playlistID and playlistIndex was supplied and a playlist is played starting with the
*given index.
*/
function open_playlist_preview(audioFileID, audioFileTitle, audioFileArtist, playlistID, playlistIndex) {
if (playlistIndex != undefined)
if (playlistIndex != undefined) {
if (playlistIndex == undefined) //Use a resonable default.
playlistIndex = 0;
url = 'Playlist/playlist-preview/audioFileID/'+audioFileID+'/playlistIndex/'+playlistIndex+'/playlistID/'+playlistID;
else
} else {
url = 'Playlist/playlist-preview/audioFileID/'+audioFileID+'/audioFileArtist/'+audioFileArtist+'/audioFileTitle/'+audioFileTitle;
}
//$.post(baseUri+'Playlist/audio-preview-player', {fileName: fileName, cueIn: cueIn, cueOut: cueOut, fadeIn: fadeIn, fadeInFileName: fadeInFileName, fadeOut: fadeOut, fadeOutFileName: fadeOutFileName})
if (preview_window == null || preview_window.closed || playlistIndex === undefined){
preview_window = window.open(url, 'Audio Player', 'width=450,height=800');
@ -681,5 +696,6 @@ function open_playlist_preview(audioFileID, audioFileTitle, audioFileArtist, pla
//var elemID = "spl_"+elemIndexString;
//$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause");
preview_window.focus();
return false;
}

View File

@ -5,7 +5,6 @@ $(document).ready(function(){
var audioFileID = $('.audioFileID').text();
var playlistID = $('.playlistID').text();
var playlistIndex = $('.playlistIndex').text();
console.log('in the ready');
playlist_jplayer = new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
@ -42,18 +41,21 @@ function playAll(playlistID, playlistIndex) {
var myPlaylist = new Array();
var media;
var index;
for(index in data){
if (data[index]['mp3'] != 'undefined'){
console.log(data[index]);
if (data[index]['mp3'] != undefined){
media = {title: data[index]['title'],
artist: data[index]['artist'],
mp3:data[index]['mp3']
mp3:"/api/get-media/fileID/"+data[index]['mp3']
};
}else if (data[index]['ogg'] != 'undefined') {
}else if (data[index]['oga'] != undefined) {
media = {title: data[index]['title'],
artist: data[index]['artist'],
oga:data[index]['ogg']
oga:"/api/get-media/fileID/"+data[index]['oga']
};
}
console.log(media);
myPlaylist[index] = media;
idToPostionLookUp[data[index]['id']] = data[index]['position'];
@ -85,9 +87,10 @@ function playOne(audioFileID) {
oga:"/api/get-media/fileID/"+audioFileID
};
}
playlist[0] = media;
playlist_jplayer.setPlaylist(playlist);
playlist_jplayer.option("autoPlay", true);
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);
playlist_jplayer.play(0);
}