Sorry if this is an obvious question, but I'm a bit stumped. I have a channel that shows "live" (hls) streams and also "archive" (mp4) streams -- through two different screens and populated with two different XML documents.
In my appDetailScreen.brs file I have the following function for button assignments based on if a user has viewed a video for more than 30 seconds, or not:
Function refreshShowDetail(screen As Object, showList As Object, showIndex as Integer) As Integer
if validateParam(screen, "roSpringboardScreen", "refreshShowDetail") = false return -1
if validateParam(showList, "roArray", "refreshShowDetail") = false return -1
show = showList[showIndex]
'Uncomment this statement to dump the details for each show
'PrintAA(show)
screen.ClearButtons()
if regread(show.contentid) <> invalid and regread(show.contentid).toint() >=30 then
screen.AddButton(1, "Resume playing")
screen.AddButton(2, "Play from beginning")
else
screen.addButton(2,"Play")
end if
screen.SetStaticRatingEnabled(false)
screen.SetContent(show)
screen.Show()
End Function
So far, nothing new. This works just fine for video-on-demand (mp4) files. What I would like to do is alter the code so that if a user is playing back a "live" stream (hls) the only option available is "Play" or "Play Live Stream" -- something like that. Is there a way to add an additional if statement to the code above that would look at the XML file and, based on something like <contentType> or <streamFormat> give the user only a "Play Live Stream" option?
I was playing around with:
if showList[showIndex].contentType = "LiveStream" then
screen.AddButton(2, "Play Live Stream")
and I even tried
if show.contentType = "LiveStream then
screen.AddButton(2, "Play Live Stream")
But I'm either missing something here, or not understanding or overlooking a very basic concept for the programming language. For reference, here is one of my many failed attempts:
Function refreshShowDetail(screen As Object, showList As Object, showIndex as Integer) As Integer
if validateParam(screen, "roSpringboardScreen", "refreshShowDetail") = false return -1
if validateParam(showList, "roArray", "refreshShowDetail") = false return -1
show = showList[showIndex]
'Uncomment this statement to dump the details for each show
'PrintAA(show)
screen.ClearButtons()
if showList[showIndex].contentType = "LiveStream" then
screen.AddButton(2, "Play Live Stream")
else if regread(show.contentid) <> invalid and regread(show.contentid).toint() >=30 then
screen.AddButton(1, "Resume playing")
screen.AddButton(2, "Play from beginning")
else
screen.addButton(2,"Play")
end if
screen.SetStaticRatingEnabled(false)
screen.SetContent(show)
screen.Show()
End Function
In my XML document each video (live, or VOD) has either <contentType>LiveStream</contentType> or <contentType>Archive</contentType>
Any help someone can provide would be very much appreciated.