Here are a left and right buttons on audio springboard which should increment items in an array of 5 items forward or backwards by one.
else if msg.isRemoteKeyPressed()
if msg.GetIndex() = 4 ' < LEFT
scr.ClearButtons()
if msg.isPlaybackPosition() then
spot = msg.GetIndex()
index = playlist[spot]
if index > 0 then index=index-1
if index=0 then index=playlist.count()-1
m.audio.SetNext(msg.GetIndex() -1)
end if
m.audio.Play()
scr.AddButton(2, "Pause")
scr.AddButton(4, "Stop")
scr.AddButton(5, "Done")
else if msg.GetIndex() = 5 ' > RIGHT
scr.ClearButtons()
if msg.isPlaybackPosition() then
spot = msg.GetIndex()
index = playlist[spot]
if index > 0 then index=index+1
if index=0 then index=playlist.count()+1
m.audio.SetNext(msg.GetIndex() +1)
end if
m.audio.Play()
scr.AddButton(2, "Pause")
scr.AddButton(4, "Stop")
scr.AddButton(5, "Done")
end if
What is happening is both left and right buttons only increment one track forward, which is the same behavior as simply stopping the audio and starting it again. Does the format of the array matter? I ask because the titles on the springboard don't advance with the audio, it only shows the last items title. the array is like this:
port = CreateObject("roMessagePort")
m.audio = CreateObject("roAudioPlayer")
m.audio.SetMessagePort(port)
item = CreateObject("roAssociativeArray")
item.Url = "http://www.xxx.com/roku/songs/dawn.mp3"
item.Artist = "xxx"
item.Title = "Dawn"
item.Album = "Alls Well That Ends Well"
item.HDPosterUrl = "pkg:/images/albumcover_hd.png"
item.SDPosterUrl = "pkg:/images/albumcover_sd.png"
item.StreamFormat = "mp3"
m.audio.AddContent(item)
item.Url = "http://www.xxx.com/roku/songs/nightfall.mp3"
item.Artist = "xxx"
item.Title = "Dusk"
item.Album = "Alls Well That Ends Well"
item.HDPosterUrl = "pkg:/images/albumcover_hd.png"
item.SDPosterUrl = "pkg:/images/albumcover_sd.png"
item.StreamFormat = "mp3"
m.audio.AddContent(item)
m.audio.SetLoop(true)
m.audio.SetNext(0)
I've seen arrays formated a bunch of ways, and since RokuJoel provided the code for the left/right buttons im looking somewhere else for the problem.
thanks
Kinetics Screensavers