"RokuJoel" wrote:
go back to the videoplayer example. Modify your XML to include a field that says audio or video, like:
<contentformat>audio</contentformat>
and also, if it is audio, then add something like
<audiostreamurl>http://myserver.com/myfile.mp3</audiostreamurl>
and of course set the streamformat to mp3 or mp4 depending on the content type.
add a parser for that field to the parse_show_feed function.
item.contentformat = validstr(curShow.contentformat.GetText())
item.audiostreamurl = validstr(curShow.audiostreamurl.GetText())
In your Springboard screen code, check if the contentformat=audio or video, if not video, call your audioplayer function:
if msg.GetIndex() = 2
if showlist[showindex].contentformat <> "audio" then
showList[showIndex].PlayStart = 0
showVideoScreen(showList[showIndex])
refreshShowDetail(screen,showList,showIndex)
else
playaudio(showlist[showindex))
refreshShowDetail(screen,showList,showIndex)
end if
endif
That should provide you with a rough outline of how to do it.
- Joel
Okay, I added the new section to the parse_show_feed section:
'fetch all values from the xml for the current show
item.hdImg = validstr(curShow@hdImg)
item.sdImg = validstr(curShow@sdImg)
item.ContentId = validstr(curShow.contentId.GetText())
item.Title = validstr(curShow.title.GetText())
item.Description = validstr(curShow.description.GetText())
item.ContentType = validstr(curShow.contentType.GetText())
item.ContentQuality = validstr(curShow.contentQuality.GetText())
item.Synopsis = validstr(curShow.synopsis.GetText())
item.Genre = validstr(curShow.genres.GetText())
item.Runtime = validstr(curShow.runtime.GetText())
item.HDBifUrl = validstr(curShow.hdBifUrl.GetText())
item.SDBifUrl = validstr(curShow.sdBifUrl.GetText()) item.contentformat = validstr(curShow.contentformat.GetText())
item.audiostreamurl = validstr(curShow.audiostreamurl.GetText()) item.StreamFormat = validstr(curShow.streamFormat.GetText())
if item.StreamFormat = "" then 'set default streamFormat to mp4 if doesn't exist in xml
item.StreamFormat = "mp4"
endifand then I added the other code:
.PlayStart = PlayStart.ToInt()
endif
endif if msg.GetIndex() = 3
endif
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
end ifNow I'm locking up at the opening screen.
Did I add the code in the right places?
Do I have to bring any code from the AudioPlayer app to play audios, or does it have that function hiding somewhere?
I'm learning as I go...thanks for the help....again!
😄