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: 
btpoole
Level 8

Setting m3u8 location

Over the course of several months I have been able to put together a channel for live streaming. When the channel is selected I have the xml pointed to a script on my server that gathers the stream and converts it to create a m3u8 file. How is it possible to tell the roku where the stream resides? I guess I don't understand how to direct the roku to the file location since I used the initial xml entry to start the script. I have tried to set the location thru a redirect but the roku seems to time out before it starts to stream.
Thanks
0 Kudos
2 REPLIES 2\
RokuJoel
Roku Employee
Roku Employee

Re: Setting m3u8 location

Not sure exactly what you are asking here, but if I was to guess I would say you should modify your server script to return the .m3u8 location when it runs, perhaps something like this would work in Brightscript:


scriptURL=xml.videos.video[0].ScriptURL

xfer=createobject("roURLTransfer")
xfer.seturl(scriptURL)
videoobject={}
videoObject.stream.streamURL=xfer.gettostring()
videoObject.StreamFormat="hls"


- Joel
0 Kudos
btpoole
Level 8

Re: Setting m3u8 location

Thanks Joel, I think in my post I stated I had my the path in my xml file pointing to the script. The script converts my video to a m3u8 file on the fly. I am using the videoplayer sample category xml. I set that to my create the feed xml. In the individual feel xml file I was using the <stream></stream> path directed to my script on my server. This worked at starting the conversion script. The problem came in on how to tell the roku channel where the m3u8 file was going to be stored since I used the xml stream attribute to start the script. I have attempted to return the m3u8 location (script is in Perl) but since the script does not terminate (live continuous stream) it never returns the location because the location is set in the line following the execution of the converion. So, I was thinking there must be a way to initiate the script with urlTransfer just before feed.push is started. I have created a function:

Function transcode_stream(url As String) as Object
request = CreateObject("roUrlTransfer")
request.SetUrl("http:xxx.xxx.x.x:8000/conversion.pl")
return request
End Function

But as you may notice this is not complete as I don't know where to go from here. I need cause the file at the url to execute which is done just by calling it (like I do when I use it in the xml path). Along with doing this I need to know where to put the function call, will it go in the showFeed.brs? Another thought after really looking at your example, could I add another attribute to the category feed xml called scripturl, put the path to the script there and have it initiate the script. I would have to put a sleep in somewhere to wait for creation of the m3u8 file but that should be no problem.
0 Kudos