diff --git a/dashboard-ui/css/detailtable.css b/dashboard-ui/css/detailtable.css index c77807fbb8..761af8df13 100644 --- a/dashboard-ui/css/detailtable.css +++ b/dashboard-ui/css/detailtable.css @@ -1,6 +1,6 @@ .detailTableContainer { width: 100%; - max-width: 1200px; + max-width: 1100px; text-align: center; margin: 0 auto; } diff --git a/dashboard-ui/scripts/Itemdetailpage.js b/dashboard-ui/scripts/Itemdetailpage.js index 158ce2683e..f726fcc5f6 100644 --- a/dashboard-ui/scripts/Itemdetailpage.js +++ b/dashboard-ui/scripts/Itemdetailpage.js @@ -472,7 +472,7 @@ var item = items[i]; - html += ''; + html += ''; var imageTags = item.ImageTags || {}; @@ -618,12 +618,6 @@ var self = this; self.play = play; - - self.playById = function (id) { - ApiClient.getItem(Dashboard.getCurrentUserId(), id).done(function (item) { - MediaPlayer.play([item]); - }); - }; } window.ItemDetailPage = new itemDetailPage(); diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 4969c94df7..854dce76b4 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -1,4 +1,4 @@ -var LibraryBrowser = (function (window, $) { +var LibraryBrowser = (function (window, document, $) { var defaultBackground = "#999;"; @@ -213,6 +213,7 @@ html += ''; + html += ''; html += ''; html += 'Track'; @@ -236,6 +237,8 @@ html += ''; + html += ''; + var num = item.IndexNumber; if (num && item.ParentIndexNumber) { @@ -281,6 +284,50 @@ return html; }, + showPlayMenu: function (positionTo, itemId, mediaType, resumePositionTicks) { + + var isPlaying = MediaPlayer.isPlaying(); + + if (!isPlaying && !resumePositionTicks) { + MediaPlayer.playById(itemId); + return; + } + + $('.playFlyout').popup("close").remove(); + + var html = '
'; + + html += ''; + + html += '
'; + + $($.mobile.activePage).append(html); + + $('.playFlyout').popup({ positionTo: positionTo || "window" }).trigger('create').popup("open").on("popupafterclose", function () { + + $(this).off("popupafterclose").remove(); + + }).parents(".ui-popup-container").css("margin-left", 100); + }, + + closePlayMenu: function () { + $('.playFlyout').popup("close").remove(); + }, + getHref: function (item, itemByNameContext) { if (item.url) { @@ -1472,4 +1519,4 @@ }; -})(window, jQuery); \ No newline at end of file +})(window, document, jQuery); \ No newline at end of file diff --git a/dashboard-ui/scripts/mediaplayer.js b/dashboard-ui/scripts/mediaplayer.js index 22092070ef..c856e02bff 100644 --- a/dashboard-ui/scripts/mediaplayer.js +++ b/dashboard-ui/scripts/mediaplayer.js @@ -1,4 +1,4 @@ -(function (document, clearTimeout, screen, localStorage, _V_, $, setInterval) { +(function (document, clearTimeout, screen, localStorage, _V_, $, setInterval, window) { function mediaPlayer() { var self = this; @@ -8,8 +8,7 @@ var currentMediaElement; var currentProgressInterval; - function playAudio(items, params) { - var item = items[0]; + function playAudio(item, params) { var volume = localStorage.getItem("volume") || 0.5; @@ -57,7 +56,7 @@ }); $(".itemAudio").on("ended", function () { - MediaPlayer.stopAudio(item.Id); + MediaPlayer.stopAudio(item.Id); Playlist.playNext(); }); @@ -66,30 +65,29 @@ localStorage.setItem("volume", this.volume); }); - $(".itemAudio").on("play", updateAudioProgress(item.Id)); + $(".itemAudio").on("play", updateAudioProgress(item.Id)); return $('audio', nowPlayingBar)[0]; } - function updateAudioProgress(itemId) { - ApiClient.reportPlaybackStart(Dashboard.getCurrentUserId(), itemId); + function updateAudioProgress(itemId) { + ApiClient.reportPlaybackStart(Dashboard.getCurrentUserId(), itemId); - currentProgressInterval = setInterval(function () { - var position; - $(".itemAudio").each(function () { - position = Math.floor(10000000 * this.currentTime); - }); + currentProgressInterval = setInterval(function () { + var position; + $(".itemAudio").each(function () { + position = Math.floor(10000000 * this.currentTime); + }); - ApiClient.reportPlaybackProgress(Dashboard.getCurrentUserId(), itemId, position); - }, 30000); - } + ApiClient.reportPlaybackProgress(Dashboard.getCurrentUserId(), itemId, position); + }, 30000); + } + + function playVideo(item, startPosition) { - function playVideo(items, startPosition) { //stop/kill videoJS if (currentMediaElement) self.stop(); - var item = items[0]; - // Account for screen rotation. Use the larger dimension as the width. var screenWidth = Math.max(screen.height, screen.width); var screenHeight = Math.min(screen.height, screen.width); @@ -223,11 +221,11 @@ } function updateProgress() { - var player = _V_("videoWindow"); - var itemString = player.tag.src.match(new RegExp("Videos/[0-9a-z\-]+", "g")); - var itemId = itemString[0].replace("Videos/", ""); + var player = _V_("videoWindow"); + var itemString = player.tag.src.match(new RegExp("Videos/[0-9a-z\-]+", "g")); + var itemId = itemString[0].replace("Videos/", ""); - ApiClient.reportPlaybackStart(Dashboard.getCurrentUserId(), itemId); + ApiClient.reportPlaybackStart(Dashboard.getCurrentUserId(), itemId); currentProgressInterval = setInterval(function () { var player = _V_("videoWindow"); @@ -282,10 +280,10 @@ if (item.MediaType === "Video") { - mediaElement = playVideo(items, startPosition); + mediaElement = playVideo(item, startPosition); } else if (item.MediaType === "Audio") { - mediaElement = playAudio(items); + mediaElement = playAudio(item); } if (!mediaElement) { @@ -357,6 +355,28 @@ $('#mediaInfo', nowPlayingBar).html(html); }; + self.playById = function (id, startPositionTicks) { + + ApiClient.getItem(Dashboard.getCurrentUserId(), id).done(function (item) { + + self.play([item], startPositionTicks); + + }); + + }; + + self.canQueue = function (mediaType) { + return mediaType == "Audio"; + }; + + self.playLast = function(itemId) { + + }; + + self.playNext = function (itemId) { + + }; + self.stop = function () { var elem = currentMediaElement; @@ -382,7 +402,7 @@ //player.tech.destroy(); player.destroy(); } else { - self.stopAudio(); + self.stopAudio(); elem.pause(); elem.src = ""; @@ -411,23 +431,23 @@ if (currentProgressInterval) { clearTimeout(currentProgressInterval); } - } + }; - self.stopAudio = function () { - var itemString = $(".itemAudio source").attr('src').match(new RegExp("Audio/[0-9a-z\-]+", "g")); - var itemId = itemString[0].replace("Audio/", ""); + self.stopAudio = function () { + var itemString = $(".itemAudio source").attr('src').match(new RegExp("Audio/[0-9a-z\-]+", "g")); + var itemId = itemString[0].replace("Audio/", ""); - var position; - $(".itemAudio").each(function () { - position = Math.floor(10000000 * this.currentTime); - }); + var position; + $(".itemAudio").each(function () { + position = Math.floor(10000000 * this.currentTime); + }); - ApiClient.reportPlaybackStopped(Dashboard.getCurrentUserId(), itemId, position); + ApiClient.reportPlaybackStopped(Dashboard.getCurrentUserId(), itemId, position); - if (currentProgressInterval) { - clearTimeout(currentProgressInterval); - } - } + if (currentProgressInterval) { + clearTimeout(currentProgressInterval); + } + }; self.isPlaying = function () { return currentMediaElement; @@ -436,4 +456,4 @@ window.MediaPlayer = new mediaPlayer(); -})(document, clearTimeout, screen, localStorage, _V_, $, setInterval); \ No newline at end of file +})(document, clearTimeout, screen, localStorage, _V_, $, setInterval, window); \ No newline at end of file diff --git a/dashboard-ui/scripts/songs.js b/dashboard-ui/scripts/songs.js index e2d22e3694..5b0a4d836e 100644 --- a/dashboard-ui/scripts/songs.js +++ b/dashboard-ui/scripts/songs.js @@ -8,7 +8,7 @@ IncludeItemTypes: "Audio", Recursive: true, Fields: "ItemCounts,DateCreated,UserData,AudioInfo,ParentId", - Limit: 300, + Limit: 200, StartIndex: 0 };