Here's a little one I threw together just for you:
sub main()
poster=createobject("roposterscreen")
content=stationlist()
poster.setcontentlist(content)
port=createobject("romessageport")
poster.setmessageport(port)
audioplayer=createobject("roaudioplayer")
audioplayer.setmessageport(port)
poster.show()
while true
msg=wait(0,port)
if lcase(type(msg))=lcase("roposterscreenevent") then
print "poster screen event"
if msg.islistitemselected() then
ndx=msg.getindex()
audioplayer.stop()
audioplayer.clearcontent()
sleep(500)
audioplayer.addcontent(content[ndx])
audioplayer.play()
end if
else if type(msg)="roAudioPlayerEvent"
if msg.isstatusmessage() then
print msg.getmessage()
end if
end if
end while
end sub
function stationlist() as object
list=[{ShortDescriptionLine1:"Station1"
ShortDescriptionLine2:"My first radio station"
url:"myradiostation.com:8010/"
SDPosterURL:"pkg:/images/mm_icon_focus_sd.png"
HDPosterURL:"pkg:/images/mm_icon_focus_hd.png"
streamformat:"mp3"}
{ShortDescriptionLine1:"Station2"
ShortDescriptionLine2:"My second radio station"
url:"http://myradiostation2.com:15476/"
SDPosterURL:"pkg:/images/mm_icon_focus_sd.png"
HDPosterURL:"pkg:/images/mm_icon_focus_hd.png"
streamformat:"mp3"}]
return list
end function
In this case I made a copy of the simpleposter example, renamed it "simpleaudioplayer", opened the .brs file in the source folder and replaced it's contents with the above, and tested it (with some real radio stations).
- Joel