Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 7

Stream Format Issue

Dear Roku Team,

I am testing using the xml categories. I have the main categories.xml which lists 3 items. Then I have themind.xml which has my channels and the music.xml which holds my radio stations. For some odd reason the xml wont pull the STREAMFORMAT from my xml. If i do it manualy and type the stream format lets say hls or mp3 it plays the stream but I have 2 different format which one is for my channels thats uses HLS and the other MP3 for the radio. Setting it manually servers one way or the other and not both and thats why i need it to pull the stream format dynamically. My showfeed.xml looks like this. Please help me as this is causing me many night of not being able to sleep.
I am highlithing the area. I have modified this section zillion times but still wont pull it dynamically.
***********************************************************************************************************
Function parse_show_feed(xml As Object, feed As Object) As Void

showCount = 0
showList = xml.GetChildElements()

for each curShow in showList

'for now, don't process meta info about the feed size
if curShow.GetName() = "resultLength" or curShow.GetName() = "endIndex" then
goto skipitem
endif

item = init_show_feed_item()

'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.StreamFormat = validstr(curShow.streamFormat.GetText())
'if item.StreamFormat = " " then 'set default streamFormat to 'hls if doesn't exist in xml
'item.StreamFormat = "hls"
'endif

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())


'map xml attributes into screen specific variables
item.ShortDescriptionLine1 = item.Title
item.ShortDescriptionLine2 = item.Description
item.HDPosterUrl = item.hdImg
item.SDPosterUrl = item.sdImg

item.Length = strtoi(item.Runtime)
item.Categories = CreateObject("roArray", 5, true)
item.Categories.Push(item.Genre)
item.Actors = CreateObject("roArray", 5, true)
item.Actors.Push(item.Genre)
item.Description = item.Synopsis

'Set Default screen values for items not in feed
item.HDBranded = false
item.IsHD = false
item.StarRating = "90"
item.ContentType = "episode"

'media may be at multiple bitrates, so parse an build arrays
for idx = 0 to 4
e = curShow.media[idx]
if e <> invalid then
item.StreamBitrates.Push(strtoi(validstr(e.streamBitrate.GetText())))
item.StreamQualities.Push(validstr(e.streamQuality.GetText()))
item.StreamUrls.Push(validstr(e.streamUrl.GetText()))
endif
next idx

showCount = showCount + 1
feed.Push(item)

skipitem:

next

End Function
0 Kudos
2 Replies
Highlighted
Roku Employee
Roku Employee

Re: Stream Format Issue

It would be helpful if you post a chunk of your XML, if you don't want to reveal url's or other private information, then replace your server names and file names with something generic like "server.com/file.mp3".

- Joel
0 Kudos
Highlighted
Level 7

Re: Stream Format Issue

Have you tried putting a "stop" statement after the line item.StreamFormat = validstr(curShow.streamFormat.GetText()) ?
Then, when the debugger runs, type: ?curShow.streamFormat.GetText()

Also I notice that in the next line that you have commented out:
'if item.StreamFormat = " " then 'set default streamFormat to 'hls if doesn't exist in xml

when you get around to uncommenting that line you might want to change the " " to "" (i.e. no space between the quotes) if you're testing for an empty string rather than testing for a string that contains exactly one space character.
https://github.com/belltown/
0 Kudos