CC-2430: Preview tracks in the library + better preview (ability to jump around in clip)

- Merged with devel, removed js from StoredFile.php
This commit is contained in:
Daniel 2012-03-02 17:55:17 -05:00
parent 51f004933b
commit a246f85a5b
6 changed files with 570 additions and 1151 deletions

View File

@ -88,6 +88,8 @@ class LibraryController extends Zend_Controller_Action
if (isset($this->pl_sess->id) && $screen == "playlist") {
$menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "copy");
}
//Open a jPlayer window and play the audio clip.
$menu["play"] = array("name"=> "Play", "icon" => "big_play");
$menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}");

View File

@ -660,10 +660,8 @@ Logging::log("getting media! - 2");
//access to zend view methods to access url helpers is needed.
if($type == "au" && isset( $audioResults )) {
$audioFile = $audioResults[$row['id']-1]['gunid'].".".pathinfo($audioResults[$row['id']-1]['filepath'], PATHINFO_EXTENSION);
$row['image'] = '<a href="javascript:void(0);" class="big_play"
onclick="open_audio_preview(\''.$audioFile.'\', \'spl_'.$row['id'].'\');">
<span class="ui-icon ui-icon-play"></span></a>';
$row['audioFile'] = $audioResults[$row['id']-1]['gunid'].".".pathinfo($audioResults[$row['id']-1]['filepath'], PATHINFO_EXTENSION);
$row['image'] = '<span class="ui-icon ui-icon-play"></span>';
}
else {

View File

@ -1,4 +1,4 @@
var AIRTIME = (function(AIRTIME){
var AIRTIME = (function(AIRTIME){
var mod,
libraryInit;
@ -158,8 +158,14 @@ var AIRTIME = (function(AIRTIME){
"fnRowCallback": AIRTIME.library.events.fnRowCallback,
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
//add the play function to the library_type td
$(nRow).find('td.library_type').click(function(){
open_audio_preview(aData.audioFile, iDataIndex);
return false;
});
//call the context menu so we can prevent the event from propagating.
$(nRow).find('td:not(.library_checkbox)').click(function(e){
$(nRow).find('td:not(.library_checkbox, .library_type)').click(function(e){
$(this).contextMenu({x: e.pageX, y: e.pageY});
@ -351,6 +357,14 @@ var AIRTIME = (function(AIRTIME){
oItems.edit.callback = callback;
}
//define a play callback.
if (oItems.play !== undefined) {
callback = function() {
open_audio_preview(data.audioFile, data.id);
};
oItems.play.callback = callback;
}
//define a delete callback.
if (oItems.del !== undefined) {
@ -445,9 +459,9 @@ var AIRTIME = (function(AIRTIME){
return AIRTIME;
}(AIRTIME || {}));
}(AIRTIME || {}));
function addToolBarButtonsLibrary(aButtons) {
function addToolBarButtonsLibrary(aButtons) {
var i,
length = aButtons.length,
libToolBar = $(".library_toolbar"),
@ -487,9 +501,9 @@ function addToolBarButtonsLibrary(aButtons) {
}(i));
}
}
}
function checkImportStatus(){
function checkImportStatus(){
$.getJSON('/Preference/is-import-in-progress', function(data){
var div = $('#import_status');
if (data == true){
@ -499,9 +513,9 @@ function checkImportStatus(){
div.hide();
}
});
}
}
function addProgressIcon(id) {
function addProgressIcon(id) {
var tr = $("#au_"+id),
span;
@ -515,9 +529,9 @@ function addProgressIcon(id) {
tr.find("td.library_title")
.append('<span class="small-icon progress"></span>');
}
}
}
function checkSCUploadStatus(){
function checkSCUploadStatus(){
var url = '/Library/get-upload-to-soundcloud-status';
@ -539,9 +553,9 @@ function checkSCUploadStatus(){
}
});
});
}
}
function addQtipToSCIcons(){
function addQtipToSCIcons(){
$(".progress, .soundcloud, .sc-error").live('mouseover', function(){
var id = $(this).parent().parent().data("aData").id;
@ -620,4 +634,24 @@ function addQtipToSCIcons(){
});
}
});
}
}
var audio_preview_window = null;
function open_audio_preview(filename, index) {
url = 'Playlist/audio-preview-player/filename/'+filename+'/index/'+index;
//$.post(baseUri+'Playlist/audio-preview-player', {fileName: fileName, cueIn: cueIn, cueOut: cueOut, fadeIn: fadeIn, fadeInFileName: fadeInFileName, fadeOut: fadeOut, fadeOutFileName: fadeOutFileName})
if (audio_preview_window == null || audio_preview_window.closed){
audio_preview_window = window.open(url, 'Audio Player', 'width=400,height=95');
} else if (!audio_preview_window.closed) {
audio_preview_window.play(filename);
} else {
console.log("something else : "+baseUrl+url);
}
//Set the play button to pause.
//var elemID = "spl_"+elemIndexString;
//$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause");
return false;
}

View File

@ -1,4 +1,4 @@
var audio_preview_window = null;
var audio_preview_window_p = null;
function playlistAudioPreviewEditor(filename, elemIndexString){
@ -41,7 +41,7 @@ function playlistAudioPreviewEditor(filename, elemIndexString){
}
function open_audio_preview(filename, index) {
function open_audio_preview_old(filename, index) {
console.log("hello world 2 "+filename+" help?");
url = 'Playlist/audio-preview-player/filename/'+filename+'/index/'+index;
//$.post(baseUri+'Playlist/audio-preview-player', {fileName: fileName, cueIn: cueIn, cueOut: cueOut, fadeIn: fadeIn, fadeInFileName: fadeInFileName, fadeOut: fadeOut, fadeOutFileName: fadeOutFileName})
@ -57,6 +57,13 @@ function open_audio_preview(filename, index) {
console.log("something else : "+baseUrl+url);
}
audio_preview_window.focus();
//Set the play button to pause.
var elemID = "spl_"+elemIndexString;
$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause");
return false;
}
$('#library_type').bind('click', function(){
console.log(data);
});

View File

@ -67,6 +67,6 @@ function play(filename){
cssSelectorAncestor: '#jp_container_1',
wmode: "window"
});
$this.focus();
}

File diff suppressed because one or more lines are too long