diff --git a/components/music/NowPlaying.brs b/components/music/NowPlaying.brs index 3205f89e..2db8c77d 100644 --- a/components/music/NowPlaying.brs +++ b/components/music/NowPlaying.brs @@ -10,6 +10,9 @@ sub init() m.buttons.selectedIndex = 1 m.buttons.focusedIndex = 1 m.buttons.setFocus(true) + + m.top.audio = createObject("RoSGNode", "Audio") + m.top.audio.observeField("contentIndex", "audioIndexChanged") end sub sub audioIndexChanged() @@ -43,14 +46,15 @@ end sub ' Set values for displayed values on screen sub itemContentChanged() + if m.top.audio.contentIndex = -1 then return + item = m.top.itemContent[m.top.audio.contentIndex] m.top.findNode("musicartistPoster").uri = item.posterURL m.top.overhangTitle = item.json.AlbumArtist + " / " + item.json.name - m.top.audio.observeField("contentIndex", "audioIndexChanged") setFieldText("numberofsongs", "Track " + stri(m.top.audio.contentIndex + 1) + "/" + stri(m.top.itemContent.count())) - setFieldText("artist", item.json.AlbumArtist) + setFieldText("artist", item.json.Artists[0]) setFieldText("album", item.json.album) setFieldText("song", item.json.name) end sub diff --git a/source/ShowScenes.brs b/source/ShowScenes.brs index 051dc230..81055137 100644 --- a/source/ShowScenes.brs +++ b/source/ShowScenes.brs @@ -418,12 +418,12 @@ function CreateAudioPlayerGroup(audiodata) group = CreateObject("roSGNode", "NowPlaying") songMetaDataArray = CreateObject("roArray", 0, true) + content = createObject("RoSGNode", "ContentNode") if type(audiodata) = "roArray" ' Passed data is an array of audio, setup playback as a playlist - m.audio = createObject("RoSGNode", "Audio") - m.audio.contentIsPlaylist = true + group.audio.contentIsPlaylist = true audioPlaylistContent = createObject("RoSGNode", "ContentNode") @@ -447,7 +447,7 @@ function CreateAudioPlayerGroup(audiodata) songContent.streamformat = songData.mediaSources[0].container end for - m.audio.content = audioPlaylistContent + content = audioPlaylistContent else if type(audiodata) = "roSGNode" ' Passed data is a single node @@ -455,9 +455,6 @@ function CreateAudioPlayerGroup(audiodata) if audiodata.subtype() = "MusicSongData" ' Passed data is data for a single song, setup playback as a single song - m.audio = createObject("RoSGNode", "Audio") - m.audio.content = createObject("RoSGNode", "ContentNode") - songData = AudioItem(audiodata.id) songMetaDataArray.push(ItemMetaData(audiodata.id)) @@ -471,19 +468,21 @@ function CreateAudioPlayerGroup(audiodata) params.MediaSourceId = songData.mediaSources[0].id - m.audio.content.url = buildURL(Substitute("Audio/{0}/stream", audiodata.id), params) - m.audio.content.title = audiodata.title - m.audio.content.streamformat = songData.mediaSources[0].container + content.url = buildURL(Substitute("Audio/{0}/stream", audiodata.id), params) + content.title = audiodata.title + content.streamformat = songData.mediaSources[0].container end if end if + group.itemContent = songMetaDataArray + group.musicArtistAlbumData = audiodata - group.audio = m.audio + group.audio.content = content group.audio.control = "stop" group.audio.control = "none" group.audio.control = "play" - group.itemContent = songMetaDataArray + m.global.sceneManager.callFunc("pushScene", group)