Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
itrailblaz
Visitor

Help with 2 streams shoutcast npr.brs

I used the sample audioplayer and it work fine. How do I add a second stream to the code? 😞
0 Kudos
5 REPLIES 5
itrailblaz
Visitor

Re: Help with 2 streams shoutcast npr.brs

bump
0 Kudos
bandal
Visitor

Re: Help with 2 streams shoutcast npr.brs

A code snippet would be great if anyone has it.
DA
0 Kudos
RokuJoel
Binge Watcher

Re: Help with 2 streams shoutcast npr.brs

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
0 Kudos
itrailblaz
Visitor

Re: Help with 2 streams shoutcast npr.brs

Thank you very much, its working. One more question: Since doing that my theme is not working, how do I implement that? (Overhang png files)
0 Kudos
RokuJoel
Binge Watcher

Re: Help with 2 streams shoutcast npr.brs

you would put your theme in a "theme function" and call that when the channel first loads:

sub main()
settheme()
'do stuff
end sub
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.