diff --git a/src/components/remotecontrol/remotecontrol.js b/src/components/remotecontrol/remotecontrol.js index 7b620d536a..1149440264 100644 --- a/src/components/remotecontrol/remotecontrol.js +++ b/src/components/remotecontrol/remotecontrol.js @@ -110,31 +110,54 @@ define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageL return null; } - function updateNowPlayingInfo(context, state) { + function updateNowPlayingInfo(context, state, serverId) { var item = state.NowPlayingItem; var displayName = item ? getNowPlayingNameHtml(item).replace("
", " - ") : ""; - context.querySelector(".nowPlayingPageTitle").innerHTML = displayName; + console.debug(JSON.stringify(item, null, 4)); + //alert(item.Artists); + if(item.Type == "Audio" || item.MediaStreams[0].Type == "Audio"){ + var songName = item.Name; + if(item.Album != null && (item.Artists != null)) { + var albumName = item.Album; + if(item.ArtistItems != null) { + var artistName = item.ArtistItems[0].Name; + context.querySelector(".nowPlayingAlbum").innerHTML = '' + albumName + ''; + context.querySelector(".nowPlayingArtist").innerHTML = '' + artistName + ''; + context.querySelector(".contextMenuAlbum").innerHTML = 'album View album'; + context.querySelector(".contextMenuArtist").innerHTML = 'person View artist'; + } else { + context.querySelector(".nowPlayingAlbum").innerHTML = albumName; + var artistName = item.Artists; + context.querySelector(".nowPlayingArtist").innerHTML = artistName; + } + + } + context.querySelector(".nowPlayingSongName").innerHTML = songName; + } else { + context.querySelector(".nowPlayingPageTitle").innerHTML = displayName; + } - if (displayName.length > 0) { + if (displayName.length > 0 && item.Type != "Audio") { context.querySelector(".nowPlayingPageTitle").classList.remove("hide"); } else { context.querySelector(".nowPlayingPageTitle").classList.add("hide"); } var url = item ? seriesImageUrl(item, { - maxHeight: 300 * 2 + maxHeight: 300 }) || imageUrl(item, { - maxHeight: 300 * 2 + maxHeight: 300 }) : null; console.debug("updateNowPlayingInfo"); - setImageUrl(context, url); + setImageUrl(context, state, url); if (item) { backdrop.setBackdrops([item]); var apiClient = connectionManager.getApiClient(item.ServerId); apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (fullItem) { var userData = fullItem.UserData || {}; var likes = null == userData.Likes ? "" : userData.Likes; + context.querySelector(".nowPlayingPageUserDataButtonsTitle").innerHTML = ''; context.querySelector(".nowPlayingPageUserDataButtons").innerHTML = ''; }); } else { @@ -143,17 +166,24 @@ define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageL } } - function setImageUrl(context, url) { + function setImageUrl(context, state, url) { currentImgUrl = url; + var item = state.NowPlayingItem; var imgContainer = context.querySelector(".nowPlayingPageImageContainer"); if (url) { imgContainer.innerHTML = ''; - imgContainer.classList.remove("hide"); + if(item.Type == "Audio"){ + context.querySelector(".nowPlayingPageImage").classList.add("nowPlayingPageImageAudio"); + context.querySelector(".nowPlayingPageImageContainer").classList.remove("nowPlayingPageImageAudio"); + } else { + context.querySelector(".nowPlayingPageImageContainer").classList.add("nowPlayingPageImagePoster"); + context.querySelector(".nowPlayingPageImage").classList.remove("nowPlayingPageImageAudio"); + } } else { - imgContainer.classList.add("hide"); - imgContainer.innerHTML = ""; + imgContainer.innerHTML = '
'; } + } function buttonVisible(btn, enabled) { @@ -331,7 +361,7 @@ define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageL function updatePlayPauseState(isPaused, isActive) { var context = dlg; var btnPlayPause = context.querySelector(".btnPlayPause"); - btnPlayPause.querySelector("i").innerHTML = isPaused ? "" : "pause"; + btnPlayPause.querySelector("i").innerHTML = isPaused ? "play_circle_filled" : "pause_circle_filled"; buttonVisible(btnPlayPause, isActive); } @@ -393,6 +423,9 @@ define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageL } imageLoader.lazyChildren(itemsContainer); + context.querySelector(".playlist").classList.add("hide"); + context.querySelector(".contextMenu").classList.add("hide"); + context.querySelector(".btnSavePlaylist").classList.add("hide"); }); } @@ -647,7 +680,26 @@ define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageL var playlistItemId = e.detail.playlistItemId; playbackManager.movePlaylistItem(playlistItemId, newIndex, currentPlayer); }); - context.querySelector(".btnSavePlaylist").addEventListener("click", savePlaylist); + //context.querySelector(".btnSavePlaylist").addEventListener("click", savePlaylist); + context.querySelector(".btnTooglePlaylist").addEventListener("click", function () { + if(context.querySelector(".playlist").classList.contains("hide")) { + context.querySelector(".playlist").classList.remove("hide"); + context.querySelector(".btnSavePlaylist").classList.remove("hide"); + context.querySelector(".contextMenu").classList.add("hide"); + } else { + context.querySelector(".playlist").classList.add("hide"); + context.querySelector(".btnSavePlaylist").classList.add("hide"); + } + }); + context.querySelector(".btnToogleContextMenu").addEventListener("click", function () { + if(context.querySelector(".contextMenu").classList.contains("hide")) { + context.querySelector(".contextMenu").classList.remove("hide"); + context.querySelector(".btnSavePlaylist").classList.add("hide"); + context.querySelector(".playlist").classList.add("hide"); + } else { + context.querySelector(".contextMenu").classList.add("hide"); + } + }); } function onPlayerChange() {