Resolve playback bug
This commit is contained in:
parent
963aae78d8
commit
1c0ca462c4
|
@ -10,6 +10,9 @@ sub init()
|
||||||
m.buttons.selectedIndex = 1
|
m.buttons.selectedIndex = 1
|
||||||
m.buttons.focusedIndex = 1
|
m.buttons.focusedIndex = 1
|
||||||
m.buttons.setFocus(true)
|
m.buttons.setFocus(true)
|
||||||
|
|
||||||
|
m.top.audio = createObject("RoSGNode", "Audio")
|
||||||
|
m.top.audio.observeField("contentIndex", "audioIndexChanged")
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
sub audioIndexChanged()
|
sub audioIndexChanged()
|
||||||
|
@ -43,14 +46,15 @@ end sub
|
||||||
|
|
||||||
' Set values for displayed values on screen
|
' Set values for displayed values on screen
|
||||||
sub itemContentChanged()
|
sub itemContentChanged()
|
||||||
|
if m.top.audio.contentIndex = -1 then return
|
||||||
|
|
||||||
item = m.top.itemContent[m.top.audio.contentIndex]
|
item = m.top.itemContent[m.top.audio.contentIndex]
|
||||||
|
|
||||||
m.top.findNode("musicartistPoster").uri = item.posterURL
|
m.top.findNode("musicartistPoster").uri = item.posterURL
|
||||||
m.top.overhangTitle = item.json.AlbumArtist + " / " + item.json.name
|
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("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("album", item.json.album)
|
||||||
setFieldText("song", item.json.name)
|
setFieldText("song", item.json.name)
|
||||||
end sub
|
end sub
|
||||||
|
|
|
@ -418,12 +418,12 @@ function CreateAudioPlayerGroup(audiodata)
|
||||||
|
|
||||||
group = CreateObject("roSGNode", "NowPlaying")
|
group = CreateObject("roSGNode", "NowPlaying")
|
||||||
songMetaDataArray = CreateObject("roArray", 0, true)
|
songMetaDataArray = CreateObject("roArray", 0, true)
|
||||||
|
content = createObject("RoSGNode", "ContentNode")
|
||||||
|
|
||||||
if type(audiodata) = "roArray"
|
if type(audiodata) = "roArray"
|
||||||
' Passed data is an array of audio, setup playback as a playlist
|
' Passed data is an array of audio, setup playback as a playlist
|
||||||
|
|
||||||
m.audio = createObject("RoSGNode", "Audio")
|
group.audio.contentIsPlaylist = true
|
||||||
m.audio.contentIsPlaylist = true
|
|
||||||
|
|
||||||
audioPlaylistContent = createObject("RoSGNode", "ContentNode")
|
audioPlaylistContent = createObject("RoSGNode", "ContentNode")
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ function CreateAudioPlayerGroup(audiodata)
|
||||||
songContent.streamformat = songData.mediaSources[0].container
|
songContent.streamformat = songData.mediaSources[0].container
|
||||||
end for
|
end for
|
||||||
|
|
||||||
m.audio.content = audioPlaylistContent
|
content = audioPlaylistContent
|
||||||
|
|
||||||
else if type(audiodata) = "roSGNode"
|
else if type(audiodata) = "roSGNode"
|
||||||
' Passed data is a single node
|
' Passed data is a single node
|
||||||
|
@ -455,9 +455,6 @@ function CreateAudioPlayerGroup(audiodata)
|
||||||
if audiodata.subtype() = "MusicSongData"
|
if audiodata.subtype() = "MusicSongData"
|
||||||
' Passed data is data for a single song, setup playback as a single song
|
' 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)
|
songData = AudioItem(audiodata.id)
|
||||||
|
|
||||||
songMetaDataArray.push(ItemMetaData(audiodata.id))
|
songMetaDataArray.push(ItemMetaData(audiodata.id))
|
||||||
|
@ -471,19 +468,21 @@ function CreateAudioPlayerGroup(audiodata)
|
||||||
|
|
||||||
params.MediaSourceId = songData.mediaSources[0].id
|
params.MediaSourceId = songData.mediaSources[0].id
|
||||||
|
|
||||||
m.audio.content.url = buildURL(Substitute("Audio/{0}/stream", audiodata.id), params)
|
content.url = buildURL(Substitute("Audio/{0}/stream", audiodata.id), params)
|
||||||
m.audio.content.title = audiodata.title
|
content.title = audiodata.title
|
||||||
m.audio.content.streamformat = songData.mediaSources[0].container
|
content.streamformat = songData.mediaSources[0].container
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
group.itemContent = songMetaDataArray
|
||||||
|
|
||||||
group.musicArtistAlbumData = audiodata
|
group.musicArtistAlbumData = audiodata
|
||||||
group.audio = m.audio
|
group.audio.content = content
|
||||||
group.audio.control = "stop"
|
group.audio.control = "stop"
|
||||||
group.audio.control = "none"
|
group.audio.control = "none"
|
||||||
group.audio.control = "play"
|
group.audio.control = "play"
|
||||||
|
|
||||||
group.itemContent = songMetaDataArray
|
|
||||||
|
|
||||||
m.global.sceneManager.callFunc("pushScene", group)
|
m.global.sceneManager.callFunc("pushScene", group)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user