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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can anyone post their working HLS XML?

I am using the following and every time I go to play the video it just drops out instantly with the cryptic unknown error.


We are trying to leverage the adaptive bitrate streams that are already running within our iOS app, so it has several bitrates under it obviously. If I point right to the MP4s then things are all okay so it seems like an XML or stream issue.
0 Kudos

Re: Can anyone post their working HLS XML?

XML structure doesn't really matter. It's what you set on the roAssociativeArray object that you pass as content. In Gabby, our video code does something like this:

This is part of a larger function. Hopefully, this is enough context for you to decipher/understand.
content = {}

if isVideo then
content.minBandwidth = 20
content.StreamQualities = CreateObject("roArray", 5, true)
content.StreamBitrates = CreateObject("roArray", 5, true)
content.StreamUrls = CreateObject("roArray", 5, true)
if e.Length <> invalid then
if type(e.Length) = "roString" and len(e.Length) > 0 then
content.Length = e.Length
end if
end if

content.Tag = e.Tag
content.Url = e.Url
content.Title = e.Title
content.Artist = e.Artist
content.Album = e.Album
content.Description = e.Description
content.HDPosterURL = e.HDPosterURL
content.SDPosterURL = e.SDPosterURL
content.StreamFormat = e.StreamFormat
content.ContentType = e.ContentType
content.ReleaseDate = e.ReleaseDate
content.ContentId = e.ContentId
content.ContentQuality = e.ContentQuality
content.StartPosition = e.StartPosition

'image attributes
content.ImageTitle = e.ImageTitle
content.CameraManufacturer = e.CameraManufacturer
content.CameraModel = e.CameraModel
content.DTOrig = e.DTOrig
content.Copyright = e.Copyright
content.ImageFilename = e.ImageFilename
content.ImageShortFilename = e.ImageShortFilename
content.ImagePeriod = e.ImagePeriod
content.OverlayPeriod = e.OverlayPeriod

if isVideo then
content.SubtitleUrl = e.SubtitleUrl
content.EpisodeNumber = e.EpisodeNumber
content.IsHD = e.IsHD
content.HDBranded = e.HDBranded

'media may be at multiple bitrates, so parse an build arrays
for idx = 0 to 4
content.StreamBitrates[idx] = e.StreamBitrates[idx]
content.StreamQualities[idx] = e.StreamQualities[idx]
content.StreamUrls[idx] = e.StreamUrls[idx]
next idx

return content
0 Kudos

Re: Can anyone post their working HLS XML?

Sorry the question wasn't really about the XML in general it was more a question of can I just swap the code that I am using for the MP4 and point to our adaptive bit-rate streams with no code changes. It looks like the answer to that is a no 🙂

Thanks for posting the code, much appreciated!
0 Kudos

Re: Can anyone post their working HLS XML?

In general, you do just need to change the .mp4 url to the .m3u8 url and change the streamFormat from "mp4" to "hls".

However, there may be other knobs to turn. The most common gotcha is the minBandwidth setting.

The adaptive stream switching is handled automatically by the firmware.

0 Kudos

Re: Can anyone post their working HLS XML?

I actually figured it was handled in the firmware. So I will set minBandwidth, but do I still need to specify StreamBitrates then and if yes, do I list all my bitrates from the m3u8? Thanks!
0 Kudos

Re: Can anyone post their working HLS XML?

Just set StreamBitrates to [0]

You only need to list the one top level .m3u8 as a StreamUrls.

0 Kudos