CC-5768 : jPlayer, make now playing and playlist preview buttons function.
now playing and preview buttons function. need to filter playlist with lock icons for unplayable media.
This commit is contained in:
parent
044081ef13
commit
771be4fed9
|
@ -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/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/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.
|
//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/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');
|
$view->headScript()->appendFile($baseUrl.'js/airtime/audiopreview/jPlayerWindow.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
|
|
@ -290,7 +290,6 @@ class Application_Model_ShowBuilder
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$row = $this->defaultRowArray;
|
$row = $this->defaultRowArray;
|
||||||
|
|
||||||
$position = 0;
|
|
||||||
$instance = $showInstance->getDbId();
|
$instance = $showInstance->getDbId();
|
||||||
$showStartDT = $showInstance->getDbStarts(null);
|
$showStartDT = $showInstance->getDbStarts(null);
|
||||||
$showEndDT = $showInstance->getDbEnds(null);
|
$showEndDT = $showInstance->getDbEnds(null);
|
||||||
|
@ -326,6 +325,7 @@ class Application_Model_ShowBuilder
|
||||||
$row["ends"] = $schedEndDT->format("H:i:s");
|
$row["ends"] = $schedEndDT->format("H:i:s");
|
||||||
|
|
||||||
$mediaItem = $scheduledItem->getMediaItem();
|
$mediaItem = $scheduledItem->getMediaItem();
|
||||||
|
$row["mediaId"] = $mediaItem->getId();
|
||||||
$row["title"] = htmlspecialchars($mediaItem->getName());
|
$row["title"] = htmlspecialchars($mediaItem->getName());
|
||||||
$row["creator"] = htmlspecialchars($mediaItem->getCreator());
|
$row["creator"] = htmlspecialchars($mediaItem->getCreator());
|
||||||
$row["album"] = htmlspecialchars($mediaItem->getSource());
|
$row["album"] = htmlspecialchars($mediaItem->getSource());
|
||||||
|
@ -341,8 +341,6 @@ class Application_Model_ShowBuilder
|
||||||
$row["fadein"] = $scheduledItem->getDbFadeIn();
|
$row["fadein"] = $scheduledItem->getDbFadeIn();
|
||||||
$row["fadeout"] = $scheduledItem->getDbFadeOut();
|
$row["fadeout"] = $scheduledItem->getDbFadeOut();
|
||||||
|
|
||||||
$row["pos"] = $position++;
|
|
||||||
|
|
||||||
self::itemRowCheck($showInstance, $row);
|
self::itemRowCheck($showInstance, $row);
|
||||||
|
|
||||||
$this->contentDT = $schedEndDT;
|
$this->contentDT = $schedEndDT;
|
||||||
|
|
|
@ -13,8 +13,8 @@ class Presentation_JPlayerItemAudioFile extends Presentation_JPlayerItem
|
||||||
$item = array(
|
$item = array(
|
||||||
"title" => $this->media->getName(),
|
"title" => $this->media->getName(),
|
||||||
"artist" => $this->media->getCreator(),
|
"artist" => $this->media->getCreator(),
|
||||||
$mime => $this->media->getURI()
|
$mime => $this->media->getURI(),
|
||||||
//"mp3" => "http://sourcefabric.airtime.pro/airtime_web_241/public/api/get-media/file/6864.mp3"
|
"mime" => $this->media->getMime()
|
||||||
);
|
);
|
||||||
|
|
||||||
return array($item);
|
return array($item);
|
||||||
|
|
|
@ -13,10 +13,8 @@ class Presentation_JPlayerItemWebstream extends Presentation_JPlayerItem
|
||||||
$item = array(
|
$item = array(
|
||||||
"title" => $this->media->getName(),
|
"title" => $this->media->getName(),
|
||||||
"artist" => $this->media->getCreator(),
|
"artist" => $this->media->getCreator(),
|
||||||
$mime => $this->media->getURI()
|
$mime => $this->media->getURI(),
|
||||||
//"artist" => "Sourcefabric",
|
"mime" => $this->media->getMime()
|
||||||
//$mime => "http://sourcefabric.out.airtime.pro:8000/sourcefabric_b"
|
|
||||||
//$mime => "http://206.190.135.28:8048/"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return array($item);
|
return array($item);
|
||||||
|
|
|
@ -423,7 +423,6 @@ div.jp-playlist {
|
||||||
width:100%;
|
width:100%;
|
||||||
height: 75px;
|
height: 75px;
|
||||||
background-color: rgba(39, 39, 39, 0.9);
|
background-color: rgba(39, 39, 39, 0.9);
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
height: 0px;
|
height: 0px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
|
@ -6,16 +6,26 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
var mod = AIRTIME.playerPreview,
|
var mod = AIRTIME.playerPreview,
|
||||||
playlistJPlayer;
|
playlistJPlayer;
|
||||||
|
|
||||||
function changePlaylist(data) {
|
function addToPlaylist(data) {
|
||||||
|
var playNow = false;
|
||||||
|
|
||||||
playlistJPlayer.setPlaylist(data.playlist);
|
if (playlistJPlayer.playlist.length === 0) {
|
||||||
playlistJPlayer.play(0);
|
playNow = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.playlist.forEach(function(mediaObject, index, mediaArray) {
|
||||||
|
|
||||||
|
if (mod.isAudioSupported(mediaObject.mime)) {
|
||||||
|
playlistJPlayer.add(mediaObject, playNow);
|
||||||
|
playNow = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchMedia(mediaId) {
|
function fetchMedia(mediaId) {
|
||||||
var url = baseUrl+"audiopreview/media-preview";
|
var url = baseUrl+"audiopreview/media-preview";
|
||||||
|
|
||||||
$.get(url, {format: "json", id: mediaId}, changePlaylist);
|
$.get(url, {format: "json", id: mediaId}, addToPlaylist);
|
||||||
}
|
}
|
||||||
|
|
||||||
mod.previewMedia = function(mediaId) {
|
mod.previewMedia = function(mediaId) {
|
||||||
|
@ -23,6 +33,28 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
fetchMedia(mediaId);
|
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() {
|
mod.initPlayer = function() {
|
||||||
|
|
||||||
$.jPlayer.timeFormat.showHour = true;
|
$.jPlayer.timeFormat.showHour = true;
|
||||||
|
@ -72,7 +104,6 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$( "#open_playlist" ).click(function() {
|
$( "#open_playlist" ).click(function() {
|
||||||
$(".jp-playlist").toggleClass( "open" );
|
$(".jp-playlist").toggleClass( "open" );
|
||||||
$( this ).toggleClass( "selected" );
|
$( this ).toggleClass( "selected" );
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -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) {
|
$playlist.on("click", ".ui-icon-closethick", function(e) {
|
||||||
var $li = $(this).parents("li");
|
var $li = $(this).parents("li");
|
||||||
$li.remove();
|
$li.remove();
|
||||||
|
|
|
@ -69,7 +69,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
.find(".fc-event-inner")
|
.find(".fc-event-inner")
|
||||||
.append('<span id="'+instance_id+'" title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
|
.append('<span id="'+instance_id+'" title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
mod.getTimestamp = function() {
|
mod.getTimestamp = function() {
|
||||||
|
|
||||||
|
@ -605,10 +605,11 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$nRow.addClass("lib-audio");
|
$nRow.addClass("lib-audio");
|
||||||
if (!isAudioSupported(aData.mime)) {
|
if (!isAudioSupported(aData.mime)) {
|
||||||
$image.html('<span class="ui-icon ui-icon-locked"></span>');
|
$image.html('<span class="ui-icon ui-icon-locked"></span>');
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$image.html('<img title="'+$.i18n._("Track preview")+'" src="'+baseUrl+'css/images/icon_audioclip.png"></img>')
|
$image.html('<img title="'+$.i18n._("Track preview")+'" src="'+baseUrl+'css/images/icon_audioclip.png"></img>')
|
||||||
.click(function() {
|
.click(function() {
|
||||||
open_show_preview(aData.instance, aData.pos);
|
AIRTIME.playerPreview.previewMedia(aData.mediaId);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue