I am testing out Roku2’s capability to play HLS streams served by Wowza. I have found no problems playing static content and live streams. However, I did run into a problem with an in-house feature involving HTTP redirects that I’m hoping someone from Roku can give some pointers.
We have a feature that has user-agent detection and redirects from a generic URL to a protocol-specific URL depending on the user-agent. For example, given a generic URL “http://.com/path/to/file.mp4”, and a user-agent “roku”, we will perform an HTTP redirect to “http://.com/path/to/file.mp4/playlist.m3u8”.
This is the sequence of events I got from tcpdump on the Roku2.
Roku2 does a GET on the generic URL. It receives a “HTTP/1.1 302 Found” for the correct URL that points to playlist.m3u8.
Roku2 does a GET on the URL “http://.com/path/to/file.mp4/playlist.m3u8”. It receives a “HTTP/1.1 200 OK” and the following playlist.m3u8 file from Wowza:
This is where things go wrong. Roku2 does a GET on the generic URL again and somehow strips out the filename: “http://.com/path/to/playlist.m3u8?wowzasessionid=12345678” and receives a “HTTP/1.1 302 Found” for the incorrect URL, also without a filename, and with a duplicate playlist.m3u8: “http://.com/path/to/playlist.m3u8/playlist.meu8?wowzasessionid=12345678”.
Roku2 does a GET on the incorrect URL and receives a “HTTP/1.1 403 Forbidden”, and the session ends.
For this test, I took the example “simplevideoplayer” from the SDK and hardcoded URL’s in. My Roku2 is running 4.1 build 1275.
Was an answer to this question ever provided? We’re planning on deploying a load balancing system that uses 302 redirects, and it would be helpful to know if this will break playback on Roku.
Yes, I don’t think Roku has problems handling 302 redirections. I have a very specific case of strange data alterations between our server and Roku that I was able to capture via tcpdump. I already sent the capture to someone and am hoping they’d get back to me with findings.
I’ve been struggling trying I get a channel working on Roku. The stream works fine on my test hls player but not on the roku 2. I’ve been debugging and found the same redirect and 403 error. Did anyone ever come up with a resolution on this?
I am trying to call an API in ROKU player using bright script. But I a getting “response code -3”. But when I am hitting that service on Web Browser it gives the xml in response. Actually there is a redirection in the API which I am using. As I know the redirection is not handled by the ROKU OS level. So How will I come out this situation. Please help me and provide me any solution for that, how can I handle the redirection in ROKU?
See if the NWM_ResolveRedirect function in the urlUtils.brs file in your Roku SDK helps. You can find it in the common folder of the mrsstemplate example.
Hi Joel,
Thanks for quick reply. I tried the method which you have suggested but no luck.
I am not able to get the header data means
h = msg.GetResponseHeaders()
Print h
this is returning blank.
As sdkdocs said: GetResponseHeaders() as Object
Returns an roAssociativeArray containing all the headers returned by the server for appropriate protocols (such as HTTP). Headers are only returned when the status code is greater than or equal to 200 and less than 300.
The response code which I am getting is “-3” and that’s why I am not able to get the header data.
but when I am trying the API directly on browser its giving me the XML.
Is there any other way to work with this
-3 is not an http status code of course, since all status codes are positive 3-digit integers. If you’re getting this -3 value from roUrlEvent.GetResponseCode, the doc (http://sdkdocs.roku.com/display/sdkdoc/roUrlEvent) says that that value means CURLE_URL_MALFORMAT. So it sounds like your URL is invalid.
Also, this doesn’t have anything to do with the original topic (redirects and HLS), does it? And Roku does support redirects internally. I’m not sure if it did at the time the original post was posted, over 3 years ago, which demonstrates the reason it’s not a good idea to post to very old threads.