diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php
index c8c313b29..4f65761e3 100644
--- a/airtime_mvc/application/Bootstrap.php
+++ b/airtime_mvc/application/Bootstrap.php
@@ -133,8 +133,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view->headScript()->appendFile($baseUrl.'js/tipsy/jquery.tipsy.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/airtime/common/common.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
- $view->headScript()->appendFile($baseUrl.'js/airtime/common/audioplaytest.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
-
+
//scripts for the jPlayer preview bar.
$view->headScript()->appendFile($baseUrl.'js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/airtime/audiopreview/jPlayerWindow.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php
index 6e1d3dad1..8e9266ed3 100644
--- a/airtime_mvc/application/models/ShowBuilder.php
+++ b/airtime_mvc/application/models/ShowBuilder.php
@@ -290,7 +290,6 @@ class Application_Model_ShowBuilder
$rows = array();
$row = $this->defaultRowArray;
- $position = 0;
$instance = $showInstance->getDbId();
$showStartDT = $showInstance->getDbStarts(null);
$showEndDT = $showInstance->getDbEnds(null);
@@ -326,6 +325,7 @@ class Application_Model_ShowBuilder
$row["ends"] = $schedEndDT->format("H:i:s");
$mediaItem = $scheduledItem->getMediaItem();
+ $row["mediaId"] = $mediaItem->getId();
$row["title"] = htmlspecialchars($mediaItem->getName());
$row["creator"] = htmlspecialchars($mediaItem->getCreator());
$row["album"] = htmlspecialchars($mediaItem->getSource());
@@ -341,8 +341,6 @@ class Application_Model_ShowBuilder
$row["fadein"] = $scheduledItem->getDbFadeIn();
$row["fadeout"] = $scheduledItem->getDbFadeOut();
- $row["pos"] = $position++;
-
self::itemRowCheck($showInstance, $row);
$this->contentDT = $schedEndDT;
diff --git a/airtime_mvc/application/models/presentation/JPlayerItemAudioFile.php b/airtime_mvc/application/models/presentation/JPlayerItemAudioFile.php
index b69fbd8b8..5273f4074 100644
--- a/airtime_mvc/application/models/presentation/JPlayerItemAudioFile.php
+++ b/airtime_mvc/application/models/presentation/JPlayerItemAudioFile.php
@@ -13,8 +13,8 @@ class Presentation_JPlayerItemAudioFile extends Presentation_JPlayerItem
$item = array(
"title" => $this->media->getName(),
"artist" => $this->media->getCreator(),
- $mime => $this->media->getURI()
- //"mp3" => "http://sourcefabric.airtime.pro/airtime_web_241/public/api/get-media/file/6864.mp3"
+ $mime => $this->media->getURI(),
+ "mime" => $this->media->getMime()
);
return array($item);
diff --git a/airtime_mvc/application/models/presentation/JPlayerItemWebstream.php b/airtime_mvc/application/models/presentation/JPlayerItemWebstream.php
index 138dd8728..27e74023e 100644
--- a/airtime_mvc/application/models/presentation/JPlayerItemWebstream.php
+++ b/airtime_mvc/application/models/presentation/JPlayerItemWebstream.php
@@ -13,10 +13,8 @@ class Presentation_JPlayerItemWebstream extends Presentation_JPlayerItem
$item = array(
"title" => $this->media->getName(),
"artist" => $this->media->getCreator(),
- $mime => $this->media->getURI()
- //"artist" => "Sourcefabric",
- //$mime => "http://sourcefabric.out.airtime.pro:8000/sourcefabric_b"
- //$mime => "http://206.190.135.28:8048/"
+ $mime => $this->media->getURI(),
+ "mime" => $this->media->getMime()
);
return array($item);
diff --git a/airtime_mvc/public/css/jplayer.airtime.audio.preview.css b/airtime_mvc/public/css/jplayer.airtime.audio.preview.css
index 971d27023..7bd9c7fc4 100644
--- a/airtime_mvc/public/css/jplayer.airtime.audio.preview.css
+++ b/airtime_mvc/public/css/jplayer.airtime.audio.preview.css
@@ -423,7 +423,6 @@ div.jp-playlist {
width:100%;
height: 75px;
background-color: rgba(39, 39, 39, 0.9);
- text-align: center;
overflow: hidden;
height: 0px;
position: relative;
diff --git a/airtime_mvc/public/js/airtime/audiopreview/jPlayerWindow.js b/airtime_mvc/public/js/airtime/audiopreview/jPlayerWindow.js
index c14167f51..33b1e982e 100644
--- a/airtime_mvc/public/js/airtime/audiopreview/jPlayerWindow.js
+++ b/airtime_mvc/public/js/airtime/audiopreview/jPlayerWindow.js
@@ -6,16 +6,26 @@ var AIRTIME = (function(AIRTIME) {
var mod = AIRTIME.playerPreview,
playlistJPlayer;
- function changePlaylist(data) {
+ function addToPlaylist(data) {
+ var playNow = false;
- playlistJPlayer.setPlaylist(data.playlist);
- playlistJPlayer.play(0);
+ if (playlistJPlayer.playlist.length === 0) {
+ playNow = true;
+ }
+
+ data.playlist.forEach(function(mediaObject, index, mediaArray) {
+
+ if (mod.isAudioSupported(mediaObject.mime)) {
+ playlistJPlayer.add(mediaObject, playNow);
+ playNow = false;
+ }
+ });
}
function fetchMedia(mediaId) {
var url = baseUrl+"audiopreview/media-preview";
- $.get(url, {format: "json", id: mediaId}, changePlaylist);
+ $.get(url, {format: "json", id: mediaId}, addToPlaylist);
}
mod.previewMedia = function(mediaId) {
@@ -23,6 +33,28 @@ var AIRTIME = (function(AIRTIME) {
fetchMedia(mediaId);
};
+ mod.isAudioSupported = function(mime){
+ var audio = new Audio();
+
+ var bMime = null;
+ if (mime.indexOf("ogg") != -1 || mime.indexOf("vorbis") != -1) {
+ bMime = 'audio/ogg; codecs="vorbis"';
+ } else {
+ bMime = mime;
+ }
+
+ var x = audio.canPlayType(bMime);
+
+ //return a true of the browser can play this file natively, or if the
+ //file is an mp3 and flash is installed (jPlayer will fall back to flash to play mp3s).
+ //Note that checking the navigator.mimeTypes value does not work for IE7, but the alternative
+ //is adding a javascript library to do the work for you, which seems like overkill....
+ return (!!audio.canPlayType && audio.canPlayType(bMime) != "") ||
+ (mime.indexOf("mp3") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) ||
+ (mime.indexOf("mp4") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) ||
+ (mime.indexOf("mpeg") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined);
+ };
+
mod.initPlayer = function() {
$.jPlayer.timeFormat.showHour = true;
@@ -72,7 +104,6 @@ var AIRTIME = (function(AIRTIME) {
}
});
-
$( "#open_playlist" ).click(function() {
$(".jp-playlist").toggleClass( "open" );
$( this ).toggleClass( "selected" );
diff --git a/airtime_mvc/public/js/airtime/common/audioplaytest.js b/airtime_mvc/public/js/airtime/common/audioplaytest.js
deleted file mode 100644
index 078d8f1e4..000000000
--- a/airtime_mvc/public/js/airtime/common/audioplaytest.js
+++ /dev/null
@@ -1,20 +0,0 @@
-
-function isAudioSupported(mime){
- var audio = new Audio();
-
- var bMime = null;
- if (mime.indexOf("ogg") != -1 || mime.indexOf("vorbis") != -1) {
- bMime = 'audio/ogg; codecs="vorbis"';
- } else {
- bMime = mime;
- }
-
- //return a true of the browser can play this file natively, or if the
- //file is an mp3 and flash is installed (jPlayer will fall back to flash to play mp3s).
- //Note that checking the navigator.mimeTypes value does not work for IE7, but the alternative
- //is adding a javascript library to do the work for you, which seems like overkill....
- return (!!audio.canPlayType && audio.canPlayType(bMime) != "") ||
- (mime.indexOf("mp3") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) ||
- (mime.indexOf("mp4") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) ||
- (mime.indexOf("mpeg") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined);
-}
diff --git a/airtime_mvc/public/js/airtime/playlist/playlist.js b/airtime_mvc/public/js/airtime/playlist/playlist.js
index db8a04a1e..3041ce9e7 100644
--- a/airtime_mvc/public/js/airtime/playlist/playlist.js
+++ b/airtime_mvc/public/js/airtime/playlist/playlist.js
@@ -748,6 +748,13 @@ var AIRTIME = (function(AIRTIME){
});
});
+ $playlist.on("click", ".big_play", function(e) {
+ var $li = $(this).parents("li");
+ mediaId = $li.data("mediaId");
+
+ AIRTIME.playerPreview.previewMedia(mediaId);
+ });
+
$playlist.on("click", ".ui-icon-closethick", function(e) {
var $li = $(this).parents("li");
$li.remove();
diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js
index 8d4dfe91f..01f8f4a42 100644
--- a/airtime_mvc/public/js/airtime/showbuilder/builder.js
+++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js
@@ -69,7 +69,7 @@ var AIRTIME = (function(AIRTIME){
.find(".fc-event-inner")
.append('');
}
- }
+ };
mod.getTimestamp = function() {
@@ -605,10 +605,11 @@ var AIRTIME = (function(AIRTIME){
$nRow.addClass("lib-audio");
if (!isAudioSupported(aData.mime)) {
$image.html('');
- } else {
+ }
+ else {
$image.html('
')
.click(function() {
- open_show_preview(aData.instance, aData.pos);
+ AIRTIME.playerPreview.previewMedia(aData.mediaId);
return false;
});
}