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.

hls SD 512 [http://urltostream.com/dir/filename.m3u8](http://urltostream.com/dir/filename.m3u8)

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.

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.

createContentItem:
    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)
	else
		if e.Length <> invalid then
			if type(e.Length) = "roString" and len(e.Length) > 0 then					
				content.Length = e.Length
			end if			
		end if
	endif
    
	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
	endif
    
    return content

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 :slightly_smiling_face:

Thanks for posting the code, much appreciated!

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.

–Kevin

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!

Just set StreamBitrates to [0]

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

–Kevin