diff --git a/dashboard-ui/css/mediaplayer-video.css b/dashboard-ui/css/mediaplayer-video.css index 3dec7de764..b523c4199b 100644 --- a/dashboard-ui/css/mediaplayer-video.css +++ b/dashboard-ui/css/mediaplayer-video.css @@ -162,6 +162,10 @@ .videoControls .nowPlayingText { max-width: 160px; } + + #mediaPlayer .nowPlayingImage { + display: none; + } } @media all and (max-width: 960px), all and (max-height: 550px) { @@ -184,8 +188,8 @@ } } -@media all and (max-width: 500px) { - #mediaPlayer .previousTrackButton, #mediaPlayer .nextTrackButton { +@media all and (max-width: 555px) { + #mediaPlayer .videoControls .previousTrackButton, #mediaPlayer .videoControls .nextTrackButton { display: none!important; } .videoTopControlsLogo { @@ -199,7 +203,7 @@ } } -@media all and (min-width: 1200px) { +@media all and (min-width: 1300px) { #videoPlayer .nowPlayingInfo img { height: auto !important; max-width: 150px; diff --git a/dashboard-ui/scripts/mediaplayer-video.js b/dashboard-ui/scripts/mediaplayer-video.js index 574fd0a5d6..f99496189d 100644 --- a/dashboard-ui/scripts/mediaplayer-video.js +++ b/dashboard-ui/scripts/mediaplayer-video.js @@ -1166,8 +1166,7 @@ //show stop button $('#video-playButton', videoControls).hide(); $('#video-pauseButton', videoControls).show(); - $('#video-previousTrackButton', videoControls).hide(); - $('#video-nextTrackButton', videoControls).hide(); + $('.videoTrackControl').hide(); var videoElement = $('#videoElement', mediaPlayerContainer).prepend(html); @@ -1329,6 +1328,32 @@ return video[0]; }; + + self.updatePlaylistUi = function () { + var index = self.currentPlaylistIndex(null), + length = self.playlist.length, + requiresNativeControls = !self.canAutoPlayVideo(), + controls = $(requiresNativeControls ? '.videoAdvancedControls' : '.videoControls'); + + if (length < 2) { + $('.videoTrackControl').hide(); + return; + } + + if (index === 0) { + $('.previousTrackButton', controls).attr('disabled', 'disabled'); + } else { + $('.previousTrackButton', controls).removeAttr('disabled'); + } + + if ((index + 1) >= length) { + $('.nextTrackButton', controls).attr('disabled', 'disabled'); + } else { + $('.nextTrackButton', controls).removeAttr('disabled'); + } + + $('.videoTrackControl', controls).show(); + }; } createVideoPlayer(MediaPlayer); diff --git a/dashboard-ui/scripts/mediaplayer.js b/dashboard-ui/scripts/mediaplayer.js index e796af7cd4..e69455df22 100644 --- a/dashboard-ui/scripts/mediaplayer.js +++ b/dashboard-ui/scripts/mediaplayer.js @@ -507,8 +507,7 @@ if (options.startPositionTicks || firstItem.MediaType !== 'Video' || !self.canAutoPlayVideo()) { self.playInternal(firstItem, options.startPositionTicks, function () { - self.playlist = items; - currentPlaylistIndex = 0; + self.setPlaylistState(0, items); }); return; @@ -518,8 +517,7 @@ items = intros.Items.concat(items); self.playInternal(items[0], options.startPositionTicks, function () { - self.playlist = items; - currentPlaylistIndex = 0; + self.setPlaylistState(0, items); }); }); @@ -721,10 +719,23 @@ var newItem = self.playlist[i]; self.playInternal(newItem, 0, function () { - currentPlaylistIndex = i; + self.setPlaylistState(i); }); }; + // Set currentPlaylistIndex and playlist. Using a method allows for overloading in derived player implementations + self.setPlaylistState = function (i, items) { + if (!isNaN(i)) { + currentPlaylistIndex = i; + } + if (items) { + self.playlist = items; + } + if (self.updatePlaylistUi) { + self.updatePlaylistUi(); + } + }; + self.nextTrack = function () { var newIndex = currentPlaylistIndex + 1; @@ -735,7 +746,7 @@ console.log('playing next track'); self.playInternal(newItem, 0, function () { - currentPlaylistIndex = newIndex; + self.setPlaylistState(newIndex); }); } }; @@ -747,7 +758,7 @@ if (newItem) { self.playInternal(newItem, 0, function () { - currentPlaylistIndex = newIndex; + self.setPlaylistState(newIndex); }); } } diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 7dbbd9b792..be0df11232 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1399,10 +1399,13 @@ $(function () { videoPlayerHtml += ''; videoPlayerHtml += '
'; - videoPlayerHtml += ''; + videoPlayerHtml += ''; + videoPlayerHtml += ''; + + videoPlayerHtml += ''; videoPlayerHtml += '
'; - videoPlayerHtml += ''; + videoPlayerHtml += ''; videoPlayerHtml += '
'; videoPlayerHtml += ''; @@ -1419,10 +1422,10 @@ $(function () { // Create controls videoPlayerHtml += '
'; - videoPlayerHtml += ''; + videoPlayerHtml += ''; videoPlayerHtml += ''; videoPlayerHtml += ''; - videoPlayerHtml += ''; + videoPlayerHtml += ''; videoPlayerHtml += '
'; videoPlayerHtml += '';