diff --git a/dashboard-ui/css/librarybrowser.css b/dashboard-ui/css/librarybrowser.css index 80f23b85c4..9d63c6d58e 100644 --- a/dashboard-ui/css/librarybrowser.css +++ b/dashboard-ui/css/librarybrowser.css @@ -7,7 +7,7 @@ padding-top: 48px !important; } - .libraryPage:not(.metadataEditorPage):not(#indexPage):not(#boxsetsPage):not(#itemListPage) { + .libraryPage:not(.metadataEditorPage):not(#indexPage):not(#boxsetsPage):not(#itemListPage):not(.nowPlayingPage) { padding-top: 91px !important; } @@ -174,7 +174,7 @@ } .ehsContent { - max-width: 620px; + max-width: 640px; margin: 0 auto; padding: 0; border-spacing: 0; diff --git a/dashboard-ui/nowplaying.html b/dashboard-ui/nowplaying.html index be4eacb6b0..3e40413009 100644 --- a/dashboard-ui/nowplaying.html +++ b/dashboard-ui/nowplaying.html @@ -4,9 +4,52 @@ ${TitleMediaBrowser} -
+
+ +
+ + + + +
+
+ +
+ +
+ +
+ +
+
+ + + +
+
+ +
+
+ + +
+
+
+ + + + +
+
+ + + + +
+ +
diff --git a/dashboard-ui/scripts/nowplayingpage.js b/dashboard-ui/scripts/nowplayingpage.js new file mode 100644 index 0000000000..eae107feda --- /dev/null +++ b/dashboard-ui/scripts/nowplayingpage.js @@ -0,0 +1,118 @@ +(function (window, document, $, setTimeout, clearTimeout) { + + var currentPlayer; + + function bindEvents(page) { + + $('.radioTabButton', page).on('change', function () { + + var elem = $('.' + this.value, page); + elem.siblings('.tabContent').hide(); + + elem.show(); + }); + + $('.btnCommand', page).on('click', function () { + + + }); + } + + function onPlaybackStart(e, state) { + + var player = this; + + player.beginPlayerUpdates(); + + onStateChanged.call(player, e, state); + } + + function onPlaybackStopped(e, state) { + + var player = this; + + player.endPlayerUpdates(); + } + + function onStateChanged(e, state) { + + } + + function updateSupportedCommands(page, commands) { + + $('.btnCommand', page).each(function () { + + $(this).buttonEnabled(commands.indexOf(this.getAttribute('data-command')) != -1); + + }); + } + + function releaseCurrentPlayer() { + + if (currentPlayer) { + + $(currentPlayer).off('.nowplayingpage'); + currentPlayer.endPlayerUpdates(); + currentPlayer = null; + } + } + + function bindToPlayer(page, player) { + + releaseCurrentPlayer(); + + currentPlayer = player; + + player.getPlayerState().done(function (state) { + + if (state.itemName) { + player.beginPlayerUpdates(); + } + + onStateChanged.call(player, { type: 'init' }, state); + }); + + $(player).on('playbackstart.nowplayingpage', onPlaybackStart) + .on('playbackstop.nowplayingpage', onPlaybackStopped) + .on('volumechange.nowplayingpage', onStateChanged) + .on('playstatechange.nowplayingpage', onStateChanged) + .on('positionchange.nowplayingpage', onStateChanged); + + var playerInfo = MediaController.getPlayerInfo(); + + var supportedCommands = playerInfo.supportedCommands; + + updateSupportedCommands(page, supportedCommands); + } + + $(document).on('pageinit', "#nowPlayingPage", function () { + + var page = this; + + bindEvents(page); + + }).on('pageshow', "#nowPlayingPage", function () { + + var page = this; + + $('.radioTabButton:first', page).checked(true).checkboxradio('refresh').trigger('change'); + + $(function () { + + $(MediaController).on('playerchange.nowplayingpage', function () { + + bindToPlayer(page, MediaController.getCurrentPlayer()); + }); + + bindToPlayer(page, MediaController.getCurrentPlayer()); + + }); + + }).on('pagehide', "#nowPlayingPage", function () { + + releaseCurrentPlayer(); + + $(MediaController).off('playerchange.nowplayingpage'); + }); + +})(window, document, jQuery, setTimeout, clearTimeout); \ No newline at end of file