CC-3391: Audio Preview cannot play tracks with commas in their filename
- The content distribution header filename attribute, wasn't properly quoted for inline content. This causes a bug for files with comma names. - changed the play button in library back to the speaker icon - removed some dead code preview_player.js - removed the file name attribute, will need better approch to presenting the user with audio information.
This commit is contained in:
parent
348011dbc3
commit
709e117f41
|
@ -116,10 +116,9 @@ class ApiController extends Zend_Controller_Action
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = $this->_getParam("name");
|
$fileID = $this->_getParam("fileID");
|
||||||
$filename = $this->_getParam("filename");
|
$file_id = substr($fileID, 0, strpos($fileID, "."));
|
||||||
|
|
||||||
$file_id = substr($filename, 0, strpos($filename, "."));
|
|
||||||
if (ctype_alnum($file_id) && strlen($file_id) == 32)
|
if (ctype_alnum($file_id) && strlen($file_id) == 32)
|
||||||
{
|
{
|
||||||
$media = Application_Model_StoredFile::RecallByGunid($file_id);
|
$media = Application_Model_StoredFile::RecallByGunid($file_id);
|
||||||
|
@ -132,7 +131,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$file_base_name = substr($file_base_name, 1);
|
$file_base_name = substr($file_base_name, 1);
|
||||||
// possibly use fileinfo module here in the future.
|
// possibly use fileinfo module here in the future.
|
||||||
// http://www.php.net/manual/en/book.fileinfo.php
|
// http://www.php.net/manual/en/book.fileinfo.php
|
||||||
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
$ext = pathinfo($fileID, PATHINFO_EXTENSION);
|
||||||
//Download user left clicks a track and selects Download.
|
//Download user left clicks a track and selects Download.
|
||||||
if ("true" == $this->_getParam('download')){
|
if ("true" == $this->_getParam('download')){
|
||||||
//path_info breaks up a file path into seperate pieces of informaiton.
|
//path_info breaks up a file path into seperate pieces of informaiton.
|
||||||
|
@ -146,7 +145,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
|
header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
|
||||||
}else{
|
}else{
|
||||||
//user clicks play button for track and downloads it.
|
//user clicks play button for track and downloads it.
|
||||||
header("Content-Disposition: inline; filename=$file_base_name");
|
header('Content-Disposition: inline; filename="'.$file_base_name.'"');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->smartReadFile($filepath, $ext);
|
$this->smartReadFile($filepath, $ext);
|
||||||
|
|
|
@ -198,8 +198,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function audioPreviewPlayerAction()
|
public function audioPreviewPlayerAction()
|
||||||
{
|
{
|
||||||
$name = $this->_getParam('name');
|
$fileID = $this->_getParam('fileID');
|
||||||
$fileName = $this->_getParam('filename');
|
|
||||||
$playlistIndex = $this->_getParam('index');
|
$playlistIndex = $this->_getParam('index');
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
@ -218,8 +217,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
|
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->name = $name;
|
$this->view->fileName = $fileID;
|
||||||
$this->view->fileName = $fileName;
|
|
||||||
$this->view->playlistIndex= $playlistIndex;
|
$this->view->playlistIndex= $playlistIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -660,7 +660,7 @@ Logging::log("getting media! - 2");
|
||||||
|
|
||||||
if($type == "au"){//&& isset( $audioResults )) {
|
if($type == "au"){//&& isset( $audioResults )) {
|
||||||
$row['audioFile'] = $row['gunid'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
|
$row['audioFile'] = $row['gunid'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
|
||||||
$row['image'] = '<div class="big_play"><span class="ui-icon ui-icon-play"></span></div>';
|
$row['image'] = '<div class="big_play"><img src="/css/images/icon_audioclip.png"></div>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$row['image'] = '<img src="/css/images/icon_playlist.png">';
|
$row['image'] = '<img src="/css/images/icon_playlist.png">';
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<div id="content" class="jp-container">
|
<div id="content" class="jp-container">
|
||||||
<span class='name'><?php echo "$this->name" ?></span>
|
<span class='fileID'><?php echo "$this->fileName" ?></span>
|
||||||
<span class='filename'><?php echo "$this->fileName" ?></span>
|
|
||||||
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
|
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
|
||||||
<div id="jp_container_1" class="jp-audio">
|
<div id="jp_container_1" class="jp-audio">
|
||||||
<div class="jp-type-single">
|
<div class="jp-type-single">
|
||||||
|
|
|
@ -160,7 +160,7 @@
|
||||||
|
|
||||||
//add the play function to the library_type td
|
//add the play function to the library_type td
|
||||||
$(nRow).find('td.library_type').click(function(){
|
$(nRow).find('td.library_type').click(function(){
|
||||||
open_audio_preview(aData.track_title, aData.audioFile, aData.id);
|
open_audio_preview(aData.audioFile, aData.id);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@
|
||||||
//define a play callback.
|
//define a play callback.
|
||||||
if (oItems.play !== undefined) {
|
if (oItems.play !== undefined) {
|
||||||
callback = function() {
|
callback = function() {
|
||||||
open_audio_preview(data.track_title, data.audioFile, data.id);
|
open_audio_preview(data.audioFile, data.id);
|
||||||
};
|
};
|
||||||
oItems.play.callback = callback;
|
oItems.play.callback = callback;
|
||||||
}
|
}
|
||||||
|
@ -638,13 +638,13 @@
|
||||||
|
|
||||||
var audio_preview_window = null;
|
var audio_preview_window = null;
|
||||||
|
|
||||||
function open_audio_preview(name, filename, index) {
|
function open_audio_preview(fileID, index) {
|
||||||
url = 'Playlist/audio-preview-player/name/'+name+'/filename/'+filename+'/index/'+index;
|
url = 'Playlist/audio-preview-player/fileID/'+fileID+'/index/'+index;
|
||||||
//$.post(baseUri+'Playlist/audio-preview-player', {fileName: fileName, cueIn: cueIn, cueOut: cueOut, fadeIn: fadeIn, fadeInFileName: fadeInFileName, fadeOut: fadeOut, fadeOutFileName: fadeOutFileName})
|
//$.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){
|
if (audio_preview_window == null || audio_preview_window.closed){
|
||||||
audio_preview_window = window.open(url, 'Audio Player', 'width=400,height=95');
|
audio_preview_window = window.open(url, 'Audio Player', 'width=400,height=95');
|
||||||
} else if (!audio_preview_window.closed) {
|
} else if (!audio_preview_window.closed) {
|
||||||
audio_preview_window.play(name, filename);
|
audio_preview_window.play(fileID);
|
||||||
} else {
|
} else {
|
||||||
console.log("something else : "+baseUrl+url);
|
console.log("something else : "+baseUrl+url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,49 +1,11 @@
|
||||||
|
|
||||||
|
|
||||||
function audioPreview(filename, elemID){
|
|
||||||
console.log("in the audio preview");
|
|
||||||
var elems = $('.ui-icon.ui-icon-pause');
|
|
||||||
elems.attr("class", "ui-icon ui-icon-play");
|
|
||||||
|
|
||||||
if ($("#jquery_jplayer_1").data("jPlayer") && $("#jquery_jplayer_1").data("jPlayer").status.paused != true){
|
|
||||||
$('#jquery_jplayer_1').jPlayer('stop');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ext = getFileExt(filename);
|
|
||||||
var uri = "/api/get-media/file/" + filename;
|
|
||||||
|
|
||||||
var media;
|
|
||||||
var supplied;
|
|
||||||
if (ext == "ogg"){
|
|
||||||
media = {oga:uri};
|
|
||||||
supplied = "oga";
|
|
||||||
} else {
|
|
||||||
media = {mp3:uri};
|
|
||||||
supplied = "mp3";
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#jquery_jplayer_1").jPlayer("destroy");
|
|
||||||
$("#jquery_jplayer_1").jPlayer({
|
|
||||||
ready: function () {
|
|
||||||
$(this).jPlayer("setMedia", media).jPlayer("play");
|
|
||||||
},
|
|
||||||
swfPath: "/js/jplayer",
|
|
||||||
supplied: supplied
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause");
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
var filename = $(".filename").text();
|
var fileID = $(".fileID").text();
|
||||||
var name = $(".name").text();
|
play(fileID);
|
||||||
play(name, filename);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function play(name, filename){
|
function play(fileID){
|
||||||
var uri = "/api/get-media/name/"+name+"/filename/" + filename;
|
var uri = "/api/get-media/fileID/" + fileID;
|
||||||
var ext = getFileExt(filename);
|
var ext = getFileExt(fileID);
|
||||||
|
|
||||||
|
|
||||||
var media;
|
var media;
|
||||||
|
|
|
@ -248,11 +248,10 @@ var AIRTIME = (function(AIRTIME){
|
||||||
function openAudioPreview(event) {
|
function openAudioPreview(event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
var name = $(this).parent().find('.spl_title').text();
|
|
||||||
var audioFile = $(this).attr('audioFile');
|
var audioFile = $(this).attr('audioFile');
|
||||||
var id = "";
|
var id = "";
|
||||||
|
|
||||||
open_audio_preview(name, audioFile, id);
|
open_audio_preview(audioFile, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function editName() {
|
function editName() {
|
||||||
|
|
|
@ -89,12 +89,10 @@ div.jp-video div.jp-interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Used to hide the filename field **/
|
/* Used to hide the filename field **/
|
||||||
span.filename {
|
span.fileID {
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
span.name {
|
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @group CONTROLS */
|
/* @group CONTROLS */
|
||||||
|
|
||||||
div.jp-controls-holder {
|
div.jp-controls-holder {
|
||||||
|
|
Loading…
Reference in New Issue