diff --git a/airtime_mvc/application/controllers/AudiopreviewController.php b/airtime_mvc/application/controllers/AudiopreviewController.php
index 478b7ef19..af8b8c283 100644
--- a/airtime_mvc/application/controllers/AudiopreviewController.php
+++ b/airtime_mvc/application/controllers/AudiopreviewController.php
@@ -24,15 +24,22 @@ class AudiopreviewController extends Zend_Controller_Action
$audioFileID = $this->_getParam('audioFileID');
$audioFileArtist = $this->_getParam('audioFileArtist');
$audioFileTitle = $this->_getParam('audioFileTitle');
+ $type = $this->_getParam('type');
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
+
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
- $this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
- $this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
- $this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.airtime.audio.preview.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headScript()->appendFile(
+ $baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],
+ 'text/javascript');
+ $this->view->headScript()->appendFile(
+ $baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],
+ 'text/javascript');
+ $this->view->headLink()->appendStylesheet(
+ $baseUrl.'/js/jplayer/skin/jplayer.airtime.audio.preview.css?'.$CC_CONFIG['airtime_version']);
$this->_helper->layout->setLayout('audioPlayer');
$logo = Application_Model_Preference::GetStationLogo();
@@ -41,6 +48,17 @@ class AudiopreviewController extends Zend_Controller_Action
} else {
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
}
+
+ if ($type == "audioclip") {
+ $uri = "/api/get-media/file/".$audioFileID;
+ } else if ($type == "stream") {
+ $webstream = CcWebstreamQuery::create()->findPk($audioFileID);
+ $uri = $webstream->getDbUrl();
+ } else {
+ throw new Exception("Unknown type for audio preview!");
+ }
+
+ $this->view->uri = $uri;
$this->view->audioFileID = $audioFileID;
$this->view->audioFileArtist = $audioFileArtist;
$this->view->audioFileTitle = $audioFileTitle;
diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php
index a945324c1..62c900907 100644
--- a/airtime_mvc/application/models/StoredFile.php
+++ b/airtime_mvc/application/models/StoredFile.php
@@ -641,6 +641,11 @@ class Application_Model_StoredFile
$blSelect[] = "NULL::int AS ".$key;
$fileSelect[] = $key;
$streamSelect[] = "NULL::int AS ".$key;
+ } else if ($key === "filepath") {
+ $plSelect[] = "NULL::VARCHAR AS ".$key;
+ $blSelect[] = "NULL::VARCHAR AS ".$key;
+ $fileSelect[] = $key;
+ $streamSelect[] = "url AS ".$key;
} else {
$plSelect[] = "NULL::text AS ".$key;
$blSelect[] = "NULL::text AS ".$key;
@@ -719,13 +724,13 @@ class Application_Model_StoredFile
//datatable stuff really needs to be pulled out and generalized within the project
//access to zend view methods to access url helpers is needed.
- Logging::log($type);
if ($type == "au") {
$row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
$row['image'] = '
';
} else if ($type == "pl") {
$row['image'] = '
';
} else if ($type == "st") {
+ $row['audioFile'] = $row['id'];
$row['image'] = '
';
} else if ($type == "bl") {
$row['image'] = '
';
diff --git a/airtime_mvc/application/views/scripts/audiopreview/audio-preview.phtml b/airtime_mvc/application/views/scripts/audiopreview/audio-preview.phtml
index d440d96ca..447157a16 100644
--- a/airtime_mvc/application/views/scripts/audiopreview/audio-preview.phtml
+++ b/airtime_mvc/application/views/scripts/audiopreview/audio-preview.phtml
@@ -6,8 +6,8 @@
blockId)): ?>
blockId" ?>
blockIndex" ?>
-audioFileID)): ?>
- audioFileID" ?>
+uri)): ?>
+ uri" ?>
audioFileTitle" ?>
audioFileArtist" ?>
showID)): ?>
diff --git a/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js b/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js
index dcc33f11d..2feca14a1 100644
--- a/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js
+++ b/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js
@@ -35,7 +35,8 @@ $(document).ready(function(){
$.jPlayer.timeFormat.showHour = true;
- var audioFileID = $('.audioFileID').text();
+ var audioUri = $('.audioUri').text();
+ //var audioFileID = $('.audioFileID').text();
var playlistID = $('.playlistID').text();
var playlistIndex = $('.playlistIndex').text();
var showID = $('.showID').text();
@@ -47,8 +48,8 @@ $(document).ready(function(){
if (playlistID != "" && playlistID !== ""){
playAllPlaylist(playlistID, playlistIndex);
- }else if (audioFileID != "") {
- playOne(audioFileID);
+ }else if (audioUri != "") {
+ playOne(audioUri);
}else if (showID != "") {
playAllShow(showID, showIndex);
}else if(blockId != "" && blockIndex != ""){
@@ -179,18 +180,18 @@ function play(p_playlistIndex){
* Playing one audio track occurs from the library. This function will create the media, setup
* jplayer and play the track.
*/
-function playOne(p_audioFileID) {
+function playOne(uri) {
var playlist = new Array();
- var fileExtension = p_audioFileID.split('.').pop();
+ var fileExtension = uri.split('.').pop();
if (fileExtension.toLowerCase() === 'mp3') {
media = {title: $('.audioFileTitle').text() !== 'null' ?$('.audioFileTitle').text():"",
artist: $('.audioFileArtist').text() !== 'null' ?$('.audioFileArtist').text():"",
- mp3:"/api/get-media/file/"+p_audioFileID
+ mp3:uri
};
- }else if (fileExtension.toLowerCase() === 'ogg' ) {
+ } else if (fileExtension.toLowerCase() === 'ogg' ) {
media = {title: $('.audioFileTitle').text() != 'null' ?$('.audioFileTitle').text():"",
artist: $('.audioFileArtist').text() != 'null' ?$('.audioFileArtist').text():"",
- oga:"/api/get-media/file/"+p_audioFileID
+ oga:uri
};
}
_playlist_jplayer.option("autoPlay", true);
diff --git a/airtime_mvc/public/js/airtime/common/common.js b/airtime_mvc/public/js/airtime/common/common.js
index 074c6f267..bd162f980 100644
--- a/airtime_mvc/public/js/airtime/common/common.js
+++ b/airtime_mvc/public/js/airtime/common/common.js
@@ -43,15 +43,18 @@ function openAudioPreview(p_event) {
}
}
-function open_audio_preview(audioFileID, audioFileTitle, audioFileArtist) {
+function open_audio_preview(type, id, audioFileTitle, audioFileArtist) {
// we need to remove soundcloud icon from audioFileTitle
var index = audioFileTitle.indexOf("