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

Problem with HTTP redirect 302 and HLS

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://<domain>.com/path/to/file.mp4", and a user-agent "roku", we will perform an HTTP redirect to "http://<domain>.com/path/to/file.mp4/playlist.m3u8".

This is the sequence of events I got from tcpdump on the Roku2.

1. 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.

2. Roku2 does a GET on the URL "http://<domain>.com/path/to/file.mp4/playlist.m3u8". It receives a "HTTP/1.1 200 OK" and the following playlist.m3u8 file from Wowza:

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=672450
playlist.m3u8?wowzasessionid=12345678
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=64000
playlist.m3u8?wowzaaudioonly&wowzasession


3. This is where things go wrong. Roku2 does a GET on the generic URL again and somehow strips out the filename: "http://<domain>.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://<domain>.com/path/to/playlist.m3u8/playlist.meu8?wowzasessionid=12345678".

4. 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.

Is Roku's behavior in step 3 expected?
0 Kudos
12 REPLIES 12
RokuKevin
Visitor

Re: Problem with HTTP redirect 302 and HLS

Jules27,

If you send me a private message with the top level url, I will take a look at it.

--Kevin
0 Kudos
jules27
Visitor

Re: Problem with HTTP redirect 302 and HLS

Kevin,

I sent you some links last Tuesday. Do you have any updates with regards to Roku's behavior?

Thanks.
0 Kudos
jaycharles
Visitor

Re: Problem with HTTP redirect 302 and HLS

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.
0 Kudos
jules27
Visitor

Re: Problem with HTTP redirect 302 and HLS

No, the answer to this question has not been provided.
0 Kudos
jaycharles
Visitor

Re: Problem with HTTP redirect 302 and HLS

FWIW, I just deployed a test app to see what my result would be. 302 redirection seems to be working fine for me against Roku 4.1
0 Kudos
jules27
Visitor

Re: Problem with HTTP redirect 302 and HLS

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.
0 Kudos
EdNewman
Visitor

Re: Problem with HTTP redirect 302 and HLS

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?
0 Kudos
gaurachit
Channel Surfer

Re: Problem with HTTP redirect 302 and HLS

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?

Thanks in advance.
0 Kudos
RokuJoel
Binge Watcher

Re: Problem with HTTP redirect 302 and HLS

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.

- Joel
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.